From 83a47b4626933195d4289e579a6a52e451bf6455 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 06:02:35 +0200 Subject: [PATCH 001/150] CC0 oot: apply rewritten history result on top of historical history "git checkout https://github.com/Dragorn421/oot/tree/oot_cc0redo_take2" git reset upstream/main git add ... git commit --- .gitignore | 1 - Dockerfile | 14 +- Doxyfile | 2 +- Makefile | 126 +- README.md | 80 +- assets/objects/gameplay_keep/eff_fire.c | 8 +- assets/objects/gameplay_keep/eff_fire.h | 12 +- assets/objects/gameplay_keep/gFish1Anim.c | 13 + assets/objects/gameplay_keep/gFish1Anim.h | 10 + assets/objects/gameplay_keep/gFish2Anim.c | 13 + assets/objects/gameplay_keep/gFish2Anim.h | 10 + .../objects/gameplay_keep/gFishInWaterAnim.c | 13 - .../objects/gameplay_keep/gFishInWaterAnim.h | 10 - .../gameplay_keep/gFishOutOfWaterAnim.c | 13 - .../gameplay_keep/gFishOutOfWaterAnim.h | 10 - assets/objects/gameplay_keep/gameplay_keep.h | 4 +- assets/objects/object_tp/object_tp.c | 52 - assets/objects/object_tp/object_tp.h | 34 - .../object_triforce_spot.c | 30 - .../object_triforce_spot.h | 24 - assets/xml/n64dd/error_textures.xml | 8 - assets/xml/objects/gameplay_keep.xml | 9 +- assets/xml/objects/object_bg.xml | 95 +- assets/xml/objects/object_bl.xml | 46 +- assets/xml/objects/object_dekubaba.xml | 57 +- .../xml/objects/object_efc_crystal_light.xml | 6 +- assets/xml/objects/object_efc_fire_ball.xml | 8 +- assets/xml/objects/object_efc_lgt_shower.xml | 6 +- assets/xml/objects/object_efc_tw.xml | 13 +- assets/xml/objects/object_ge1.xml | 165 +- assets/xml/objects/object_geldb.xml | 48 +- assets/xml/objects/object_gi_jewel.xml | 17 +- assets/xml/objects/object_gla.xml | 182 +- assets/xml/objects/object_god_lgt.xml | 14 +- assets/xml/objects/object_hata.xml | 101 +- assets/xml/objects/object_horse.xml | 8 +- assets/xml/objects/object_ik.xml | 84 +- assets/xml/objects/object_jj.xml | 149 +- assets/xml/objects/object_light_ring.xml | 6 +- assets/xml/objects/object_mir_ray.xml | 20 +- assets/xml/objects/object_nb.xml | 299 +- assets/xml/objects/object_sk2.xml | 181 +- assets/xml/objects/object_skb.xml | 155 +- assets/xml/objects/object_tp.xml | 28 +- assets/xml/objects/object_triforce_spot.xml | 15 +- assets/xml/objects/object_vali.xml | 111 +- assets/xml/objects/object_wf.xml | 298 +- assets/xml/objects/object_zf.xml | 399 ++- assets/xml/overlays/ovl_En_Ganon_Organ.xml | 21 +- assets/xml/textures/link_animetion.xml | 7 + assets/xml/textures/nes_font_static.xml | 279 +- assets/xml/textures/nes_font_static_v2.xml | 281 +- assets/xml/textures/place_title_cards.xml | 1 + baseroms/ntsc-1.0/config.yml | 4 - baseroms/ntsc-1.1/config.yml | 4 - baseroms/ntsc-1.2/config.yml | 4 - baseroms/pal-1.0/config.yml | 4 - baseroms/pal-1.1/config.yml | 4 - data/n64dd.bss.s | 2 + docker-compose.yml | 12 +- ...NG_MACOS.md => BUILDING_BINUTILS_MACOS.md} | 49 +- docs/BUILDING_DOCKER.md | 27 - docs/vscode.md | 94 - include/actor.h | 8 +- include/animation.h | 55 + include/audio.h | 2 +- include/bgcheck.h | 3 +- include/code_800D71F0.h | 8 + include/curve.h | 62 - include/effect.h | 8 +- include/functions.h | 31 + include/gfx.h | 2 +- include/gfx_setupdl.h | 6 +- include/gfxalloc.h | 2 +- include/kanread.h | 8 - include/libc/string.h | 7 +- include/n64dd.h | 82 +- include/n64dd_internal.h | 99 + include/player.h | 6 +- include/prerender.h | 18 +- include/ultra64.h | 6 + include/ultra64/leo.h | 397 ++- include/ultra64/leo_internal.h | 131 + include/ultra64/leoappli.h | 406 ++- include/ultra64/leodrive.h | 147 - include/view.h | 2 +- include/vis.h | 84 - include/z64.h | 32 + include/z_lib.h | 2 +- requirements.txt | 2 +- retail_progress.py | 3 + spec/objects.inc | 4 +- spec/spec | 121 +- src/audio/internal/effects.c | 2 +- src/audio/internal/heap.c | 2 +- src/boot/is_debug.c | 6 - src/boot/yaz0.c | 4 +- src/boot/z_std_dma.c | 4 +- src/buffers/gfxbuffers.c | 2 + src/code/PreRender.c | 80 +- src/code/code_8006C510.c | 42 + src/code/code_800ACE70.c | 101 + src/code/code_800AD920.c | 68 + src/code/code_800D71F0.s | 1359 ++++++++ src/code/fault_gc.c | 12 +- src/code/fault_gc_drawer.c | 4 - src/code/fault_n64.c | 2 +- src/code/game.c | 107 +- src/code/gfxalloc.c | 8 +- src/code/graph.c | 4 +- src/code/kanread.s | 205 -- src/code/main.c | 8 +- src/code/sched.c | 2 +- src/code/sys_math3d.c | 4 +- src/code/z_actor.c | 16 +- src/code/z_bg_collect.c | 30 +- src/code/z_bgcheck.c | 3 +- src/code/z_camera.c | 8 +- src/code/z_collision_check.c | 4 +- src/code/z_demo.c | 52 +- src/code/z_eff_blure.c | 84 +- src/code/z_fcurve_data.c | 84 - src/code/z_fcurve_data_skelanime.c | 244 +- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_kanfont.c | 11 +- src/code/z_kankyo.c | 8 +- src/code/z_lib.c | 21 +- src/code/z_memory_utils.c | 44 +- src/code/z_message.c | 14 +- src/code/z_play.c | 18 +- src/code/z_player_call.c | 2 +- src/code/z_player_lib.c | 4 +- src/code/z_quake.c | 2 +- src/code/z_rcp.c | 24 +- src/code/z_room.c | 35 +- src/code/z_sram.c | 135 +- src/code/z_view.c | 8 +- src/code/z_viscvg.c | 146 - src/code/z_vismono.c | 50 +- src/code/z_viszbuf.c | 117 - src/code/z_vr_box_draw.c | 6 +- src/libc/code_80106860.c | 12 + src/libc/code_801068B0.c | 23 + src/libc/fmodf.c | 21 +- src/libc/memmove.c | 33 - src/libc/memset.c | 21 - src/libc64/__osMalloc_gc.c | 12 +- src/libc64/__osMalloc_n64.c | 2 +- src/libc64/aprintf.c | 7 +- src/libc64/sprintf.c | 3 - src/libleo/api/cacreateleomanager.c | 83 - src/libleo/api/cjcreateleomanager.c | 84 - src/libleo/api/getaadr.s | 323 -- src/libleo/api/getkadr.s | 212 -- src/libleo/api/readwrite.c | 33 - src/libleo/leo/leo_tbl.c | 58 - src/libleo/leo/leoc2_syndrome.c | 3 - src/libleo/leo/leofunc.c | 135 - src/libleo/leo/leoglobals.c | 8 - src/libleo/leo/leoinquiry.c | 23 - src/libleo/leo/leointerrupt.c | 208 -- src/libleo/leo/leomode_sel.c | 27 - src/libleo/leo/leomseq_tbl.c | 60 - src/libleo/leo/leord_capa.c | 17 - src/libleo/leo/leoreset.c | 29 - src/libleo/leo/leotempbuffer.c | 3 - src/libu64/gfxprint.c | 7 +- src/{libleo/api => n64dd/libleo}/bytetolba.c | 4 +- src/n64dd/libleo/cacreateleomanager.c | 64 + src/n64dd/libleo/cjcreateleomanager.c | 65 + src/{libleo/api => n64dd/libleo}/clearqueue.c | 14 +- src/{libleo/api => n64dd/libleo}/driveexist.c | 18 +- src/n64dd/libleo/getaadr.s | 2346 ++++++++++++++ src/{libleo/api => n64dd/libleo}/getaadr2.s | 0 src/n64dd/libleo/getkadr.s | 705 +++++ src/{libleo/api => n64dd/libleo}/lbatobyte.c | 4 +- src/n64dd/libleo/leo_tbl.c | 32 + src/n64dd/libleo/leoc2_syndrome.c | 4 + src/{libleo/leo => n64dd/libleo}/leoc2ecc.c | 26 +- src/{libleo/leo => n64dd/libleo}/leocmdex.c | 120 +- .../leo => n64dd/libleo}/leodiskinit.c | 18 +- src/n64dd/libleo/leofunc.c | 127 + src/n64dd/libleo/leoglobals.c | 5 + src/n64dd/libleo/leoinquiry.c | 20 + src/{libleo/leo => n64dd/libleo}/leoint.c | 94 +- src/n64dd/libleo/leointerrupt.c | 192 ++ src/{libleo/leo => n64dd/libleo}/leomecha.c | 223 +- src/n64dd/libleo/leomode_sel.c | 19 + src/{libleo/leo => n64dd/libleo}/leomotor.c | 22 +- src/n64dd/libleo/leomseq_tbl.c | 51 + src/{libleo/leo => n64dd/libleo}/leoram.c | 28 +- src/n64dd/libleo/leord_capa.c | 15 + .../leo => n64dd/libleo}/leord_diskid.c | 15 +- src/{libleo/leo => n64dd/libleo}/leoread.c | 28 +- src/n64dd/libleo/leoreset.c | 28 + src/{libleo/leo => n64dd/libleo}/leoseek.c | 16 +- src/n64dd/libleo/leotempbuffer.c | 4 + .../leo => n64dd/libleo}/leotestunit.c | 6 +- src/{libleo/leo => n64dd/libleo}/leotimer.c | 84 +- .../leo => n64dd/libleo}/leotranslat.c | 41 +- src/{libleo/leo => n64dd/libleo}/leoutil.c | 6 +- src/{libleo/leo => n64dd/libleo}/leowrite.c | 31 +- .../api/seek.c => n64dd/libleo/readdiskid.c} | 15 +- src/n64dd/libleo/readwrite.c | 26 + .../leo/leorezero.c => n64dd/libleo/rezero.c} | 7 +- src/{libleo/api => n64dd/libleo}/spdlmotor.c | 29 +- .../api => n64dd/libleo}/testunitready.c | 21 +- src/n64dd/n64dd_0.c | 554 ++++ src/n64dd/{n64dd_data_buffer.c => n64dd_1.c} | 2 + src/n64dd/n64dd_2.c | 334 ++ src/n64dd/n64dd_3.c | 387 +++ src/n64dd/n64dd_4.c | 230 ++ .../{n64dd_error_headers.c => n64dd_5.c} | 4 +- src/n64dd/n64dd_6.c | 1734 +++++++++++ src/n64dd/n64dd_7.c | 247 ++ src/n64dd/n64dd_801C8000.c | 348 --- src/n64dd/n64dd_801C8940.c | 400 --- src/n64dd/n64dd_801C9440.c | 263 -- src/n64dd/n64dd_801C9B70.c | 172 -- src/n64dd/n64dd_801CA0B0.c | 247 -- src/n64dd/n64dd_error_bodies.c | 46 - src/n64dd/n64dd_error_textures.c | 19 - src/n64dd/z_n64dd.c | 591 ---- .../actors/ovl_Arms_Hook/z_arms_hook.c | 2 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 114 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.h | 2 +- .../ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 2 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c | 2 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 217 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h | 17 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 14 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 15 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 1219 ++++---- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 114 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c | 78 +- .../ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h | 2 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 238 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h | 4 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 469 ++- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h | 34 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c | 68 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h | 2 +- .../ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 5 +- .../z_bg_hidan_rsekizou.c | 261 +- .../z_bg_hidan_rsekizou.h | 10 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c | 32 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h | 4 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 178 +- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.h | 15 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 12 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 247 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.h | 32 +- .../z_bg_jya_bombchuiwa.c | 6 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c | 22 +- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h | 2 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c | 64 +- .../actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h | 7 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 8 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 198 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h | 11 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c | 4 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c | 10 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 6 - .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 31 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.h | 6 +- .../actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c | 10 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 10 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 1 - .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 8 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 165 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h | 12 +- .../actors/ovl_Bg_Pushbox/z_bg_pushbox.c | 22 +- .../z_bg_spot00_hanebasi.c | 21 +- .../z_bg_spot01_idosoko.c | 10 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h | 2 +- .../ovl_Bg_Spot05_Soko/z_bg_spot05_soko.c | 24 +- .../z_bg_spot08_iceblock.c | 471 ++- .../z_bg_spot08_iceblock.h | 53 +- .../ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c | 55 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 50 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 49 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h | 2 +- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 18 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c | 41 +- .../ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h | 6 +- .../z_bg_spot16_bombstone.c | 2 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 29 +- .../ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h | 1 + .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 2 +- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 122 +- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h | 10 +- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 48 +- .../actors/ovl_Bg_Umajump/z_bg_umajump.c | 2 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 1 - .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 6 +- src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c | 27 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 10 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 2 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 2 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 4 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 4 +- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 14 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 125 +- .../actors/ovl_Demo_Effect/z_demo_effect.h | 5 +- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 292 +- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h | 28 +- src/overlays/actors/ovl_Demo_Go/z_demo_go.c | 6 +- src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c | 4 +- src/overlays/actors/ovl_Demo_Im/z_demo_im.c | 17 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 47 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h | 3 +- .../actors/ovl_Door_Toki/z_door_toki.c | 2 +- .../actors/ovl_Door_Toki/z_door_toki.h | 2 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 2 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 29 +- src/overlays/actors/ovl_En_Ani/z_en_ani.h | 4 +- .../actors/ovl_En_Anubice/z_en_anubice.c | 269 +- .../actors/ovl_En_Anubice/z_en_anubice.h | 22 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.c | 27 +- .../ovl_En_Anubice_Tag/z_en_anubice_tag.h | 2 +- src/overlays/actors/ovl_En_Bb/z_en_bb.c | 2 +- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 883 +++--- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 30 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 567 ++-- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 58 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 179 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h | 27 +- .../actors/ovl_En_Bom_Chu/z_en_bom_chu.c | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.c | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.h | 10 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 1 - src/overlays/actors/ovl_En_Bw/z_en_bw.c | 4 +- .../actors/ovl_En_Changer/z_en_changer.c | 341 +- .../actors/ovl_En_Changer/z_en_changer.h | 25 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 4 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 78 +- src/overlays/actors/ovl_En_Cs/z_en_cs.c | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 1462 ++++----- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 39 +- src/overlays/actors/ovl_En_Dh/z_en_dh.c | 14 +- src/overlays/actors/ovl_En_Dha/z_en_dha.c | 1 - src/overlays/actors/ovl_En_Dns/z_en_dns.c | 391 ++- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 42 +- .../actors/ovl_En_Dodojr/z_en_dodojr.c | 2 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 2 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.c | 36 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.h | 8 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 1 - .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 16 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 12 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 880 +++--- .../actors/ovl_En_Firefly/z_en_firefly.h | 41 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 815 +++-- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 34 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 11 +- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 8 +- src/overlays/actors/ovl_En_Fz/z_en_fz.h | 4 +- .../ovl_En_Ganon_Organ/z_en_ganon_organ.c | 95 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 750 ++--- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 44 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 648 ++-- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 44 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 243 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 29 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 75 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.h | 10 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 49 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 1 + src/overlays/actors/ovl_En_Hata/z_en_hata.c | 74 +- src/overlays/actors/ovl_En_Hata/z_en_hata.h | 6 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 66 +- .../actors/ovl_En_Heishi4/z_en_heishi4.c | 12 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 6 +- .../actors/ovl_En_Ice_Hono/z_en_ice_hono.c | 28 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 1092 +++---- src/overlays/actors/ovl_En_Ik/z_en_ik.h | 103 +- .../actors/ovl_En_Insect/z_en_insect.c | 31 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 12 +- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 421 ++- src/overlays/actors/ovl_En_Jj/z_en_jj.h | 42 +- .../ovl_En_Jj/z_en_jj_cutscene_data.inc.c | 158 - .../actors/ovl_En_Karebaba/z_en_karebaba.c | 44 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 362 +-- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 13 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 2 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 263 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.h | 36 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 44 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 14 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 572 ++-- src/overlays/actors/ovl_En_Md/z_en_md.h | 34 +- src/overlays/actors/ovl_En_Mk/z_en_mk.c | 4 +- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 23 +- src/overlays/actors/ovl_En_Ms/z_en_ms.c | 38 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 137 +- src/overlays/actors/ovl_En_Nb/z_en_nb.h | 5 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 42 +- .../actors/ovl_En_Niw_Girl/z_en_niw_girl.c | 2 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.c | 6 +- .../actors/ovl_En_Niw_Lady/z_en_niw_lady.h | 2 +- src/overlays/actors/ovl_En_Nwc/z_en_nwc.c | 4 +- src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 320 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 39 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 6 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 433 ++- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 31 +- src/overlays/actors/ovl_En_St/z_en_st.c | 62 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 4 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 219 +- src/overlays/actors/ovl_En_Test/z_en_test.h | 8 +- src/overlays/actors/ovl_En_Tite/z_en_tite.c | 2 +- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 831 +++-- src/overlays/actors/ovl_En_Tp/z_en_tp.h | 48 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 560 ++-- src/overlays/actors/ovl_En_Tr/z_en_tr.h | 30 +- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 942 +++--- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 36 +- .../actors/ovl_En_Viewer/z_en_viewer.c | 8 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 181 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h | 14 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 1708 +++++----- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 114 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 538 ++-- .../actors/ovl_En_Wood02/z_en_wood02.h | 74 +- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 4 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 2736 ++++++++--------- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 145 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 14 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 8 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 4 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 16 +- .../ovl_Item_Etcetera/z_item_etcetera.h | 28 +- .../actors/ovl_Magic_Fire/z_magic_fire.c | 2 +- .../actors/ovl_Magic_Wind/z_magic_wind.c | 11 +- .../actors/ovl_Magic_Wind/z_magic_wind.h | 3 +- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 934 +++--- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h | 52 +- .../ovl_Obj_Blockstop/z_obj_blockstop.c | 10 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 14 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 2 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 30 +- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 402 +-- .../ovl_Obj_Timeblock/z_obj_timeblock.h | 29 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 326 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.h | 12 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 65 +- .../actors/ovl_player_actor/z_player.c | 234 +- .../ovl_file_choose/z_file_choose.c | 4 +- src/overlays/gamestates/ovl_title/z_title.c | 14 +- .../misc/ovl_kaleido_scope/z_kaleido_debug.c | 6 +- .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 4 +- tools/Makefile | 1 - .../extract/extase_oot64/dlist_resources.py | 2 +- .../extase_oot64/skelcurve_resources.py | 10 +- tools/assets/extract/write_source.txt | 3 + tools/fix_bss.py | 1 - tools/m2ctx.py | 35 +- tools/mkdmadata.c | 1 - tools/mkldscript.c | 1 - tools/mkspecrules.c | 4 +- tools/n64chksum.h | 6 +- tools/namefixer.py | 2 +- tools/permuter_settings.toml | 4 + tools/spec.c | 244 +- tools/spec.h | 38 +- tools/util.c | 6 +- tools/util.h | 8 +- undefined_syms.txt | 56 + 470 files changed, 25561 insertions(+), 24230 deletions(-) create mode 100644 assets/objects/gameplay_keep/gFish1Anim.c create mode 100644 assets/objects/gameplay_keep/gFish1Anim.h create mode 100644 assets/objects/gameplay_keep/gFish2Anim.c create mode 100644 assets/objects/gameplay_keep/gFish2Anim.h delete mode 100644 assets/objects/gameplay_keep/gFishInWaterAnim.c delete mode 100644 assets/objects/gameplay_keep/gFishInWaterAnim.h delete mode 100644 assets/objects/gameplay_keep/gFishOutOfWaterAnim.c delete mode 100644 assets/objects/gameplay_keep/gFishOutOfWaterAnim.h delete mode 100644 assets/objects/object_tp/object_tp.c delete mode 100644 assets/objects/object_tp/object_tp.h delete mode 100644 assets/objects/object_triforce_spot/object_triforce_spot.c delete mode 100644 assets/objects/object_triforce_spot/object_triforce_spot.h delete mode 100644 assets/xml/n64dd/error_textures.xml create mode 100644 assets/xml/textures/link_animetion.xml create mode 100644 data/n64dd.bss.s rename docs/{BUILDING_MACOS.md => BUILDING_BINUTILS_MACOS.md} (57%) delete mode 100644 docs/BUILDING_DOCKER.md delete mode 100644 docs/vscode.md create mode 100644 include/code_800D71F0.h delete mode 100644 include/curve.h create mode 100644 include/functions.h delete mode 100644 include/kanread.h create mode 100644 include/n64dd_internal.h create mode 100644 include/ultra64/leo_internal.h delete mode 100644 include/vis.h create mode 100644 include/z64.h create mode 100644 src/code/code_8006C510.c create mode 100644 src/code/code_800ACE70.c create mode 100644 src/code/code_800AD920.c create mode 100644 src/code/code_800D71F0.s delete mode 100644 src/code/kanread.s delete mode 100644 src/code/z_fcurve_data.c delete mode 100644 src/code/z_viscvg.c delete mode 100644 src/code/z_viszbuf.c create mode 100644 src/libc/code_80106860.c create mode 100644 src/libc/code_801068B0.c delete mode 100644 src/libc/memmove.c delete mode 100644 src/libc/memset.c delete mode 100644 src/libleo/api/cacreateleomanager.c delete mode 100644 src/libleo/api/cjcreateleomanager.c delete mode 100644 src/libleo/api/getaadr.s delete mode 100644 src/libleo/api/getkadr.s delete mode 100644 src/libleo/api/readwrite.c delete mode 100644 src/libleo/leo/leo_tbl.c delete mode 100644 src/libleo/leo/leoc2_syndrome.c delete mode 100644 src/libleo/leo/leofunc.c delete mode 100644 src/libleo/leo/leoglobals.c delete mode 100644 src/libleo/leo/leoinquiry.c delete mode 100644 src/libleo/leo/leointerrupt.c delete mode 100644 src/libleo/leo/leomode_sel.c delete mode 100644 src/libleo/leo/leomseq_tbl.c delete mode 100644 src/libleo/leo/leord_capa.c delete mode 100644 src/libleo/leo/leoreset.c delete mode 100644 src/libleo/leo/leotempbuffer.c rename src/{libleo/api => n64dd/libleo}/bytetolba.c (91%) create mode 100644 src/n64dd/libleo/cacreateleomanager.c create mode 100644 src/n64dd/libleo/cjcreateleomanager.c rename src/{libleo/api => n64dd/libleo}/clearqueue.c (50%) rename src/{libleo/api => n64dd/libleo}/driveexist.c (72%) create mode 100644 src/n64dd/libleo/getaadr.s rename src/{libleo/api => n64dd/libleo}/getaadr2.s (100%) create mode 100644 src/n64dd/libleo/getkadr.s rename src/{libleo/api => n64dd/libleo}/lbatobyte.c (91%) create mode 100644 src/n64dd/libleo/leo_tbl.c create mode 100644 src/n64dd/libleo/leoc2_syndrome.c rename src/{libleo/leo => n64dd/libleo}/leoc2ecc.c (97%) rename src/{libleo/leo => n64dd/libleo}/leocmdex.c (68%) rename src/{libleo/leo => n64dd/libleo}/leodiskinit.c (59%) create mode 100644 src/n64dd/libleo/leofunc.c create mode 100644 src/n64dd/libleo/leoglobals.c create mode 100644 src/n64dd/libleo/leoinquiry.c rename src/{libleo/leo => n64dd/libleo}/leoint.c (81%) create mode 100644 src/n64dd/libleo/leointerrupt.c rename src/{libleo/leo => n64dd/libleo}/leomecha.c (53%) create mode 100644 src/n64dd/libleo/leomode_sel.c rename src/{libleo/leo => n64dd/libleo}/leomotor.c (50%) create mode 100644 src/n64dd/libleo/leomseq_tbl.c rename src/{libleo/leo => n64dd/libleo}/leoram.c (64%) create mode 100644 src/n64dd/libleo/leord_capa.c rename src/{libleo/leo => n64dd/libleo}/leord_diskid.c (74%) rename src/{libleo/leo => n64dd/libleo}/leoread.c (76%) create mode 100644 src/n64dd/libleo/leoreset.c rename src/{libleo/leo => n64dd/libleo}/leoseek.c (67%) create mode 100644 src/n64dd/libleo/leotempbuffer.c rename src/{libleo/leo => n64dd/libleo}/leotestunit.c (53%) rename src/{libleo/leo => n64dd/libleo}/leotimer.c (70%) rename src/{libleo/leo => n64dd/libleo}/leotranslat.c (68%) rename src/{libleo/leo => n64dd/libleo}/leoutil.c (97%) rename src/{libleo/leo => n64dd/libleo}/leowrite.c (63%) rename src/{libleo/api/seek.c => n64dd/libleo/readdiskid.c} (59%) create mode 100644 src/n64dd/libleo/readwrite.c rename src/{libleo/leo/leorezero.c => n64dd/libleo/rezero.c} (87%) rename src/{libleo/api => n64dd/libleo}/spdlmotor.c (51%) rename src/{libleo/api => n64dd/libleo}/testunitready.c (52%) create mode 100644 src/n64dd/n64dd_0.c rename src/n64dd/{n64dd_data_buffer.c => n64dd_1.c} (87%) create mode 100644 src/n64dd/n64dd_2.c create mode 100644 src/n64dd/n64dd_3.c create mode 100644 src/n64dd/n64dd_4.c rename src/n64dd/{n64dd_error_headers.c => n64dd_5.c} (83%) create mode 100644 src/n64dd/n64dd_6.c create mode 100644 src/n64dd/n64dd_7.c delete mode 100644 src/n64dd/n64dd_801C8000.c delete mode 100644 src/n64dd/n64dd_801C8940.c delete mode 100644 src/n64dd/n64dd_801C9440.c delete mode 100644 src/n64dd/n64dd_801C9B70.c delete mode 100644 src/n64dd/n64dd_801CA0B0.c delete mode 100644 src/n64dd/n64dd_error_bodies.c delete mode 100644 src/n64dd/n64dd_error_textures.c delete mode 100644 src/n64dd/z_n64dd.c delete mode 100644 src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c diff --git a/.gitignore b/.gitignore index 4ccab810466..65afa6ef884 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ # Cache files __pycache__/ .pyc -.DS_Store # IDE files .vscode/ diff --git a/Dockerfile b/Dockerfile index 8f23b1df7f1..711cd918f09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ -FROM ubuntu:24.04 AS build - +FROM ubuntu:22.04 as build ENV TZ=UTC -ENV LANG=C.UTF-8 RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ apt-get update && \ @@ -10,7 +8,6 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone & build-essential \ python3 \ python3-pip \ - python3-venv \ git \ curl \ clang-tidy \ @@ -19,8 +16,15 @@ RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone & apt-get clean && \ rm -rf /var/lib/apt/lists/* +RUN python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein "mapfile-parser>=1.2.1,<2.0.0" "rabbitizer>=1.0.0,<2.0.0" +RUN python3 -m pip install --upgrade attrs pycparser + +ENV LANG C.UTF-8 +RUN mkdir /oot WORKDIR /oot + RUN git config --global --add safe.directory /oot -CMD make -j $(nproc) setup && make -j $(nproc) && tail -f /dev/null +CMD ["/bin/sh", "-c", \ + "echo 'usage:\n docker run --rm --mount type=bind,source=\"$(pwd)\",destination=/oot oot make -j$(nproc) setup\n docker run --rm --mount type=bind,source=\"$(pwd)\",destination=/oot oot make -j$(nproc)'"] diff --git a/Doxyfile b/Doxyfile index 499b9061700..53ee04bdf13 100644 --- a/Doxyfile +++ b/Doxyfile @@ -187,7 +187,7 @@ SHORT_NAMES = NO # description.) # The default value is: NO. -JAVADOC_AUTOBRIEF = YES +JAVADOC_AUTOBRIEF = NO # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If diff --git a/Makefile b/Makefile index f9023b08eb0..04f4afdc102 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ COMPILER ?= ido # gc-jp-ce GameCube Japan (Collector's Edition disc) # ique-cn iQue Player (Simplified Chinese) VERSION ?= gc-eu-mq-dbg -# Number of threads to extract and compress with. +# Number of threads to compress with. N_THREADS ?= $(shell nproc) # If DEBUG_OBJECTS is 1, produce additional debugging files such as objdump output or raw binaries for assets DEBUG_OBJECTS ?= 0 @@ -393,7 +393,7 @@ SFCFLAGS := --matching # Extra debugging steps ifeq ($(DEBUG_OBJECTS),1) - OBJDUMP_CMD = @$(OBJDUMP) $(OBJDUMP_FLAGS) $@ > $(@:.o=.s) + OBJDUMP_CMD = @$(OBJDUMP) -d $@ > $(@:.o=.s) OBJCOPY_CMD = @$(OBJCOPY) -O binary $@ $(@:.o=.bin) else OBJDUMP_CMD = @: @@ -447,8 +447,6 @@ else CC_CHECK = @: endif -OBJDUMP_FLAGS := -d -r -z -Mreg-names=32 - #### Files #### # ROM image @@ -602,13 +600,13 @@ else SEGMENT_FILES := OVL_SEGMENT_FILES := endif -OVL_RELOC_FILES := $(OVL_SEGMENT_FILES:.plf=.reloc.o) +RELOC_O_FILES := $(OVL_SEGMENT_FILES:.plf=.reloc.o) O_FILES := $(shell $(CPP) $(CPPFLAGS) -I. $(SPEC) | $(BUILD_DIR_REPLACE) | sed -n -E 's/^[ \t]*include[ \t]*"([a-zA-Z0-9/_.-]+\.o)"/\1/p') MAKEROM_O_FILES := $(BUILD_DIR)/src/makerom/rom_header.o $(BUILD_DIR)/src/makerom/ipl3.o $(BUILD_DIR)/src/makerom/entry.o # Automatic dependency files -DEP_FILES := $(O_FILES:.o=.d) $(O_FILES:.o=.asmproc.d) $(OVL_RELOC_FILES:.o=.d) $(BUILD_DIR)/spec.d $(MAKEROM_O_FILES:.o=.d) +DEP_FILES := $(O_FILES:.o=.d) $(O_FILES:.o=.asmproc.d) $(RELOC_O_FILES:.o=.d) $(BUILD_DIR)/spec.d $(MAKEROM_O_FILES:.o=.d) $(BUILD_DIR)/src/boot/build.o: CPP_DEFINES += -DBUILD_CREATOR="\"$(BUILD_CREATOR)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_TIME="\"$(BUILD_TIME)\"" @@ -680,7 +678,7 @@ $(BUILD_DIR)/src/libc/%.o: CFLAGS := $(EGCS_CFLAGS) -mno-abicalls $(BUILD_DIR)/src/libc/%.o: CCASFLAGS := $(EGCS_CCASFLAGS) $(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -O1 $(BUILD_DIR)/src/libc/%.o: MIPS_VERSION := -$(BUILD_DIR)/src/libc/memmove.o: MIPS_VERSION := -mips2 +$(BUILD_DIR)/src/libc/code_801068B0.o: MIPS_VERSION := -mips2 else ifeq ($(DEBUG_FEATURES),1) $(BUILD_DIR)/src/libc/%.o: OPTFLAGS := -g $(BUILD_DIR)/src/libc/%.o: ASOPTFLAGS := -g @@ -742,7 +740,7 @@ $(BUILD_DIR)/src/libultra/os/exceptasm.o: POSTPROCESS_OBJ := $(PYTHON) tools/set endif $(BUILD_DIR)/src/code/%.o: ASOPTFLAGS := -O2 -$(BUILD_DIR)/src/libleo/%.o: ASOPTFLAGS := -O2 +$(BUILD_DIR)/src/n64dd/libleo/%.o: ASOPTFLAGS := -O2 $(BUILD_DIR)/src/libultra/libc/%.o: ASOPTFLAGS := -O2 $(BUILD_DIR)/src/libultra/mgu/%.o: ASOPTFLAGS := -O2 @@ -792,8 +790,8 @@ $(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1 endif endif -$(BUILD_DIR)/src/libleo/%.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/libleo/%.o: OPTFLAGS := -O2 +$(BUILD_DIR)/src/n64dd/libleo/%.o: CC := $(CC_OLD) +$(BUILD_DIR)/src/n64dd/libleo/%.o: OPTFLAGS := -O2 ifeq ($(PLATFORM),IQUE) $(BUILD_DIR)/src/libgcc/%.o: CC := $(EGCS_CC) @@ -845,49 +843,6 @@ ifneq ($(COMPARE),0) endif endif -clean: - $(RM) -r $(BUILD_DIR) - -assetclean: - $(RM) -r $(EXTRACTED_DIR) - -distclean: - $(RM) -r extracted/ - $(RM) -r build/ - $(MAKE) -C tools distclean - -venv: -# Create the virtual environment if it doesn't exist. -# Delete the virtual environment directory if creation fails. - test -d $(VENV) || python3 -m venv $(VENV) || { rm -rf $(VENV); false; } - $(PYTHON) -m pip install -U pip - $(PYTHON) -m pip install -U -r requirements.txt - -setup: venv - $(MAKE) -C tools - $(PYTHON) tools/decompress_baserom.py $(VERSION) - $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION) - $(PYTHON) -m tools.assets.extract $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR) -v $(VERSION) -j$(N_THREADS) - $(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION) - $(PYTHON) tools/extract_text.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/text -v $(VERSION) - $(PYTHON) tools/extract_audio.py -b $(EXTRACTED_DIR)/baserom -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml - -disasm: - $(RM) -r $(EXPECTED_DIR) - VERSION=$(VERSION) DISASM_BASEROM=$(BASEROM_DIR)/baserom-decompressed.z64 DISASM_DIR=$(EXPECTED_DIR) PYTHON=$(PYTHON) AS_CMD='$(AS) $(ASFLAGS)' LD=$(LD) ./tools/disasm/do_disasm.sh - -run: $(ROM) -ifeq ($(N64_EMULATOR),) - $(error Emulator path not set. Set N64_EMULATOR in the Makefile or define it as an environment variable) -endif - $(N64_EMULATOR) $< - - -.PHONY: all rom compress clean assetclean distclean venv setup disasm run -.DEFAULT_GOAL := rom - -#### Various Recipes #### - ifeq ($(PLATFORM),IQUE) COMPRESS_ARGS := --format gzip --pad-to 0x4000 CIC = 6102 @@ -907,7 +862,7 @@ $(ROMC): $(ROM) $(ELF) $(BUILD_DIR)/compress_ranges.txt LDFLAGS := -T $(LDSCRIPT) -T $(BUILD_DIR)/linker_scripts/makerom.ld -T $(BUILD_DIR)/undefined_syms.txt --emit-relocs -Map $(MAP) -$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(SEGMENT_FILES) $(OVL_RELOC_FILES) $(LDSCRIPT) $(MAKEROM_O_FILES) \ +$(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(SEGMENT_FILES) $(RELOC_O_FILES) $(LDSCRIPT) $(MAKEROM_O_FILES) \ $(BUILD_DIR)/linker_scripts/makerom.ld $(BUILD_DIR)/undefined_syms.txt \ $(SAMPLEBANK_O_FILES) $(SOUNDFONT_O_FILES) $(SEQUENCE_O_FILES) \ $(BUILD_DIR)/assets/audio/sequence_font_table.o $(BUILD_DIR)/assets/audio/audiobank_padding.o @@ -916,18 +871,6 @@ $(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(SEGMENT_FILES) $(OVL_RELOC_FIL $(BUILD_DIR)/linker_scripts/makerom.ld: linker_scripts/makerom.ld $(CPP) -I include $(CPPFLAGS) $< > $@ -## Order-only prerequisites -# These ensure e.g. the O_FILES are built before the OVL_RELOC_FILES. -# The intermediate phony targets avoid quadratically-many dependencies between the targets and prerequisites. - -o_files: $(O_FILES) -$(OVL_RELOC_FILES): | o_files - -asset_files: $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) -$(O_FILES): | asset_files - -.PHONY: o_files asset_files - $(BUILD_DIR)/spec: $(SPEC) $(SPEC_INCLUDES) $(CPP) $(CPPFLAGS) -MD -MP -MF $@.d -MT $@ -I. $< | $(BUILD_DIR_REPLACE) > $@ @@ -948,13 +891,56 @@ $(SEGMENTS_DIR)/%.reloc.o: $(SEGMENTS_DIR)/%.plf $(AS) $(ASFLAGS) $(@:.o=.s) -o $@ $(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt - $(CPP) $(CPPFLAGS) $< > $@ + $(CPP) $(CPPFLAGS) $< > $(BUILD_DIR)/undefined_syms.txt + +clean: + $(RM) -r $(BUILD_DIR) + +assetclean: + $(RM) -r $(EXTRACTED_DIR) + +distclean: + $(RM) -r extracted/ + $(RM) -r build/ + $(MAKE) -C tools distclean + +venv: +# Create the virtual environment if it doesn't exist. +# Delete the virtual environment directory if creation fails. + test -d $(VENV) || python3 -m venv $(VENV) || { rm -rf $(VENV); false; } + $(PYTHON) -m pip install -U pip + $(PYTHON) -m pip install -U -r requirements.txt + +setup: venv + $(MAKE) -C tools -j + $(PYTHON) tools/decompress_baserom.py $(VERSION) + $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION) + $(PYTHON) -m tools.assets.extract $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR) -v $(VERSION) -j$(N_THREADS) + $(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION) + $(PYTHON) tools/extract_text.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/text -v $(VERSION) + $(PYTHON) tools/extract_audio.py -b $(EXTRACTED_DIR)/baserom -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml + +disasm: + $(RM) -r $(EXPECTED_DIR) + VERSION=$(VERSION) DISASM_BASEROM=$(BASEROM_DIR)/baserom-decompressed.z64 DISASM_DIR=$(EXPECTED_DIR) PYTHON=$(PYTHON) AS_CMD='$(AS) $(ASFLAGS)' LD=$(LD) ./tools/disasm/do_disasm.sh + +resources: $(ASSET_FILES_OUT) +run: $(ROM) +ifeq ($(N64_EMULATOR),) + $(error Emulator path not set. Set N64_EMULATOR in the Makefile or define it as an environment variable) +endif + $(N64_EMULATOR) $< + +.PHONY: all rom compress clean assetclean distclean venv setup disasm run +.DEFAULT_GOAL := rom + +#### Various Recipes #### $(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/% $(OBJCOPY) -I binary -O $(LD_OFORMAT) $< $@ $(BUILD_DIR)/data/%.o: data/%.s - $(CPP) $(CPPFLAGS) -MD -MP -MF $(@:.o=.d) -MT $@ -Iinclude $< | $(AS) $(ASFLAGS) -o $@ + $(CPP) $(CPPFLAGS) -MD -MP -MF $(@:.o=.d) -MT $@ -Iinclude $< | iconv --from UTF-8 --to EUC-JP | $(AS) $(ASFLAGS) -o $@ ifeq ($(PLATFORM),IQUE) NES_CHARMAP := assets/text/charmap.chn.txt @@ -1039,6 +1025,10 @@ $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR) $(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata_table_spec.h +o_files: $(O_FILES) +$(RELOC_O_FILES): | o_files +.PHONY: o_files + $(BUILD_DIR)/src/%.o: src/%.c $(CC_CHECK) $< -o $@ $(PREPROCESS) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< diff --git a/README.md b/README.md index 89c87b13db5..428c74eb9dd 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ 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][discord]. +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 builds the following versions: @@ -56,24 +57,37 @@ The default version is `gc-eu-mq-dbg`, i.e. the GameCube Europe/PAL Master Quest ## Installation -We recommend using WSL on Windows, or native Linux, which the rest of this readme describes. We currently have instructions for - -* [Windows](#Windows), with and without WSL -* [macOS](docs/BUILDING_MACOS.md) -* [Linux](#Linux-Native-or-under-WSL--VM), natively or using WSL / VM -* [Docker](docs/BUILDING_DOCKER.md) - -(These will also depend on the Linux instructions.) -Some of these may also be out of date or unmaintained; usually our contributors use WSL, Linux, and macOS, so these instructions should be up to date. - ### Windows For Windows 10 or 11, install WSL and a distribution by following this [WSL Installation Guide](https://learn.microsoft.com/en-us/windows/wsl/install). -We recommend using Ubuntu as the Linux distribution. +We recommend using Debian or Ubuntu Linux distributions. + +For older versions of Windows, install a Linux VM or refer to [Docker](#Docker) instructions. + +### macOS + +For macOS, use homebrew to install the following dependencies: + +* coreutils +* make +* python3 +* md5sha1sum +* libiconv -For older versions of Windows, install a Linux VM or refer to [Docker](docs/BUILDING_DOCKER.md) instructions. +You can install them with the following commands: +```bash +brew update +brew install coreutils make python3 md5sha1sum libiconv +``` + +You'll also need to [build and install mips-linux-binutils](docs/BUILDING_BINUTILS_MACOS.md). + +Going forward in this guide, please use `gmake` whenever you encounter a `make` command. +The `make` that comes with macOS behaves differently than GNU make and is incompatible with this project. + +You should now be able to continue from [step 2](#2-clone-the-repository) of the Linux instructions. ### Linux (Native or under WSL / VM) @@ -110,21 +124,12 @@ If you are using GCC as the compiler for Ocarina of Time, you will also need the #### 2. Clone the repository -**N.B.** If using WSL, we strongly encourage you to clone into WSL's Linux filesystem using Linux's `git`. -Cloning into the Windows filesystem will result in much slower read/write speeds, and often causes issues when Windows copies the files with the wrong line endings, which the compiler IDO cannot handle correctly. - Clone `https://github.com/zeldaret/oot.git` where you wish to have the project, with a command such as: ```bash git clone https://github.com/zeldaret/oot.git ``` -This will copy the GitHub repository contents into a new folder in the current directory called `oot`. Change into this directory before doing anything else: - -```bash -cd oot -``` - #### 3. Prepare a base ROM First, pick the version of the game you want to build. @@ -180,12 +185,35 @@ md5sum: WARNING: 1 computed checksum did NOT match This means that the built ROM isn't the same as the base one, so something went wrong or some part of the code doesn't match. -**NOTE:** to speed up the build, you can either: +### Docker + +#### 1. Setup requirements + +To use Docker, you'll need either Docker Desktop or Docker Toolbox installed and setup based on your system. + +On Ubuntu, Docker and required tools can be installed with: `sudo apt install docker.io docker-compose docker-buildx` + +You'll also need to prepare a local version of the project with a copied base ROM (see steps [2](#2-clone-the-repository) and [3](#3-prepare-a-base-rom) of the Linux instructions). + +#### 2. Create the Docker image + +From inside your local project, run the following command: + +```bash +docker build . -t oot +``` + +#### 3. Start the container + +To start the container, you can mount your local filesystem into the Docker container and run an interactive bash session. + +```bash +docker run -it --rm --mount type=bind,source="$(pwd)",destination=/oot oot /bin/bash +``` -* pass `-jN` to `make setup` and `make`, where N is the number of threads to use in the build. The generally-accepted wisdom is to use the number of virtual cores your computer has. -* pass `-j` to `make setup` and `make`, to use as many threads as possible, but beware that this can use too much memory on lower-end systems. +#### 4. Setup and Build the ROM -Both of these have the disadvantage that the ordering of the terminal output is scrambled, so for debugging it is best to stick to one thread (i.e. not pass `-j` or `-jN`). +Once inside the container, you can follow steps [4](#4-setup-the-rom-and-build-process) and [5](#5-build-the-rom) of the Linux instructions to setup and build the ROM, or run any other command you need. ## Changing build options diff --git a/assets/objects/gameplay_keep/eff_fire.c b/assets/objects/gameplay_keep/eff_fire.c index 7d95baaae48..75273714109 100644 --- a/assets/objects/gameplay_keep/eff_fire.c +++ b/assets/objects/gameplay_keep/eff_fire.c @@ -13,10 +13,10 @@ Gfx gEffFire2DL[24] = { #include "assets/objects/gameplay_keep/gEffFire2DL.inc.c" }; -u64 gDecorativeFlameMaskTex[TEX_LEN(u64, gDecorativeFlameMaskTex_WIDTH, gDecorativeFlameMaskTex_HEIGHT, 4)] = { -#include "assets/objects/gameplay_keep/gDecorativeFlameMaskTex.i4.inc.c" +u64 gEffFire1Tex[TEX_LEN(u64, gEffFire1Tex_WIDTH, gEffFire1Tex_HEIGHT, 4)] = { +#include "assets/objects/gameplay_keep/gEffFire1Tex.i4.inc.c" }; -u64 gDecorativeFlameTex[TEX_LEN(u64, gDecorativeFlameTex_WIDTH, gDecorativeFlameTex_HEIGHT, 8)] = { -#include "assets/objects/gameplay_keep/gDecorativeFlameTex.i8.inc.c" +u64 gEffFire2Tex[TEX_LEN(u64, gEffFire2Tex_WIDTH, gEffFire2Tex_HEIGHT, 8)] = { +#include "assets/objects/gameplay_keep/gEffFire2Tex.i8.inc.c" }; diff --git a/assets/objects/gameplay_keep/eff_fire.h b/assets/objects/gameplay_keep/eff_fire.h index cf3aee7eb50..df53344fc12 100644 --- a/assets/objects/gameplay_keep/eff_fire.h +++ b/assets/objects/gameplay_keep/eff_fire.h @@ -7,11 +7,11 @@ extern Vtx gEffFireVtx[]; extern Gfx gEffFire1DL[24]; extern Gfx gEffFire2DL[24]; -#define gDecorativeFlameMaskTex_WIDTH 32 -#define gDecorativeFlameMaskTex_HEIGHT 128 -extern u64 gDecorativeFlameMaskTex[TEX_LEN(u64, gDecorativeFlameMaskTex_WIDTH, gDecorativeFlameMaskTex_HEIGHT, 4)]; -#define gDecorativeFlameTex_WIDTH 32 -#define gDecorativeFlameTex_HEIGHT 64 -extern u64 gDecorativeFlameTex[TEX_LEN(u64, gDecorativeFlameTex_WIDTH, gDecorativeFlameTex_HEIGHT, 8)]; +#define gEffFire1Tex_WIDTH 32 +#define gEffFire1Tex_HEIGHT 128 +extern u64 gEffFire1Tex[TEX_LEN(u64, gEffFire1Tex_WIDTH, gEffFire1Tex_HEIGHT, 4)]; +#define gEffFire2Tex_WIDTH 32 +#define gEffFire2Tex_HEIGHT 64 +extern u64 gEffFire2Tex[TEX_LEN(u64, gEffFire2Tex_WIDTH, gEffFire2Tex_HEIGHT, 8)]; #endif diff --git a/assets/objects/gameplay_keep/gFish1Anim.c b/assets/objects/gameplay_keep/gFish1Anim.c new file mode 100644 index 00000000000..64dc61543db --- /dev/null +++ b/assets/objects/gameplay_keep/gFish1Anim.c @@ -0,0 +1,13 @@ +#include "gFish1Anim.h" + +s16 gFish1FrameData[] = { +#include "assets/objects/gameplay_keep/gFish1FrameData.inc.c" +}; + +JointIndex gFish1JointIndices[] = { +#include "assets/objects/gameplay_keep/gFish1JointIndices.inc.c" +}; + +AnimationHeader gFish1Anim = { +#include "assets/objects/gameplay_keep/gFish1Anim.inc.c" +}; diff --git a/assets/objects/gameplay_keep/gFish1Anim.h b/assets/objects/gameplay_keep/gFish1Anim.h new file mode 100644 index 00000000000..91e9beec1b7 --- /dev/null +++ b/assets/objects/gameplay_keep/gFish1Anim.h @@ -0,0 +1,10 @@ +#ifndef GAMEPLAY_KEEP_GFISH1ANIM_H +#define GAMEPLAY_KEEP_GFISH1ANIM_H + +#include "animation.h" + +extern s16 gFish1FrameData[]; +extern JointIndex gFish1JointIndices[]; +extern AnimationHeader gFish1Anim; + +#endif diff --git a/assets/objects/gameplay_keep/gFish2Anim.c b/assets/objects/gameplay_keep/gFish2Anim.c new file mode 100644 index 00000000000..fce5a386ac3 --- /dev/null +++ b/assets/objects/gameplay_keep/gFish2Anim.c @@ -0,0 +1,13 @@ +#include "gFish2Anim.h" + +s16 gFish2FrameData[] = { +#include "assets/objects/gameplay_keep/gFish2FrameData.inc.c" +}; + +JointIndex gFish2JointIndices[] = { +#include "assets/objects/gameplay_keep/gFish2JointIndices.inc.c" +}; + +AnimationHeader gFish2Anim = { +#include "assets/objects/gameplay_keep/gFish2Anim.inc.c" +}; diff --git a/assets/objects/gameplay_keep/gFish2Anim.h b/assets/objects/gameplay_keep/gFish2Anim.h new file mode 100644 index 00000000000..d23dfdd127a --- /dev/null +++ b/assets/objects/gameplay_keep/gFish2Anim.h @@ -0,0 +1,10 @@ +#ifndef GAMEPLAY_KEEP_GFISH2ANIM_H +#define GAMEPLAY_KEEP_GFISH2ANIM_H + +#include "animation.h" + +extern s16 gFish2FrameData[]; +extern JointIndex gFish2JointIndices[]; +extern AnimationHeader gFish2Anim; + +#endif diff --git a/assets/objects/gameplay_keep/gFishInWaterAnim.c b/assets/objects/gameplay_keep/gFishInWaterAnim.c deleted file mode 100644 index 10c6afb9f1e..00000000000 --- a/assets/objects/gameplay_keep/gFishInWaterAnim.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "gFishInWaterAnim.h" - -s16 gFishInWaterFrameData[] = { -#include "assets/objects/gameplay_keep/gFishInWaterFrameData.inc.c" -}; - -JointIndex gFishInWaterJointIndices[] = { -#include "assets/objects/gameplay_keep/gFishInWaterJointIndices.inc.c" -}; - -AnimationHeader gFishInWaterAnim = { -#include "assets/objects/gameplay_keep/gFishInWaterAnim.inc.c" -}; diff --git a/assets/objects/gameplay_keep/gFishInWaterAnim.h b/assets/objects/gameplay_keep/gFishInWaterAnim.h deleted file mode 100644 index 956d54c2ba6..00000000000 --- a/assets/objects/gameplay_keep/gFishInWaterAnim.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GAMEPLAY_KEEP_GFISHINWATERANIM_H -#define GAMEPLAY_KEEP_GFISHINWATERANIM_H - -#include "animation.h" - -extern s16 gFishInWaterFrameData[]; -extern JointIndex gFishInWaterJointIndices[]; -extern AnimationHeader gFishInWaterAnim; - -#endif diff --git a/assets/objects/gameplay_keep/gFishOutOfWaterAnim.c b/assets/objects/gameplay_keep/gFishOutOfWaterAnim.c deleted file mode 100644 index 7579f0ca935..00000000000 --- a/assets/objects/gameplay_keep/gFishOutOfWaterAnim.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "gFishOutOfWaterAnim.h" - -s16 gFishOutOfWaterFrameData[] = { -#include "assets/objects/gameplay_keep/gFishOutOfWaterFrameData.inc.c" -}; - -JointIndex gFishOutOfWaterJointIndices[] = { -#include "assets/objects/gameplay_keep/gFishOutOfWaterJointIndices.inc.c" -}; - -AnimationHeader gFishOutOfWaterAnim = { -#include "assets/objects/gameplay_keep/gFishOutOfWaterAnim.inc.c" -}; diff --git a/assets/objects/gameplay_keep/gFishOutOfWaterAnim.h b/assets/objects/gameplay_keep/gFishOutOfWaterAnim.h deleted file mode 100644 index e96f7103918..00000000000 --- a/assets/objects/gameplay_keep/gFishOutOfWaterAnim.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GAMEPLAY_KEEP_GFISHOUTOFWATERANIM_H -#define GAMEPLAY_KEEP_GFISHOUTOFWATERANIM_H - -#include "animation.h" - -extern s16 gFishOutOfWaterFrameData[]; -extern JointIndex gFishOutOfWaterJointIndices[]; -extern AnimationHeader gFishOutOfWaterAnim; - -#endif diff --git a/assets/objects/gameplay_keep/gameplay_keep.h b/assets/objects/gameplay_keep/gameplay_keep.h index 3419f256787..8f28bc92159 100644 --- a/assets/objects/gameplay_keep/gameplay_keep.h +++ b/assets/objects/gameplay_keep/gameplay_keep.h @@ -44,9 +44,9 @@ #include "gameplay_keep_0x16A50.h" #include "hilite4_tex.h" #include "gameplay_keep_0x173D0.h" -#include "gFishOutOfWaterAnim.h" +#include "gFish1Anim.h" #include "gameplay_keep_0x18610.h" -#include "gFishInWaterAnim.h" +#include "gFish2Anim.h" #include "eff_shockwave.h" #include "eff_bubble.h" #include "eff_fire_footprint.h" diff --git a/assets/objects/object_tp/object_tp.c b/assets/objects/object_tp/object_tp.c deleted file mode 100644 index b79b3b4cdfc..00000000000 --- a/assets/objects/object_tp/object_tp.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "object_tp.h" -#include "gfx.h" - -Gfx gTailpasaranTailSegmentDL[14] = { -#include "assets/objects/object_tp/gTailpasaranTailSegmentDL.inc.c" -}; - -Vtx gTailpasaranTailSegmentVtx[] = { -#include "assets/objects/object_tp/gTailpasaranTailSegmentVtx.inc.c" -}; - -Vtx gTailpasaranHeadClawVtx[] = { -#include "assets/objects/object_tp/gTailpasaranHeadClawVtx.inc.c" -}; - -Vtx gTailpasaranHeadMouthpartsVtx[] = { -#include "assets/objects/object_tp/gTailpasaranHeadMouthpartsVtx.inc.c" -}; - -Gfx gTailpasaranHeadClawDL[54] = { -#include "assets/objects/object_tp/gTailpasaranHeadClawDL.inc.c" -}; - -Gfx gTailpasaranHeadMouthpartsDL[18] = { -#include "assets/objects/object_tp/gTailpasaranHeadMouthpartsDL.inc.c" -}; - -Gfx gTailpasaranHeadDL[3] = { -#include "assets/objects/object_tp/gTailpasaranHeadDL.inc.c" -}; - -u64 gTailpasaranHeadRearTex[TEX_LEN(u64, gTailpasaranHeadRearTex_WIDTH, gTailpasaranHeadRearTex_HEIGHT, 16)] = { -#include "assets/objects/object_tp/gTailpasaranHeadRearTex.rgba16.inc.c" -}; - -u64 gTailpasaranHeadClawBaseTex[TEX_LEN(u64, gTailpasaranHeadClawBaseTex_WIDTH, gTailpasaranHeadClawBaseTex_HEIGHT, - 16)] = { -#include "assets/objects/object_tp/gTailpasaranHeadClawBaseTex.rgba16.inc.c" -}; - -u64 gTailpasaranHeadClawTex[TEX_LEN(u64, gTailpasaranHeadClawTex_WIDTH, gTailpasaranHeadClawTex_HEIGHT, 16)] = { -#include "assets/objects/object_tp/gTailpasaranHeadClawTex.rgba16.inc.c" -}; - -u64 gTailpasaranTailSegmentTex[TEX_LEN(u64, gTailpasaranTailSegmentTex_WIDTH, gTailpasaranTailSegmentTex_HEIGHT, 8)] = { -#include "assets/objects/object_tp/gTailpasaranTailSegmentTex.ia8.inc.c" -}; - -u64 gTailpasaranHeadMouthpartsTex[TEX_LEN(u64, gTailpasaranHeadMouthpartsTex_WIDTH, - gTailpasaranHeadMouthpartsTex_HEIGHT, 16)] = { -#include "assets/objects/object_tp/gTailpasaranHeadMouthpartsTex.rgba16.inc.c" -}; diff --git a/assets/objects/object_tp/object_tp.h b/assets/objects/object_tp/object_tp.h deleted file mode 100644 index 004facfb584..00000000000 --- a/assets/objects/object_tp/object_tp.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef OBJECT_TP_H -#define OBJECT_TP_H - -#include "ultra64.h" -#include "tex_len.h" - -extern Gfx gTailpasaranTailSegmentDL[14]; -extern Vtx gTailpasaranTailSegmentVtx[]; - -extern Gfx gTailpasaranHeadClawDL[54]; -extern Gfx gTailpasaranHeadMouthpartsDL[18]; -extern Gfx gTailpasaranHeadDL[3]; - -#define gTailpasaranHeadRearTex_WIDTH 8 -#define gTailpasaranHeadRearTex_HEIGHT 16 -extern u64 gTailpasaranHeadRearTex[TEX_LEN(u64, gTailpasaranHeadRearTex_WIDTH, gTailpasaranHeadRearTex_HEIGHT, 16)]; - -#define gTailpasaranHeadClawBaseTex_WIDTH 8 -#define gTailpasaranHeadClawBaseTex_HEIGHT 8 -extern u64 gTailpasaranHeadClawBaseTex[TEX_LEN(u64, gTailpasaranHeadClawBaseTex_WIDTH, gTailpasaranHeadClawBaseTex_HEIGHT, 16)]; - -#define gTailpasaranHeadClawTex_WIDTH 16 -#define gTailpasaranHeadClawTex_HEIGHT 16 -extern u64 gTailpasaranHeadClawTex[TEX_LEN(u64, gTailpasaranHeadClawTex_WIDTH, gTailpasaranHeadClawTex_HEIGHT, 16)]; - -#define gTailpasaranTailSegmentTex_WIDTH 64 -#define gTailpasaranTailSegmentTex_HEIGHT 64 -extern u64 gTailpasaranTailSegmentTex[TEX_LEN(u64, gTailpasaranTailSegmentTex_WIDTH, gTailpasaranTailSegmentTex_HEIGHT, 8)]; - -#define gTailpasaranHeadMouthpartsTex_WIDTH 8 -#define gTailpasaranHeadMouthpartsTex_HEIGHT 8 -extern u64 gTailpasaranHeadMouthpartsTex[TEX_LEN(u64, gTailpasaranHeadMouthpartsTex_WIDTH, gTailpasaranHeadMouthpartsTex_HEIGHT, 16)]; - -#endif diff --git a/assets/objects/object_triforce_spot/object_triforce_spot.c b/assets/objects/object_triforce_spot/object_triforce_spot.c deleted file mode 100644 index 49729e7253f..00000000000 --- a/assets/objects/object_triforce_spot/object_triforce_spot.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "object_triforce_spot.h" -#include "gfx.h" - -Vtx gTriforceVtx[] = { -#include "assets/objects/object_triforce_spot/gTriforceVtx.inc.c" -}; - -Vtx gTriforceLightColumnVtx[] = { -#include "assets/objects/object_triforce_spot/gTriforceLightColumnVtx.inc.c" -}; - -Gfx gTriforceDL[72] = { -#include "assets/objects/object_triforce_spot/gTriforceDL.inc.c" -}; - -Gfx gTriforceLightColumnDL[26] = { -#include "assets/objects/object_triforce_spot/gTriforceLightColumnDL.inc.c" -}; - -u64 gTriforceTex[TEX_LEN(u64, gTriforceTex_WIDTH, gTriforceTex_HEIGHT, 8)] = { -#include "assets/objects/object_triforce_spot/gTriforceTex.i8.inc.c" -}; - -u64 gTriforceColumnSide1Tex[TEX_LEN(u64, gTriforceColumnSide1Tex_WIDTH, gTriforceColumnSide1Tex_HEIGHT, 8)] = { -#include "assets/objects/object_triforce_spot/gTriforceColumnSide1Tex.i8.inc.c" -}; - -u64 gTriforceColumnSide2Tex[TEX_LEN(u64, gTriforceColumnSide2Tex_WIDTH, gTriforceColumnSide2Tex_HEIGHT, 8)] = { -#include "assets/objects/object_triforce_spot/gTriforceColumnSide2Tex.i8.inc.c" -}; diff --git a/assets/objects/object_triforce_spot/object_triforce_spot.h b/assets/objects/object_triforce_spot/object_triforce_spot.h deleted file mode 100644 index 7db44851fc3..00000000000 --- a/assets/objects/object_triforce_spot/object_triforce_spot.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef OBJECT_TRIFORCE_SPOT_H -#define OBJECT_TRIFORCE_SPOT_H - -#include "ultra64.h" -#include "tex_len.h" - -extern Vtx gTriforceVtx[]; -extern Gfx gTriforceDL[72]; - -extern Gfx gTriforceLightColumnDL[26]; - -#define gTriforceTex_WIDTH 64 -#define gTriforceTex_HEIGHT 64 -extern u64 gTriforceTex[TEX_LEN(u64, gTriforceTex_WIDTH, gTriforceTex_HEIGHT, 8)]; - -#define gTriforceColumnSide1Tex_WIDTH 64 -#define gTriforceColumnSide1Tex_HEIGHT 32 -extern u64 gTriforceColumnSide1Tex[TEX_LEN(u64, gTriforceColumnSide1Tex_WIDTH, gTriforceColumnSide1Tex_HEIGHT, 8)]; - -#define gTriforceColumnSide2Tex_WIDTH 64 -#define gTriforceColumnSide2Tex_HEIGHT 32 -extern u64 gTriforceColumnSide2Tex[TEX_LEN(u64, gTriforceColumnSide2Tex_WIDTH, gTriforceColumnSide2Tex_HEIGHT, 8)]; - -#endif diff --git a/assets/xml/n64dd/error_textures.xml b/assets/xml/n64dd/error_textures.xml deleted file mode 100644 index 82b997cb26a..00000000000 --- a/assets/xml/n64dd/error_textures.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index ee175c50535..97d1bebaef6 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -26,7 +26,6 @@ - @@ -847,7 +846,7 @@ - + @@ -869,7 +868,7 @@ - + @@ -1351,8 +1350,8 @@ - - + + diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index 133de136f6a..c5a09a5de89 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -1,80 +1,63 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bl.xml b/assets/xml/objects/object_bl.xml index 3ae9c89dc0d..d94789ecba2 100644 --- a/assets/xml/objects/object_bl.xml +++ b/assets/xml/objects/object_bl.xml @@ -1,43 +1,23 @@ - - - - - - - + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml index e099d4e6c96..f1e914a526d 100644 --- a/assets/xml/objects/object_dekubaba.xml +++ b/assets/xml/objects/object_dekubaba.xml @@ -1,43 +1,36 @@ - - - - - - + + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - + + + + + + @@ -45,15 +38,11 @@ - - - - - - + + - - + + diff --git a/assets/xml/objects/object_efc_crystal_light.xml b/assets/xml/objects/object_efc_crystal_light.xml index dbd09361918..e28a7698cc8 100644 --- a/assets/xml/objects/object_efc_crystal_light.xml +++ b/assets/xml/objects/object_efc_crystal_light.xml @@ -1,9 +1,9 @@ - - + + - + diff --git a/assets/xml/objects/object_efc_fire_ball.xml b/assets/xml/objects/object_efc_fire_ball.xml index 2c9ec2cab96..7b1b16bbd53 100644 --- a/assets/xml/objects/object_efc_fire_ball.xml +++ b/assets/xml/objects/object_efc_fire_ball.xml @@ -1,10 +1,10 @@ - + - - - + + + diff --git a/assets/xml/objects/object_efc_lgt_shower.xml b/assets/xml/objects/object_efc_lgt_shower.xml index 81d3d5e17d6..b5119206cb1 100644 --- a/assets/xml/objects/object_efc_lgt_shower.xml +++ b/assets/xml/objects/object_efc_lgt_shower.xml @@ -1,9 +1,9 @@ - - + + - + diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml index cfc539111fd..faa39d1299d 100644 --- a/assets/xml/objects/object_efc_tw.xml +++ b/assets/xml/objects/object_efc_tw.xml @@ -1,13 +1,12 @@ - - - - - + - - + + + + + diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index 0aaaf59b7b6..e7db085698c 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -1,134 +1,111 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + - + - + + + + + + diff --git a/assets/xml/objects/object_geldb.xml b/assets/xml/objects/object_geldb.xml index 1488db00b0f..f80ad410a66 100644 --- a/assets/xml/objects/object_geldb.xml +++ b/assets/xml/objects/object_geldb.xml @@ -1,7 +1,7 @@ - + @@ -120,28 +120,28 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_gi_jewel.xml b/assets/xml/objects/object_gi_jewel.xml index 1d919b6ef66..b8a8adba2a2 100644 --- a/assets/xml/objects/object_gi_jewel.xml +++ b/assets/xml/objects/object_gi_jewel.xml @@ -1,34 +1,29 @@ - - - - - + + - - - - + + - - + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index cf92179a795..0f03838fafa 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -1,140 +1,122 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_god_lgt.xml b/assets/xml/objects/object_god_lgt.xml index e6f38dfdc27..ceb29cb60ad 100644 --- a/assets/xml/objects/object_god_lgt.xml +++ b/assets/xml/objects/object_god_lgt.xml @@ -1,16 +1,16 @@ - + - - - - - + + + + + - + diff --git a/assets/xml/objects/object_hata.xml b/assets/xml/objects/object_hata.xml index 7a8beff3a44..38ada492d3e 100644 --- a/assets/xml/objects/object_hata.xml +++ b/assets/xml/objects/object_hata.xml @@ -1,79 +1,66 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - + + - + + - + + - + + - + + - + + - + + - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_horse.xml b/assets/xml/objects/object_horse.xml index e4b2a067e30..f190e3b49c8 100644 --- a/assets/xml/objects/object_horse.xml +++ b/assets/xml/objects/object_horse.xml @@ -50,10 +50,10 @@ - - - - + + + + diff --git a/assets/xml/objects/object_ik.xml b/assets/xml/objects/object_ik.xml index 55b4a6ff76b..f73477b0350 100644 --- a/assets/xml/objects/object_ik.xml +++ b/assets/xml/objects/object_ik.xml @@ -8,47 +8,47 @@ - - + + - - - - - - - - - - - - + + + + + + + + + + + + - + - + - - - - + + + + - - - - + + + + - + @@ -115,18 +115,18 @@ - - - + + + - - - + + + @@ -136,22 +136,22 @@ - + - + - + - + - - - + + + @@ -185,13 +185,13 @@ - + - + @@ -206,8 +206,8 @@ - - + + diff --git a/assets/xml/objects/object_jj.xml b/assets/xml/objects/object_jj.xml index 816b7d706cf..abbed959f54 100644 --- a/assets/xml/objects/object_jj.xml +++ b/assets/xml/objects/object_jj.xml @@ -1,111 +1,90 @@ - - - - - - - - - - - - - - + + + + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_light_ring.xml b/assets/xml/objects/object_light_ring.xml index b2183f32fc6..6c8b1411fc4 100644 --- a/assets/xml/objects/object_light_ring.xml +++ b/assets/xml/objects/object_light_ring.xml @@ -1,9 +1,9 @@ - + - - + + diff --git a/assets/xml/objects/object_mir_ray.xml b/assets/xml/objects/object_mir_ray.xml index 90d93a999c2..988cea9adee 100644 --- a/assets/xml/objects/object_mir_ray.xml +++ b/assets/xml/objects/object_mir_ray.xml @@ -1,21 +1,15 @@ - - - + - + + + + - - - - - - - - - + + diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml index 9b909a89eb1..8ac57553ba4 100644 --- a/assets/xml/objects/object_nb.xml +++ b/assets/xml/objects/object_nb.xml @@ -1,171 +1,150 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_sk2.xml b/assets/xml/objects/object_sk2.xml index 9ee3768863c..d49d3cb5dab 100644 --- a/assets/xml/objects/object_sk2.xml +++ b/assets/xml/objects/object_sk2.xml @@ -1,34 +1,33 @@ - + - - + - + - + - + - + - + - + - + @@ -37,7 +36,7 @@ - + @@ -49,7 +48,7 @@ - + @@ -61,144 +60,68 @@ - + - + - - - - - - + + + + - - + + - - + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml index a7d5798c61b..c7895a886cc 100644 --- a/assets/xml/objects/object_skb.xml +++ b/assets/xml/objects/object_skb.xml @@ -1,122 +1,111 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_tp.xml b/assets/xml/objects/object_tp.xml index 62abff312cd..27fafff4011 100644 --- a/assets/xml/objects/object_tp.xml +++ b/assets/xml/objects/object_tp.xml @@ -1,26 +1,22 @@ - - - - + + - + - + - - - - - - - - - - + + + + + + + + diff --git a/assets/xml/objects/object_triforce_spot.xml b/assets/xml/objects/object_triforce_spot.xml index f645f2859f6..6008dade955 100644 --- a/assets/xml/objects/object_triforce_spot.xml +++ b/assets/xml/objects/object_triforce_spot.xml @@ -1,16 +1,15 @@ - + - + - - - - - - + + + + + diff --git a/assets/xml/objects/object_vali.xml b/assets/xml/objects/object_vali.xml index 240a7e13715..ee98b1de9b9 100644 --- a/assets/xml/objects/object_vali.xml +++ b/assets/xml/objects/object_vali.xml @@ -1,104 +1,67 @@ - - - - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index cd9a297c9e2..f9492168de7 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -1,243 +1,229 @@ - - - - - - - - + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + diff --git a/assets/xml/objects/object_zf.xml b/assets/xml/objects/object_zf.xml index 3a64ee72661..d6d17075b1d 100644 --- a/assets/xml/objects/object_zf.xml +++ b/assets/xml/objects/object_zf.xml @@ -1,152 +1,150 @@ - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -159,151 +157,150 @@ - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_En_Ganon_Organ.xml b/assets/xml/overlays/ovl_En_Ganon_Organ.xml index 6668b85fd00..438e046c934 100644 --- a/assets/xml/overlays/ovl_En_Ganon_Organ.xml +++ b/assets/xml/overlays/ovl_En_Ganon_Organ.xml @@ -1,25 +1,12 @@ - - - - - - - - - - - - - - + - - + + - + diff --git a/assets/xml/textures/link_animetion.xml b/assets/xml/textures/link_animetion.xml new file mode 100644 index 00000000000..8df8efba470 --- /dev/null +++ b/assets/xml/textures/link_animetion.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/assets/xml/textures/nes_font_static.xml b/assets/xml/textures/nes_font_static.xml index 9561fb1036f..850e63590a3 100644 --- a/assets/xml/textures/nes_font_static.xml +++ b/assets/xml/textures/nes_font_static.xml @@ -1,144 +1,143 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/textures/nes_font_static_v2.xml b/assets/xml/textures/nes_font_static_v2.xml index 9e037d45bc2..6c8384e277e 100644 --- a/assets/xml/textures/nes_font_static_v2.xml +++ b/assets/xml/textures/nes_font_static_v2.xml @@ -1,145 +1,144 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/textures/place_title_cards.xml b/assets/xml/textures/place_title_cards.xml index 30851a36945..4d21c41fb65 100644 --- a/assets/xml/textures/place_title_cards.xml +++ b/assets/xml/textures/place_title_cards.xml @@ -1,4 +1,5 @@ + diff --git a/baseroms/ntsc-1.0/config.yml b/baseroms/ntsc-1.0/config.yml index e164590c399..919307cf222 100644 --- a/baseroms/ntsc-1.0/config.yml +++ b/baseroms/ntsc-1.0/config.yml @@ -67,10 +67,6 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB600 end_offset: 0xEC088 -- name: n64dd/error_textures - xml_path: assets/xml/n64dd/error_textures.xml - start_offset: 0xC160 - end_offset: 0x11D60 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/ntsc-1.1/config.yml b/baseroms/ntsc-1.1/config.yml index ee27b55df99..1ed8fc185b1 100644 --- a/baseroms/ntsc-1.1/config.yml +++ b/baseroms/ntsc-1.1/config.yml @@ -67,10 +67,6 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB7C0 end_offset: 0xEC248 -- name: n64dd/error_textures - xml_path: assets/xml/n64dd/error_textures.xml - start_offset: 0xC140 - end_offset: 0x11D40 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/ntsc-1.2/config.yml b/baseroms/ntsc-1.2/config.yml index b0c8b18bee1..a7ba264e295 100644 --- a/baseroms/ntsc-1.2/config.yml +++ b/baseroms/ntsc-1.2/config.yml @@ -67,10 +67,6 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB610 end_offset: 0xEC098 -- name: n64dd/error_textures - xml_path: assets/xml/n64dd/error_textures.xml - start_offset: 0xC120 - end_offset: 0x11D20 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/pal-1.0/config.yml b/baseroms/pal-1.0/config.yml index 2602ed0e7c2..60fdb421698 100644 --- a/baseroms/pal-1.0/config.yml +++ b/baseroms/pal-1.0/config.yml @@ -73,10 +73,6 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F20 end_offset: 0xE99A8 -- name: n64dd/error_textures - xml_path: assets/xml/n64dd/error_textures.xml - start_offset: 0xC0E0 - end_offset: 0x11CE0 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/pal-1.1/config.yml b/baseroms/pal-1.1/config.yml index 4001c620514..a62af8e9937 100644 --- a/baseroms/pal-1.1/config.yml +++ b/baseroms/pal-1.1/config.yml @@ -73,10 +73,6 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F60 end_offset: 0xE99E8 -- name: n64dd/error_textures - xml_path: assets/xml/n64dd/error_textures.xml - start_offset: 0xC0E0 - end_offset: 0x11CE0 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/data/n64dd.bss.s b/data/n64dd.bss.s new file mode 100644 index 00000000000..9fe5cdf89a1 --- /dev/null +++ b/data/n64dd.bss.s @@ -0,0 +1,2 @@ +.bss +.space 0xDC80 diff --git a/docker-compose.yml b/docker-compose.yml index 8f0a30b137f..a6cdbbdf8e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,11 @@ +version: "3" services: oot: - build: - context: . - dockerfile: Dockerfile volumes: - - ./:/oot + - oot-sync:/oot:nocopy + image: "oot:latest" tty: true - stdin_open: true + +volumes: + oot-sync: + external: true diff --git a/docs/BUILDING_MACOS.md b/docs/BUILDING_BINUTILS_MACOS.md similarity index 57% rename from docs/BUILDING_MACOS.md rename to docs/BUILDING_BINUTILS_MACOS.md index f6bb2391bf3..b72db420a67 100644 --- a/docs/BUILDING_MACOS.md +++ b/docs/BUILDING_BINUTILS_MACOS.md @@ -1,33 +1,6 @@ -# Building on macOS +# Building mips-linux-binutils on MacOS -**N.B.** C++17 is required to build the asset processing program that we use (ZAPD), so check your OS version can support this before proceeding. - - -## 1. Dependencies - -For macOS, use Homebrew to install the following dependencies: - -* coreutils -* make -* python3 -* bash -* clang-format -* libxml2 -* libiconv - -You can install them with the following commands: - -```bash -brew update -brew install coreutils make python3 bash clang-format libxml2 libiconv -``` - -(The repository expects Homebrew-installed programs to be either linked correctly in `$PATH` etc. or in their default locations.) - - -## 2. Building mips-linux-binutils - -The following instructions are written for MacOS users but should apply to any Unix-like system, with maybe some modifications at the end regarding the bash_profile. +The following instructions are written for MacOS users but should apply to any unix-like system, with maybe some modifications at the end regarding the bash_profile. Create destination dir for binutils ```bash @@ -46,7 +19,7 @@ curl -O https://ftp.gnu.org/gnu/binutils/binutils-2.46.0.tar.xz tar xjf binutils-2.46.0.tar.xz ``` -Create and enter a build directory +Create and enter build dir ```bash mkdir build-binutils cd build-binutils @@ -63,27 +36,17 @@ make -j$(nproc) sudo make install ``` -Edit your `~/.bash_profile`/`~/.zprofile` (or whichever shell you use) to add the new binutils binaries to the system PATH +Edit your ~/.bash_profile to add the new binutils binaries to the system PATH ```bash echo 'export PATH="$PATH:/opt/cross/bin"' >> ~/.bash_profile ``` -Reload `~/.bash_profile` (or just launch a new terminal tab) +Reload ~/.bash_profile (or just launch a new terminal tab) ```bash source ~/.bash_profile ``` -If this worked, you can now delete the temporary directory `~/binutils-tmp`. - - -## 3. Final note - -Apple's version of `make` is very out-of-date, so you should use the brew-installed `gmake` in place of `make` in this repo from now on. - -You should now be able to continue from [step 2](../README.md#2-clone-the-repository) of the Linux instructions. - - -## 4. Building GCC (optional) +## Building GCC (optional) If you'd like to compile with GCC instead of IDO (e.g. for modding), you can build it from source similarly to how we built binutils: diff --git a/docs/BUILDING_DOCKER.md b/docs/BUILDING_DOCKER.md deleted file mode 100644 index 60f54c1686a..00000000000 --- a/docs/BUILDING_DOCKER.md +++ /dev/null @@ -1,27 +0,0 @@ -# Building using Docker - -## 1. Setup requirements - -To use Docker, you'll need either Docker Desktop or Docker Toolbox installed and setup based on your system. - -On Ubuntu, Docker and required tools can be installed with: `sudo apt install docker.io docker-compose docker-buildx` - -You'll also need to prepare a local version of the project with a copied base ROM (see steps [2](../README.md#2-clone-the-repository) and [3](../README.md#3-prepare-a-base-rom) of the Linux instructions). - -## 2. Create and start the Docker image build - -From the root of your local project, run the following command: - -```bash -docker-compose up --build -``` - -This should immediately begin steps [4](../README.md#4-setup-the-rom-and-build-process) and [5](../README.md#5-build-the-rom) within the Docker container. - -## 3. Shell into the 'oot' container - -To exec into the oot Docker image at any time, run the following command either during or after the build: - -```bash -docker-compose exec oot bash -``` diff --git a/docs/vscode.md b/docs/vscode.md deleted file mode 100644 index 4262d0beaef..00000000000 --- a/docs/vscode.md +++ /dev/null @@ -1,94 +0,0 @@ -# VSCode - -A lot of people on this project use VSCode as their coding environment. - -## Extensions - -There are a number of useful extensions available to make work more efficient: - -- C/C++ IntelliSense -- Clang-Format -- HexInspector (hover on numbers for float and other info) -- NumberMonger (convert hex to decimal and vice versa) -- Better MIPS Support - - - - -## Useful keyboard shortcuts - -- Ctrl + Alt + Up/Down (on Windows, on Linux it's Ctrl + Shift + Up/Down or Shift + Alt + Up/Down) gives multicursors across consecutive lines. If you want several cursors in a more diverse arrangement, middle clicking works, at least on Windows. -- Alt + Up/Down moves lines up/down. -- Shift + Alt + Up/Down (Linux: Ctrl + Shift + Alt + Up/Down) copies lines up/down. -- Ctrl + P offers a box to use to search for and open files. -- Ctrl + Shift + P offers a box for commands like editing settings or reloading the window. - -- Make use of VSCode's search/search-and-replace features. - - Ctrl + Click goes to a definition. - - Ctrl + F for search in current file - - Ctrl + H for replace in current file - - Ctrl + Shift + F for search in all files - - Ctrl + Shift + H for replace in all files - - F2 for Rename symbol - -Many of VS Code's other shortcuts can be found on [its getting started page](https://code.visualstudio.com/docs/getstarted/keybindings), which also has links to OS-specific PDFs. - -## C/C++ configuration - -You can create a `.vscode/c_cpp_properties.json` file with `C/C++: Edit Configurations (JSON)` in the command box to customise how IntelliSense reads the repository (stuff like where to look for includes, flags, compiler defines, etc.) to make VSCode's IntelliSense plugin better able to understand the structure of the repository. - -Below is a good default one to use for this project's repository, for the oot-gc-eu-mq-dbg version specifically. - -A more complete `c_cpp_properties.json` with configurations for all supported versions [can be found here](c_cpp_properties.json). - -```jsonc -{ - "configurations": [ - { - "name": "oot-gc-eu-mq-dbg", - "compilerArgs": [ - "-m32" // Removes integer truncation warnings with gbi macros - ], - "includePath": [ // Matches makefile's includes - "include", - "include/libc", - "src", - "build/gc-eu-mq-dbg", - ".", - "extracted/gc-eu-mq-dbg" - ], - "defines": [ - "_LANGUAGE_C", // For gbi.h - // Version-specific - "OOT_VERSION=GC_EU_MQ_DBG", - "OOT_REGION=REGION_EU", - "PLATFORM_N64=0", - "PLATFORM_GC=1", - "DEBUG_FEATURES=1", - "F3DEX_GBI_2", - "F3DEX_GBI_PL", - "GBI_DOWHILE", - "GBI_DEBUG" - ], - "cStandard": "gnu89", // C89 + some GNU extensions from C99 like C++ comments - } - ], - "version": 4 -} -``` - -## Settings - -Add the following to (or create) the `.vscode/settings.json` file for VSCode to search the gitignored asset files by default: - -```jsonc -{ - "search.useIgnoreFiles": false, - "search.exclude": { - "**/.git": true, - "baseroms/**": true, - "build/**": true, - "expected/**": true, - }, -} -``` diff --git a/include/actor.h b/include/actor.h index 985f32abb33..e7efa6f168b 100644 --- a/include/actor.h +++ b/include/actor.h @@ -780,15 +780,15 @@ void Gfx_DrawDListXlu(struct PlayState* play, Gfx* dlist); Actor* Actor_FindNearby(struct PlayState* play, Actor* refActor, s16 actorId, u8 actorCategory, f32 range); s32 func_800354B4(struct PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5); -void func_8003555C(struct PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel); -void func_800355B8(struct PlayState* play, Vec3f* pos); +void func_8003555C(struct PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3); +void func_800355B8(struct PlayState* play, Vec3f* arg1); u8 func_800355E4(struct PlayState* play, Collider* collider); u8 Actor_ApplyDamage(Actor* actor); void Actor_SetDropFlag(Actor* actor, ColliderElement* elem, s32 freezeFlag); void Actor_SetDropFlagJntSph(Actor* actor, ColliderJntSph* jntSph, s32 freezeFlag); void func_80035844(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3); -Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, - struct PlayState* play, s16 params, Gfx* dList); +struct EnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, + struct PlayState* play, s16 params, Gfx* dList); void func_800359B8(Actor* actor, s16 arg1, Vec3s* arg2); s32 Flags_GetEventChkInf(s32 flag); void Flags_SetEventChkInf(s32 flag); diff --git a/include/animation.h b/include/animation.h index fdf14843b94..cd7b4794ffe 100644 --- a/include/animation.h +++ b/include/animation.h @@ -430,4 +430,59 @@ void LinkAnimation_BlendToMorph(struct PlayState* play, SkelAnime* skelAnime, Li s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); +// fcurve_skelanime structs +typedef struct TransformData { + /* 0x0000 */ u16 unk_00; // appears to be flags + /* 0x0002 */ s16 unk_02; + /* 0x0004 */ s16 unk_04; + /* 0x0006 */ s16 unk_06; + /* 0x0008 */ f32 unk_08; +} TransformData; // size = 0xC + +typedef struct TransformUpdateIndex { + /* 0x0000 */ u8* refIndex; + /* 0x0004 */ TransformData* transformData; + /* 0x0008 */ s16* copyValues; + /* 0x000C */ s16 unk_0C; + /* 0x000E */ s16 unk_0E; +} TransformUpdateIndex; // size = 0x10 + +typedef struct SkelCurveLimb { + /* 0x0000 */ u8 firstChildIdx; + /* 0x0001 */ u8 nextLimbIdx; + /* 0x0004 */ Gfx* dList[2]; +} SkelCurveLimb; // size = 0xC + +typedef struct SkelCurveLimbList { + /* 0x0000 */ SkelCurveLimb** limbs; + /* 0x0004 */ u8 limbCount; +} SkelCurveLimbList; // size = 0x8 + +typedef struct LimbTransform { + /* 0x0000 */ Vec3s scale; + /* 0x0006 */ Vec3s rot; + /* 0x000C */ Vec3s pos; +} LimbTransform; // size = 0x12 + +typedef struct SkelAnimeCurve { + /* 0x0000 */ u8 limbCount; + /* 0x0004 */ SkelCurveLimb** limbList; + /* 0x0008 */ TransformUpdateIndex* transUpdIdx; + /* 0x000C */ f32 unk_0C; // seems to be unused + /* 0x0010 */ f32 animFinalFrame; + /* 0x0014 */ f32 animSpeed; + /* 0x0018 */ f32 animCurFrame; + /* 0x001C */ LimbTransform* transforms; +} SkelAnimeCurve; // size = 0x20 + +typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); +typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); + +// "reverse" compatibility typedefs +// These map Elliptic's "new" names, as used by ZAPD, +// to "old" names, as kept in this branch after dropping Elliptic's commits. +typedef TransformData CurveInterpKnot; +typedef TransformUpdateIndex CurveAnimationHeader; +typedef SkelCurveLimbList CurveSkeletonHeader; + #endif diff --git a/include/audio.h b/include/audio.h index 412a5ecdd63..4daa86a1b60 100644 --- a/include/audio.h +++ b/include/audio.h @@ -1168,7 +1168,7 @@ void func_800F436C(Vec3f* pos, u16 sfxId, f32 arg2); void func_800F4414(Vec3f* pos, u16 sfxId, f32); void func_800F44EC(s8 arg0, s8 arg1); void func_800F4524(Vec3f* pos, u16 sfxId, s8 arg2); -void Audio_PlaySwordChargeSfx(Vec3f* pos, u8 level); +void Audio_PlaySwordChargeSfx(Vec3f*, u8); void Audio_PlaySfxRiver(Vec3f* pos, f32 freqScale); void Audio_PlaySfxWaterfall(Vec3f* pos, f32 freqScale); void Audio_SetBgmVolumeOffDuringFanfare(void); diff --git a/include/bgcheck.h b/include/bgcheck.h index 13b85705822..6712fcbcf1b 100644 --- a/include/bgcheck.h +++ b/include/bgcheck.h @@ -473,9 +473,8 @@ s32 func_800427B4(CollisionPoly* polyA, CollisionPoly* polyB, Vec3f* pointA, Vec void BgCheck_DrawDynaCollision(struct PlayState*, CollisionContext*); void BgCheck_DrawStaticCollision(struct PlayState*, CollisionContext*); #endif - void func_80043334(CollisionContext* colCtx, struct Actor* actor, s32 bgId); -s32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, struct Actor* carriedActor); +s32 DynaPolyActor_TransformActorOnTop(CollisionContext* colCtx, s32 bgId, struct Actor* actor); void DynaPolyActor_Init(struct DynaPolyActor* dynaActor, s32 transformFlags); void DynaPolyActor_UnsetAllInteractFlags(struct DynaPolyActor* dynaActor); void DynaPolyActor_SetActorOnTop(struct DynaPolyActor* dynaActor); diff --git a/include/code_800D71F0.h b/include/code_800D71F0.h new file mode 100644 index 00000000000..2e6977f8f9b --- /dev/null +++ b/include/code_800D71F0.h @@ -0,0 +1,8 @@ +#ifndef CODE_800D71F0_H +#define CODE_800D71F0_H + +#include "ultra64/ultratypes.h" + +s32 func_800D71F0(s32 character); + +#endif diff --git a/include/curve.h b/include/curve.h deleted file mode 100644 index 8779b04b47a..00000000000 --- a/include/curve.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef CURVE_H -#define CURVE_H - -#include "ultra64.h" - -struct PlayState; -struct Actor; - -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 - /* 0x6 */ s16 rightGradient; // right derivative at the point - /* 0x8 */ f32 ordinate; // output value -} CurveInterpKnot; // size = 0xC - -typedef struct CurveAnimationHeader { - /* 0x0 */ u8* knotCounts; - /* 0x4 */ CurveInterpKnot* interpolationData; - /* 0x8 */ s16* constantData; - /* 0xC */ s16 unk_0C; // Set but not used, always 1 in objects - /* 0xE */ s16 frameCount; // Not used, inferred from use in objects -} CurveAnimationHeader; // size = 0x10 - -typedef struct SkelCurveLimb { - /* 0x0 */ u8 child; - /* 0x1 */ u8 sibling; - /* 0x4 */ Gfx* dList[2]; -} SkelCurveLimb; // size = 0xC - -typedef struct CurveSkeletonHeader { - /* 0x0 */ SkelCurveLimb** limbs; - /* 0x4 */ u8 limbCount; -} CurveSkeletonHeader; // size = 0x8 - -typedef struct SkelCurve { - /* 0x00 */ u8 limbCount; - /* 0x04 */ SkelCurveLimb** skeleton; - /* 0x08 */ CurveAnimationHeader* animation; - /* 0x0C */ f32 unk_0C; // set but not used - /* 0x10 */ f32 endFrame; - /* 0x14 */ f32 playSpeed; - /* 0x18 */ f32 curFrame; - /* 0x1C */ s16 (*jointTable)[9]; -} SkelCurve; // size = 0x20 - -typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelCurve* skelCuve, s32 limbIndex, void* thisx); -typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelCurve* skelCuve, s32 limbIndex, void* thisx); - -f32 Curve_Interpolate(f32 x, CurveInterpKnot* knots, s32 knotCount); - -void SkelCurve_Clear(SkelCurve* skelCurve); -s32 SkelCurve_Init(struct PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, - CurveAnimationHeader* animation); -void SkelCurve_Destroy(struct PlayState* play, SkelCurve* skelCurve); -void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* animation, f32 arg2, f32 endFrame, f32 curFrame, - f32 playSpeed); -s32 SkelCurve_Update(struct PlayState* play, SkelCurve* skelCurve); -void SkelCurve_Draw(struct Actor* actor, struct PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, - PostCurveLimbDraw postLimbDraw, s32 lod, void* data); - -#endif diff --git a/include/effect.h b/include/effect.h index 060b6cd0905..1eb046a736c 100644 --- a/include/effect.h +++ b/include/effect.h @@ -101,10 +101,10 @@ typedef struct EffectBlure { /* 0x188 */ u16 flags; /* 0x18A */ s16 addAngleChange; /* 0x18C */ s16 addAngle; - /* 0x18E */ u8 p1StartColor[4]; - /* 0x192 */ u8 p2StartColor[4]; - /* 0x196 */ u8 p1EndColor[4]; - /* 0x19A */ u8 p2EndColor[4]; + /* 0x18E */ Color_RGBA8 p1StartColor; + /* 0x192 */ Color_RGBA8 p2StartColor; + /* 0x196 */ Color_RGBA8 p1EndColor; + /* 0x19A */ Color_RGBA8 p2EndColor; /* 0x19E */ u8 numElements; // "now_edge_num" /* 0x19F */ u8 elemDuration; /* 0x1A0 */ u8 unkFlag; diff --git a/include/functions.h b/include/functions.h new file mode 100644 index 00000000000..8d64dbb4004 --- /dev/null +++ b/include/functions.h @@ -0,0 +1,31 @@ +#ifndef FUNCTIONS_H +#define FUNCTIONS_H + +#include "z64.h" +#include "animation.h" +#include "play_state.h" + +void* MemCopy(void* dest, void* src, s32 size); + +f32 func_8006C5A8(f32 target, TransformData* transData, s32 refIdx); +void SkelCurve_Clear(SkelAnimeCurve* skelCurve); +s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, + TransformUpdateIndex* transUpdIdx); +void SkelCurve_Destroy(PlayState* play, SkelAnimeCurve* skelCurve); +void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame, + f32 animCurFrame, f32 animSpeed); +s32 SkelCurve_Update(PlayState* play, SkelAnimeCurve* skelCurve); +void SkelCurve_Draw(Actor* actor, PlayState* play, SkelAnimeCurve* skelCurve, + OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data); + +void func_800ACE70(struct_801664F0* this); +void func_800ACE90(struct_801664F0* this); +void func_800ACE98(struct_801664F0* this, Gfx** gfxp); +void VisMono_Init(VisMono* this); +void VisMono_Destroy(VisMono* this); +void VisMono_Draw(VisMono* this, Gfx** gfxp); +void func_800AD920(struct_80166500* this); +void func_800AD950(struct_80166500* this); +void func_800AD958(struct_80166500* this, Gfx** gfxp); + +#endif diff --git a/include/gfx.h b/include/gfx.h index 6e1fcabe172..c5bbb89eb24 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -64,7 +64,7 @@ Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far); -Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height); +Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height); Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y); Gfx* Gfx_TexScroll(GraphicsContext* gfxCtx, u32 x, u32 y, s32 width, s32 height); Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2, u32 x2, diff --git a/include/gfx_setupdl.h b/include/gfx_setupdl.h index 1ba9ba06f51..73ca7425c56 100644 --- a/include/gfx_setupdl.h +++ b/include/gfx_setupdl.h @@ -96,15 +96,15 @@ Gfx* Gfx_SetupDL_64(Gfx* gfx); Gfx* Gfx_SetupDL_34(Gfx* gfx); void Gfx_SetupDL_44Xlu(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_36Opa(struct GraphicsContext* gfxCtx); -void Gfx_SetupDL_28Opa(struct GraphicsContext* gfxCtx); Gfx* Gfx_SetupDL_28(Gfx* gfx); +void Gfx_SetupDL_28Opa(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_38Xlu(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_4Xlu(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_37Opa(struct GraphicsContext* gfxCtx); Gfx* Gfx_SetupDL_39(Gfx* gfx); void Gfx_SetupDL_39Opa(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_39Overlay(struct GraphicsContext* gfxCtx); -void Gfx_SetupDL_39Ptr(Gfx** gfxP); +void Gfx_SetupDL_39Ptr(Gfx** gfxp); void Gfx_SetupDL_40Opa(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_41Opa(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_47Xlu(struct GraphicsContext* gfxCtx); @@ -117,6 +117,6 @@ void Gfx_SetupDL_27Xlu(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_60NoCDXlu(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_61Xlu(struct GraphicsContext* gfxCtx); void Gfx_SetupDL_56Opa(struct GraphicsContext* gfxCtx); -void Gfx_SetupDL_56Ptr(Gfx** gfxP); +void Gfx_SetupDL_56Ptr(Gfx** gfxp); #endif diff --git a/include/gfxalloc.h b/include/gfxalloc.h index 158a2a9f589..06e8a80be18 100644 --- a/include/gfxalloc.h +++ b/include/gfxalloc.h @@ -5,6 +5,6 @@ Gfx* Gfx_Open(Gfx* gfx); Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); -void* Gfx_Alloc(Gfx** gfxP, u32 size); +void* Gfx_Alloc(Gfx** gfx, u32 size); #endif diff --git a/include/kanread.h b/include/kanread.h deleted file mode 100644 index bea4831c81b..00000000000 --- a/include/kanread.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef KANREAD_H -#define KANREAD_H - -#include "ultra64/ultratypes.h" - -s32 Kanji_OffsetFromShiftJIS(s32 sjis); - -#endif diff --git a/include/libc/string.h b/include/libc/string.h index 3e2e6be592a..fa4ababe87f 100644 --- a/include/libc/string.h +++ b/include/libc/string.h @@ -7,7 +7,10 @@ char* strchr(const char*, int); size_t strlen(const char*); void* memcpy(void*, const void*, size_t); -void* memmove(void* dest, const void* src, size_t len); -void* memset(void* dest, int val, size_t len); +#ifdef BBPLAYER +#define func_80106860 memset +#endif +void* func_80106860(void* ptr, int val, size_t size); +void* func_801068B0(void* dst, void* src, size_t size); #endif diff --git a/include/n64dd.h b/include/n64dd.h index e5b1b7aa311..181366013d3 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -2,7 +2,6 @@ #define N64DD_H #include "ultra64.h" -#include "ultra64/leo.h" #include "pause.h" #include "scene.h" #include "map_mark.h" @@ -68,35 +67,6 @@ typedef struct n64ddStruct_80121220 { s32 (*unk_78)(struct PlayState*, void*, void*); } n64ddStruct_80121220; // size = ? -typedef struct struct_801E0D18 { - /* 0x00 */ LEOCmd unk_00; - /* 0x1C */ OSMesgQueue unk_1C; - /* 0x38 */ LEODiskID diskId; - /* 0x58 */ UNK_TYPE unk_58; - /* 0x5C */ UNK_TYPE unk_5C; - /* 0x60 */ u32 unk_60; - /* 0x64 */ u8 unk_64; - /* 0x65 */ u8 unk_65; - /* 0x66 */ u8 unk_66; - /* 0x68 */ s32 unk_68; - /* 0x6C */ s32 unk_6C; -} struct_801E0D18; // size = 0x70 - -typedef struct struct_801D9D50 { - /* 0x00 */ u8 unk_00; // command enum - /* 0x04 */ s32 unk_04; - /* 0x08 */ u8 unk_08; - /* 0x0C */ void (*unk_0C)(void*, void*, void*); - /* 0x10 */ s32 unk_10; - /* 0x14 */ void (*unk_14)(void*, uintptr_t, size_t); - /* 0x18 */ void* unk_18; - /* 0x1C */ void* unk_1C; // either OSMesgQueue* (command 0) or integer LBA (commands 2 and 3) - /* 0x20 */ void* unk_20; // either OSMesgQueue* (command 0) or integer byte size (commands 3 and 4) - /* 0x24 */ OSId unk_24; - /* 0x28 */ void* unk_28; - /* 0x2C */ OSPri unk_2C; -} struct_801D9D50; // size = 0x30 - void func_800AD410(void); void func_800AD488(void); n64ddStruct_80121220* func_800AD4C0(n64ddStruct_80121220* arg0); @@ -111,39 +81,10 @@ s32 func_801C70FC(void); void func_801C7268(void); s32 func_801C7658(void); s32 func_801C7818(void); -void func_801C7C1C(void* dest, s32 offset, s32 size); +void func_801C7C1C(void* arg0, s32 arg1, s32 arg2); void func_801C7E78(void); void n64dd_SetDiskVersion(s32 arg0); -s32 func_801C8000(struct_801D9D50* arg0); -s32 func_801C81C4(void); -void func_801C81EC(struct_801E0D18* arg0); -void func_801C8298(struct_801E0D18* arg0); -void func_801C82E0(struct_801E0D18* arg0); -void func_801C832C(struct_801E0D18* arg0); -void func_801C83A0(struct_801E0D18* arg0); -void func_801C8414(struct_801E0D18* arg0); -s32 func_801C873C(struct_801E0D18* arg0); - -void func_801C8AA8(void); -s32 func_801C91E0(struct_801E0D18*); -s32 func_801C9260(struct_801E0D18*); -s32 func_801C9334(struct_801E0D18*); -s32 func_801C93C4(struct_801E0D18*); - -void func_801C94F8(u8* arg0, u16 arg1); -void func_801C9A10(u8* arg0, s32 arg1, u8* str); -void func_801C9B50(s32 arg0, void (*arg1)(void*, uintptr_t, size_t)); - -u8* func_801C9E28(s32 errorNum); -u8* func_801C9EC0(void); -u8* func_801C9F90(s32 errorNum); -u8* func_801C9FFC(void); -u8* func_801CA030(s32 errorNum); -u8* func_801CA070(void); - -void func_801CA1F0(void* charTexBuf, s32 posX, s32 posY, s32 dx, s32 dy, s32 cy, void* frameBuf, s32 screenWidth); - extern n64ddStruct_800FEE70_pointers D_800FEE70; extern n64ddStruct_80121220* B_80121220; @@ -153,25 +94,4 @@ extern u8 D_80121212; extern vu8 D_80121213; extern vu8 D_80121214; -extern s32 (*D_801D2E54)(struct_801E0D18*); - -extern u8 gN64DDDiskReadTemporaryBuffer[]; - -extern s32 D_801D2E90; -extern OSMesgQueue* B_801E0D10[2]; - -extern s32 D_801D2EA0; -extern s32 D_801D2EA8; -extern s32 B_801E0F60; -extern s32 B_801E0F64; -extern void (*D_801D2EB4)(void*, void*, void*); - -// Error messages -extern const char* gN64DDLocalizedErrorNumberHeaders[]; // "Error Number " array -extern const char* D_801D2EE0[2][8][4]; // Array of error message strings - -// Error textures -extern u64 gN64DDError41Texs[2][0x600 / sizeof(u64)]; -extern u64 gN64DDPleaseReadManualTexs[2][0x2800 / sizeof(u64)]; - #endif diff --git a/include/n64dd_internal.h b/include/n64dd_internal.h new file mode 100644 index 00000000000..c7b1c8cab89 --- /dev/null +++ b/include/n64dd_internal.h @@ -0,0 +1,99 @@ +#ifndef N64DD_INTERNAL_H +#define N64DD_INTERNAL_H + +#include "ultra64.h" +#include "n64dd.h" +#include "stack.h" +#include "irqmgr.h" + +extern IrqMgr gIrqMgr; // from main.c + +typedef struct struct_801DA5D0 { + /* 0x00 */ u8 unk0; + /* 0x01 */ char pad1[3]; + /* 0x04 */ s32 unk4; + /* 0x08 */ s8 unk8; + /* 0x09 */ char pad9[3]; + /* 0x0C */ void (*unkC)(s32, s32, s32); + /* 0x10 */ s32 unk10; + /* 0x14 */ void (*unk14)(void*, uintptr_t, size_t); + /* 0x18 */ void* unk18; + union { // different substruct based on struct_801DA5D0.unk0 ? see func_801C8860 + struct { + /* 0x1C */ OSMesgQueue* unk1C; + /* 0x20 */ OSMesgQueue* unk20; + /* 0x24 */ s32 unk24; + /* 0x28 */ void* unk28; + /* 0x2C */ s32 unk2C; + } unk1C_1; + struct { + /* 0x1C */ s32 unk1C; + /* 0x20 */ s32 unk20; + } unk1C_3_4; + }; +} struct_801DA5D0; // size >= 0x30 + +typedef struct struct_801E1598 { + /* 0x00 */ LEOCmd unk0; + /* 0x1C */ OSMesgQueue unk1C; + /* 0x34 */ char pad34[4]; + /* 0x38 */ LEODiskID unk38; + /* 0x58 */ void* unk58; + /* 0x5C */ s32 unk5C; + /* 0x60 */ s32 unk60; + /* 0x64 */ s8 unk64; + /* 0x65 */ s8 unk65; + /* 0x66 */ u8 unk66; + /* 0x67 */ char pad67[1]; + /* 0x68 */ s32 unk68; // OSMesg + /* 0x6C */ s32 unk6C; +} struct_801E1598; // size >= 0x70 + +s32 func_801C8860(struct_801DA5D0*); +s32 func_801C8A24(void); +void func_801CAA60(u8*, UNK_TYPE, UNK_TYPE, UNK_TYPE, s32, s32, s16*, s32); +void func_801C9318(void); +void func_801CA3C0(s32, void (*)(void*, uintptr_t, size_t)); +s32 func_801C8F9C(struct_801E1598*); + +typedef struct struct_801DA5C8 { + /* 0x000 */ s32 unk0; + /* 0x004 */ s32 unk4; + /* 0x008 */ void* unk8; + /* 0x00C */ void* unkC; + /* 0x010 */ n64ddStruct_80121220* unk10; + /* 0x014 */ char pad14[0x104]; +} struct_801DA5C8; // size = 0x118 +extern s32 D_801D3728; +extern s32 D_801E17E0; +extern s32 D_801E17E4; +typedef struct struct_801C79DC { + /* 0x00 */ OSMesg unk0[30]; + /* 0x78 */ OSMesgQueue unk78; + /* 0x90 */ IrqMgrClient unk90; + /* 0x98 */ IrqMgr* unk98; +} struct_801C79DC; // size >= 0x9C +extern s32 D_801D3720; +typedef struct struct_801E1590 { + /* 0x0 */ OSMesgQueue* unk0; + /* 0x4 */ OSMesgQueue* unk4; +} struct_801E1590; // size >= 8 +extern void (*D_801D3734)(UNK_PTR, UNK_PTR, UNK_PTR); +extern s32 D_801D3710; +void func_801C8B40(struct_801E1598*); +void func_801C8AF8(struct_801E1598*); +UNK_PTR func_801CA800(s32); +UNK_PTR func_801CA698(s32); +UNK_PTR func_801CA86C(void); +UNK_PTR func_801CA8A0(s32); +UNK_PTR func_801CA8E0(void); +UNK_PTR func_801CA730(void); +extern s32 (*D_801D36D4)(struct_801E1598*); +s32 func_801C9BA4(struct_801E1598*); +void func_801CA280(UNK_PTR, UNK_TYPE, const char*); +extern const char* gN64DDLocalizedErrorNumberHeaders[2]; +void func_801C9D68(char*, u16); + +extern u8 gN64DDDiskReadTemporaryBuffer[]; + +#endif diff --git a/include/player.h b/include/player.h index 63c9d25b658..94d87c0185c 100644 --- a/include/player.h +++ b/include/player.h @@ -706,7 +706,7 @@ typedef struct WeaponInfo { #define LEDGE_DIST_MAX 399.96002f #define PLAYER_STATE1_0 (1 << 0) -#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1) // Bottle is swung; Bottle is active and can catch things +#define PLAYER_STATE1_1 (1 << 1) // Bottle is swung; Bottle is active and can catch things #define PLAYER_STATE1_2 (1 << 2) #define PLAYER_STATE1_3 (1 << 3) #define PLAYER_STATE1_HOSTILE_LOCK_ON (1 << 4) // Currently locked onto a hostile actor. Triggers a "battle" variant of many actions. @@ -916,7 +916,7 @@ typedef struct Player { s8 startedAnim; // Player_Action_TimeTravelEnd: Started playing the animation that was previously frozen s8 facingUpSlope; // Player_Action_SlideOnSlope: Facing uphill when sliding on a slope s8 isLakeHyliaCs; // Player_Action_BlueWarpArrive: In Lake Hylia CS after Water Temple. Floating down is delayed until a specific point in the cutscene. - s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle + s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `D_80854A04`, corresponds to actor caught in a bottle } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running /* 0x0850 */ union { @@ -954,7 +954,7 @@ typedef struct Player { /* 0x0890 */ u8 unk_890; /* 0x0891 */ u8 bodyShockTimer; /* 0x0892 */ u8 unk_892; - /* 0x0893 */ u8 hoverBootsTimer; + /* 0x0893 */ u8 unk_893; /* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling /* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down) /* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope) diff --git a/include/prerender.h b/include/prerender.h index 0674fac020a..9aedbb81fce 100644 --- a/include/prerender.h +++ b/include/prerender.h @@ -30,15 +30,15 @@ void PreRender_SetValuesSave(PreRender* this, u32 width, u32 height, void* fbuf, void PreRender_Init(PreRender* this); void PreRender_SetValues(PreRender* this, u32 width, u32 height, void* fbuf, void* zbuf); void PreRender_Destroy(PreRender* this); -void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); -void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave); -void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP); -void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP); -void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP); -void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP); -void func_800C213C(PreRender* this, Gfx** gfxP); -void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP); -void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP); +void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a); +void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave); +void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp); +void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp); +void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp); +void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp); +void func_800C213C(PreRender* this, Gfx** gfxp); +void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp); +void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp); void PreRender_ApplyFilters(PreRender* this); #endif diff --git a/include/ultra64.h b/include/ultra64.h index c7607ac9218..8309b5290a5 100644 --- a/include/ultra64.h +++ b/include/ultra64.h @@ -1,6 +1,10 @@ #ifndef ULTRA64_H #define ULTRA64_H +#define BADCASTP (void*) +#define BADCASTI (u32) +#define STATIC + #include "assert.h" #include "math.h" #include "stdarg.h" @@ -40,6 +44,8 @@ #include "ultra64/ucode.h" #include "ultra64/version.h" +#include "ultra64/leo.h" + union uObjBg; void __osPiCreateAccessQueue(void); diff --git a/include/ultra64/leo.h b/include/ultra64/leo.h index 3bc8a1dd6e4..09055ea84d1 100644 --- a/include/ultra64/leo.h +++ b/include/ultra64/leo.h @@ -1,146 +1,184 @@ -#ifndef ULTRA64_LEO_H -#define ULTRA64_LEO_H + +/*---------------------------------------------------------------------* + Copyright (C) 1998 Nintendo. + + $RCSfile: leo.h,v $ + $Revision: 1.29 $ + $Date: 1998/12/21 07:30:15 $ + *---------------------------------------------------------------------*/ + +#ifndef _LEO_H_ +#define _LEO_H_ #ifdef _LANGUAGE_C_PLUS_PLUS extern "C" { #endif -#include "pi.h" #include "leoappli.h" #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) -typedef u32 LEOError; - -typedef u8 LEOSpdlMode; - -typedef u8 LEOStatus; - -typedef struct LEOVersion { - /* 0x0 */ u8 driver; // version of sw - /* 0x1 */ u8 drive; // version of hw - /* 0x2 */ u8 deviceType; // dev type, always 00 - /* 0x3 */ u8 nDevices; // # of devices, always 01 -} LEOVersion; // size = 0x4 - -typedef struct LEOCapacity { - /* 0x0 */ u32 startLBA; - /* 0x4 */ u32 endLBA; - /* 0x8 */ u32 nbytes; -} LEOCapacity; // size = 0xC - -typedef struct LEODiskTime { - /* 0x0 */ u8 pad; - /* 0x1 */ u8 yearhi; - /* 0x2 */ u8 yearlo; - /* 0x3 */ u8 month; - /* 0x4 */ u8 day; - /* 0x5 */ u8 hour; - /* 0x6 */ u8 minute; - /* 0x7 */ u8 second; -} LEODiskTime; // size = 0x8 - -typedef struct LEOSerialNum { - /* 0x0 */ u64 lineNumber; - /* 0x8 */ LEODiskTime time; -} LEOSerialNum; // size = 0x10 - -typedef struct LEODiskID { - /* 0x0 */ u8 gameName[4]; - /* 0x4 */ u8 gameVersion; - /* 0x5 */ u8 diskNumber; - /* 0x6 */ u8 ramUsage; - /* 0x7 */ u8 diskUsage; - /* 0x8 */ LEOSerialNum serialNumber; - /* 0x18 */ u8 company[2]; - /* 0x1A */ u8 freeArea[6]; -} LEODiskID; // size = 0x20 - -// Not attempting to number this struct until required since it's scary -typedef struct LEOCmd { - /* 0x00 */ LEOCmdHeader header; - union { - struct { - /* 0x0C */ u32 lba; - /* 0x10 */ u32 transferBlks; - /* 0x14 */ void* buffPtr; - /* 0x18 */ u32 rwBytes; +/************************************************************************** + * + * Type definitions + * + */ +typedef u32 LEOError; + +typedef u8 LEOSpdlMode; + +typedef u8 LEOStatus; + +typedef struct +{ + u8 drive; /* version of hw */ + u8 driver; /* version of sw */ + u8 deviceType; /* dev type, always 00 */ + u8 ndevices; /* # of devices, always 01 */ +} LEOVersion; + +typedef struct +{ + u32 startLBA; + u32 endLBA; + u32 nbytes; +} LEOCapacity; + +typedef struct +{ + u8 pad; + u8 yearhi; + u8 yearlo; + u8 month; + u8 day; + u8 hour; + u8 minute; + u8 second; +} LEODiskTime; + +typedef struct +{ + u64 lineNumber; + LEODiskTime time; +} LEOSerialNum; + +typedef struct +{ + u8 gameName[4]; + u8 gameVersion; + u8 diskNumber; + u8 ramUsage; + u8 diskUsage; + LEOSerialNum serialNumber; + u8 company[2]; + u8 freeArea[6]; +} LEODiskID; + +typedef struct +{ + LEOCmdHeader header; + union + { + struct + { + u32 lba; + u32 xfer_blks; + void *buff_ptr; + u32 rw_bytes; #ifdef _LONGCMD - /* 0x1C */ u32 size; + u32 size; #endif - } readWrite; - struct { - /* 0x0C */ u32 lba; - } seek; - struct { - /* 0x0C */ void* bufferPointer; - } readdiskid; - /* 0x0C */ LEODiskTime time; - struct { - /* 0x0C */ u8 reserve1; - /* 0x0D */ u8 reserve2; - /* 0x0E */ u8 standbyTime; - /* 0x0F */ u8 sleepTime; - /* 0x10 */ u32 reserve3; - } modeSelect; - } data; -} LEOCmd; // size = 0x1C - - -#define _nbytes readwrite.rwBytes -#define _result header.status - -#endif // defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) - - -#define LEO_SW_VERSION 6 // This will be returned by LeoInquiry command + } readwrite; + struct + { + u32 lba; + } seek; + struct + { + void *buffer_pointer; + } readdiskid; + LEODiskTime time; + struct + { + u8 reserve1; + u8 reserve2; + u8 standby_time; + u8 sleep_time; + u32 reserve3; + } modeselect; + + } data; + +} LEOCmd; + + +#define _nbytes readwrite.rw_bytes +#define _result header.status + + + +#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ + +/************************************************************************** + * + * Global definitions + * + */ +#define LEO_SW_VERSION 6 /* This will be returned by */ + /* LeoInquiry command */ -#define OS_PRIORITY_LEOMGR OS_PRIORITY_PIMGR +#define OS_PRIORITY_LEOMGR OS_PRIORITY_PIMGR -#define DDROM_FONT_START 0x000A0000 -#define DDROM_WAVEDATA_START 0x00140000 +/* + * Drive Rom offset address + */ +#define DDROM_FONT_START 0x000a0000 +#define DDROM_WAVEDATA_START 0x00140000 /* * Definition for osLeoSpdlMotor() */ -#define ACTIVE 0 -#define STANDBY 1 -#define SLEEP 2 -#define BRAKE 4 - -#define LEO_MOTOR_ACTIVE 0 -#define LEO_MOTOR_STANDBY 1 -#define LEO_MOTOR_SLEEP 2 -#define LEO_MOTOR_BRAKE 4 - -#define NUM_LBAS 4292 - -#define BLK_SIZE_ZONE0 19720 -#define BLK_SIZE_ZONE1 18360 -#define BLK_SIZE_ZONE2 17680 -#define BLK_SIZE_ZONE3 16320 -#define BLK_SIZE_ZONE4 14960 -#define BLK_SIZE_ZONE5 13600 -#define BLK_SIZE_ZONE6 12240 -#define BLK_SIZE_ZONE7 10880 -#define BLK_SIZE_ZONE8 9520 - -#define MAX_BLK_SIZE BLK_SIZE_ZONE0 -#define MIN_BLK_SIZE BLK_SIZE_ZONE8 - -#define LEO_ERROR_GOOD 0 -#define LEO_ERROR_DRIVE_NOT_READY 1 -#define LEO_ERROR_DIAGNOSTIC_FAILURE 2 -#define LEO_ERROR_COMMAND_PHASE_ERROR 3 -#define LEO_ERROR_DATA_PHASE_ERROR 4 -#define LEO_ERROR_REAL_TIME_CLOCK_FAILURE 5 -#define LEO_ERROR_BUSY 8 +#define ACTIVE 0 +#define STANDBY 1 +#define SLEEP 2 +#define BRAKE 4 + +#define LEO_MOTOR_ACTIVE 0 +#define LEO_MOTOR_STANDBY 1 +#define LEO_MOTOR_SLEEP 2 +#define LEO_MOTOR_BRAKE 4 + +#define NUM_LBAS 4292 /* total number of LBAs */ + +#define BLK_SIZE_ZONE0 19720 +#define BLK_SIZE_ZONE1 18360 +#define BLK_SIZE_ZONE2 17680 +#define BLK_SIZE_ZONE3 16320 +#define BLK_SIZE_ZONE4 14960 +#define BLK_SIZE_ZONE5 13600 +#define BLK_SIZE_ZONE6 12240 +#define BLK_SIZE_ZONE7 10880 +#define BLK_SIZE_ZONE8 9520 + +#define MAX_BLK_SIZE BLK_SIZE_ZONE0 +#define MIN_BLK_SIZE BLK_SIZE_ZONE8 + +/* + * Error codes + */ +#define LEO_ERROR_GOOD 0 +#define LEO_ERROR_DRIVE_NOT_READY 1 +#define LEO_ERROR_DIAGNOSTIC_FAILURE 2 +#define LEO_ERROR_COMMAND_PHASE_ERROR 3 +#define LEO_ERROR_DATA_PHASE_ERROR 4 +#define LEO_ERROR_REAL_TIME_CLOCK_FAILURE 5 +#define LEO_ERROR_BUSY 8 #define LEO_ERROR_INCOMPATIBLE_MEDIUM_INSTALLED 11 #define LEO_ERROR_UNKNOWN_FORMAT 11 #define LEO_ERROR_NO_SEEK_COMPLETE 21 #define LEO_ERROR_WRITE_FAULT 22 #define LEO_ERROR_UNRECOVERED_READ_ERROR 23 -#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24 +#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24 #define LEO_ERROR_TRACK_FOLLOWING_ERROR 25 #define LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE 25 #define LEO_ERROR_INVALID_COMMAND_OPERATION_CODE 31 @@ -150,65 +188,92 @@ typedef struct LEOCmd { #define LEO_ERROR_COMMAND_TERMINATED 34 #define LEO_ERROR_QUEUE_FULL 35 #define LEO_ERROR_ILLEGAL_TIMER_VALUE 36 -#define LEO_ERROR_WAITING_NMI 37 +#define LEO_ERROR_WAITING_NMI 37 #define LEO_ERROR_DEVICE_COMMUNICATION_FAILURE 41 #define LEO_ERROR_MEDIUM_NOT_PRESENT 42 #define LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED 43 -#define LEO_ERROR_RAMPACK_NOT_CONNECTED 44 +#define LEO_ERROR_RAMPACK_NOT_CONNECTED 44 #define LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED 47 -#define LEO_ERROR_EJECTED_ILLEGALLY_RESUME 49 +#define LEO_ERROR_EJECTED_ILLEGALLY_RESUME 49 -#define LEO_ERROR_NOT_BOOTED_DISK 45 +/* + * Reserved + */ +#define LEO_ERROR_NOT_BOOTED_DISK 45 #define LEO_ERROR_DIDNOT_CHANGED_DISK_AS_EXPECTED 46 -#define LEO_ERROR_RTC_NOT_SET_CORRECTLY 48 -#define LEO_ERROR_DIAGNOSTIC_FAILURE_RESET 50 -#define LEO_ERROR_EJECTED_ILLEGALLY_RESET 51 +/* + * Error codes only used in IPL + */ +#define LEO_ERROR_RTC_NOT_SET_CORRECTLY 48 +#define LEO_ERROR_DIAGNOSTIC_FAILURE_RESET 50 +#define LEO_ERROR_EJECTED_ILLEGALLY_RESET 51 #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) +/************************************************************************** + * + * Macro definitions + * + */ #define GET_ERROR(x) ((x).header.sense) -extern LEODiskID leoBootID; -extern OSPiHandle* __osDiskHandle; // For exceptasm to get disk info - -// Initialize routine -s32 LeoCreateLeoManager(OSPri comPri, OSPri intPri, OSMesg* cmdBuf, s32 cmdMsgCnt); -s32 LeoCJCreateLeoManager(OSPri comPri, OSPri intPri, OSMesg* cmdBuf, s32 cmdMsgCnt); -s32 LeoCACreateLeoManager(OSPri comPri, OSPri intPri, OSMesg* cmdBuf, s32 cmdMsgCnt); -u32 LeoDriveExist(void); - -// Synchronous functions -s32 LeoClearQueue(void); -s32 LeoByteToLBA(s32 startlba, u32 nbytes, s32* lba); -s32 LeoLBAToByte(s32 startlba, u32 nlbas, s32* bytes); -s32 LeoReadCapacity(LEOCapacity* cap, s32 dir); -s32 LeoInquiry(LEOVersion* ver); -s32 LeoTestUnitReady(LEOStatus* status); - -// Asynchronous functions -s32 LeoSpdlMotor(LEOCmd* cmdBlock, LEOSpdlMode mode, OSMesgQueue* mq); -s32 LeoSeek(LEOCmd* cmdBlock, u32 lba, OSMesgQueue* mq); -s32 LeoRezero(LEOCmd* cmdBlock, OSMesgQueue* mq); -s32 LeoReadWrite(LEOCmd* cmdBlock, s32 direction, u32 LBA, void* vAddr, u32 nLBAs, OSMesgQueue* mq); -s32 LeoReadDiskID(LEOCmd* cmdBlock, LEODiskID* vaddr, OSMesgQueue* mq); -s32 LeoSetRTC(LEOCmd* cmdBlock, LEODiskTime* RTCdata, OSMesgQueue* mq); -s32 LeoReadRTC(LEOCmd* cmdBlock, OSMesgQueue* mq); -s32 LeoModeSelectAsync(LEOCmd* cmdBlock, u32 standby, u32 sleep, OSMesgQueue* mq); - -// Font routines -int LeoGetKAdr(int sjis); -int LeoGetAAdr(int code, int* dx, int* dy, int* cy); -int LeoGetAAdr2(u32 ccode, int* dx, int* dy, int* cy); - -// Boot function -void LeoBootGame(void* entry); - -#endif // defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) + +/************************************************************************** + * + * Extern variables + * + */ +extern LEODiskID leoBootID; +extern OSPiHandle *__osDiskHandle; /* For exceptasm to get disk info*/ + + +/************************************************************************** + * + * Function prototypes + * + */ +/* Initialize routine */ +extern s32 LeoCreateLeoManager(OSPri comPri, OSPri intPri, + OSMesg *cmdBuf, s32 cmdMsgCnt); +extern s32 LeoCJCreateLeoManager(OSPri comPri, OSPri intPri, + OSMesg *cmdBuf, s32 cmdMsgCnt); +extern s32 LeoCACreateLeoManager(OSPri comPri, OSPri intPri, + OSMesg *cmdBuf, s32 cmdMsgCnt); +extern u32 LeoDriveExist(void); + +/* Synchronous functions */ +extern s32 LeoClearQueue(void); +extern s32 LeoByteToLBA(s32 startLBA, u32 nbytes, s32 *lbas); +extern s32 LeoLBAToByte(s32 startLBA, u32 nLBAs, s32 *bytes); +extern s32 LeoReadCapacity(LEOCapacity *cap, s32 dir); +extern s32 LeoInquiry(LEOVersion *ver); +extern s32 LeoTestUnitReady(LEOStatus *status); + +/* Asynchronous functions */ +extern s32 LeoSpdlMotor(LEOCmd *cmdBlock, LEOSpdlMode mode, OSMesgQueue *mq); +extern s32 LeoSeek(LEOCmd *cmdBlock, u32 lba, OSMesgQueue *mq); +extern s32 LeoRezero(LEOCmd *cmdBlock, OSMesgQueue *mq); +extern s32 LeoReadWrite(LEOCmd *cmdBlock, s32 direction, + u32 LBA, void *vAddr, u32 nLBAs, OSMesgQueue *mq); +extern s32 LeoReadDiskID(LEOCmd *cmdBlock, LEODiskID *vaddr, OSMesgQueue *mq); +extern s32 LeoSetRTC(LEOCmd *cmdBlock, LEODiskTime *RTCdata, OSMesgQueue *mq); +extern s32 LeoReadRTC(LEOCmd *cmdBlock, OSMesgQueue *mq); +extern s32 LeoModeSelectAsync(LEOCmd *cmdBlock, u32 standby, + u32 sleep, OSMesgQueue *mq); + +/* Font routines */ +extern int LeoGetKAdr(int sjis); +extern int LeoGetAAdr(int code,int *dx,int *dy, int *cy); +extern int LeoGetAAdr2(u32 ccode,int *dx,int *dy, int *cy); + +/* Boot function */ +extern void LeoBootGame(void *entry); + +#endif /* defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS) */ #ifdef _LANGUAGE_C_PLUS_PLUS } #endif -#endif - +#endif /* !_LEO_H */ diff --git a/include/ultra64/leo_internal.h b/include/ultra64/leo_internal.h new file mode 100644 index 00000000000..5f7f132e4cf --- /dev/null +++ b/include/ultra64/leo_internal.h @@ -0,0 +1,131 @@ +#ifndef LEO_INTERNAL_H +#define LEO_INTERNAL_H + +#include "ultra64.h" +#include "stack.h" + +extern OSPiHandle* LEOPiInfo; +void leointerrupt(void*); +void leomain(void*); +void leoClr_queue(void); +u8 leoChk_asic_ready(u32); +void leoDrive_reset(void); +extern s32 __leoActive; +typedef struct tgt_param_form { + /* 0x0 */ u16 lba; + /* 0x2 */ u16 cylinder; + /* 0x4 */ u16 blk_bytes; + /* 0x6 */ u8 sec_bytes; + /* 0x7 */ u8 head; + /* 0x8 */ u8 zone; + /* 0x9 */ u8 rdwr_blocks; + /* 0xA */ u8 start_block; +} tgt_param_form; +s32 __leoSetReset(void); +s32 __osLeoInterrupt(void); +OSPiHandle* osLeoDiskInit(void); +extern LEOVersion __leoVersion; +extern STACK(leoDiskStack, 0x1000); +extern const u16 LEOBYTE_TBL2[]; +extern const u16 LEOVZONE_TBL[][0x10]; +extern const u8 LEOVZONE_PZONEHD_TBL[][0x10]; +u16 leoLba_to_vzone(u32 lba); +u16 leoLba_to_phys(u32 lba); +u8 leoSeek_i(u16 rwmode); +extern OSMesgQueue LEOc2ctrl_que; +u32 leoChkUnit_atten(void); +u8 leoChk_cur_drvmode(void); +void leoClrUA_RESET(void); +void leoInitUnit_atten(void); +u8 leoRead_system_area(void); +u32 leoRetUnit_atten(void); +u8 leoSend_asic_cmd_w(u32 asic_cmd, u32 asic_data); +extern OSIoMesg LEOPiDmaParam; +extern s32 currentCommand; +typedef union leo_sys_form { + /* 0x00 */ struct { + /* 0x00 */ u32 country; + /* 0x04 */ u8 fmt_type; + /* 0x05 */ u8 disk_type; + /* 0x06 */ u16 ipl_load_len; + /* 0x08 */ u8 defect_num[20]; + /* 0x1C */ void* loadptr; + /* 0x20 */ u8 defect_data[192]; + /* 0xE0 */ u16 rom_end_lba; + /* 0xE2 */ u16 ram_start_lba; + /* 0xE4 */ u16 ram_end_lba; + } param; + /* 0x00 */ u64 u64_data[29]; +} leo_sys_form; // size = 0xE8 +void leoRead_common(unsigned int offset); +u32 leoChk_err_retry(u32 sense); +typedef struct block_param_form { + /* 0x0 */ u8* pntr; + /* 0x4 */ u8* c2buff_e; + /* 0x8 */ u8 err_pos[4]; + /* 0xC */ u8 err_num; + /* 0xD */ u8 bytes; + /* 0xE */ u16 blkbytes; +} block_param_form; // size = 0x10 +extern u8 LEOC2_Syndrome[2][0xE8 * 4]; +extern block_param_form LEOc2_param; +void leoSet_mseq(u16 rwmode); +u8 leoDetect_index_w(void); +extern const u16 LEOZONE_SCYL_TBL[]; +extern const u16 LEOZONE_OUTERCYL_TBL[]; +extern const u8 LEOBYTE_TBL1[]; +int leoC2_Correction(void); +u8 leoSend_asic_cmd_w_nochkDiskChange(u32 asic_cmd, u32 asic_data); +u8 leoChk_done_status(u32 asic_cmd); +u8 leoWait_mecha_cmd_done(u32 asic_cmd); +u8 leoRecal_w(void); +u8 leoSeek_w(void); +void leoClrUA_MEDIUM_CHANGED(void); +void leoSetUA_MEDIUM_CHANGED(void); +u8 leoAnalize_asic_status(void); +void leoMode_sel(void); +extern u8 LEO_TempBuffer[0xE8]; +void leoTest_unit_rdy(void); +void leoSeek(void); +void leoRd_capacity(void); +extern const u16 LEORAM_START_LBA[]; +extern const u32 LEORAM_BYTE[]; + +void leoClr_reset(void); +void leoInquiry(void); +void leoRead(void); +void leoReadDiskId(void); +void leoReadTimer(void); +void leoRezero(void); +void leoSetTimer(void); +void leoStart_stop(void); +void leoTranslate(void); +void leoWrite(void); + +extern leo_sys_form LEO_sys_data; + +extern OSThread LEOcommandThread; +extern OSThread LEOinterruptThread; +extern STACK(LEOcommandThreadStack, 0x400); +extern STACK(LEOinterruptThreadStack, 0x400); +extern OSMesgQueue LEOcommand_que; +extern OSMesgQueue LEOevent_que; +extern OSMesgQueue LEOcontrol_que; +extern OSMesgQueue LEOdma_que; +extern OSMesgQueue LEOblock_que; +extern OSMesg LEOevent_que_buf; +extern OSMesg LEOcontrol_que_buf; +extern OSMesg LEOdma_que_buf[2]; +extern OSMesg LEOblock_que_buf; +extern u8* LEOwrite_pointer; +extern LEOCmd* LEOcur_command; +extern s32 LEOasic_bm_ctl_shadow; +extern s32 LEOasic_seq_ctl_shadow; +extern u8 LEOdrive_flag; +extern vu8 LEOclr_que_flag; +// extern u16 LEOrw_flags; +extern tgt_param_form LEOtgt_param; +extern u8 LEOdisk_type; +extern u32 LEO_country_code; + +#endif diff --git a/include/ultra64/leoappli.h b/include/ultra64/leoappli.h index ef526ee5a54..619fbc08395 100644 --- a/include/ultra64/leoappli.h +++ b/include/ultra64/leoappli.h @@ -1,72 +1,101 @@ -#ifndef ULTRA64_LEOAPPLI_H -#define ULTRA64_LEOAPPLI_H - -#include "thread.h" -#include "message.h" - -#define LEO_DISK_TYPE_MIN 0 -#define LEO_DISK_TYPE_MAX 6 - -#define LEO_LBA_MIN 0 -#define LEO_LBA_MAX 4291 - -#define LEO_LBA_ROM_TOP LEO_LBA_MIN -#define LEO_LBA_ROM_END0 1417 -#define LEO_LBA_ROM_END1 1965 -#define LEO_LBA_ROM_END2 2513 -#define LEO_LBA_ROM_END3 3061 -#define LEO_LBA_ROM_END4 3609 -#define LEO_LBA_ROM_END5 4087 -#define LEO_LBA_ROM_END6 LEO_LBA_MAX -#define LEO_LBA_RAM_TOP0 (LEO_LBA_ROM_END0+1) -#define LEO_LBA_RAM_TOP1 (LEO_LBA_ROM_END1+1) -#define LEO_LBA_RAM_TOP2 (LEO_LBA_ROM_END2+1) -#define LEO_LBA_RAM_TOP3 (LEO_LBA_ROM_END3+1) -#define LEO_LBA_RAM_TOP4 (LEO_LBA_ROM_END4+1) -#define LEO_LBA_RAM_TOP5 (LEO_LBA_ROM_END5+1) -#define LEO_LBA_RAM_TOP6 (LEO_LBA_ROM_END6+1) -#define LEO_LBA_RAM_END6 LEO_LBA_MAX - -void leoInitialize(OSPri compri, OSPri intpri, OSMesg* command_que_buf, u32 cmd_buff_size); -void leoCommand(void* cmd_blk_addr); -void LeoReset(void); -s32 LeoResetClear(void); - -#define LEO_PRIORITY_WRK (OS_PRIORITY_PIMGR-1) -#define LEO_PRIORITY_INT OS_PRIORITY_PIMGR - -#define LEO_COMMAND_CLEAR_QUE 0x01 -#define LEO_COMMAND_INQUIRY 0x02 -#define LEO_COMMAND_TEST_UNIT_READY 0x03 -#define LEO_COMMAND_REZERO 0x04 -#define LEO_COMMAND_READ 0x05 -#define LEO_COMMAND_WRITE 0x06 -#define LEO_COMMAND_SEEK 0x07 -#define LEO_COMMAND_START_STOP 0x08 -#define LEO_COMMAND_READ_CAPACITY 0x09 -#define LEO_COMMAND_TRANSLATE 0x0A -#define LEO_COMMAND_MODE_SELECT 0x0B -#define LEO_COMMAND_READ_DISK_ID 0x0C -#define LEO_COMMAND_READ_TIMER 0x0D -#define LEO_COMMAND_SET_TIMER 0x0E -// should be -// #define LEO_COMMAND_CLEAR_RESET 0x0F - -#define LEO_CONTROL_POST 0x80 // ENABLE POST QUEUE -#define LEO_CONTROL_START 0x01 // START COMMAND -#define LEO_CONTROL_STBY 0x02 // STAND-BY MODE(NOT SLEEP MODE) -#define LEO_CONTROL_WRT 0x01 // READ RE-WRITE-ABLE CAPACITY -#define LEO_CONTROL_TBL 0x01 // TRANSLATE BYTE TO LBA -#define LEO_CONTROL_BRAKE 0x04 // SLEEP MODE(BRAKE ON) - -#define LEO_TEST_UNIT_MR 0x01 // MEDIUM REMOVED -#define LEO_TEST_UNIT_RE 0x02 // HEAD RETRACTED -#define LEO_TEST_UNIT_SS 0x04 // SPINDLE STOPPED - -#define LEO_STATUS_GOOD 0x00 -#define LEO_STATUS_CHECK_CONDITION 0x02 -#define LEO_STATUS_BUSY 0x08 +/* + * F i l e N a m e : l e o a p p l i . h + * + **************************************************************************** + * (C) Copyright ALPS Electric Co., Ltd. 1995-1997 + **************************************************************************** + * Version + * + * ver Date + * ---- -------- + * 1.01 '97-11-18 Add MOTOR BRAKE definition for control bit. + **************************************************************************** +*/ +/*-----------------------------------*/ +/* DRIVE PARAMETER */ +/*-----------------------------------*/ +#define LEO_DISK_TYPE_MIN 0 +#define LEO_DISK_TYPE_MAX 6 +#define LEO_LBA_MIN 0 +#define LEO_LBA_MAX 4291 + +#define LEO_LBA_ROM_TOP LEO_LBA_MIN +#define LEO_LBA_ROM_END0 1417 +#define LEO_LBA_ROM_END1 1965 +#define LEO_LBA_ROM_END2 2513 +#define LEO_LBA_ROM_END3 3061 +#define LEO_LBA_ROM_END4 3609 +#define LEO_LBA_ROM_END5 4087 +#define LEO_LBA_ROM_END6 LEO_LBA_MAX +#define LEO_LBA_RAM_TOP0 (LEO_LBA_ROM_END0+1) +#define LEO_LBA_RAM_TOP1 (LEO_LBA_ROM_END1+1) +#define LEO_LBA_RAM_TOP2 (LEO_LBA_ROM_END2+1) +#define LEO_LBA_RAM_TOP3 (LEO_LBA_ROM_END3+1) +#define LEO_LBA_RAM_TOP4 (LEO_LBA_ROM_END4+1) +#define LEO_LBA_RAM_TOP5 (LEO_LBA_ROM_END5+1) +#define LEO_LBA_RAM_TOP6 (LEO_LBA_ROM_END6+1) +#define LEO_LBA_RAM_END6 LEO_LBA_MAX + +/*-----------------------------------*/ +/* LEO FUNCTION DEFINITIONS */ +/*-----------------------------------*/ +extern void leoInitialize(OSPri PRI_WRK, OSPri PRI_INT, OSMesg *command_que_buf, u32 cmd_buff_size); +extern void leoCommand(void *CDB); +extern void LeoReset(void); +extern s32 LeoResetClear(void); + +/*-----------------------------------*/ +/* THREAD PRIORITY */ +/*-----------------------------------*/ +#define LEO_PRIORITY_WRK (OS_PRIORITY_PIMGR-1) +#define LEO_PRIORITY_INT OS_PRIORITY_PIMGR + +/*-----------------------------------*/ +/* COMMAND CODE */ +/*-----------------------------------*/ +#define LEO_COMMAND_CLEAR_QUE 0x01 +#define LEO_COMMAND_INQUIRY 0x02 +#define LEO_COMMAND_TEST_UNIT_READY 0x03 +#define LEO_COMMAND_REZERO 0x04 +#define LEO_COMMAND_READ 0x05 +#define LEO_COMMAND_WRITE 0x06 +#define LEO_COMMAND_SEEK 0x07 +#define LEO_COMMAND_START_STOP 0x08 +#define LEO_COMMAND_READ_CAPACITY 0x09 +#define LEO_COMMAND_TRANSLATE 0x0a +#define LEO_COMMAND_MODE_SELECT 0x0b +#define LEO_COMMAND_READ_DISK_ID 0x0c +#define LEO_COMMAND_READ_TIMER 0x0d +#define LEO_COMMAND_SET_TIMER 0x0e + +/*-----------------------------------*/ +/* CONTROL BIT */ +/*-----------------------------------*/ +#define LEO_CONTROL_POST 0x80 /* ENABLE POST QUEUE */ +#define LEO_CONTROL_START 0x01 /* START COMMAND */ +#define LEO_CONTROL_STBY 0x02 /* STAND-BY MODE(NOT SLEEP MODE) */ +#define LEO_CONTROL_WRT 0x01 /* READ RE-WRITE-ABLE CAPACITY */ +#define LEO_CONTROL_TBL 0x01 /* TRANSLATE BYTE TO LBA */ +#define LEO_CONTROL_BRAKE 0x04 /* SLEEP MODE(BRAKE ON) */ + +/*-----------------------------------*/ +/* BIT FIELD PARAMETER */ +/*-----------------------------------*/ +#define LEO_TEST_UNIT_MR 0x01 /* MEDIUM REMOVED */ +#define LEO_TEST_UNIT_RE 0x02 /* HEAD RETRACTED */ +#define LEO_TEST_UNIT_SS 0x04 /* SPINDLE STOPPED */ + +/*-----------------------------------*/ +/* STATUS */ +/*-----------------------------------*/ +#define LEO_STATUS_GOOD 0x00 +#define LEO_STATUS_CHECK_CONDITION 0x02 +#define LEO_STATUS_BUSY 0x08 + +/*-----------------------------------*/ +/* SENSE CODE */ +/*-----------------------------------*/ #define LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION 00 #define LEO_SENSE_DRIVE_NOT_READY 01 #define LEO_SENSE_DIAGNOSTIC_FAILURE 02 @@ -78,7 +107,7 @@ s32 LeoResetClear(void); #define LEO_SENSE_NO_SEEK_COMPLETE 21 #define LEO_SENSE_WRITE_FAULT 22 #define LEO_SENSE_UNRECOVERED_READ_ERROR 23 -#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24 +#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24 #define LEO_SENSE_TRACK_FOLLOWING_ERROR 25 #define LEO_SENSE_TRACKING_OR_SPDL_SERVO_FAILURE 25 #define LEO_SENSE_INVALID_COMMAND_OPERATION_CODE 31 @@ -94,105 +123,152 @@ s32 LeoResetClear(void); #define LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED 47 #define LEO_SENSE_EJECTED_ILLEGALLY_RESUME 49 -typedef struct LEOCmdHeader { - /* 0x0 */ u8 command; - /* 0x1 */ u8 reserve1; - /* 0x2 */ u8 control; - /* 0x3 */ u8 reserve3; - /* 0x4 */ u8 status; - /* 0x5 */ u8 sense; - /* 0x6 */ u8 reserve6; - /* 0x7 */ u8 reserve7; - /* 0x8 */ OSMesgQueue* post; -} LEOCmdHeader; // 0xC - -typedef struct LEOCmdClearQueue { - /* 0x0 */ LEOCmdHeader header; -} LEOCmdClearQueue; // 0xC - -typedef struct LEOCmdInquiry { - /* 0x00 */ LEOCmdHeader header; - /* 0x0C */ u8 devType; - /* 0x0D */ u8 version; - /* 0x0E */ u8 devNum; - /* 0x0F */ u8 leoBiosVer; - /* 0x10 */ u32 reserve5; -} LEOCmdInquiry; // size = 0x14 - -typedef struct LEOCmdTestUnitReady { - /* 0x0 */ LEOCmdHeader header; - /* 0xC */ u8 test; - /* 0xD */ u8 reserve2; - /* 0xE */ u8 reserve3; - /* 0xF */ u8 reserve4; -} LEOCmdTestUnitReady; // size = 0x10 - -typedef struct LEOCmdRezero { - /* 0x0 */ LEOCmdHeader header; -} LEOCmdRezero; // size = 0xC - -typedef struct LEOCmdRead { - /* 0x00 */ LEOCmdHeader header; - /* 0x0C */ u32 lba; - /* 0x10 */ u32 transferBlks; - /* 0x14 */ void* buffPtr; - /* 0x18 */ u32 rwBytes; -} LEOCmdRead; // size = 0x1C +/*-----------------------------------*/ +/* Command Block Header */ +/*-----------------------------------*/ +typedef struct{ + u8 command; + u8 reserve1; + u8 control; + u8 reserve3; + u8 status; + u8 sense; + u8 reserve6; + u8 reserve7; + OSMesgQueue *post; +} LEOCmdHeader; + +/*-----------------------------------*/ +/* CLEAR QUEUE(01H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; +} LEOCmdClearQue; + +/*-----------------------------------*/ +/* INQUIRY(02H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u8 dev_type; + u8 version; + u8 dev_num; + u8 leo_bios_ver; + u32 reserve5; +} LEOCmdInquiry; + +/*-----------------------------------*/ +/* TEST UNIT READY(03H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u8 test; + u8 reserve2; + u8 reserve3; + u8 reserve4; +} LEOCmdTestUnitReady; +/*-----------------------------------*/ +/* REZERO(04H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; +} LEOCmdRezero; + +/*-----------------------------------*/ +/* READ(05H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u32 lba; + u32 xfer_blks; + void *buff_ptr; + u32 rw_bytes; +} LEOCmdRead; + +/*-----------------------------------*/ +/* WRITE(06H) command */ +/*-----------------------------------*/ typedef LEOCmdRead LEOCmdWrite; -typedef struct LEOCmdSeek { - /* 0x0 */ LEOCmdHeader header; - /* 0xC */ u32 lba; -} LEOCmdSeek; // size = 0x10 - -typedef struct LEOCmdStartStop { - /* 0x0 */ LEOCmdHeader header; -} LEOCmdStartStop; // size = 0xC - -typedef struct LEOCmdReadCapacity { - /* 0x00 */ LEOCmdHeader header; - /* 0x0C */ u32 startLba; - /* 0x10 */ u32 endLba; - /* 0x14 */ u32 capaBytes; -} LEOCmdReadCapacity; // size = 0x18 - -typedef struct LEOCmdTranslate { - /* 0x00 */ LEOCmdHeader header; - /* 0x0C */ u32 startLba; - /* 0x10 */ u32 inParam; - /* 0x14 */ u32 outParam; -} LEOCmdTranslate; // size = 0x18 - -typedef struct LEOCmdModeSelect { - /* 0x00 */ LEOCmdHeader header; - /* 0x0C */ u8 pageCode; - /* 0x0D */ u8 reserve1; - /* 0x0E */ u8 standbyTime; - /* 0x0F */ u8 sleepTime; - /* 0x10 */ u8 ledOnTime; - /* 0x11 */ u8 ledOffTime; - /* 0x12 */ u8 reserve18; - /* 0x13 */ u8 reserve19; -} LEOCmdModeSelect; // size = 0x14 - -typedef struct LEOCmdReadDiskId { - /* 0x0 */ LEOCmdHeader header; - /* 0xC */ void* bufferPointer; -} LEOCmdReadDiskId; // size = 0x10 - -typedef struct LEOCmdReadTimer { - /* 0x00 */ LEOCmdHeader header; - /* 0x0C */ u8 reserve12; - /* 0x0D */ u8 reserve13; - /* 0x0E */ u8 year; - /* 0x0F */ u8 month; - /* 0x10 */ u8 day; - /* 0x11 */ u8 hour; - /* 0x12 */ u8 minute; - /* 0x13 */ u8 second; -} LEOCmdReadTimer; // size = 0x14 +/*-----------------------------------*/ +/* SEEK(07H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u32 lba; +} LEOCmdSeek; + +/*-----------------------------------*/ +/* START/STOP(08H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; +} LEOCmdStartStop; + +/*-----------------------------------*/ +/* READ CAPACITY(09H) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u32 start_lba; + u32 end_lba; + u32 capa_bytes; +} LEOCmdReadCapacity; + +/*-----------------------------------*/ +/* TRANSLATE(0AH) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u32 start_lba; + u32 in_param; + u32 out_param; +} LEOCmdTranslate; +/*-----------------------------------*/ +/* MODE SELECT(0BH) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u8 page_code; + u8 reserve1; + u8 standby_time; + u8 sleep_time; + u8 led_on_time; + u8 led_off_time; + u8 reserve18; + u8 reserve19; +} LEOCmdModeSelect; + +/*-----------------------------------*/ +/* READ DISK ID(0CH) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + void *buffer_pointer; +} LEOCmdReadDiskId; + +/*-----------------------------------*/ +/* READ TIMER(0DH) command */ +/*-----------------------------------*/ +typedef struct { + LEOCmdHeader header; + u8 reserve12; + u8 reserve13; + u8 year; + u8 month; + u8 day; + u8 hour; + u8 minute; + u8 second; +} LEOCmdReadTimer; + +/*-----------------------------------*/ +/* SET TIMER(0EH) command */ +/*-----------------------------------*/ typedef LEOCmdReadTimer LEOCmdSetTimer; -#endif +/*-------end of leoappli.h--------------------------*/ + + diff --git a/include/ultra64/leodrive.h b/include/ultra64/leodrive.h index fbbbef8e0f2..36b28f4b9ed 100644 --- a/include/ultra64/leodrive.h +++ b/include/ultra64/leodrive.h @@ -1,14 +1,7 @@ #ifndef ULTRA64_LEODRIVE_H #define ULTRA64_LEODRIVE_H -#include "leo.h" -#include "leoappli.h" -#include "message.h" -#include "pi.h" #include "rcp.h" -#include "stack.h" -#include "thread.h" -#include "ultratypes.h" #define ASIC_BASE PI_DOM2_ADDR1 @@ -51,144 +44,4 @@ // ASIC_STATUS read bits #define LEO_STATUS_MECHANIC_INTR 0x02000000 // Mechanic Interrupt Raised -typedef union { - /* 0x0 */ u8 u8_data[4]; - /* 0x0 */ u16 u16_data[2]; - /* 0x0 */ u32 u32_data; -} data_trans_form; // size = 0x4 - -typedef struct { - /* 0x00 */ u8* pntr; - /* 0x04 */ u8* c2buff_e; - /* 0x08 */ u8 err_pos[4]; - /* 0x0C */ u8 err_num; - /* 0x0D */ u8 bytes; - /* 0x0E */ u16 blkbytes; -} block_param_form; // size = 0x10 - -typedef struct { - /* 0x0 */ u16 lba; - /* 0x2 */ u16 cylinder; - /* 0x4 */ u16 blk_bytes; - /* 0x6 */ u8 sec_bytes; - /* 0x7 */ u8 head; - /* 0x8 */ u8 zone; - /* 0x9 */ u8 rdwr_blocks; - /* 0xA */ u8 start_block; -} tgt_param_form; // size = 0xC - -typedef union { - /* 0x00 */ struct { - /* 0x00 */ u32 country; - /* 0x04 */ u8 fmt_type; - /* 0x05 */ u8 disk_type; - /* 0x06 */ u16 ipl_load_len; - /* 0x08 */ u8 defect_num[20]; - /* 0x1C */ void* loadptr; - /* 0x20 */ u8 defect_data[192]; - /* 0xE0 */ u16 rom_end_lba; - /* 0xE2 */ u16 ram_start_lba; - /* 0xE4 */ u16 ram_end_lba; - } param; - /* 0x00 */ u64 u64_data[29]; -} leo_sys_form; // size = 0xE8 - -void leomain(void* arg); -void leointerrupt(void* arg); - -OSPiHandle* osLeoDiskInit(void); -s32 __osLeoInterrupt(void); - -void leoClr_queue(void); -void leoInquiry(void); -void leoTest_unit_rdy(void); -void leoRezero(void); -void leoRead(void); -void leoWrite(void); -void leoSeek(void); -void leoStart_stop(void); -void leoRd_capacity(void); -void leoTranslate(); -void leoMode_sel(void); -void leoReadDiskId(void); -void leoReadTimer(void); -void leoSetTimer(void); -void leoClr_reset(void); - -u16 leoLba_to_phys(u32 lba); -u16 leoLba_to_vzone(u32 lba); - -u8 leoAnalize_asic_status(void); -u8 leoChk_asic_ready(u32 asic_cmd); -u8 leoChk_done_status(u32 asic_cmd); -u8 leoSend_asic_cmd_i(u32 asic_cmd, u32 asic_data); -u8 leoWait_mecha_cmd_done(u32 asic_cmd); -u8 leoSend_asic_cmd_w(u32 asic_cmd, u32 asic_data); -u8 leoSend_asic_cmd_w_nochkDiskChange(u32 asic_cmd, u32 asic_data); -u8 leoDetect_index_w(void); -u8 leoRecal_i(void); -u8 leoRecal_w(void); -u8 leoSeek_i(u16 rwmode); -u8 leoSeek_w(void); -u8 leoRecv_event_mesg(s32 control); -u32 leoChk_err_retry(u32 sense); -u8 leoChk_cur_drvmode(void); -void leoDrive_reset(void); -u32 leoChkUnit_atten(void); -u32 leoRetUnit_atten(void); -void leoClrUA_RESET(void); -void leoClrUA_MEDIUM_CHANGED(void); -void leoSetUA_MEDIUM_CHANGED(void); -void leoInitUnit_atten(void); - -s32 __leoSetReset(void); - -void leoRead_common(unsigned int offset); - -int leoC2_Correction(void); - -void leoSet_mseq(u16 rwmode); - -extern leo_sys_form LEO_sys_data; -extern OSThread LEOcommandThread; -extern OSThread LEOinterruptThread; -extern STACK(LEOcommandThreadStack, 0x400); -extern STACK(LEOinterruptThreadStack, 0x400); -extern OSMesgQueue LEOcommand_que; -extern OSMesgQueue LEOevent_que; -extern OSMesgQueue LEOcontrol_que; -extern OSMesgQueue LEOdma_que; -extern OSMesgQueue LEOblock_que; -extern OSMesg LEOevent_que_buf[1]; -extern OSMesg LEOcontrol_que_buf[1]; -extern OSMesg LEOdma_que_buf[2]; -extern OSMesg LEOblock_que_buf[1]; -extern u8* LEOwrite_pointer; -extern LEOCmd* LEOcur_command; -extern u32 LEOasic_bm_ctl_shadow; -extern u32 LEOasic_seq_ctl_shadow; -extern u8 LEOdrive_flag; -extern vu8 LEOclr_que_flag; -// needs to not be volatile in some files -// extern vu16 LEOrw_flags; -extern u8 LEOdisk_type; -extern tgt_param_form LEOtgt_param; -extern u32 LEO_country_code; - -extern const char LEOfirmware_rev[]; -extern const u8 LEOBYTE_TBL1[]; -extern const u16 LEOBYTE_TBL2[]; -extern const u16 LEOVZONE_TBL[][0x10]; -extern const u16 LEOZONE_SCYL_TBL[]; -extern const u8 LEOVZONE_PZONEHD_TBL[][0x10]; -extern const u16 LEOZONE_OUTERCYL_TBL[]; -extern const u16 LEORAM_START_LBA[]; -extern const s32 LEORAM_BYTE[]; - -extern s32 __leoActive; -extern LEOVersion __leoVersion; -extern STACK(leoDiskStack, 0x1000); - -extern OSPiHandle* LEOPiInfo; - #endif diff --git a/include/view.h b/include/view.h index b2dadd3db4e..5ca3410da6b 100644 --- a/include/view.h +++ b/include/view.h @@ -92,7 +92,7 @@ s32 View_Apply(View* view, s32 mask); s32 View_ApplyOrthoToOverlay(View* view); s32 View_ApplyPerspectiveToOverlay(View* view); s32 View_UpdateViewingMatrix(View* view); -s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP); +s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp); #if DEBUG_FEATURES s32 View_ErrorCheckEyePosition(f32 eyeX, f32 eyeY, f32 eyeZ); #endif diff --git a/include/vis.h b/include/vis.h deleted file mode 100644 index 52b1f0a690c..00000000000 --- a/include/vis.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef VIS_H -#define VIS_H - -#include "ultra64.h" -#include "color.h" - -typedef enum FramebufferFilterType { - /* 0 */ FB_FILTER_NONE, - /* 1 */ FB_FILTER_CVG_RGB, - /* 2 */ FB_FILTER_CVG_RGB_UNIFORM, - /* 3 */ FB_FILTER_CVG_ONLY, - /* 4 */ FB_FILTER_CVG_RGB_FOG, // Not recommended, easily overflows blender - /* 5 */ FB_FILTER_ZBUF_IA, - /* 6 */ FB_FILTER_ZBUF_RGBA, - /* 7 */ FB_FILTER_MONO -} FramebufferFilterType; - -typedef enum VisScissorType { - /* 0 */ VIS_NO_SETSCISSOR, - /* 1 */ VIS_SETSCISSOR -} VisScissorType; - -typedef struct Vis { - /* 0x00 */ u32 type; - /* 0x04 */ u32 scissorType; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x0C */ Color_RGBA8_u32 envColor; -} Vis; // size = 0x10 - - -/* Cvg: Coverage */ - -#define FB_FILTER_TO_CVG_TYPE(filter) (filter) - -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), - /* 3 */ VIS_CVG_TYPE_CVG_ONLY = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_ONLY), - /* 4 */ VIS_CVG_TYPE_CVG_RGB_FOG = FB_FILTER_TO_CVG_TYPE(FB_FILTER_CVG_RGB_FOG) -} VisCvgType; - -typedef struct VisCvg { - /* 0x00 */ Vis vis; -} VisCvg; // size = 0x10 - -void VisCvg_Init(VisCvg* this); -void VisCvg_Destroy(VisCvg* this); -void VisCvg_Draw(VisCvg* this, Gfx** gfxP); - - -/* Mono: Desaturation */ - -// Only one type - -typedef struct VisMono { - /* 0x00 */ Vis vis; - /* 0x10 */ u16* tlut; - /* 0x14 */ Gfx* dList; -} VisMono; // size = 0x18 - -void VisMono_Init(VisMono* this); -void VisMono_Destroy(VisMono* this); -void VisMono_Draw(VisMono* this, Gfx** gfxP); - - -/* ZBuf: Z-Buffer */ - -#define FB_FILTER_TO_ZBUF_TYPE(filter) ((filter) - FB_FILTER_ZBUF_IA) - -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 VisZBuf { - /* 0x00 */ Vis vis; -} VisZBuf; // size = 0x10 - -void VisZBuf_Init(VisZBuf* this); -void VisZBuf_Destroy(VisZBuf* this); -void VisZBuf_Draw(VisZBuf* this, Gfx** gfxP); - -#endif diff --git a/include/z64.h b/include/z64.h new file mode 100644 index 00000000000..5b8e3af0bff --- /dev/null +++ b/include/z64.h @@ -0,0 +1,32 @@ +#ifndef Z64_H +#define Z64_H + +#include "ultra64.h" +#include "color.h" + +// Vis... +typedef struct struct_801664F0 { + /* 0x00 */ u32 type; + /* 0x04 */ u32 setScissor; + /* 0x08 */ Color_RGBA8_u32 color; + /* 0x0C */ Color_RGBA8_u32 envColor; +} struct_801664F0; // size = 0x10 + +typedef struct VisMono { + /* 0x00 */ u32 unk_00; + /* 0x04 */ u32 setScissor; + /* 0x08 */ Color_RGBA8_u32 primColor; + /* 0x0C */ Color_RGBA8_u32 envColor; + /* 0x10 */ u16* tlut; + /* 0x14 */ Gfx* dList; +} VisMono; // size = 0x18 + +// Vis... +typedef struct struct_80166500 { + /* 0x00 */ u32 useRgba; + /* 0x04 */ u32 setScissor; + /* 0x08 */ Color_RGBA8_u32 primColor; + /* 0x08 */ Color_RGBA8_u32 envColor; +} struct_80166500; // size = 0x10 + +#endif diff --git a/include/z_lib.h b/include/z_lib.h index c2e36e7cc3a..e0c89e7965a 100644 --- a/include/z_lib.h +++ b/include/z_lib.h @@ -6,7 +6,7 @@ #include "z_math.h" #include "color.h" -void Lib_MemSet(u8* dest, size_t len, u8 val); +void Lib_MemSet(u8* dest, size_t size, u8 val); f32 Math_CosS(s16 angle); f32 Math_SinS(s16 angle); s32 Math_ScaledStepToS(s16* pValue, s16 target, s16 step); diff --git a/requirements.txt b/requirements.txt index bea2fe176c1..49e1bda597e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,4 +19,4 @@ toml mapfile-parser>=2.3.5,<3.0.0 pyelftools==0.30 rabbitizer>=1.0.0,<2.0.0 -spimdisasm>=1.28.1,<2.0.0 +spimdisasm==1.35.0 diff --git a/retail_progress.py b/retail_progress.py index cf6a623c4ae..49264882598 100755 --- a/retail_progress.py +++ b/retail_progress.py @@ -320,6 +320,9 @@ def print_summary(version: str, csv: bool, only_not_ok: bool): expected_object_files, comparison_data_list ): c_path = expected_object.relative_to(expected_dir).with_suffix(".c") + if not c_path.exists(): + c_path = c_path.with_suffix(".s") + assert c_path.exists() data = data_async.get() insts1 = data.insts1 diff --git a/spec/objects.inc b/spec/objects.inc index ea3c29d4b3d..5b9aceda4ea 100644 --- a/spec/objects.inc +++ b/spec/objects.inc @@ -44,9 +44,9 @@ beginseg include "$(BUILD_DIR)/assets/objects/gameplay_keep/gameplay_keep_0x16A50.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/hilite4_tex.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/gameplay_keep_0x173D0.o" - include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFishOutOfWaterAnim.o" + include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFish1Anim.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/gameplay_keep_0x18610.o" - include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFishInWaterAnim.o" + include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFish2Anim.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/eff_shockwave.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/eff_bubble.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/eff_fire_footprint.o" diff --git a/spec/spec b/spec/spec index 76615133bec..3b397692685 100644 --- a/spec/spec +++ b/spec/spec @@ -107,8 +107,8 @@ beginseg // Functions that GCC-compiled code may depend on, placed in boot so they will always be loaded #ifdef COMPILER_GCC include "$(BUILD_DIR)/src/libultra/libc/string.o" - include "$(BUILD_DIR)/src/libc/memset.o" - include "$(BUILD_DIR)/src/libc/memmove.o" + include "$(BUILD_DIR)/src/libc/code_80106860.o" + include "$(BUILD_DIR)/src/libc/code_801068B0.o" include "$(BUILD_DIR)/src/gcc_fix/missing_gcc_functions.o" #endif @@ -544,7 +544,7 @@ beginseg include "$(BUILD_DIR)/src/code/z_elf_message.o" include "$(BUILD_DIR)/src/code/z_face_reaction.o" include "$(BUILD_DIR)/src/code/z_env_flags.o" - include "$(BUILD_DIR)/src/code/z_fcurve_data.o" + include "$(BUILD_DIR)/src/code/code_8006C510.o" include "$(BUILD_DIR)/src/code/z_fcurve_data_skelanime.o" include "$(BUILD_DIR)/src/code/z_game_dlftbls.o" include "$(BUILD_DIR)/src/code/z_horse.o" @@ -592,9 +592,9 @@ beginseg include "$(BUILD_DIR)/data/unk_8012ABC0.data.o" include "$(BUILD_DIR)/src/code/z_view.o" include "$(BUILD_DIR)/src/code/z_vimode.o" - include "$(BUILD_DIR)/src/code/z_viscvg.o" + include "$(BUILD_DIR)/src/code/code_800ACE70.o" include "$(BUILD_DIR)/src/code/z_vismono.o" - include "$(BUILD_DIR)/src/code/z_viszbuf.o" + include "$(BUILD_DIR)/src/code/code_800AD920.o" include "$(BUILD_DIR)/src/code/z_vr_box.o" include "$(BUILD_DIR)/src/code/z_vr_box_draw.o" include "$(BUILD_DIR)/src/code/z_player_call.o" @@ -657,7 +657,7 @@ beginseg include "$(BUILD_DIR)/src/code/fault_gc.o" include "$(BUILD_DIR)/src/code/fault_gc_drawer.o" #endif - include "$(BUILD_DIR)/src/code/kanread.o" + include "$(BUILD_DIR)/src/code/code_800D71F0.o" #if DEBUG_FEATURES include "$(BUILD_DIR)/src/code/ucode_disas.o" #endif @@ -780,21 +780,21 @@ beginseg include "$(BUILD_DIR)/src/libc/sqrt.o" include "$(BUILD_DIR)/src/libc/fmodf.o" #if !COMPILER_GCC - include "$(BUILD_DIR)/src/libc/memset.o" - include "$(BUILD_DIR)/src/libc/memmove.o" + include "$(BUILD_DIR)/src/libc/code_80106860.o" + include "$(BUILD_DIR)/src/libc/code_801068B0.o" #endif #elif PLATFORM_GC include "$(BUILD_DIR)/src/libc/sqrt.o" include "$(BUILD_DIR)/src/libc/fabsf.o" include "$(BUILD_DIR)/src/libc/fmodf.o" #if !COMPILER_GCC - include "$(BUILD_DIR)/src/libc/memset.o" - include "$(BUILD_DIR)/src/libc/memmove.o" + include "$(BUILD_DIR)/src/libc/code_80106860.o" + include "$(BUILD_DIR)/src/libc/code_801068B0.o" #endif #elif PLATFORM_IQUE include "$(BUILD_DIR)/src/libc/fmodf.o" #if !COMPILER_GCC - include "$(BUILD_DIR)/src/libc/memmove.o" + include "$(BUILD_DIR)/src/libc/code_801068B0.o" #endif include "$(BUILD_DIR)/src/libc/fabsf.o" include "$(BUILD_DIR)/src/libc/sqrt.o" @@ -863,58 +863,55 @@ endseg #if PLATFORM_N64 beginseg name "n64dd" - compress align 0x40 - include "$(BUILD_DIR)/src/n64dd/z_n64dd.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_data_buffer.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_801C8000.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_801C8940.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_801C9440.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_801C9B70.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_error_headers.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_error_bodies.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_error_textures.o" - include "$(BUILD_DIR)/src/n64dd/n64dd_801CA0B0.o" - include "$(BUILD_DIR)/src/libleo/api/readwrite.o" - include "$(BUILD_DIR)/src/libleo/leo/leofunc.o" - include "$(BUILD_DIR)/src/libleo/leo/leoram.o" - include "$(BUILD_DIR)/src/libleo/leo/leoint.o" - include "$(BUILD_DIR)/src/libleo/leo/leocmdex.o" - include "$(BUILD_DIR)/src/libleo/api/getaadr2.o" - include "$(BUILD_DIR)/src/libleo/leo/leoread.o" - include "$(BUILD_DIR)/src/libleo/api/lbatobyte.o" - include "$(BUILD_DIR)/src/libleo/leo/leoinquiry.o" - include "$(BUILD_DIR)/src/libleo/leo/leodiskinit.o" - include "$(BUILD_DIR)/src/libleo/api/seek.o" - include "$(BUILD_DIR)/src/libleo/leo/leord_diskid.o" - include "$(BUILD_DIR)/src/libleo/leo/leomecha.o" - include "$(BUILD_DIR)/src/libleo/api/spdlmotor.o" - include "$(BUILD_DIR)/src/libleo/leo/leo_tbl.o" - include "$(BUILD_DIR)/src/libleo/leo/leotempbuffer.o" - include "$(BUILD_DIR)/src/libleo/leo/leoc2_syndrome.o" - include "$(BUILD_DIR)/src/libleo/leo/leoc2ecc.o" - include "$(BUILD_DIR)/src/libleo/leo/leomseq_tbl.o" - include "$(BUILD_DIR)/src/libleo/leo/leomotor.o" - include "$(BUILD_DIR)/src/libleo/api/driveexist.o" - include "$(BUILD_DIR)/src/libleo/leo/leomode_sel.o" - include "$(BUILD_DIR)/src/libleo/leo/leord_capa.o" - include "$(BUILD_DIR)/src/libleo/leo/leoutil.o" - include "$(BUILD_DIR)/src/libleo/leo/leorezero.o" - include "$(BUILD_DIR)/src/libleo/api/clearqueue.o" - include "$(BUILD_DIR)/src/libleo/api/bytetolba.o" - include "$(BUILD_DIR)/src/libleo/leo/leoreset.o" - include "$(BUILD_DIR)/src/libleo/leo/leotranslat.o" - include "$(BUILD_DIR)/src/libleo/leo/leotimer.o" - include "$(BUILD_DIR)/src/libleo/api/getkadr.o" - include "$(BUILD_DIR)/src/libleo/api/getaadr.o" - include "$(BUILD_DIR)/src/libleo/leo/leoglobals.o" - include "$(BUILD_DIR)/src/libleo/leo/leowrite.o" - include "$(BUILD_DIR)/src/libleo/api/cjcreateleomanager.o" - include "$(BUILD_DIR)/src/libleo/leo/leointerrupt.o" - include "$(BUILD_DIR)/src/libleo/api/cacreateleomanager.o" - include "$(BUILD_DIR)/src/libleo/api/testunitready.o" - include "$(BUILD_DIR)/src/libleo/leo/leotestunit.o" - include "$(BUILD_DIR)/src/libleo/leo/leoseek.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_0.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_1.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_2.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_3.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_4.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_5.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_6.o" + include "$(BUILD_DIR)/src/n64dd/n64dd_7.o" + include "$(BUILD_DIR)/src/n64dd/libleo/readwrite.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leofunc.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoram.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoint.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leocmdex.o" + include "$(BUILD_DIR)/src/n64dd/libleo/getaadr2.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoread.o" + include "$(BUILD_DIR)/src/n64dd/libleo/lbatobyte.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoinquiry.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leodiskinit.o" + include "$(BUILD_DIR)/src/n64dd/libleo/readdiskid.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leord_diskid.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leomecha.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leotempbuffer.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoc2_syndrome.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leo_tbl.o" + include "$(BUILD_DIR)/src/n64dd/libleo/spdlmotor.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoc2ecc.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leomseq_tbl.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoglobals.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leomotor.o" + include "$(BUILD_DIR)/src/n64dd/libleo/driveexist.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leomode_sel.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leord_capa.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoutil.o" + include "$(BUILD_DIR)/src/n64dd/libleo/rezero.o" + include "$(BUILD_DIR)/src/n64dd/libleo/clearqueue.o" + include "$(BUILD_DIR)/src/n64dd/libleo/bytetolba.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoreset.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leotranslat.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leotimer.o" + include "$(BUILD_DIR)/src/n64dd/libleo/getkadr.o" + include "$(BUILD_DIR)/src/n64dd/libleo/getaadr.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leowrite.o" + include "$(BUILD_DIR)/src/n64dd/libleo/cjcreateleomanager.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leointerrupt.o" + include "$(BUILD_DIR)/src/n64dd/libleo/cacreateleomanager.o" + include "$(BUILD_DIR)/src/n64dd/libleo/testunitready.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leotestunit.o" + include "$(BUILD_DIR)/src/n64dd/libleo/leoseek.o" endseg #endif diff --git a/src/audio/internal/effects.c b/src/audio/internal/effects.c index 284d1429512..1e47af80e1b 100644 --- a/src/audio/internal/effects.c +++ b/src/audio/internal/effects.c @@ -273,8 +273,8 @@ f32 Audio_AdsrUpdate(AdsrState* adsr) { case ADSR_STATE_START_LOOP: adsr->envIndex = 0; adsr->action.s.state = ADSR_STATE_LOOP; - retry:; FALLTHROUGH; + retry:; case ADSR_STATE_LOOP: adsr->delay = adsr->envelope[adsr->envIndex].delay; switch (adsr->delay) { diff --git a/src/audio/internal/heap.c b/src/audio/internal/heap.c index e00e7af43d3..420098e238e 100644 --- a/src/audio/internal/heap.c +++ b/src/audio/internal/heap.c @@ -1204,7 +1204,7 @@ void* AudioHeap_AllocPermanent(s32 tableType, s32 id, u32 size) { gAudioCtx.permanentCache[index].size = size; //! @bug UB: missing return. "ramAddr" is in v0 at this point, but doing an - //! explicit return uses an additional register. + // explicit return uses an additional register. #ifdef AVOID_UB return ramAddr; #endif diff --git a/src/boot/is_debug.c b/src/boot/is_debug.c index 185ee77c629..223bf014be4 100644 --- a/src/boot/is_debug.c +++ b/src/boot/is_debug.c @@ -33,8 +33,6 @@ void osSyncPrintfUnused(const char* fmt, ...) { #if DEBUG_FEATURES _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif - - va_end(args); } void osSyncPrintf(const char* fmt, ...) { @@ -44,8 +42,6 @@ void osSyncPrintf(const char* fmt, ...) { #if DEBUG_FEATURES _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif - - va_end(args); } // assumption @@ -56,8 +52,6 @@ void rmonPrintf(const char* fmt, ...) { #if DEBUG_FEATURES _Printf(is_proutSyncPrintf, NULL, fmt, args); #endif - - va_end(args); } #if OOT_VERSION < PAL_1_0 diff --git a/src/boot/yaz0.c b/src/boot/yaz0.c index 601d5145eb5..1a49bd0e0d9 100644 --- a/src/boot/yaz0.c +++ b/src/boot/yaz0.c @@ -4,8 +4,8 @@ #include "ultra64.h" #include "dma.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:128" \ - "pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" \ + "pal-1.1:0" ALIGNED(16) u8 sYaz0DataBuffer[0x400]; u8* sYaz0DataBufferEnd; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 226465a3f6e..4f973ae7b24 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -45,8 +45,8 @@ #include "dma.h" #include "thread.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:82" \ - "pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:78" \ + "pal-1.0:76 pal-1.1:76" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/buffers/gfxbuffers.c b/src/buffers/gfxbuffers.c index 1806570ae4a..83386e41268 100644 --- a/src/buffers/gfxbuffers.c +++ b/src/buffers/gfxbuffers.c @@ -3,6 +3,8 @@ #include "gfx.h" #include "ultra64.h" +#pragma increment_block_number "" + ALIGNED(16) u64 gGfxSPTaskOutputBuffer[0x3000]; ALIGNED(16) u64 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE / sizeof(u64)]; diff --git a/src/code/PreRender.c b/src/code/PreRender.c index d240f6c80e4..6e9252f5b91 100644 --- a/src/code/PreRender.c +++ b/src/code/PreRender.c @@ -48,19 +48,19 @@ void PreRender_Destroy(PreRender* this) { /** * Copies RGBA16 image `img` to `imgDst` * - * @param gfxP Display list pointer + * @param gfxp Display list pointer * @param img Image to copy from * @param imgDst Buffer to copy to */ -void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) { +void PreRender_CopyImage(PreRender* this, Gfx** gfxp, void* img, void* imgDst) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LOG_UTILS_CHECK_NULL_POINTER("this", this, "../PreRender.c", 215); - LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxP, "../PreRender.c", 216); - gfx = *gfxP; + LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxp, "../PreRender.c", 216); + gfx = *gfxp; LOG_UTILS_CHECK_NULL_POINTER("glistp", gfx, "../PreRender.c", 218); gDPPipeSync(gfx++); @@ -108,22 +108,22 @@ void PreRender_CopyImage(PreRender* this, Gfx** gfxP, void* img, void* imgDst) { gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); - *gfxP = gfx; + *gfxp = gfx; } /** * Copies part of `this->fbufSave` in the region (this->ulx, this->uly), (this->lrx, this->lry) to the same location in * `this->fbuf`. */ -void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { +void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LOG_UTILS_CHECK_NULL_POINTER("this", this, "../PreRender.c", 278); - LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxP, "../PreRender.c", 279); - gfx = *gfxP; + LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxp, "../PreRender.c", 279); + gfx = *gfxp; LOG_UTILS_CHECK_NULL_POINTER("glistp", gfx, "../PreRender.c", 281); gDPPipeSync(gfx++); @@ -175,22 +175,22 @@ void PreRender_CopyImageRegionImpl(PreRender* this, Gfx** gfxP) { gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, this->width, this->height); - *gfxP = gfx; + *gfxp = gfx; } /** * Copies `buf` to `bufSave`, discarding the alpha channel and modulating the RGB channel by * the color ('r', 'g', 'b', 'a') */ -void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a) { +void func_800C170C(PreRender* this, Gfx** gfxp, void* buf, void* bufSave, u32 r, u32 g, u32 b, u32 a) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LOG_UTILS_CHECK_NULL_POINTER("this", this, "../PreRender.c", 343); - LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxP, "../PreRender.c", 344); - gfx = *gfxP; + LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxp, "../PreRender.c", 344); + gfx = *gfxp; LOG_UTILS_CHECK_NULL_POINTER("glistp", gfx, "../PreRender.c", 346); gDPPipeSync(gfx++); @@ -245,33 +245,33 @@ void func_800C170C(PreRender* this, Gfx** gfxP, void* buf, void* bufSave, u32 r, gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); - *gfxP = gfx; + *gfxp = gfx; } /** * Copies `fbuf` to `fbufSave`, discarding the alpha channel and leaving the rgb channel unchanged */ -void func_800C1AE8(PreRender* this, Gfx** gfxP, void* fbuf, void* fbufSave) { - func_800C170C(this, gfxP, fbuf, fbufSave, 255, 255, 255, 255); +void func_800C1AE8(PreRender* this, Gfx** gfxp, void* fbuf, void* fbufSave) { + func_800C170C(this, gfxp, fbuf, fbufSave, 255, 255, 255, 255); } /** * Reads the coverage values stored in the RGBA16 format `img` with dimensions `this->width`, `this->height` and * converts it to an 8-bpp intensity image. * - * @param gfxP Display list pointer + * @param gfxp Display list pointer * @param img Image to read coverage from * @param cvgDst Buffer to store coverage into */ -void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* cvgDst) { +void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxp, void* img, void* cvgDst) { Gfx* gfx; s32 rowsRemaining; s32 curRow; s32 nRows; LOG_UTILS_CHECK_NULL_POINTER("this", this, "../PreRender.c", 422); - LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxP, "../PreRender.c", 423); - gfx = *gfxP; + LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxp, "../PreRender.c", 423); + gfx = *gfxp; LOG_UTILS_CHECK_NULL_POINTER("glistp", gfx, "../PreRender.c", 425); gDPPipeSync(gfx++); @@ -341,30 +341,30 @@ void PreRender_CoverageRgba16ToI8(PreRender* this, Gfx** gfxP, void* img, void* // Reset the color image to the current framebuffer gDPPipeSync(gfx++); gDPSetColorImage(gfx++, G_IM_FMT_RGBA, G_IM_SIZ_16b, this->width, this->fbuf); - *gfxP = gfx; + *gfxp = gfx; } /** * Saves zbuf to zbufSave */ -void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxP) { +void PreRender_SaveZBuffer(PreRender* this, Gfx** gfxp) { LOG_UTILS_CHECK_NULL_POINTER("this->zbuf_save", this->zbufSave, "../PreRender.c", 481); LOG_UTILS_CHECK_NULL_POINTER("this->zbuf", this->zbuf, "../PreRender.c", 482); if ((this->zbufSave != NULL) && (this->zbuf != NULL)) { - PreRender_CopyImage(this, gfxP, this->zbuf, this->zbufSave); + PreRender_CopyImage(this, gfxp, this->zbuf, this->zbufSave); } } /** * Saves fbuf to fbufSave */ -void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP) { +void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxp) { LOG_UTILS_CHECK_NULL_POINTER("this->fbuf_save", this->fbufSave, "../PreRender.c", 495); LOG_UTILS_CHECK_NULL_POINTER("this->fbuf", this->fbuf, "../PreRender.c", 496); if ((this->fbufSave != NULL) && (this->fbuf != NULL)) { - func_800C1AE8(this, gfxP, this->fbuf, this->fbufSave); + func_800C1AE8(this, gfxp, this->fbuf, this->fbufSave); } } @@ -372,8 +372,8 @@ void PreRender_SaveFramebuffer(PreRender* this, Gfx** gfxP) { * Fetches the coverage of the current framebuffer into an image of the same format as the current color image, storing * it over the framebuffer in memory. */ -void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxP) { - Gfx* gfx = *gfxP; +void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxp) { + Gfx* gfx = *gfxp; gDPPipeSync(gfx++); // Set the blend color to full white and set maximum depth. @@ -407,26 +407,26 @@ void PreRender_FetchFbufCoverage(PreRender* this, Gfx** gfxP) { gDPFillRectangle(gfx++, 0, 0, this->width, this->height); gDPPipeSync(gfx++); - *gfxP = gfx; + *gfxp = gfx; } /** * Draws the coverage of the current framebuffer `this->fbuf` to an I8 image at `this->cvgSave`. Overwrites * `this->fbuf` in the process. */ -void PreRender_DrawCoverage(PreRender* this, Gfx** gfxP) { - PreRender_FetchFbufCoverage(this, gfxP); +void PreRender_DrawCoverage(PreRender* this, Gfx** gfxp) { + PreRender_FetchFbufCoverage(this, gfxp); LOG_UTILS_CHECK_NULL_POINTER("this->cvg_save", this->cvgSave, "../PreRender.c", 532); if (this->cvgSave != NULL) { - PreRender_CoverageRgba16ToI8(this, gfxP, this->fbuf, this->cvgSave); + PreRender_CoverageRgba16ToI8(this, gfxp, this->fbuf, this->cvgSave); } } /** * Restores zbufSave to zbuf */ -void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP) { - PreRender_CopyImage(this, gfxP, this->zbufSave, this->zbuf); +void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxp) { + PreRender_CopyImage(this, gfxp, this->zbufSave, this->zbuf); } /** @@ -434,7 +434,7 @@ void PreRender_RestoreZBuffer(PreRender* this, Gfx** gfxP) { * the alpha channel from `this->cvgSave` modulated by environment color. The alpha channel becomes the framebuffer's * coverage content. */ -void func_800C213C(PreRender* this, Gfx** gfxP) { +void func_800C213C(PreRender* this, Gfx** gfxp) { Gfx* gfx; s32 rowsRemaining; s32 curRow; @@ -443,8 +443,8 @@ void func_800C213C(PreRender* this, Gfx** gfxP) { if (this->cvgSave != NULL) { LOG_UTILS_CHECK_NULL_POINTER("this", this, "../PreRender.c", 563); - LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxP, "../PreRender.c", 564); - gfx = *gfxP; + LOG_UTILS_CHECK_NULL_POINTER("glistpp", gfxp, "../PreRender.c", 564); + gfx = *gfxp; LOG_UTILS_CHECK_NULL_POINTER("glistp", gfx, "../PreRender.c", 566); gDPPipeSync(gfx++); @@ -510,23 +510,23 @@ void func_800C213C(PreRender* this, Gfx** gfxP) { #undef FB_ROWS gDPPipeSync(gfx++); - *gfxP = gfx; + *gfxp = gfx; } } /** * Copies fbufSave to fbuf */ -void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxP) { - PreRender_CopyImage(this, gfxP, this->fbufSave, this->fbuf); +void PreRender_RestoreFramebuffer(PreRender* this, Gfx** gfxp) { + PreRender_CopyImage(this, gfxp, this->fbufSave, this->fbuf); } /** * Copies part of `this->fbufSave` in the region (this->ulx, this->uly), (this->lrx, this->lry) to the same location in * `this->fbuf`. */ -void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxP) { - PreRender_CopyImageRegionImpl(this, gfxP); +void PreRender_CopyImageRegion(PreRender* this, Gfx** gfxp) { + PreRender_CopyImageRegionImpl(this, gfxp); } /** diff --git a/src/code/code_8006C510.c b/src/code/code_8006C510.c new file mode 100644 index 00000000000..feed11512aa --- /dev/null +++ b/src/code/code_8006C510.c @@ -0,0 +1,42 @@ +#include "ultra64.h" +#include "animation.h" +#include "math.h" + +f32 func_8006C510(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { + char pad[0x1C]; + f32 sq = SQ(arg0); + f32 cube = sq * arg0; + + return (((cube + cube) - sq * 3.0f) + 1.0f) * arg2 + (sq * 3.0f - (cube + cube)) * arg3 + + ((cube - (sq + sq)) + arg0) * arg4 * arg1 + (cube - sq) * arg5 * arg1; +} + +f32 func_8006C5A8(f32 target, TransformData* transData, s32 refIdx) { + s32 i; + s32 j; + + if (target <= transData->unk_02) { + return transData->unk_08; + } + if (target >= transData[refIdx - 1].unk_02) { + return transData[refIdx - 1].unk_08; + } + + for (i = 0;; i++) { + j = i + 1; + if (transData[j].unk_02 > target) { + if (transData[i].unk_00 & 1) { + return transData[i].unk_08; + } else if (transData[i].unk_00 & 2) { + return transData[i].unk_08 + + ((target - (f32)transData[i].unk_02) / ((f32)transData[j].unk_02 - (f32)transData[i].unk_02)) * + (transData[j].unk_08 - transData[i].unk_08); + } else { + f32 diff = (f32)transData[j].unk_02 - (f32)transData[i].unk_02; + return func_8006C510((target - transData[i].unk_02) / ((f32)transData[j].unk_02 - transData[i].unk_02), + diff * (1.0f / 30.0f), transData[i].unk_08, transData[j].unk_08, + transData[i].unk_06, transData[j].unk_04); + } + } + } +} diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c new file mode 100644 index 00000000000..27878d5807c --- /dev/null +++ b/src/code/code_800ACE70.c @@ -0,0 +1,101 @@ +#include "ultra64.h" +#include "gfx.h" + +#include "functions.h" +#include "z64.h" + +// Note : This file is related to z_vismono, the original name was probably z_vis + +Gfx D_8012AC00[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsDPPipeSync(), + gsDPSetBlendColor(0, 0, 0, 8), + gsSPEndDisplayList(), +}; + +Gfx D_8012AC28[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsSPEndDisplayList(), +}; + +Gfx D_8012AC40[] = { + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), + + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsSPEndDisplayList(), +}; + +Gfx D_8012AC58[] = { + gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), + gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | + GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), + gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + gsSPEndDisplayList(), +}; + +// Init +void func_800ACE70(struct_801664F0* this) { + this->type = 0; + this->setScissor = false; + this->color.r = 255; + this->color.g = 255; + this->color.b = 255; + this->color.a = 255; +} + +// Destroy +void func_800ACE90(struct_801664F0* this) { +} + +// Draw +void func_800ACE98(struct_801664F0* this, Gfx** gfxp) { + Gfx* gfx = *gfxp; + + gDPPipeSync(gfx++); + gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); + + if (this->setScissor == true) { + gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + } + + switch (this->type) { + case 1: + gSPDisplayList(gfx++, D_8012AC40); + break; + case 2: + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); + gSPDisplayList(gfx++, D_8012AC58); + break; + case 3: + gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba); + gSPDisplayList(gfx++, D_8012AC00); + break; + case 4: + gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba); + gSPDisplayList(gfx++, D_8012AC28); + break; + } + + gDPPipeSync(gfx++); + *gfxp = gfx; +} diff --git a/src/code/code_800AD920.c b/src/code/code_800AD920.c new file mode 100644 index 00000000000..62b9b54c5bc --- /dev/null +++ b/src/code/code_800AD920.c @@ -0,0 +1,68 @@ +#include "ultra64.h" +#include "gfx.h" + +#include "functions.h" +#include "z64.h" + +// Note : This file is related to z_vismono, the original name was probably z_vis + +// z-buffer +extern u16 D_0E000000[]; + +// Init +void func_800AD920(struct_80166500* this) { + this->useRgba = false; + this->setScissor = false; + this->primColor.r = 255; + this->primColor.g = 255; + this->primColor.b = 255; + this->primColor.a = 255; + + // clang-format off + this->envColor.r = 0; \ + this->envColor.g = 0; \ + this->envColor.b = 0; \ + this->envColor.a = 255; + // clang-format on +} + +// Destroy +void func_800AD950(struct_80166500* this) { +} + +// Draw +void func_800AD958(struct_80166500* this, Gfx** gfxp) { + Gfx* gfx = *gfxp; + s32 pad; + u16* tex = D_0E000000; + s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA; + s32 y; + s32 height = 6; + + gDPPipeSync(gfx++); + if (this->setScissor == true) { + gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); + } + + gDPSetOtherMode(gfx++, + G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | + G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2); + gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); + + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + + for (y = 0; y <= SCREEN_HEIGHT - height; y += height) { + gDPLoadTextureBlock(gfx++, tex, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + + gSPTextureRectangle(gfx++, 0, y << 2, SCREEN_WIDTH << 2, (y + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, + 1 << 10); + tex += SCREEN_WIDTH * height; + } + + gDPPipeSync(gfx++); + *gfxp = gfx; +} diff --git a/src/code/code_800D71F0.s b/src/code/code_800D71F0.s new file mode 100644 index 00000000000..a5a1fe63dd9 --- /dev/null +++ b/src/code/code_800D71F0.s @@ -0,0 +1,1359 @@ +#include "ultra64/asm.h" +#include "ultra64/regdef.h" + +.text + +LEAF(func_800D71F0) + li a2, 188 + blt a0, 0x8800, .L800D723C + srl a1, a0, 8 + addi a1, a1, -0x88 + andi a3, a0, 0xFF + addi a3, a3, -0x40 + mul a2, a2, a1 + blt a3, 0x40, .L800D722C + addi a3, a3, -1 +.L800D722C: + mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ + addi a3, a3, 0x30A + add a3, a3, a2 + sll v0, a3, 7 + jr ra + +.L800D723C: + srl a1, a0, 8 + addi a1, a1, -0x81 + andi a3, a0, 0xFF + addi a3, a3, -0x40 + mul a2, a2, a1 + blt a3, 0x40, .L800D7268 + addi a3, a3, -1 +.L800D7268: + mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ + add a3, a3, a2 + sll a3, a3, 1 + la a2, D_800D7288 + add a3, a3, a2 + lh a2, (a3) + sll v0, a2, 7 + jr ra +END(func_800D71F0) + +DATA(D_800D7288) + .half 0x0000 + .half 0x0001 + .half 0x0002 + .half 0x0003 + .half 0x0004 + .half 0x0005 + .half 0x0006 + .half 0x0007 + .half 0x0008 + .half 0x0009 + .half 0x000A + .half 0x000B + .half 0x000C + .half 0x000D + .half 0x000E + .half 0x000F + .half 0x0010 + .half 0x0011 + .half 0x0012 + .half 0x0013 + .half 0x0014 + .half 0x0015 + .half 0x0016 + .half 0x0017 + .half 0x0018 + .half 0x0019 + .half 0x001A + .half 0x001B + .half 0x001C + .half 0x001D + .half 0x001E + .half 0x001F + .half 0x0020 + .half 0x0021 + .half 0x0022 + .half 0x0023 + .half 0x0024 + .half 0x0025 + .half 0x0026 + .half 0x0027 + .half 0x0028 + .half 0x0029 + .half 0x002A + .half 0x002B + .half 0x002C + .half 0x002D + .half 0x002E + .half 0x002F + .half 0x0030 + .half 0x0031 + .half 0x0032 + .half 0x0033 + .half 0x0034 + .half 0x0035 + .half 0x0036 + .half 0x0037 + .half 0x0038 + .half 0x0039 + .half 0x003A + .half 0x003B + .half 0x003C + .half 0x003D + .half 0x003E + .half 0x003F + .half 0x0040 + .half 0x0041 + .half 0x0042 + .half 0x0043 + .half 0x0044 + .half 0x0045 + .half 0x0046 + .half 0x0047 + .half 0x0048 + .half 0x0049 + .half 0x004A + .half 0x004B + .half 0x004C + .half 0x004D + .half 0x004E + .half 0x004F + .half 0x0050 + .half 0x0051 + .half 0x0052 + .half 0x0053 + .half 0x0054 + .half 0x0055 + .half 0x0056 + .half 0x0057 + .half 0x0058 + .half 0x0059 + .half 0x005A + .half 0x005B + .half 0x005C + .half 0x005D + .half 0x005E + .half 0x005F + .half 0x0060 + .half 0x0061 + .half 0x0062 + .half 0x0063 + .half 0x0064 + .half 0x0065 + .half 0x0066 + .half 0x0067 + .half 0x0068 + .half 0x0069 + .half 0x006A + .half 0x006B + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x006C + .half 0x006D + .half 0x006E + .half 0x006F + .half 0x0070 + .half 0x0071 + .half 0x0072 + .half 0x0073 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0074 + .half 0x0075 + .half 0x0076 + .half 0x0077 + .half 0x0078 + .half 0x0079 + .half 0x007A + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x007B + .half 0x007C + .half 0x007D + .half 0x007E + .half 0x007F + .half 0x0080 + .half 0x0081 + .half 0x0082 + .half 0x0083 + .half 0x0084 + .half 0x0085 + .half 0x0086 + .half 0x0087 + .half 0x0088 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0089 + .half 0x008A + .half 0x008B + .half 0x008C + .half 0x008D + .half 0x008E + .half 0x008F + .half 0x0090 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0091 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0092 + .half 0x0093 + .half 0x0094 + .half 0x0095 + .half 0x0096 + .half 0x0097 + .half 0x0098 + .half 0x0099 + .half 0x009A + .half 0x009B + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x009C + .half 0x009D + .half 0x009E + .half 0x009F + .half 0x00A0 + .half 0x00A1 + .half 0x00A2 + .half 0x00A3 + .half 0x00A4 + .half 0x00A5 + .half 0x00A6 + .half 0x00A7 + .half 0x00A8 + .half 0x00A9 + .half 0x00AA + .half 0x00AB + .half 0x00AC + .half 0x00AD + .half 0x00AE + .half 0x00AF + .half 0x00B0 + .half 0x00B1 + .half 0x00B2 + .half 0x00B3 + .half 0x00B4 + .half 0x00B5 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x00B6 + .half 0x00B7 + .half 0x00B8 + .half 0x00B9 + .half 0x00BA + .half 0x00BB + .half 0x00BC + .half 0x00BD + .half 0x00BE + .half 0x00BF + .half 0x00C0 + .half 0x00C1 + .half 0x00C2 + .half 0x00C3 + .half 0x00C4 + .half 0x00C5 + .half 0x00C6 + .half 0x00C7 + .half 0x00C8 + .half 0x00C9 + .half 0x00CA + .half 0x00CB + .half 0x00CC + .half 0x00CD + .half 0x00CE + .half 0x00CF + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x00D0 + .half 0x00D1 + .half 0x00D2 + .half 0x00D3 + .half 0x00D4 + .half 0x00D5 + .half 0x00D6 + .half 0x00D7 + .half 0x00D8 + .half 0x00D9 + .half 0x00DA + .half 0x00DB + .half 0x00DC + .half 0x00DD + .half 0x00DE + .half 0x00DF + .half 0x00E0 + .half 0x00E1 + .half 0x00E2 + .half 0x00E3 + .half 0x00E4 + .half 0x00E5 + .half 0x00E6 + .half 0x00E7 + .half 0x00E8 + .half 0x00E9 + .half 0x00EA + .half 0x00EB + .half 0x00EC + .half 0x00ED + .half 0x00EE + .half 0x00EF + .half 0x00F0 + .half 0x00F1 + .half 0x00F2 + .half 0x00F3 + .half 0x00F4 + .half 0x00F5 + .half 0x00F6 + .half 0x00F7 + .half 0x00F8 + .half 0x00F9 + .half 0x00FA + .half 0x00FB + .half 0x00FC + .half 0x00FD + .half 0x00FE + .half 0x00FF + .half 0x0100 + .half 0x0101 + .half 0x0102 + .half 0x0103 + .half 0x0104 + .half 0x0105 + .half 0x0106 + .half 0x0107 + .half 0x0108 + .half 0x0109 + .half 0x010A + .half 0x010B + .half 0x010C + .half 0x010D + .half 0x010E + .half 0x010F + .half 0x0110 + .half 0x0111 + .half 0x0112 + .half 0x0113 + .half 0x0114 + .half 0x0115 + .half 0x0116 + .half 0x0117 + .half 0x0118 + .half 0x0119 + .half 0x011A + .half 0x011B + .half 0x011C + .half 0x011D + .half 0x011E + .half 0x011F + .half 0x0120 + .half 0x0121 + .half 0x0122 + .half 0x0123 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0124 + .half 0x0125 + .half 0x0126 + .half 0x0127 + .half 0x0128 + .half 0x0129 + .half 0x012A + .half 0x012B + .half 0x012C + .half 0x012D + .half 0x012E + .half 0x012F + .half 0x0130 + .half 0x0131 + .half 0x0132 + .half 0x0133 + .half 0x0134 + .half 0x0135 + .half 0x0136 + .half 0x0137 + .half 0x0138 + .half 0x0139 + .half 0x013A + .half 0x013B + .half 0x013C + .half 0x013D + .half 0x013E + .half 0x013F + .half 0x0140 + .half 0x0141 + .half 0x0142 + .half 0x0143 + .half 0x0144 + .half 0x0145 + .half 0x0146 + .half 0x0147 + .half 0x0148 + .half 0x0149 + .half 0x014A + .half 0x014B + .half 0x014C + .half 0x014D + .half 0x014E + .half 0x014F + .half 0x0150 + .half 0x0151 + .half 0x0152 + .half 0x0153 + .half 0x0154 + .half 0x0155 + .half 0x0156 + .half 0x0157 + .half 0x0158 + .half 0x0159 + .half 0x015A + .half 0x015B + .half 0x015C + .half 0x015D + .half 0x015E + .half 0x015F + .half 0x0160 + .half 0x0161 + .half 0x0162 + .half 0x0163 + .half 0x0164 + .half 0x0165 + .half 0x0166 + .half 0x0167 + .half 0x0168 + .half 0x0169 + .half 0x016A + .half 0x016B + .half 0x016C + .half 0x016D + .half 0x016E + .half 0x016F + .half 0x0170 + .half 0x0171 + .half 0x0172 + .half 0x0173 + .half 0x0174 + .half 0x0175 + .half 0x0176 + .half 0x0177 + .half 0x0178 + .half 0x0179 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x017A + .half 0x017B + .half 0x017C + .half 0x017D + .half 0x017E + .half 0x017F + .half 0x0180 + .half 0x0181 + .half 0x0182 + .half 0x0183 + .half 0x0184 + .half 0x0185 + .half 0x0186 + .half 0x0187 + .half 0x0188 + .half 0x0189 + .half 0x018A + .half 0x018B + .half 0x018C + .half 0x018D + .half 0x018E + .half 0x018F + .half 0x0190 + .half 0x0191 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0192 + .half 0x0193 + .half 0x0194 + .half 0x0195 + .half 0x0196 + .half 0x0197 + .half 0x0198 + .half 0x0199 + .half 0x019A + .half 0x019B + .half 0x019C + .half 0x019D + .half 0x019E + .half 0x019F + .half 0x01A0 + .half 0x01A1 + .half 0x01A2 + .half 0x01A3 + .half 0x01A4 + .half 0x01A5 + .half 0x01A6 + .half 0x01A7 + .half 0x01A8 + .half 0x01A9 + .half 0x01AA + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x01AB + .half 0x01AC + .half 0x01AD + .half 0x01AE + .half 0x01AF + .half 0x01B0 + .half 0x01B1 + .half 0x01B2 + .half 0x01B3 + .half 0x01B4 + .half 0x01B5 + .half 0x01B6 + .half 0x01B7 + .half 0x01B8 + .half 0x01B9 + .half 0x01BA + .half 0x01BB + .half 0x01BC + .half 0x01BD + .half 0x01BE + .half 0x01BF + .half 0x01C0 + .half 0x01C1 + .half 0x01C2 + .half 0x01C3 + .half 0x01C4 + .half 0x01C5 + .half 0x01C6 + .half 0x01C7 + .half 0x01C8 + .half 0x01C9 + .half 0x01CA + .half 0x01CB + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x01CC + .half 0x01CD + .half 0x01CE + .half 0x01CF + .half 0x01D0 + .half 0x01D1 + .half 0x01D2 + .half 0x01D3 + .half 0x01D4 + .half 0x01D5 + .half 0x01D6 + .half 0x01D7 + .half 0x01D8 + .half 0x01D9 + .half 0x01DA + .half 0x01DB + .half 0x01DC + .half 0x01DD + .half 0x01DE + .half 0x01DF + .half 0x01E0 + .half 0x01E1 + .half 0x01E2 + .half 0x01E3 + .half 0x01E4 + .half 0x01E5 + .half 0x01E6 + .half 0x01E7 + .half 0x01E8 + .half 0x01E9 + .half 0x01EA + .half 0x01EB + .half 0x01EC + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x01ED + .half 0x01EE + .half 0x01EF + .half 0x01F0 + .half 0x01F1 + .half 0x01F2 + .half 0x01F3 + .half 0x01F4 + .half 0x01F5 + .half 0x01F6 + .half 0x01F7 + .half 0x01F8 + .half 0x01F9 + .half 0x01FA + .half 0x01FB + .half 0x01FC + .half 0x01FD + .half 0x01FE + .half 0x01FF + .half 0x0200 + .half 0x0201 + .half 0x0202 + .half 0x0203 + .half 0x0204 + .half 0x0205 + .half 0x0206 + .half 0x0207 + .half 0x0208 + .half 0x0209 + .half 0x020A + .half 0x020B + .half 0x020C + .half 0x020D + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x020E + .half 0x020F + .half 0x0210 + .half 0x0211 + .half 0x0212 + .half 0x0213 + .half 0x0214 + .half 0x0215 + .half 0x0216 + .half 0x0217 + .half 0x0218 + .half 0x0219 + .half 0x021A + .half 0x021B + .half 0x021C + .half 0x021D + .half 0x021E + .half 0x021F + .half 0x0220 + .half 0x0221 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0222 + .half 0x0223 + .half 0x0224 + .half 0x0225 + .half 0x0226 + .half 0x0227 + .half 0x0228 + .half 0x0229 + .half 0x022A + .half 0x022B + .half 0x022C + .half 0x022D + .half 0x022E + .half 0x022F + .half 0x0230 + .half 0x0231 + .half 0x0232 + .half 0x0233 + .half 0x0234 + .half 0x0235 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0236 + .half 0x0237 + .half 0x0238 + .half 0x0239 + .half 0x023A + .half 0x023B + .half 0x023C + .half 0x023D + .half 0x023E + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x023F + .half 0x0240 + .half 0x0241 + .half 0x0242 + .half 0x0243 + .half 0x0244 + .half 0x0245 + .half 0x0246 + .half 0x0247 + .half 0x0248 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0249 + .half 0x024A + .half 0x024B + .half 0x024C + .half 0x024D + .half 0x024E + .half 0x024F + .half 0x0250 + .half 0x0251 + .half 0x0252 + .half 0x0253 + .half 0x0254 + .half 0x0255 + .half 0x0256 + .half 0x0257 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0258 + .half 0x0259 + .half 0x025A + .half 0x025B + .half 0x025C + .half 0x025D + .half 0x025E + .half 0x025F + .half 0x0260 + .half 0x0261 + .half 0x0262 + .half 0x0263 + .half 0x0264 + .half 0x0265 + .half 0x0266 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0267 + .half 0x0268 + .half 0x0269 + .half 0x026A + .half 0x026B + .half 0x026C + .half 0x026D + .half 0x026E + .half 0x026F + .half 0x0270 + .half 0x0271 + .half 0x0272 + .half 0x0273 + .half 0x0274 + .half 0x0275 + .half 0x0276 + .half 0x0277 + .half 0x0278 + .half 0x0279 + .half 0x027A + .half 0x027B + .half 0x027C + .half 0x027D + .half 0x027E + .half 0x027F + .half 0x0280 + .half 0x0281 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0282 + .half 0x0283 + .half 0x0284 + .half 0x0285 + .half 0x0286 + .half 0x0287 + .half 0x0288 + .half 0x0289 + .half 0x028A + .half 0x028B + .half 0x028C + .half 0x028D + .half 0x028E + .half 0x028F + .half 0x0290 + .half 0x0291 + .half 0x0292 + .half 0x0293 + .half 0x0294 + .half 0x0295 + .half 0x0296 + .half 0x0297 + .half 0x0298 + .half 0x0299 + .half 0x029A + .half 0x029B + .half 0x029C + .half 0x029D + .half 0x029E + .half 0x029F + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x02A0 + .half 0x02A1 + .half 0x02A2 + .half 0x02A3 + .half 0x02A4 + .half 0x02A5 + .half 0x02A6 + .half 0x02A7 + .half 0x02A8 + .half 0x02A9 + .half 0x02AA + .half 0x02AB + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x02AC + .half 0x02AD + .half 0x02AE + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x02AF + .half 0x02B0 + .half 0x02B1 + .half 0x02B2 + .half 0x02B3 + .half 0x02B4 + .half 0x02B5 + .half 0x02B6 + .half 0x02B7 + .half 0x02B8 + .half 0x02B9 + .half 0x02BA + .half 0x02BB + .half 0x02BC + .half 0x02BD + .half 0x02BE + .half 0x02BF + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x02C0 + .half 0x02C1 + .half 0x02C2 + .half 0x02C3 + .half 0x02C4 + .half 0x02C5 + .half 0x02C6 + .half 0x02C7 + .half 0x02C8 + .half 0x02C9 + .half 0x02CA + .half 0x02CB + .half 0x02CC + .half 0x02CD + .half 0x02CE + .half 0x02CF + .half 0x02D0 + .half 0x02D1 + .half 0x02D2 + .half 0x02D3 + .half 0x02D4 + .half 0x02D5 + .half 0x02D6 + .half 0x02D7 + .half 0x02D8 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x02D9 + .half 0x02DA + .half 0x02DB + .half 0x02DC + .half 0x02DD + .half 0x02DE + .half 0x02DF + .half 0x02E0 + .half 0x02E1 + .half 0x02E2 + .half 0x02E3 + .half 0x02E4 + .half 0x02E5 + .half 0x02E6 + .half 0x02E7 + .half 0x02E8 + .half 0x02E9 + .half 0x02EA + .half 0x02EB + .half 0x02EC + .half 0x02ED + .half 0x02EE + .half 0x02EF + .half 0x02F0 + .half 0x02F1 + .half 0x02F2 + .half 0x02F3 + .half 0x02F4 + .half 0x02F5 + .half 0x02F6 + .half 0x02F7 + .half 0x02F8 + .half 0x02F9 + .half 0x02FA + .half 0x02FB + .half 0x02FC + .half 0x02FD + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x02FE + .half 0x02FF + .half 0x0300 + .half 0x0301 + .half 0x0302 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0303 + .half 0x0304 + .half 0x0305 + .half 0x0306 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0000 + .half 0x0307 + .half 0x0308 + .half 0x0309 +ENDDATA(D_800D7288) diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 800eecc52ea..99d34dbfa4f 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -13,7 +13,7 @@ * When entering this button combination, buttons that are &'d together must all be pressed together. * The L & R presses and B & A presses may be interchanged in the order they are pressed. * - * "Clients" may be registered with the crash screen to extend its functionality. There are + * "Clients" may be registered with the crash screen to extend it's functionality. There are * two kinds of client, "Client" and "AddressConverterClient". Clients contribute one or * more pages to the crash debugger, while Address Converter Clients allow the crash screen to look up * the virtual addresses of dynamically allocated overlays. @@ -26,7 +26,7 @@ * be displayed next to the floating-point status register. * - Stack Trace * This page displays a full backtrace from the crashing function back to the start of the thread. It - * displays the Program Counter for each function and, if applicable, the Virtual Program Counter + * displays both the Program Counter for each function and if applicable the Virtual Program Counter * for relocated functions in overlays. * - Client Pages * After the stack trace page, currently registered clients are processed and their pages are displayed. @@ -41,8 +41,8 @@ * DPad-Down disables sending fault pages over osSyncPrintf. */ -#pragma increment_block_number "gc-eu:160 gc-eu-dbg:160 gc-eu-dbg-2:160 gc-eu-mq:160 gc-eu-mq-dbg:160 gc-jp:160" \ - "gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160 ique-cn:160" +#pragma increment_block_number "gc-eu:96 gc-eu-dbg:96 gc-eu-dbg-2:96 gc-eu-mq:96 gc-eu-mq-dbg:96 gc-jp:96 gc-jp-ce:96" \ + "gc-jp-mq:96 gc-us:96 gc-us-mq:96 ique-cn:64" #include "libc64/sleep.h" #include "libc64/sprintf.h" @@ -1022,7 +1022,7 @@ void Fault_WalkStack(uintptr_t* spPtr, uintptr_t* pcPtr, uintptr_t* raPtr) { return; } - // ensure pc is aligned and a valid pointer, if not a stack trace cannot + // ensure pc is aligned and a valid pointer, if not a tack trace cannot // be generated if (pc % 4 != 0 || !IS_KSEG0(pc)) { *pcPtr = ra; @@ -1155,7 +1155,7 @@ void Fault_DisplayFrameBuffer(void) { } /** - * Runs all registered fault clients. Each fault client displays a page + * Runs all registered fault client. Each fault client displays a page * on the crash screen. */ void Fault_ProcessClients(void) { diff --git a/src/code/fault_gc_drawer.c b/src/code/fault_gc_drawer.c index 9c2470b9b84..d08730d4f82 100644 --- a/src/code/fault_gc_drawer.c +++ b/src/code/fault_gc_drawer.c @@ -312,8 +312,6 @@ s32 Fault_Printf(const char* fmt, ...) { va_start(args, fmt); ret = Fault_VPrintf(fmt, args); - - va_end(args); return ret; } @@ -323,8 +321,6 @@ void Fault_DrawText(s32 x, s32 y, const char* fmt, ...) { Fault_SetCursor(x, y); Fault_VPrintf(fmt, args); - - va_end(args); } void Fault_SetDrawerFB(void* fb, u16 w, u16 h) { diff --git a/src/code/fault_n64.c b/src/code/fault_n64.c index 2d31b0f323a..74ae2dcc529 100644 --- a/src/code/fault_n64.c +++ b/src/code/fault_n64.c @@ -13,7 +13,7 @@ #include "thread.h" #include "translation.h" -#pragma increment_block_number "ntsc-1.0:144 ntsc-1.1:144 ntsc-1.2:144 pal-1.0:144 pal-1.1:144" +#pragma increment_block_number "ntsc-1.0:96 ntsc-1.1:96 ntsc-1.2:96 pal-1.0:96 pal-1.1:96" typedef struct FaultMgr { OSThread thread; diff --git a/src/code/game.c b/src/code/game.c index 1636633f97d..3ddf9c8c436 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -30,14 +30,16 @@ #include "dma.h" #include "game.h" #include "play_state.h" -#include "vis.h" + +#include "functions.h" +#include "z64.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" SpeedMeter D_801664D0; -VisCvg sVisCvg; -VisZBuf sVisZBuf; -VisMono sVisMono; +struct_801664F0 D_801664F0; +struct_80166500 D_80166500; +VisMono sMonoColors; ViMode sViMode; #if DEBUG_FEATURES @@ -58,43 +60,40 @@ void GameState_FaultPrint(void) { } #endif -void GameState_SetFBFilter(Gfx** gfxP) { - Gfx* gfx = *gfxP; - - if ((R_FB_FILTER_TYPE >= FB_FILTER_CVG_RGB) && (R_FB_FILTER_TYPE <= FB_FILTER_CVG_RGB_FOG)) { - // Visualize coverage - sVisCvg.vis.type = FB_FILTER_TO_CVG_TYPE(R_FB_FILTER_TYPE); - sVisCvg.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sVisCvg.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sVisCvg.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sVisCvg.vis.primColor.a = R_FB_FILTER_A; - VisCvg_Draw(&sVisCvg, &gfx); - } else if ((R_FB_FILTER_TYPE == FB_FILTER_ZBUF_IA) || (R_FB_FILTER_TYPE == FB_FILTER_ZBUF_RGBA)) { - // Visualize z-buffer - sVisZBuf.vis.type = (R_FB_FILTER_TYPE == FB_FILTER_ZBUF_RGBA); - sVisZBuf.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sVisZBuf.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sVisZBuf.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sVisZBuf.vis.primColor.a = R_FB_FILTER_A; - sVisZBuf.vis.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sVisZBuf.vis.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sVisZBuf.vis.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sVisZBuf.vis.envColor.a = R_FB_FILTER_A; - VisZBuf_Draw(&sVisZBuf, &gfx); - } else if (R_FB_FILTER_TYPE == FB_FILTER_MONO) { - // Monochrome filter - sVisMono.vis.type = 0; - sVisMono.vis.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sVisMono.vis.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sVisMono.vis.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sVisMono.vis.primColor.a = R_FB_FILTER_A; - sVisMono.vis.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sVisMono.vis.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sVisMono.vis.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sVisMono.vis.envColor.a = R_FB_FILTER_A; - VisMono_Draw(&sVisMono, &gfx); +void GameState_SetFBFilter(Gfx** gfx) { + Gfx* gfxP = *gfx; + + if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) { + D_801664F0.type = R_FB_FILTER_TYPE; + D_801664F0.color.r = R_FB_FILTER_PRIM_COLOR(0); + D_801664F0.color.g = R_FB_FILTER_PRIM_COLOR(1); + D_801664F0.color.b = R_FB_FILTER_PRIM_COLOR(2); + D_801664F0.color.a = R_FB_FILTER_A; + func_800ACE98(&D_801664F0, &gfxP); + } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { + D_80166500.useRgba = (R_FB_FILTER_TYPE == 6); + D_80166500.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + D_80166500.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + D_80166500.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + D_80166500.primColor.a = R_FB_FILTER_A; + D_80166500.envColor.r = R_FB_FILTER_ENV_COLOR(0); + D_80166500.envColor.g = R_FB_FILTER_ENV_COLOR(1); + D_80166500.envColor.b = R_FB_FILTER_ENV_COLOR(2); + D_80166500.envColor.a = R_FB_FILTER_A; + func_800AD958(&D_80166500, &gfxP); + } else if (R_FB_FILTER_TYPE == 7) { + sMonoColors.unk_00 = 0; + sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sMonoColors.primColor.a = R_FB_FILTER_A; + sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sMonoColors.envColor.a = R_FB_FILTER_A; + VisMono_Draw(&sMonoColors, &gfxP); } - *gfxP = gfx; + *gfx = gfxP; } void func_800C4344(GameState* gameState) { @@ -160,7 +159,7 @@ void func_800C4344(GameState* gameState) { } #if DEBUG_FEATURES -void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { +void GameState_DrawInputDisplay(u16 input, Gfx** gfx) { static const u16 sInpDispBtnColors[] = { GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(255, 255, 0, 1), GPACK_RGBA5551(120, 120, 120, 1), GPACK_RGBA5551(120, 120, 120, 1), @@ -170,10 +169,10 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { GPACK_RGBA5551(0, 0, 255, 1), }; s32 i, j, k; - Gfx* gfx = *gfxP; + Gfx* gfxP = *gfx; - gDPPipeSync(gfx++); - gDPSetOtherMode(gfx++, + gDPPipeSync(gfxP++); + gDPSetOtherMode(gfxP++, G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2); @@ -181,14 +180,14 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) { for (i = 0; i < 16; i++) { j = i; if (input & (1 << i)) { - gDPSetFillColor(gfx++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); + gDPSetFillColor(gfxP++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]); k = i + 1; - gDPFillRectangle(gfx++, (j * 4) + 226, 220, (k * 4) + 225, 223); - gDPPipeSync(gfx++); + gDPFillRectangle(gfxP++, (j * 4) + 226, 220, (k * 4) + 225, 223); + gDPPipeSync(gfxP++); } } - *gfxP = gfx; + *gfx = gfxP; } #endif @@ -498,9 +497,9 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g startTime = endTime; LOG_UTILS_CHECK_NULL_POINTER("this->cleanup", gameState->destroy, "../game.c", 1088); - VisCvg_Init(&sVisCvg); - VisZBuf_Init(&sVisZBuf); - VisMono_Init(&sVisMono); + func_800ACE70(&D_801664F0); + func_800AD920(&D_80166500); + VisMono_Init(&sMonoColors); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Init(&sViMode); } @@ -529,9 +528,9 @@ void GameState_Destroy(GameState* gameState) { } Rumble_Destroy(); SpeedMeter_Destroy(&D_801664D0); - VisCvg_Destroy(&sVisCvg); - VisZBuf_Destroy(&sVisZBuf); - VisMono_Destroy(&sVisMono); + func_800ACE90(&D_801664F0); + func_800AD950(&D_80166500); + VisMono_Destroy(&sMonoColors); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Destroy(&sViMode); } diff --git a/src/code/gfxalloc.c b/src/code/gfxalloc.c index 3b4d72f0574..82fb1d3bba0 100644 --- a/src/code/gfxalloc.c +++ b/src/code/gfxalloc.c @@ -10,17 +10,17 @@ Gfx* Gfx_Close(Gfx* gfx, Gfx* dst) { return dst; } -void* Gfx_Alloc(Gfx** gfxP, u32 size) { +void* Gfx_Alloc(Gfx** gfx, u32 size) { u8* ptr; Gfx* dst; size = ALIGN8(size); - ptr = (u8*)(*gfxP + 1); + ptr = (u8*)(*gfx + 1); dst = (Gfx*)(ptr + size); - gSPBranchList(*gfxP, dst); + gSPBranchList(*gfx, dst); - *gfxP = dst; + *gfx = dst; return ptr; } diff --git a/src/code/graph.c b/src/code/graph.c index 826dd71c087..95a7aded995 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -33,8 +33,8 @@ #define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_TAIL_MAGIC 0x5678 -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ - "ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" /** * The time at which the previous `Graph_Update` ended. diff --git a/src/code/kanread.s b/src/code/kanread.s deleted file mode 100644 index fdf69ed9be0..00000000000 --- a/src/code/kanread.s +++ /dev/null @@ -1,205 +0,0 @@ -#include "ultra64/asm.h" -#include "ultra64/regdef.h" - -.text - -/** - * s32 Kanji_OffsetFromShiftJIS(s32 sjis); - * - * Returns the offset of the glyph texture data in the file `kanji` corresponding - * to a given 2-byte Shift-JIS codepoint. No range validity check is carried out. - * - * A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/ - * The file `kanji` contains the 'Level 1' kanji (0x889F-0x9872), and a reworked - * version of the non-kanji section that includes extra English and Hylian glyphs. - * - * @note This function assumes that its argument is a valid Shift-JIS codepoint; - * there is no range protection at all. - * - * @param sjis Shift-JIS Codepoint of glyph. - * @return s32 offset into `kanji` file. - * - * @remark Almost identical to "LeoGetKadr" from libleo. - */ -LEAF(Kanji_OffsetFromShiftJIS) - /* Characters with codepoints >= 0x8800 are kanji. Arrangement is regular, */ - /* so convert index directly. */ - li a2, 0xBC - blt a0, 0x8800, .nonkanji - /* 0xBC is number of glyphs in one block in the `kanji` file: */ - /* 0x100 possible codepoints with the same byte1 */ - /* - 0x40 unused at beginning */ - /* - 1 unused at 0x7F */ - /* - 3 unused at 0xFD, 0xFE, 0xFF */ - /* Get byte1 and adjust so starts at 0 */ - srl a1, a0, 8 - addi a1, a1, -0x88 - /* Get byte2 and adjust so starts at 0 */ - andi a3, a0, 0xFF - addi a3, a3, -0x40 - mul a2, a2, a1 - blt a3, 0x40, .kanji_lower_halfblock - - /* 0x__7F is always empty and elided in the file, so decrement if larger */ - addi a3, a3, -1 -.kanji_lower_halfblock: - mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ - addi a3, a3, 0x30A - add a3, a3, a2 - /* returns (0x30A + (adjusted byte2) + (adjusted byte1) * 0xBC) * FONT_CHAR_TEX_SIZE */ - sll v0, a3, 7 - jr ra - -/* Non-kanji are arranged with irregular gaps, use the lookup table. */ -.nonkanji: - /* Get byte1 and adjust so starts at 0 */ - srl a1, a0, 8 - addi a1, a1, -0x81 - /* Get byte2 and adjust so starts at 0 */ - andi a3, a0, 0xFF - addi a3, a3, -0x40 - mul a2, a2, a1 - blt a3, 0x40, .nonkanji_lower_halfblock - - /* 0x__7F is always empty and elided in the file, so decrement if larger */ - addi a3, a3, -1 -.nonkanji_lower_halfblock: - mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ - add a3, a3, a2 - sll a3, a3, 1 - la a2, sNonKanjiIndices - add a3, a3, a2 - lh a2, (a3) - /* returns sNonKanjiIndices[(adjusted byte2) + (adjusted byte1) * 0xBC] * FONT_CHAR_TEX_SIZE */ - sll v0, a2, 7 - jr ra -END(Kanji_OffsetFromShiftJIS) - -/** - * Nearly equivalent C code (Equivalent for all valid input, will behave differently on overflow due to the use of `add` in the original): - * - * extern u16 sNonKanjiIndices[]; - * - * s32 Kanji_OffsetFromShiftJIS(s32 sjis) { - * u32 byte1 = (u32)sjis >> 8; - * u32 byte2 = sjis & 0xFF; - * - * byte2 -= 0x40; - * if (byte2 >= 0x40) { - * byte2--; - * } - * - * if (sjis >= 0x8800) { - * byte1 -= 0x88; - * return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE; - * } else { - * byte1 -= 0x81; - * return sNonKanjiIndices[byte2 + byte1 * 0xBC] * FONT_CHAR_TEX_SIZE; - * } - * } - */ - -/** - * Index table, formatting follows conventional Shift-JIS character table layout, - * with space for the missing 0x__7F,0x__FD,0x__FE,0x__FF entries, and split - * into blocks by high byte. - */ -DATA(sNonKanjiIndices) -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x814_ */ .half 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F -/* 0x815_ */ .half 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F -/* 0x816_ */ .half 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F -/* 0x817_ */ .half 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E -/* 0x818_ */ .half 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E -/* 0x819_ */ .half 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E -/* 0x81A_ */ .half 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x0000, 0x0000, 0x0000 -/* 0x81B_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073 -/* 0x81C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0000 -/* 0x81D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F -/* 0x81E_ */ .half 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x81F_ */ .half 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0000, 0x0000, 0x0000, 0x0000, 0x0091 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092 -/* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB -/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4 -/* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0 -/* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0 -/* 0x82B_ */ .half 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0 -/* 0x82C_ */ .half 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100 -/* 0x82D_ */ .half 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F, 0x0110 -/* 0x82E_ */ .half 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, 0x011F, 0x0120 -/* 0x82F_ */ .half 0x0121, 0x0122, 0x0123, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x834_ */ .half 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133 -/* 0x835_ */ .half 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143 -/* 0x836_ */ .half 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x014F, 0x0150, 0x0151, 0x0152, 0x0153 -/* 0x837_ */ .half 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162 -/* 0x838_ */ .half 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0170, 0x0171, 0x0172 -/* 0x839_ */ .half 0x0173, 0x0174, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x017A -/* 0x83A_ */ .half 0x017B, 0x017C, 0x017D, 0x017E, 0x017F, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018A -/* 0x83B_ */ .half 0x018B, 0x018C, 0x018D, 0x018E, 0x018F, 0x0190, 0x0191, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192 -/* 0x83C_ */ .half 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x0198, 0x0199, 0x019A, 0x019B, 0x019C, 0x019D, 0x019E, 0x019F, 0x01A0, 0x01A1, 0x01A2 -/* 0x83D_ */ .half 0x01A3, 0x01A4, 0x01A5, 0x01A6, 0x01A7, 0x01A8, 0x01A9, 0x01AA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x83E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x83F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x844_ */ .half 0x01AB, 0x01AC, 0x01AD, 0x01AE, 0x01AF, 0x01B0, 0x01B1, 0x01B2, 0x01B3, 0x01B4, 0x01B5, 0x01B6, 0x01B7, 0x01B8, 0x01B9, 0x01BA -/* 0x845_ */ .half 0x01BB, 0x01BC, 0x01BD, 0x01BE, 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C5, 0x01C6, 0x01C7, 0x01C8, 0x01C9, 0x01CA -/* 0x846_ */ .half 0x01CB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x847_ */ .half 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01D0, 0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA -/* 0x848_ */ .half 0x01DB, 0x01DC, 0x01DD, 0x01DE, 0x01DF, 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E4, 0x01E5, 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA -/* 0x849_ */ .half 0x01EB, 0x01EC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01ED -/* 0x84A_ */ .half 0x01EE, 0x01EF, 0x01F0, 0x01F1, 0x01F2, 0x01F3, 0x01F4, 0x01F5, 0x01F6, 0x01F7, 0x01F8, 0x01F9, 0x01FA, 0x01FB, 0x01FC, 0x01FD -/* 0x84B_ */ .half 0x01FE, 0x01FF, 0x0200, 0x0201, 0x0202, 0x0203, 0x0204, 0x0205, 0x0206, 0x0207, 0x0208, 0x0209, 0x020A, 0x020B, 0x020C, 0x020D -/* 0x84C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x84D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x84E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x84F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x854_ */ .half 0x020E, 0x020F, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021A, 0x021B, 0x021C, 0x021D -/* 0x855_ */ .half 0x021E, 0x021F, 0x0220, 0x0221, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0222, 0x0223 -/* 0x856_ */ .half 0x0224, 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, 0x022C, 0x022D, 0x022E, 0x022F, 0x0230, 0x0231, 0x0232, 0x0233 -/* 0x857_ */ .half 0x0234, 0x0235, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0236, 0x0237, 0x0238 -/* 0x858_ */ .half 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x859_ */ .half 0x0000, 0x023F, 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0000, 0x0000, 0x0000, 0x0000, 0x0249 -/* 0x85A_ */ .half 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, 0x0000, 0x0000 -/* 0x85B_ */ .half 0x0000, 0x0000, 0x0000, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, 0x0262, 0x0263, 0x0264 -/* 0x85C_ */ .half 0x0265, 0x0266, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x85D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0267, 0x0268, 0x0269, 0x026A, 0x026B -/* 0x85E_ */ .half 0x026C, 0x026D, 0x026E, 0x026F, 0x0270, 0x0271, 0x0272, 0x0273, 0x0274, 0x0275, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B -/* 0x85F_ */ .half 0x027C, 0x027D, 0x027E, 0x027F, 0x0280, 0x0281, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x864_ */ .half 0x0282, 0x0283, 0x0284, 0x0285, 0x0286, 0x0287, 0x0288, 0x0289, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291 -/* 0x865_ */ .half 0x0292, 0x0293, 0x0294, 0x0295, 0x0296, 0x0297, 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x0000, 0x0000 -/* 0x866_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x867_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x868_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x869_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02A0, 0x02A1, 0x02A2, 0x02A3, 0x02A4 -/* 0x86A_ */ .half 0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86B_ */ .half 0x0000, 0x0000, 0x0000, 0x02AC, 0x02AD, 0x02AE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02AF, 0x02B0, 0x02B1, 0x02B2, 0x02B3, 0x02B4, 0x02B5, 0x02B6, 0x02B7 -/* 0x86D_ */ .half 0x02B8, 0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x874_ */ .half 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, 0x02C5, 0x02C6, 0x02C7, 0x02C8, 0x02C9, 0x02CA, 0x02CB, 0x02CC, 0x02CD, 0x02CE, 0x02CF -/* 0x875_ */ .half 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, 0x02D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x876_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x877_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x878_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x879_ */ .half 0x0000, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x02DE, 0x02DF, 0x02E0, 0x02E1, 0x02E2, 0x02E3, 0x02E4, 0x02E5, 0x02E6, 0x02E7 -/* 0x87A_ */ .half 0x02E8, 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, 0x02F0, 0x02F1, 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7 -/* 0x87B_ */ .half 0x02F8, 0x02F9, 0x02FA, 0x02FB, 0x02FC, 0x02FD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02FE, 0x02FF, 0x0300 -/* 0x87C_ */ .half 0x0301, 0x0302, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x87D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x87E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0303, 0x0304, 0x0305, 0x0306, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x87F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0307, 0x0308, 0x0309 -ENDDATA(sNonKanjiIndices) diff --git a/src/code/main.c b/src/code/main.c index f693a5c4992..e35ec69f731 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -2,14 +2,14 @@ #include "ultra64.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" \ - "ique-cn:0 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" // Declared before including other headers for BSS ordering extern uintptr_t gSegments[NUM_SEGMENTS]; #pragma increment_block_number "gc-eu:252 gc-eu-mq:252 gc-jp:252 gc-jp-ce:252 gc-jp-mq:252 gc-us:252 gc-us-mq:252" \ - "ique-cn:252 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:252 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" extern struct PreNmiBuff* gAppNmiBufferPtr; extern struct Scheduler gScheduler; @@ -44,7 +44,7 @@ extern struct IrqMgr gIrqMgr; #include "thread.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:0 ntsc-1.0:51 ntsc-1.1:51 ntsc-1.2:51 pal-1.0:49 pal-1.1:49" + "ique-cn:128 ntsc-1.0:59 ntsc-1.1:59 ntsc-1.2:59 pal-1.0:57 pal-1.1:57" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/sched.c b/src/code/sched.c index fe1d14a0c2e..f282cf206d7 100644 --- a/src/code/sched.c +++ b/src/code/sched.c @@ -58,7 +58,7 @@ #define RDP_DONE_MSG 668 #define NOTIFY_MSG 670 // original name: ENTRY_MSG -#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:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" OSTime sRSPGfxTimeStart; OSTime sRSPAudioTimeStart; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 5f41973ffe0..802bd466f99 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -7,8 +7,8 @@ #include "z_lib.h" #include "z_math.h" -#pragma increment_block_number "gc-eu:76 gc-eu-mq:76 gc-jp:76 gc-jp-ce:76 gc-jp-mq:76 gc-us:76 gc-us-mq:76 ique-cn:66" \ - "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:246" \ + "ntsc-1.0:240 ntsc-1.1:240 ntsc-1.2:240 pal-1.0:240 pal-1.1:240" s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, Vec3f* lineAClosestToB, Vec3f* lineBClosestToA); diff --git a/src/code/z_actor.c b/src/code/z_actor.c index a117131176b..0497f0f8177 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1443,7 +1443,7 @@ void Actor_UpdateBgCheckInfo(PlayState* play, Actor* actor, f32 wallCheckHeight, floorBgId = actor->floorBgId; if ((floorBgId != BGCHECK_SCENE) && (actor->bgCheckFlags & BGCHECKFLAG_GROUND)) { - DynaPolyActor_TransformCarriedActor(&play->colCtx, floorBgId, actor); + DynaPolyActor_TransformActorOnTop(&play->colCtx, floorBgId, actor); } if (flags & UPDBGCHECKINFO_FLAG_0) { @@ -4698,7 +4698,7 @@ s32 func_800354B4(PlayState* play, Actor* actor, f32 range, s16 arg3, s16 arg4, } } -void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { +void func_8003555C(PlayState* play, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3) { Color_RGBA8 color1; Color_RGBA8 color2; @@ -4711,7 +4711,7 @@ void func_8003555C(PlayState* play, Vec3f* pos, Vec3f* velocity, Vec3f* accel) { color2.b = 50; //! @bug color1 and color2 alpha components not set before being passed on - EffectSsKiraKira_SpawnSmall(play, pos, velocity, accel, &color1, &color2); + EffectSsKiraKira_SpawnSmall(play, arg1, arg2, arg3, &color1, &color2); } Vec3f D_80116268 = { 0.0f, -1.5f, 0.0f }; @@ -4723,8 +4723,8 @@ Gfx D_80116280[] = { gsSPEndDisplayList(), }; -void func_800355B8(PlayState* play, Vec3f* pos) { - func_8003555C(play, pos, &D_80116268, &D_80116274); +void func_800355B8(PlayState* play, Vec3f* arg1) { + func_8003555C(play, arg1, &D_80116268, &D_80116274); } u8 func_800355E4(PlayState* play, Collider* collider) { @@ -4830,8 +4830,8 @@ void func_80035844(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, s32 arg3) { /** * Spawns En_Part (Dissipating Flames) actor as a child of the given actor. */ -Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, PlayState* play, - s16 params, Gfx* dList) { +EnPart* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, s32 timer, s16* unused, + PlayState* play, s16 params, Gfx* dList) { EnPart* spawnedEnPart; spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y, @@ -4844,7 +4844,7 @@ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3, spawnedEnPart->timer = timer; spawnedEnPart->rotZ = arg3[1]; spawnedEnPart->rotZSpeed = arg3[2]; - return &spawnedEnPart->actor; + return spawnedEnPart; } return NULL; diff --git a/src/code/z_bg_collect.c b/src/code/z_bg_collect.c index 01114d835af..3fddb7d84de 100644 --- a/src/code/z_bg_collect.c +++ b/src/code/z_bg_collect.c @@ -8,9 +8,9 @@ #include "skin_matrix.h" /** - * Update the `carriedActor`'s position based on the dynapoly actor identified by `bgId`. + * Update the `actor`'s position based on the dynapoly actor identified by `bgId`. */ -void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) { +void DynaPolyActor_UpdatePositionOnTop(CollisionContext* colCtx, s32 bgId, Actor* actor) { MtxF prevTransform; MtxF prevTransformInv; MtxF curTransform; @@ -35,12 +35,12 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act colCtx->dyna.bgActors[bgId].curTransform.rot.z, colCtx->dyna.bgActors[bgId].curTransform.pos.x, colCtx->dyna.bgActors[bgId].curTransform.pos.y, colCtx->dyna.bgActors[bgId].curTransform.pos.z); - // Apply the movement of the dynapoly actor `bgId` over the last frame to the `carriedActor` position + // Apply the movement of the dynapoly actor `bgId` over the last frame to the `actor` position // pos = curTransform * prevTransformInv * pos // Note (curTransform * prevTransformInv) represents the transform relative to the previous frame - SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &carriedActor->world.pos, &tempPos); + SkinMatrix_Vec3fMtxFMultXYZ(&prevTransformInv, &actor->world.pos, &tempPos); SkinMatrix_Vec3fMtxFMultXYZ(&curTransform, &tempPos, &pos); - carriedActor->world.pos = pos; + actor->world.pos = pos; #if DEBUG_FEATURES if (BGCHECK_XYZ_ABSMAX <= pos.x || pos.x <= -BGCHECK_XYZ_ABSMAX || BGCHECK_XYZ_ABSMAX <= pos.y || @@ -61,18 +61,18 @@ void DynaPolyActor_UpdateCarriedActorPos(CollisionContext* colCtx, s32 bgId, Act } /** - * Update the `carriedActor`'s Y rotation based on the dynapoly actor identified by `bgId`. + * Update the `actor`'s Y rotation based on the dynapoly actor identified by `bgId`. */ -void DynaPolyActor_UpdateCarriedActorRotY(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) { +void DynaPolyActor_UpdateRotYOnTop(CollisionContext* colCtx, s32 bgId, Actor* actor) { if (DynaPoly_IsBgIdBgActor(bgId)) { s16 rotY = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y; - if (carriedActor->id == ACTOR_PLAYER) { - ((Player*)carriedActor)->yaw += rotY; + if (actor->id == ACTOR_PLAYER) { + ((Player*)actor)->yaw += rotY; } - carriedActor->shape.rot.y += rotY; - carriedActor->world.rot.y += rotY; + actor->shape.rot.y += rotY; + actor->world.rot.y += rotY; } } @@ -90,10 +90,10 @@ void func_80043334(CollisionContext* colCtx, Actor* actor, s32 bgId) { } /** - * Update the `carriedActor`'s position and Y rotation based on the dynapoly actor identified by `bgId`, according to + * Update the `actor`'s position and Y rotation based on the dynapoly actor identified by `bgId`, according to * the dynapoly actor's move flags (see `DYNA_TRANSFORM_POS` and `DYNA_TRANSFORM_ROT_Y`). */ -s32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, Actor* carriedActor) { +s32 DynaPolyActor_TransformActorOnTop(CollisionContext* colCtx, s32 bgId, Actor* actor) { s32 result = false; DynaPolyActor* dynaActor; @@ -112,12 +112,12 @@ s32 DynaPolyActor_TransformCarriedActor(CollisionContext* colCtx, s32 bgId, Acto } if (dynaActor->transformFlags & DYNA_TRANSFORM_POS) { - DynaPolyActor_UpdateCarriedActorPos(colCtx, bgId, carriedActor); + DynaPolyActor_UpdatePositionOnTop(colCtx, bgId, actor); result = true; } if (dynaActor->transformFlags & DYNA_TRANSFORM_ROT_Y) { - DynaPolyActor_UpdateCarriedActorRotY(colCtx, bgId, carriedActor); + DynaPolyActor_UpdateRotYOnTop(colCtx, bgId, actor); result = true; } diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 656bb04b5ba..ac15f6ebd04 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -14,7 +14,8 @@ #include "player.h" #include "skin_matrix.h" -#pragma increment_block_number "ntsc-1.0:136 ntsc-1.1:136 ntsc-1.2:136" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:40 ntsc-1.1:40 ntsc-1.2:40" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3baaf6579fc..416a98ef246 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -26,8 +26,8 @@ #include "save.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:64 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" s16 Camera_RequestSettingImpl(Camera* camera, s16 requestedSetting, s16 flags); s32 Camera_RequestModeImpl(Camera* camera, s16 requestedMode, u8 forceModeChange); @@ -3661,7 +3661,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:73 ntsc-1.1:73 ntsc-1.2:73 pal-1.0:73 pal-1.1:73" + "ique-cn:128 ntsc-1.0:101 ntsc-1.1:101 ntsc-1.2:101 pal-1.0:101 pal-1.1:101" s32 Camera_KeepOn4(Camera* camera) { static Vec3f sAtTarget; @@ -7477,7 +7477,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState s16 curUID; s16 j; - memset(camera, 0, sizeof(Camera)); + func_80106860(camera, 0, sizeof(*camera)); if (sInitRegs) { s32 i; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 2b7ed05de04..d5a0f4ee64f 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -16,8 +16,8 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "z_lib.h" -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:192 ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:160 pal-1.1:160" +#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ique-cn:64" \ + "ntsc-1.0:56 ntsc-1.1:56 ntsc-1.2:56 pal-1.0:56 pal-1.1:56" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 358edd32e6f..4e4295a34be 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #include "libu64/gfxprint.h" #include "array_count.h" @@ -30,6 +30,8 @@ #include "player.h" #include "save.h" +#include "functions.h" + #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/overworld/ganon_tou/ganon_tou_scene.h" @@ -1820,10 +1822,10 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) s32 csFrameCount; s16 j; - MemCpy(&totalEntries, script, sizeof(totalEntries)); + MemCopy(&totalEntries, script, sizeof(totalEntries)); script += sizeof(totalEntries); - MemCpy(&csFrameCount, script, sizeof(csFrameCount)); + MemCopy(&csFrameCount, script, sizeof(csFrameCount)); script += sizeof(csFrameCount); if ((csCtx->curFrame > csFrameCount) && (csCtx->state != CS_STATE_RUN_UNSTOPPABLE)) { @@ -1839,7 +1841,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) #endif for (i = 0; i < totalEntries; i++) { - MemCpy(&cmdType, script, sizeof(cmdType)); + MemCopy(&cmdType, script, sizeof(cmdType)); script += sizeof(cmdType); if (cmdType == CS_CMD_END_OF_SCRIPT) { @@ -1848,7 +1850,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) switch (cmdType) { case CS_CMD_MISC: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1858,7 +1860,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_LIGHT_SETTING: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1868,7 +1870,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_START_SEQ: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1878,7 +1880,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_STOP_SEQ: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1888,7 +1890,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_FADE_OUT_SEQ: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1898,7 +1900,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_RUMBLE_CONTROLLER: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1908,7 +1910,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_TIME: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1918,7 +1920,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_PLAYER_CUE: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1951,7 +1953,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_0_15: case CS_CMD_ACTOR_CUE_0_16: case CS_CMD_ACTOR_CUE_0_17: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -1984,7 +1986,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_1_15: case CS_CMD_ACTOR_CUE_1_16: case CS_CMD_ACTOR_CUE_1_17: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2013,7 +2015,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_2_11: case CS_CMD_ACTOR_CUE_2_12: case CS_CMD_ACTOR_CUE_2_13: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2041,7 +2043,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_3_10: case CS_CMD_ACTOR_CUE_3_11: case CS_CMD_ACTOR_CUE_3_12: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2065,7 +2067,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_4_6: case CS_CMD_ACTOR_CUE_4_7: case CS_CMD_ACTOR_CUE_4_8: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2087,7 +2089,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_5_4: case CS_CMD_ACTOR_CUE_5_5: case CS_CMD_ACTOR_CUE_5_6: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2110,7 +2112,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_6_5: case CS_CMD_ACTOR_CUE_6_6: case CS_CMD_ACTOR_CUE_6_7: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2132,7 +2134,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) case CS_CMD_ACTOR_CUE_7_4: case CS_CMD_ACTOR_CUE_7_5: case CS_CMD_ACTOR_CUE_7_6: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2148,7 +2150,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_ACTOR_CUE_8_0: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2164,7 +2166,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_ACTOR_CUE_9_0: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2210,7 +2212,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; case CS_CMD_TEXT: - MemCpy(&cmdEntries, script, sizeof(cmdEntries)); + MemCopy(&cmdEntries, script, sizeof(cmdEntries)); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { @@ -2231,7 +2233,7 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) break; default: - MemCpy(&cmdEntries, script, 4); + MemCopy(&cmdEntries, script, 4); script += sizeof(cmdEntries); for (j = 0; j < cmdEntries; j++) { diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index fffef14751d..60efba8efd3 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -130,17 +130,23 @@ void EffectBlure_Init1(void* thisx, void* initParamsx) { EffectBlureInit1* initParams = (EffectBlureInit1*)initParamsx; if ((this != NULL) && (initParams != NULL)) { - s32 i; - EffectBlure_InitElements(this); - - for (i = 0; i < 4; i++) { - this->p1StartColor[i] = initParams->p1StartColor[i]; - this->p2StartColor[i] = initParams->p2StartColor[i]; - this->p1EndColor[i] = initParams->p1EndColor[i]; - this->p2EndColor[i] = initParams->p2EndColor[i]; - } - + this->p1StartColor.r = initParams->p1StartColor[0]; + this->p2StartColor.r = initParams->p2StartColor[0]; + this->p1EndColor.r = initParams->p1EndColor[0]; + this->p2EndColor.r = initParams->p2EndColor[0]; + this->p1StartColor.g = initParams->p1StartColor[1]; + this->p2StartColor.g = initParams->p2StartColor[1]; + this->p1EndColor.g = initParams->p1EndColor[1]; + this->p2EndColor.g = initParams->p2EndColor[1]; + this->p1StartColor.b = initParams->p1StartColor[2]; + this->p2StartColor.b = initParams->p2StartColor[2]; + this->p1EndColor.b = initParams->p1EndColor[2]; + this->p2EndColor.b = initParams->p2EndColor[2]; + this->p1StartColor.a = initParams->p1StartColor[3]; + this->p2StartColor.a = initParams->p2StartColor[3]; + this->p1EndColor.a = initParams->p1EndColor[3]; + this->p2EndColor.a = initParams->p2EndColor[3]; this->elemDuration = initParams->elemDuration; this->unkFlag = initParams->unkFlag; this->calcMode = initParams->calcMode; @@ -165,17 +171,23 @@ void EffectBlure_Init2(void* thisx, void* initParamsx) { EffectBlureInit2* initParams = (EffectBlureInit2*)initParamsx; if ((this != NULL) && (initParams != NULL)) { - s32 i; - EffectBlure_InitElements(this); - - for (i = 0; i < 4; i++) { - this->p1StartColor[i] = initParams->p1StartColor[i]; - this->p2StartColor[i] = initParams->p2StartColor[i]; - this->p1EndColor[i] = initParams->p1EndColor[i]; - this->p2EndColor[i] = initParams->p2EndColor[i]; - } - + this->p1StartColor.r = initParams->p1StartColor[0]; + this->p2StartColor.r = initParams->p2StartColor[0]; + this->p1EndColor.r = initParams->p1EndColor[0]; + this->p2EndColor.r = initParams->p2EndColor[0]; + this->p1StartColor.g = initParams->p1StartColor[1]; + this->p2StartColor.g = initParams->p2StartColor[1]; + this->p1EndColor.g = initParams->p1EndColor[1]; + this->p2EndColor.g = initParams->p2EndColor[1]; + this->p1StartColor.b = initParams->p1StartColor[2]; + this->p2StartColor.b = initParams->p2StartColor[2]; + this->p1EndColor.b = initParams->p1EndColor[2]; + this->p2EndColor.b = initParams->p2EndColor[2]; + this->p1StartColor.a = initParams->p1StartColor[3]; + this->p2StartColor.a = initParams->p2StartColor[3]; + this->p1EndColor.a = initParams->p1EndColor[3]; + this->p2EndColor.a = initParams->p2EndColor[3]; this->elemDuration = initParams->elemDuration; this->unkFlag = initParams->unkFlag; this->calcMode = initParams->calcMode; @@ -368,14 +380,14 @@ void EffectBlure_GetComputedValues(EffectBlure* this, s32 index, f32 ratio, Vec3 color1->r = color1->g = color1->b = color1->a = 255; color2->r = color2->g = color2->b = color2->a = 255; } else { - color1->r = EffectSs_LerpU8(this->p1StartColor[0], this->p1EndColor[0], ratio); - color1->g = EffectSs_LerpU8(this->p1StartColor[1], this->p1EndColor[1], ratio); - color1->b = EffectSs_LerpU8(this->p1StartColor[2], this->p1EndColor[2], ratio); - color1->a = EffectSs_LerpU8(this->p1StartColor[3], this->p1EndColor[3], ratio); - color2->r = EffectSs_LerpU8(this->p2StartColor[0], this->p2EndColor[0], ratio); - color2->g = EffectSs_LerpU8(this->p2StartColor[1], this->p2EndColor[1], ratio); - color2->b = EffectSs_LerpU8(this->p2StartColor[2], this->p2EndColor[2], ratio); - color2->a = EffectSs_LerpU8(this->p2StartColor[3], this->p2EndColor[3], ratio); + color1->r = EffectSs_LerpU8(this->p1StartColor.r, this->p1EndColor.r, ratio); + color1->g = EffectSs_LerpU8(this->p1StartColor.g, this->p1EndColor.g, ratio); + color1->b = EffectSs_LerpU8(this->p1StartColor.b, this->p1EndColor.b, ratio); + color1->a = EffectSs_LerpU8(this->p1StartColor.a, this->p1EndColor.a, ratio); + color2->r = EffectSs_LerpU8(this->p2StartColor.r, this->p2EndColor.r, ratio); + color2->g = EffectSs_LerpU8(this->p2StartColor.g, this->p2EndColor.g, ratio); + color2->b = EffectSs_LerpU8(this->p2StartColor.b, this->p2EndColor.b, ratio); + color2->a = EffectSs_LerpU8(this->p2StartColor.a, this->p2EndColor.a, ratio); } } @@ -1001,19 +1013,19 @@ void EffectBlure_Draw(void* thisx, GraphicsContext* gfxCtx) { vtx[j].v.flag = 0; vtx[j].v.tc[0] = 0; vtx[j].v.tc[1] = 0; - vtx[j].v.cn[0] = EffectSs_LerpU8(this->p1StartColor[0], this->p1EndColor[0], ratio); - vtx[j].v.cn[1] = EffectSs_LerpU8(this->p1StartColor[1], this->p1EndColor[1], ratio); - vtx[j].v.cn[2] = EffectSs_LerpU8(this->p1StartColor[2], this->p1EndColor[2], ratio); - vtx[j].v.cn[3] = EffectSs_LerpU8(this->p1StartColor[3], this->p1EndColor[3], ratio); + vtx[j].v.cn[0] = EffectSs_LerpU8(this->p1StartColor.r, this->p1EndColor.r, ratio); + vtx[j].v.cn[1] = EffectSs_LerpU8(this->p1StartColor.g, this->p1EndColor.g, ratio); + vtx[j].v.cn[2] = EffectSs_LerpU8(this->p1StartColor.b, this->p1EndColor.b, ratio); + vtx[j].v.cn[3] = EffectSs_LerpU8(this->p1StartColor.a, this->p1EndColor.a, ratio); j++; vtx[j].v.flag = 0; vtx[j].v.tc[0] = 0; vtx[j].v.tc[1] = 0; - vtx[j].v.cn[0] = EffectSs_LerpU8(this->p2StartColor[0], this->p2EndColor[0], ratio); - vtx[j].v.cn[1] = EffectSs_LerpU8(this->p2StartColor[1], this->p2EndColor[1], ratio); - vtx[j].v.cn[2] = EffectSs_LerpU8(this->p2StartColor[2], this->p2EndColor[2], ratio); - vtx[j].v.cn[3] = EffectSs_LerpU8(this->p2StartColor[3], this->p2EndColor[3], ratio); + vtx[j].v.cn[0] = EffectSs_LerpU8(this->p2StartColor.r, this->p2EndColor.r, ratio); + vtx[j].v.cn[1] = EffectSs_LerpU8(this->p2StartColor.g, this->p2EndColor.g, ratio); + vtx[j].v.cn[2] = EffectSs_LerpU8(this->p2StartColor.b, this->p2EndColor.b, ratio); + vtx[j].v.cn[3] = EffectSs_LerpU8(this->p2StartColor.a, this->p2EndColor.a, ratio); j++; } } diff --git a/src/code/z_fcurve_data.c b/src/code/z_fcurve_data.c deleted file mode 100644 index 774f4137f77..00000000000 --- a/src/code/z_fcurve_data.c +++ /dev/null @@ -1,84 +0,0 @@ -/** - * File: z_fcurve_data.c - * Description: Interpolation functions for use with Curve SkelAnime - */ -#include "curve.h" - -#define FCURVE_INTERP_CUBIC 0 // Interpolate using a Hermite cubic spline -#define FCURVE_INTERP_NONE 1 // Return the value at the left endpoint instead of interpolating -#define FCURVE_INTERP_LINEAR 2 // Interpolate linearly - -/** - * Hermite cubic spline interpolation between two endpoints, a,b. More information available at - * https://en.wikipedia.org/wiki/Cubic_Hermite_spline - * - * @param t interpolation parameter rescaled to lie in [0,1], (x-a)/(b-a) - * @param interval distance (b-a) between the endpoints - * @param y0 p(a) - * @param y1 p(b) - * @param m0 p'(a) - * @param m1 p'(b) - * @return f32 p(t), value of the cubic interpolating polynomial - */ -f32 Curve_CubicHermiteSpline(f32 t, f32 interval, f32 y0, f32 y1, f32 m0, f32 m1) { - f32 t2 = t * t; - f32 t3 = t2 * t; - f32 t3x2 = t3 * 2.0f; - f32 t2x3 = t2 * 3.0f; - - // Hermite basis cubics h_{ij} satisfy h_{ij}^{(j)}(i) = 1, the other three values being 0 - f32 h00 = t3x2 - t2x3 + 1.0f; // h_{00}(t) = 2t^3 - 3t^2 + 1 - f32 h01 = t2x3 - t3x2; // h_{01}(t) = 3t^2 - 2t^3 - f32 h10 = t3 - t2 * 2.0f + t; // h_{10}(t) = t^3 - 2t^2 + t - f32 h11 = t3 - t2; // h_{11}(t) = t^3 - t^2 - - f32 ret = h00 * y0; - - ret += h01 * y1; - ret += h10 * m0 * interval; - ret += h11 * m1 * interval; - - return ret; -} - -/** - * Interpolates based on an array of CurveInterpKnot. - * - * @param x point at which to interpolate. - * @param knots Beginning of CurveInterpKnot array to use. - * @param knotCount number of knots to read from the array. - * @return f32 interpolated value - */ -f32 Curve_Interpolate(f32 x, CurveInterpKnot* knots, s32 knotCount) { - // If outside the entire interpolation interval, return the value at the near endpoint. - if (x <= knots[0].abscissa) { - return knots[0].ordinate; - } else if (x >= knots[knotCount - 1].abscissa) { - return knots[knotCount - 1].ordinate; - } else { - s32 cur; - - for (cur = 0;; cur++) { - s32 next = cur + 1; - // Find the subinterval in which x lies - if (x < knots[next].abscissa) { - if (knots[cur].flags & FCURVE_INTERP_NONE) { - // No interpolation - return knots[cur].ordinate; - } else if (knots[cur].flags & FCURVE_INTERP_LINEAR) { - // Linear interpolation - return knots[cur].ordinate + - ((x - (f32)knots[cur].abscissa) / ((f32)knots[next].abscissa - (f32)knots[cur].abscissa)) * - (knots[next].ordinate - knots[cur].ordinate); - } else { - // Cubic interpolation - f32 diff = (f32)knots[next].abscissa - (f32)knots[cur].abscissa; - f32 t = (x - (f32)knots[cur].abscissa) / ((f32)knots[next].abscissa - (f32)knots[cur].abscissa); - - return Curve_CubicHermiteSpline(t, diff * (1.0f / 30.0f), knots[cur].ordinate, knots[next].ordinate, - knots[cur].rightGradient, knots[next].leftGradient); - } - } - } - } -} diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index da1325ee172..3b6729fb0d7 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -1,30 +1,3 @@ -/** - * @file z_fcurve_data_skelanime.c - * @brief Curve skeleton animation system - * - * A curve skeleton has a fixed number of limbs, each of which has 9 properties that may be changed by the animation: - * - 3 scales, - * - 3 rotations, - * - 3 positions - * (note the position is stored in the animations instead of being stored in the limbs like SkelAnime would). Otherwise - * the structure is similar to an ordinary SkelAnime-compatible skeleton. - * - * The animations are significantly more complex than SkelAnime. A curve animation consists of 4 parts: - * - a header (CurveAnimationHeader) - * - a list of counts, one for each of the 9 properties of each limb (u8) - * - a list of interpolation data (CurveInterpKnot). The length is the sum of the counts. - * - a list of constant data (s16[9]). The length is the number of 0s in counts. - * - * If the interpolation count for a property is 0, the value of the property is copied from the next number in the - * constant data; there are no gaps for nonzero interpolation count. - * If the interpolation count N for a property is larger than 0, the next N elements of the interpolation data array - * are used to interpolate the value of the property, using Curve_Interpolate. - * - * Curve limbs may use LOD: - * - lower detail draws only the first displaylist - * - higher detail draws both. - */ - #include "gfx.h" #include "printf.h" #include "regs.h" @@ -33,127 +6,98 @@ #include "translation.h" #include "zelda_arena.h" #include "actor.h" -#include "curve.h" #include "play_state.h" -void SkelCurve_Clear(SkelCurve* skelCurve) { +#include "functions.h" + +void SkelCurve_Clear(SkelAnimeCurve* skelCurve) { skelCurve->limbCount = 0; - skelCurve->skeleton = NULL; - skelCurve->animation = NULL; - skelCurve->curFrame = 0.0f; - skelCurve->playSpeed = 0.0f; - skelCurve->endFrame = 0.0f; + skelCurve->limbList = NULL; + skelCurve->transUpdIdx = NULL; + skelCurve->animCurFrame = 0.0f; + skelCurve->animSpeed = 0.0f; + skelCurve->animFinalFrame = 0.0f; skelCurve->unk_0C = 0.0f; - skelCurve->jointTable = NULL; + skelCurve->transforms = NULL; } -/** - * Initialises the SkelCurve struct and mallocs the joint table. - * - * @return bool always true - */ -s32 SkelCurve_Init(PlayState* play, SkelCurve* skelCurve, CurveSkeletonHeader* skeletonHeaderSeg, - CurveAnimationHeader* animation) { +s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, + TransformUpdateIndex* transUpdIdx) { SkelCurveLimb** limbs; - CurveSkeletonHeader* skeletonHeader = SEGMENTED_TO_VIRTUAL(skeletonHeaderSeg); + SkelCurveLimbList* limbList = SEGMENTED_TO_VIRTUAL(limbListSeg); - skelCurve->limbCount = skeletonHeader->limbCount; - skelCurve->skeleton = SEGMENTED_TO_VIRTUAL(skeletonHeader->limbs); + skelCurve->limbCount = limbList->limbCount; + skelCurve->limbList = SEGMENTED_TO_VIRTUAL(limbList->limbs); - skelCurve->jointTable = - ZELDA_ARENA_MALLOC(sizeof(*skelCurve->jointTable) * skelCurve->limbCount, "../z_fcurve_data_skelanime.c", 125); - ASSERT(skelCurve->jointTable != NULL, "this->now_joint != NULL", "../z_fcurve_data_skelanime.c", 127); - skelCurve->curFrame = 0.0f; - return true; + skelCurve->transforms = + ZELDA_ARENA_MALLOC(sizeof(*skelCurve->transforms) * skelCurve->limbCount, "../z_fcurve_data_skelanime.c", 125); + ASSERT(skelCurve->transforms != NULL, "this->now_joint != NULL", "../z_fcurve_data_skelanime.c", 127); + skelCurve->animCurFrame = 0.0f; + return 1; } -/** - * Frees the joint table. - */ -void SkelCurve_Destroy(PlayState* play, SkelCurve* skelCurve) { - if (skelCurve->jointTable != NULL) { - ZELDA_ARENA_FREE(skelCurve->jointTable, "../z_fcurve_data_skelanime.c", 146); +void SkelCurve_Destroy(PlayState* play, SkelAnimeCurve* skelCurve) { + if (skelCurve->transforms != NULL) { + ZELDA_ARENA_FREE(skelCurve->transforms, "../z_fcurve_data_skelanime.c", 146); } } -void SkelCurve_SetAnim(SkelCurve* skelCurve, CurveAnimationHeader* animation, f32 arg2, f32 endFrame, f32 curFrame, - f32 playSpeed) { - skelCurve->unk_0C = arg2 - skelCurve->playSpeed; - skelCurve->endFrame = endFrame; - skelCurve->curFrame = curFrame; - skelCurve->playSpeed = playSpeed; - skelCurve->animation = animation; +void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame, + f32 animCurFrame, f32 animSpeed) { + skelCurve->unk_0C = arg2 - skelCurve->animSpeed; + skelCurve->animFinalFrame = animFinalFrame; + skelCurve->animCurFrame = animCurFrame; + skelCurve->animSpeed = animSpeed; + skelCurve->transUpdIdx = transUpdIdx; } -typedef enum SkelCurveVecType { - /* 0 */ SKELCURVE_VEC_TYPE_SCALE, - /* 1 */ SKELCURVE_VEC_TYPE_ROTATION, - /* 2 */ SKELCURVE_VEC_TYPE_POSIITON, - /* 3 */ SKELCURVE_VEC_TYPE_MAX -} SkelCurveVecType; - -#define SKELCURVE_SCALE_SCALE 1024.0f -#define SKELCURVE_SCALE_POSITION 100 - -/** - * The only animation updating function. - * - * @return bool true when the animation has finished. - */ -s32 SkelCurve_Update(PlayState* play, SkelCurve* skelCurve) { - s16* jointData; - u8* knotCounts; - CurveAnimationHeader* animation; - u16* constantData; - s32 curLimb; - s32 ret = false; - s32 coord; - CurveInterpKnot* startKnot; - s32 vecType; - - animation = SEGMENTED_TO_VIRTUAL(skelCurve->animation); - knotCounts = SEGMENTED_TO_VIRTUAL(animation->knotCounts); - startKnot = SEGMENTED_TO_VIRTUAL(animation->interpolationData); - constantData = SEGMENTED_TO_VIRTUAL(animation->constantData); - jointData = *skelCurve->jointTable; - - skelCurve->curFrame += skelCurve->playSpeed * R_UPDATE_RATE * 0.5f; - - if (((skelCurve->playSpeed >= 0.0f) && (skelCurve->curFrame > skelCurve->endFrame)) || - ((skelCurve->playSpeed < 0.0f) && (skelCurve->curFrame < skelCurve->endFrame))) { - skelCurve->curFrame = skelCurve->endFrame; - ret = true; +s32 SkelCurve_Update(PlayState* play, SkelAnimeCurve* skelCurve) { + s16* transforms; + u8* transformRefIdx; + TransformUpdateIndex* transformIndex; + u16* transformCopyValues; + s32 i; + s32 ret = 0; + s32 k; + TransformData* transData; + s32 j; + + transformIndex = SEGMENTED_TO_VIRTUAL(skelCurve->transUpdIdx); + transformRefIdx = SEGMENTED_TO_VIRTUAL(transformIndex->refIndex); + transData = SEGMENTED_TO_VIRTUAL(transformIndex->transformData); + transformCopyValues = SEGMENTED_TO_VIRTUAL(transformIndex->copyValues); + transforms = (s16*)skelCurve->transforms; + + skelCurve->animCurFrame += skelCurve->animSpeed * R_UPDATE_RATE * 0.5f; + + if ((skelCurve->animSpeed >= 0.0f && skelCurve->animCurFrame > skelCurve->animFinalFrame) || + (skelCurve->animSpeed < 0.0f && skelCurve->animCurFrame < skelCurve->animFinalFrame)) { + skelCurve->animCurFrame = skelCurve->animFinalFrame; + ret = 1; } - for (curLimb = 0; curLimb < skelCurve->limbCount; curLimb++) { - - // scale/rotation/position - for (vecType = SKELCURVE_VEC_TYPE_SCALE; vecType < SKELCURVE_VEC_TYPE_MAX; vecType++) { - - // x/y/z - for (coord = 0; coord < 3; coord++) { + for (i = 0; i < skelCurve->limbCount; i++) { + for (j = 0; j < 3; j++) { + for (k = 0; k < 3; k++) { f32 transformValue; - if (*knotCounts == 0) { - transformValue = *constantData; - *jointData = transformValue; - constantData++; + if (*transformRefIdx == 0) { + transformValue = *transformCopyValues; + *transforms = transformValue; + transformCopyValues++; } else { - transformValue = Curve_Interpolate(skelCurve->curFrame, startKnot, *knotCounts); - startKnot += *knotCounts; - if (vecType == SKELCURVE_VEC_TYPE_SCALE) { - // Rescaling allows for more refined scaling using an s16 - *jointData = transformValue * SKELCURVE_SCALE_SCALE; - } else if (vecType == SKELCURVE_VEC_TYPE_ROTATION) { - // Convert value from degrees to a binary angle - *jointData = DEG_TO_BINANG(transformValue); - } else { // SKELCURVE_VEC_TYPE_POSIITON - // Model to world scale conversion - *jointData = transformValue * SKELCURVE_SCALE_POSITION; + transformValue = func_8006C5A8(skelCurve->animCurFrame, transData, *transformRefIdx); + transData += *transformRefIdx; + if (j == 0) { + *transforms = transformValue * 1024.0f; + } else if (j == 1) { + *transforms = transformValue * (32768.0f / 180.0f); + } else { + *transforms = transformValue * 100.0f; } } - knotCounts++; - jointData++; + transformRefIdx++; + transforms++; } } } @@ -161,36 +105,32 @@ s32 SkelCurve_Update(PlayState* play, SkelCurve* skelCurve) { return ret; } -/** - * Recursively draws limbs with appropriate properties. - */ -void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, - PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { - SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->skeleton[limbIndex]); +void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelAnimeCurve* skelCurve, + OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { + SkelCurveLimb* limb = SEGMENTED_TO_VIRTUAL(skelCurve->limbList[limbIndex]); OPEN_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 279); Matrix_Push(); - if ((overrideLimbDraw == NULL) || - ((overrideLimbDraw != NULL) && overrideLimbDraw(play, skelCurve, limbIndex, data))) { + if (overrideLimbDraw == NULL || (overrideLimbDraw != NULL && overrideLimbDraw(play, skelCurve, limbIndex, data))) { Vec3f scale; Vec3s rot; Vec3f pos; Gfx* dList; - s16* jointData = skelCurve->jointTable[limbIndex]; - - scale.x = jointData[0] / SKELCURVE_SCALE_SCALE; - scale.y = jointData[1] / SKELCURVE_SCALE_SCALE; - scale.z = jointData[2] / SKELCURVE_SCALE_SCALE; - jointData += 3; - rot.x = jointData[0]; - rot.y = jointData[1]; - rot.z = jointData[2]; - jointData += 3; - pos.x = jointData[0]; - pos.y = jointData[1]; - pos.z = jointData[2]; + Vec3s* transform = (Vec3s*)&skelCurve->transforms[limbIndex]; + + scale.x = transform->x / 1024.0f; + scale.y = transform->y / 1024.0f; + scale.z = transform->z / 1024.0f; + transform++; + rot.x = transform->x; + rot.y = transform->y; + rot.z = transform->z; + transform++; + pos.x = transform->x; + pos.y = transform->y; + pos.z = transform->z; Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); @@ -225,22 +165,22 @@ void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelCurve* skelCurve, Ov postLimbDraw(play, skelCurve, limbIndex, data); } - if (limb->child != LIMB_DONE) { - SkelCurve_DrawLimb(play, limb->child, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + if (limb->firstChildIdx != LIMB_DONE) { + SkelCurve_DrawLimb(play, limb->firstChildIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } Matrix_Pop(); - if (limb->sibling != LIMB_DONE) { - SkelCurve_DrawLimb(play, limb->sibling, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); + if (limb->nextLimbIdx != LIMB_DONE) { + SkelCurve_DrawLimb(play, limb->nextLimbIdx, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } CLOSE_DISPS(play->state.gfxCtx, "../z_fcurve_data_skelanime.c", 371); } -void SkelCurve_Draw(Actor* actor, PlayState* play, SkelCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, +void SkelCurve_Draw(Actor* actor, PlayState* play, SkelAnimeCurve* skelCurve, OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data) { - if (skelCurve->jointTable != NULL) { + if (skelCurve->transforms != NULL) { SkelCurve_DrawLimb(play, 0, skelCurve, overrideLimbDraw, postLimbDraw, lod, data); } } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index ca7637214df..7c7fb49842e 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:80 gc-eu-mq:80 gc-jp:80 gc-jp-ce:80 gc-jp-mq:80 gc-us:80 gc-us-mq:80 ique-cn:64" \ - "ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ique-cn:224 ntsc-1.0:240 ntsc-1.1:240 ntsc-1.2:240 pal-1.0:240 pal-1.1:240" #include "libu64/debug.h" #include "kaleido_manager.h" diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index 280bfa3df86..85b3a11ad9a 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,4 +1,4 @@ -#include "kanread.h" +#include "code_800D71F0.h" #include "message_data_static.h" #include "printf.h" #include "segment_symbols.h" @@ -14,9 +14,8 @@ */ void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) { #if OOT_NTSC - DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], - (uintptr_t)_kanjiSegmentRomStart + Kanji_OffsetFromShiftJIS(character), FONT_CHAR_TEX_SIZE, - "../z_kanfont.c", UNK_LINE); + DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], (uintptr_t)_kanjiSegmentRomStart + func_800D71F0(character), + FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); #endif } @@ -83,7 +82,7 @@ void Font_LoadOrderedFont(Font* font) { } if (font->msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) { - offset = Kanji_OffsetFromShiftJIS(font->msgBufWide[codePointIndex]); + offset = func_800D71F0(font->msgBufWide[codePointIndex]); DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); fontBufIndex += FONT_CHAR_TEX_SIZE / 8; @@ -135,7 +134,7 @@ void Font_LoadOrderedFont(Font* font) { } if (msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) { - offset = Kanji_OffsetFromShiftJIS(msgBufWide[codePointIndex]); + offset = func_800D71F0(msgBufWide[codePointIndex]); DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); fontBufIndex += FONT_CHAR_TEX_SIZE / 8; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 5a944065b54..cbd6289b5bd 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:240 pal-1.1:240" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #include "libc64/qrand.h" #include "libu64/gfxprint.h" @@ -243,8 +243,8 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:208 ntsc-1.1:208 ntsc-1.2:208 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:192 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; diff --git a/src/code/z_lib.c b/src/code/z_lib.c index b9aa15ca4bf..666198a2725 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -7,26 +7,11 @@ #include "rand.h" #include "sfx.h" -/** - * memset: sets `len` bytes to `val` starting at address `dest`. - * - * Unlike normal memset, - * - `dest` is a `u8*` already, - * - does not return `dest`, - * - 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, memset(), MemSet() - * - * @param dest address to start at - * @param len number of bytes to write - * @param val value to write - */ -void Lib_MemSet(u8* dest, size_t len, u8 val) { - size_t i; +void Lib_MemSet(u8* dest, size_t size, u8 val) { + u32 i; // clang-format off - for (i = 0; i < len; i++) { *dest++ = val; } + for (i = 0; i < size; i++) { *dest++ = val; } // clang-format on } diff --git a/src/code/z_memory_utils.c b/src/code/z_memory_utils.c index a08567dd657..c48820af71e 100644 --- a/src/code/z_memory_utils.c +++ b/src/code/z_memory_utils.c @@ -1,47 +1,23 @@ #include "ultra64.h" -/** - * memcpy: copies `len` bytes from memory starting at `src` to memory starting at `dest`. Expects the memory - * specified by `src` and `dest` to not overlap. - * - * @see libultra also has a memcpy(). - * - * @param dest address of start of buffer writing to - * @param src address of start of buffer to read from - * @param len number of bytes to copy. (`s32` rather than the standard `size_t`) - * - * @return dest - */ -void* MemCpy(void* dest, const void* src, s32 len) { - u8* d = dest; - const u8* s = src; +void* MemCopy(void* dest, void* src, s32 size) { + u8* destu = (u8*)dest; + u8* srcu = (u8*)src; - while (len > 0) { - *d++ = *s++; - len--; + while (size > 0) { + *destu++ = *srcu++; + size--; } return dest; } -/** - * memset: sets `len` bytes to `val` starting at address `dest`. - * - * @see There are two other memsets in this codebase, Lib_MemSet(), memset(). - * This one is unused. - * - * @param dest address to start at - * @param val value to write (`s32`, but interpreted as `u8`) - * @param len number of bytes to write. (`s32` rather than the standard `size_t`) - * - * @return dest - */ -void* MemSet(void* dest, s32 val, s32 len) { - u8* d = dest; - s32 s = len; +void* MemSet(void* dest, s32 val, s32 size) { + u8* destu = (u8*)dest; + s32 s = size; while (s > 0) { - *d++ = val; + *destu++ = val; s--; } diff --git a/src/code/z_message.c b/src/code/z_message.c index 4ac21e24d00..27730cdb10b 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -24,10 +24,12 @@ #include "player.h" #include "save.h" +#include "functions.h" + #include "assets/textures/parameter_static/parameter_static.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:16" \ - "ntsc-1.1:16 ntsc-1.2:16 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #if !PLATFORM_IQUE #define MSG_BUF_DECODED (msgCtx->msgBufDecoded) @@ -3686,8 +3688,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { T("録音終了!!!!!!!!!録音終了\n", "Recording complete!!!!!!!!! Recording Complete\n")); PRINTF_COLOR_YELLOW(); PRINTF("\n====================================================================\n"); - MemCpy(gSaveContext.save.info.scarecrowLongSong, gScarecrowLongSongPtr, - sizeof(gSaveContext.save.info.scarecrowLongSong)); + MemCopy(gSaveContext.save.info.scarecrowLongSong, gScarecrowLongSongPtr, + sizeof(gSaveContext.save.info.scarecrowLongSong)); for (i = 0; i < ARRAY_COUNT(gSaveContext.save.info.scarecrowLongSong); i++) { PRINTF("%d, ", gSaveContext.save.info.scarecrowLongSong[i]); } @@ -3750,8 +3752,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { SFX_PLAY_CENTERED(NA_SE_SY_TRE_BOX_APPEAR); PRINTF_COLOR_YELLOW(); PRINTF("\n====================================================================\n"); - MemCpy(gSaveContext.save.info.scarecrowSpawnSong, gScarecrowSpawnSongPtr, - sizeof(gSaveContext.save.info.scarecrowSpawnSong)); + MemCopy(gSaveContext.save.info.scarecrowSpawnSong, gScarecrowSpawnSongPtr, + sizeof(gSaveContext.save.info.scarecrowSpawnSong)); for (i = 0; i < ARRAY_COUNT(gSaveContext.save.info.scarecrowSpawnSong); i++) { PRINTF("%d, ", gSaveContext.save.info.scarecrowSpawnSong[i]); } diff --git a/src/code/z_play.c b/src/code/z_play.c index 8d73e9e5658..c306143b8bc 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -45,14 +45,16 @@ #include "play_state.h" #include "player.h" #include "save.h" -#include "vis.h" -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:240 ntsc-1.1:240 ntsc-1.2:240 pal-1.0:240 pal-1.1:240" +#include "functions.h" +#include "z64.h" + +#pragma increment_block_number "gc-eu:226 gc-eu-mq:226 gc-jp:226 gc-jp-ce:226 gc-jp-mq:226 gc-us:226 gc-us-mq:226" \ + "ique-cn:226 ntsc-1.0:226 ntsc-1.1:226 ntsc-1.2:226 pal-1.0:226 pal-1.1:226" TransitionTile gTransitionTile; s32 gTransitionTileState; -VisMono gPlayVisMono; +VisMono D_80161498; Color_RGBA8_u32 gVisMonoColor; #if DEBUG_FEATURES @@ -261,7 +263,7 @@ void Play_Destroy(GameState* thisx) { Letterbox_Destroy(); TransitionFade_Destroy(&this->transitionFadeFlash); - VisMono_Destroy(&gPlayVisMono); + VisMono_Destroy(&D_80161498); if (gSaveContext.save.linkAge != this->linkAgeOnLoad) { Inventory_SwapAgeEquipment(); @@ -482,7 +484,7 @@ void Play_Init(GameState* thisx) { TransitionFade_SetType(&this->transitionFadeFlash, TRANS_INSTANCE_TYPE_FADE_FLASH); TransitionFade_SetColor(&this->transitionFadeFlash, RGBA8(160, 160, 160, 255)); TransitionFade_Start(&this->transitionFadeFlash); - VisMono_Init(&gPlayVisMono); + VisMono_Init(&D_80161498); gVisMonoColor.a = 0; CutsceneFlags_UnsetAll(this); @@ -1217,8 +1219,8 @@ void Play_Draw(PlayState* this) { if (gVisMonoColor.a > 0) #endif { - gPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba; - VisMono_Draw(&gPlayVisMono, &gfxP); + D_80161498.primColor.rgba = gVisMonoColor.rgba; + VisMono_Draw(&D_80161498, &gfxP); } gSPEndDisplayList(gfxP++); diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 5838188ab6a..51cdc2374cf 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -9,7 +9,7 @@ ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_CAN_PRESS_SWITCHES) #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:128 pal-1.1:128" + "ntsc-1.2:0 pal-1.1:0" void (*sPlayerCallInitFunc)(Actor* thisx, PlayState* play); void (*sPlayerCallDestroyFunc)(Actor* thisx, PlayState* play); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index c701f379db8..b9987dbf72b 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -18,8 +18,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:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 pal-1.0:0" \ - "pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ + "pal-1.0:0 pal-1.1:0" typedef struct BowSlingshotStringData { /* 0x00 */ Gfx* dList; diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 18ebfbcc389..24466e68012 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -175,7 +175,7 @@ QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) { s16 index = Quake_GetFreeIndex(); QuakeRequest* req = &sQuakeRequests[index]; - memset(req, 0, sizeof(QuakeRequest)); + func_80106860(req, 0, sizeof(QuakeRequest)); // memset req->cam = camera; req->camId = camera->camId; diff --git a/src/code/z_rcp.c b/src/code/z_rcp.c index 76cc6c467c1..976c7183298 100644 --- a/src/code/z_rcp.c +++ b/src/code/z_rcp.c @@ -947,8 +947,8 @@ Gfx* Gfx_SetupDL(Gfx* gfx, u32 i) { return Gfx_SetupDLImpl(gfx, i); } -void Gfx_SetupDLAtPtr(Gfx** gfxP, u32 i) { - *gfxP = Gfx_SetupDL(*gfxP, i); +void Gfx_SetupDLAtPtr(Gfx** gfxp, u32 i) { + *gfxp = Gfx_SetupDL(*gfxp, i); } Gfx* Gfx_SetupDL_57(Gfx* gfx) { @@ -1233,11 +1233,11 @@ void Gfx_SetupDL_39Overlay(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 1811); } -void Gfx_SetupDL_39Ptr(Gfx** gfxP) { - Gfx* gfx = *gfxP; +void Gfx_SetupDL_39Ptr(Gfx** gfxp) { + Gfx* gfx = *gfxp; gSPDisplayList(gfx++, sSetupDL[SETUPDL_39]); - *gfxP = gfx; + *gfxp = gfx; } void Gfx_SetupDL_40Opa(GraphicsContext* gfxCtx) { @@ -1395,12 +1395,12 @@ void Gfx_SetupDL_56Opa(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2090); } -void Gfx_SetupDL_56Ptr(Gfx** gfxP) { - Gfx* gfx = *gfxP; +void Gfx_SetupDL_56Ptr(Gfx** gfxp) { + Gfx* gfx = *gfxp; gSPDisplayList(gfx++, sSetupDL[SETUPDL_56]); - *gfxP = gfx; + *gfxp = gfx; } void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) { @@ -1411,8 +1411,8 @@ void Gfx_SetupDL_59Opa(GraphicsContext* gfxCtx) { CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2116); } -Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height) { - Gfx* displayList = Gfx_Alloc(gfxP, 3 * sizeof(Gfx)); +Gfx* Gfx_BranchTexScroll(Gfx** gfxp, u32 x, u32 y, s32 width, s32 height) { + Gfx* displayList = Gfx_Alloc(gfxp, 3 * sizeof(Gfx)); gDPTileSync(displayList); gDPSetTileSize(displayList + 1, G_TX_RENDERTILE, x, y, x + ((width - 1) << 2), y + ((height - 1) << 2)); @@ -1421,8 +1421,8 @@ Gfx* Gfx_BranchTexScroll(Gfx** gfxP, u32 x, u32 y, s32 width, s32 height) { return displayList; } -Gfx* func_80094E54(Gfx** gfxP, u32 x, u32 y) { - return Gfx_BranchTexScroll(gfxP, x, y, 0, 0); +Gfx* func_80094E54(Gfx** gfxp, u32 x, u32 y) { + return Gfx_BranchTexScroll(gfxp, x, y, 0, 0); } Gfx* func_80094E78(GraphicsContext* gfxCtx, u32 x, u32 y) { diff --git a/src/code/z_room.c b/src/code/z_room.c index ebcb9de743b..a24d89ba9a7 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -102,7 +102,7 @@ typedef enum RoomCullableDebugMode { typedef struct RoomShapeCullableEntryLinked { /* 0x00 */ RoomShapeCullableEntry* entry; - /* 0x04 */ f32 boundsNearZ; + /* 0x04 */ f32 startZ; /* 0x08 */ struct RoomShapeCullableEntryLinked* prev; /* 0x0C */ struct RoomShapeCullableEntryLinked* next; } RoomShapeCullableEntryLinked; // size = 0x10 @@ -111,10 +111,10 @@ typedef struct RoomShapeCullableEntryLinked { * Handle room drawing for the "cullable" type of room shape. * * Each entry referenced by the room shape struct is attached to display lists, and a position and radius indicating the - * bounding sphere for the geometry drawn. - * The first step Z-sorts the entries, and excludes the entries with a bounding sphere that is entirely before or + * volume those display lists take. + * The first step is Z-sorting the entries, also excluding the entries which bounding sphere is entirely before or * beyond the rendered depth range. - * The second step draws the entries that remain, from nearest to furthest. + * The second step is drawing the entries that remain, in ascending depth. */ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { RoomShapeCullable* roomShape; @@ -133,7 +133,7 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { s32 pad2; RoomShapeCullableEntry* roomShapeCullableEntries; RoomShapeCullableEntry* roomShapeCullableEntryIter; - f32 entryBoundsNearZ; + f32 entryStartZ; OPEN_DISPS(play->state.gfxCtx, "../z_room.c", 287); @@ -171,27 +171,27 @@ void Room_DrawCullable(PlayState* play, Room* room, u32 flags) { pos.z = roomShapeCullableEntry->boundsSphereCenter.z; SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &pos, &projectedPos, &projectedW); - // If the entry bounding sphere isn't fully before the rendered depth range + // If the entry isn't fully before the rendered depth range if (-(f32)roomShapeCullableEntry->boundsSphereRadius < projectedPos.z) { - // Compute the depth of the nearest point in the entry's bounding sphere - entryBoundsNearZ = projectedPos.z - roomShapeCullableEntry->boundsSphereRadius; + // Compute the depth at which this entry starts + entryStartZ = projectedPos.z - roomShapeCullableEntry->boundsSphereRadius; - // If the entry bounding sphere isn't fully beyond the rendered depth range - if (entryBoundsNearZ < play->lightCtx.zFar) { + // If the entry isn't fully beyond the rendered depth range + if (entryStartZ < play->lightCtx.zFar) { // This entry will be rendered insert->entry = roomShapeCullableEntry; - insert->boundsNearZ = entryBoundsNearZ; + insert->startZ = entryStartZ; - // Insert into the linked list, ordered by ascending depth of the nearest point in the bounding sphere + // Insert into the linked list, ordered by ascending start depth iter = head; if (iter == NULL) { head = tail = insert; insert->prev = insert->next = NULL; } else { do { - if (insert->boundsNearZ < iter->boundsNearZ) { + if (insert->startZ < iter->startZ) { break; } iter = iter->next; @@ -403,10 +403,9 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) { isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED); roomShape = &room->roomShape->image.single; entry = SEGMENTED_TO_VIRTUAL(roomShape->base.entry); - drawBackground = (flags & ROOM_DRAW_OPA) && isFixedCamera && (roomShape->source != NULL) && - !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_BACKGROUND); - drawOpa = (flags & ROOM_DRAW_OPA) && (entry->opa != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_OPA); - drawXlu = (flags & ROOM_DRAW_XLU) && (entry->xlu != NULL) && !(R_ROOM_IMAGE_NODRAW_FLAGS & ROOM_IMAGE_NODRAW_XLU); + drawBackground = (flags & 1) && isFixedCamera && (roomShape->source != NULL) && !(SREG(25) & 1); + drawOpa = (flags & 1) && entry->opa != NULL && !(SREG(25) & 2); + drawXlu = (flags & 2) && entry->xlu != NULL && !(SREG(25) & 4); if (drawOpa || drawBackground) { gSPSegment(POLY_OPA_DISP++, 0x03, room->segment); @@ -693,7 +692,7 @@ s32 Room_RequestNewRoom(PlayState* play, RoomContext* roomCtx, s32 roomNum) { ASSERT(roomNum < play->roomList.count, "read_room_ID < game_play->room_rom_address.num", "../z_room.c", 1009); size = play->roomList.romFiles[roomNum].vromEnd - play->roomList.romFiles[roomNum].vromStart; - roomCtx->roomRequestAddr = (void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->activeBufPage] - + roomCtx->roomRequestAddr = (void*)ALIGN16((intptr_t)roomCtx->bufPtrs[roomCtx->activeBufPage] - ((size + 8) * roomCtx->activeBufPage + 7)); osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); diff --git a/src/code/z_sram.c b/src/code/z_sram.c index f35e23600c9..9095b3817e5 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -17,6 +17,8 @@ #include "scene.h" #include "ss_sram.h" +#include "functions.h" + #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) @@ -445,7 +447,7 @@ void Sram_OpenSave(SramContext* sramCtx) { i = gSramSlotOffsets[gSaveContext.fileNum]; PRINTF(T("ぽいんと=%x(%d)\n", "Point=%x(%d)\n"), i, gSaveContext.fileNum); - MemCpy(&gSaveContext, sramCtx->readBuff + i, sizeof(Save)); + MemCopy(&gSaveContext, sramCtx->readBuff + i, sizeof(Save)); PRINTF_COLOR_YELLOW(); PRINTF("SCENE_DATA_ID = %d SceneNo = %d\n", gSaveContext.save.info.playerData.savedSceneId, @@ -533,8 +535,8 @@ void Sram_OpenSave(SramContext* sramCtx) { PRINTF_COLOR_BLUE(); PRINTF("\n====================================================================\n"); - MemCpy(gScarecrowLongSongPtr, gSaveContext.save.info.scarecrowLongSong, - sizeof(gSaveContext.save.info.scarecrowLongSong)); + MemCopy(gScarecrowLongSongPtr, gSaveContext.save.info.scarecrowLongSong, + sizeof(gSaveContext.save.info.scarecrowLongSong)); ptr = (u8*)gScarecrowLongSongPtr; for (i = 0; i < ARRAY_COUNT(gSaveContext.save.info.scarecrowLongSong); i++, ptr++) { @@ -549,8 +551,8 @@ void Sram_OpenSave(SramContext* sramCtx) { PRINTF_COLOR_GREEN(); PRINTF("\n====================================================================\n"); - MemCpy(gScarecrowSpawnSongPtr, gSaveContext.save.info.scarecrowSpawnSong, - sizeof(gSaveContext.save.info.scarecrowSpawnSong)); + MemCopy(gScarecrowSpawnSongPtr, gSaveContext.save.info.scarecrowSpawnSong, + sizeof(gSaveContext.save.info.scarecrowSpawnSong)); ptr = gScarecrowSpawnSongPtr; for (i = 0; i < ARRAY_COUNT(gSaveContext.save.info.scarecrowSpawnSong); i++, ptr++) { @@ -677,7 +679,7 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt offset = gSramSlotOffsets[slotNum]; PRINTF(T("ぽいんと=%x(%d) SAVE_MAX=%d\n", "Point=%x(%d) SAVE_MAX=%d\n"), offset, gSaveContext.fileNum, sizeof(Save)); - MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save)); + MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save)); oldChecksum = gSaveContext.save.info.checksum.value; gSaveContext.save.info.checksum.value = 0; @@ -702,7 +704,7 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt // checksum didnt match, try backup save PRINTF("ERROR!!! = %x(%d)\n", gSramSlotOffsets[slotNum], slotNum); offset = gSramSlotOffsets[slotNum + 3]; - MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save)); + MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save)); oldChecksum = gSaveContext.save.info.checksum.value; gSaveContext.save.info.checksum.value = 0; @@ -801,37 +803,37 @@ void Sram_VerifyAndLoadAllSaves(FileSelectState* fileSelect, SramContext* sramCt PRINTF("SAVECT=%x, NAME=%x, LIFE=%x, ITEM=%x, 64DD=%x, HEART=%x\n", DEATHS, NAME, HEALTH_CAP, QUEST, N64DD, DEFENSE); - MemCpy(&fileSelect->deaths[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEATHS, sizeof(fileSelect->deaths[0])); - MemCpy(&fileSelect->deaths[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEATHS, sizeof(fileSelect->deaths[0])); - MemCpy(&fileSelect->deaths[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEATHS, sizeof(fileSelect->deaths[0])); + MemCopy(&fileSelect->deaths[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEATHS, sizeof(fileSelect->deaths[0])); + MemCopy(&fileSelect->deaths[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEATHS, sizeof(fileSelect->deaths[0])); + MemCopy(&fileSelect->deaths[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEATHS, sizeof(fileSelect->deaths[0])); - MemCpy(&fileSelect->fileNames[0], sramCtx->readBuff + SLOT_OFFSET(0) + NAME, sizeof(fileSelect->fileNames[0])); - MemCpy(&fileSelect->fileNames[1], sramCtx->readBuff + SLOT_OFFSET(1) + NAME, sizeof(fileSelect->fileNames[0])); - MemCpy(&fileSelect->fileNames[2], sramCtx->readBuff + SLOT_OFFSET(2) + NAME, sizeof(fileSelect->fileNames[0])); + MemCopy(&fileSelect->fileNames[0], sramCtx->readBuff + SLOT_OFFSET(0) + NAME, sizeof(fileSelect->fileNames[0])); + MemCopy(&fileSelect->fileNames[1], sramCtx->readBuff + SLOT_OFFSET(1) + NAME, sizeof(fileSelect->fileNames[0])); + MemCopy(&fileSelect->fileNames[2], sramCtx->readBuff + SLOT_OFFSET(2) + NAME, sizeof(fileSelect->fileNames[0])); - MemCpy(&fileSelect->healthCapacities[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH_CAP, - sizeof(fileSelect->healthCapacities[0])); - MemCpy(&fileSelect->healthCapacities[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH_CAP, - sizeof(fileSelect->healthCapacities[0])); - MemCpy(&fileSelect->healthCapacities[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH_CAP, - sizeof(fileSelect->healthCapacities[0])); + MemCopy(&fileSelect->healthCapacities[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH_CAP, + sizeof(fileSelect->healthCapacities[0])); + MemCopy(&fileSelect->healthCapacities[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH_CAP, + sizeof(fileSelect->healthCapacities[0])); + MemCopy(&fileSelect->healthCapacities[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH_CAP, + sizeof(fileSelect->healthCapacities[0])); - MemCpy(&fileSelect->questItems[0], sramCtx->readBuff + SLOT_OFFSET(0) + QUEST, sizeof(fileSelect->questItems[0])); - MemCpy(&fileSelect->questItems[1], sramCtx->readBuff + SLOT_OFFSET(1) + QUEST, sizeof(fileSelect->questItems[0])); - MemCpy(&fileSelect->questItems[2], sramCtx->readBuff + SLOT_OFFSET(2) + QUEST, sizeof(fileSelect->questItems[0])); + MemCopy(&fileSelect->questItems[0], sramCtx->readBuff + SLOT_OFFSET(0) + QUEST, sizeof(fileSelect->questItems[0])); + MemCopy(&fileSelect->questItems[1], sramCtx->readBuff + SLOT_OFFSET(1) + QUEST, sizeof(fileSelect->questItems[0])); + MemCopy(&fileSelect->questItems[2], sramCtx->readBuff + SLOT_OFFSET(2) + QUEST, sizeof(fileSelect->questItems[0])); - MemCpy(&fileSelect->n64ddFlags[0], sramCtx->readBuff + SLOT_OFFSET(0) + N64DD, sizeof(fileSelect->n64ddFlags[0])); - MemCpy(&fileSelect->n64ddFlags[1], sramCtx->readBuff + SLOT_OFFSET(1) + N64DD, sizeof(fileSelect->n64ddFlags[0])); - MemCpy(&fileSelect->n64ddFlags[2], sramCtx->readBuff + SLOT_OFFSET(2) + N64DD, sizeof(fileSelect->n64ddFlags[0])); + MemCopy(&fileSelect->n64ddFlags[0], sramCtx->readBuff + SLOT_OFFSET(0) + N64DD, sizeof(fileSelect->n64ddFlags[0])); + MemCopy(&fileSelect->n64ddFlags[1], sramCtx->readBuff + SLOT_OFFSET(1) + N64DD, sizeof(fileSelect->n64ddFlags[0])); + MemCopy(&fileSelect->n64ddFlags[2], sramCtx->readBuff + SLOT_OFFSET(2) + N64DD, sizeof(fileSelect->n64ddFlags[0])); - MemCpy(&fileSelect->defense[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE, sizeof(fileSelect->defense[0])); - MemCpy(&fileSelect->defense[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE, sizeof(fileSelect->defense[0])); - MemCpy(&fileSelect->defense[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE, sizeof(fileSelect->defense[0])); + MemCopy(&fileSelect->defense[0], sramCtx->readBuff + SLOT_OFFSET(0) + DEFENSE, sizeof(fileSelect->defense[0])); + MemCopy(&fileSelect->defense[1], sramCtx->readBuff + SLOT_OFFSET(1) + DEFENSE, sizeof(fileSelect->defense[0])); + MemCopy(&fileSelect->defense[2], sramCtx->readBuff + SLOT_OFFSET(2) + DEFENSE, sizeof(fileSelect->defense[0])); #if OOT_PAL - MemCpy(&fileSelect->health[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileSelect->health[0])); - MemCpy(&fileSelect->health[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileSelect->health[0])); - MemCpy(&fileSelect->health[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileSelect->health[0])); + MemCopy(&fileSelect->health[0], sramCtx->readBuff + SLOT_OFFSET(0) + HEALTH, sizeof(fileSelect->health[0])); + MemCopy(&fileSelect->health[1], sramCtx->readBuff + SLOT_OFFSET(1) + HEALTH, sizeof(fileSelect->health[0])); + MemCopy(&fileSelect->health[2], sramCtx->readBuff + SLOT_OFFSET(2) + HEALTH, sizeof(fileSelect->health[0])); #endif PRINTF("f_64dd=%d, %d, %d\n", fileSelect->n64ddFlags[0], fileSelect->n64ddFlags[1], fileSelect->n64ddFlags[2]); @@ -910,11 +912,11 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { offset = gSramSlotOffsets[gSaveContext.fileNum]; PRINTF("I=%x no=%d\n", offset, gSaveContext.fileNum); - MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); + MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); offset = gSramSlotOffsets[gSaveContext.fileNum + 3]; PRINTF("I=%x no=%d\n", offset, gSaveContext.fileNum + 3); - MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); + MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE); @@ -924,18 +926,19 @@ void Sram_InitSave(FileSelectState* fileSelect, SramContext* sramCtx) { j = gSramSlotOffsets[gSaveContext.fileNum]; - MemCpy(&fileSelect->deaths[gSaveContext.fileNum], sramCtx->readBuff + j + DEATHS, sizeof(fileSelect->deaths[0])); - MemCpy(&fileSelect->fileNames[gSaveContext.fileNum], sramCtx->readBuff + j + NAME, - sizeof(fileSelect->fileNames[0])); - MemCpy(&fileSelect->healthCapacities[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH_CAP, - sizeof(fileSelect->healthCapacities[0])); - MemCpy(&fileSelect->questItems[gSaveContext.fileNum], sramCtx->readBuff + j + QUEST, - sizeof(fileSelect->questItems[0])); - MemCpy(&fileSelect->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD, - sizeof(fileSelect->n64ddFlags[0])); - MemCpy(&fileSelect->defense[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE, sizeof(fileSelect->defense[0])); + MemCopy(&fileSelect->deaths[gSaveContext.fileNum], sramCtx->readBuff + j + DEATHS, sizeof(fileSelect->deaths[0])); + MemCopy(&fileSelect->fileNames[gSaveContext.fileNum], sramCtx->readBuff + j + NAME, + sizeof(fileSelect->fileNames[0])); + MemCopy(&fileSelect->healthCapacities[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH_CAP, + sizeof(fileSelect->healthCapacities[0])); + MemCopy(&fileSelect->questItems[gSaveContext.fileNum], sramCtx->readBuff + j + QUEST, + sizeof(fileSelect->questItems[0])); + MemCopy(&fileSelect->n64ddFlags[gSaveContext.fileNum], sramCtx->readBuff + j + N64DD, + sizeof(fileSelect->n64ddFlags[0])); + MemCopy(&fileSelect->defense[gSaveContext.fileNum], sramCtx->readBuff + j + DEFENSE, + sizeof(fileSelect->defense[0])); #if OOT_PAL - MemCpy(&fileSelect->health[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH, sizeof(fileSelect->health[0])); + MemCopy(&fileSelect->health[gSaveContext.fileNum], sramCtx->readBuff + j + HEALTH, sizeof(fileSelect->health[0])); #endif PRINTF("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileSelect->n64ddFlags[gSaveContext.fileNum]); @@ -951,14 +954,14 @@ void Sram_EraseSave(FileSelectState* fileSelect, SramContext* sramCtx) { Sram_InitNewSave(); offset = gSramSlotOffsets[fileSelect->selectedFileIndex]; - MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); + MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE); - MemCpy(&fileSelect->n64ddFlags[fileSelect->selectedFileIndex], sramCtx->readBuff + offset + N64DD, - sizeof(fileSelect->n64ddFlags[0])); + MemCopy(&fileSelect->n64ddFlags[fileSelect->selectedFileIndex], sramCtx->readBuff + offset + N64DD, + sizeof(fileSelect->n64ddFlags[0])); offset = gSramSlotOffsets[fileSelect->selectedFileIndex + 3]; - MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); + MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000) + offset, &gSaveContext, SLOT_SIZE); PRINTF(T("CLEAR終了\n", "CLEAR END\n")); @@ -972,33 +975,33 @@ void Sram_CopySave(FileSelectState* fileSelect, SramContext* sramCtx) { gSramSlotOffsets[fileSelect->copyDestFileIndex]); offset = gSramSlotOffsets[fileSelect->selectedFileIndex]; - MemCpy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save)); + MemCopy(&gSaveContext, sramCtx->readBuff + offset, sizeof(Save)); offset = gSramSlotOffsets[fileSelect->copyDestFileIndex]; - MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); + MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); offset = gSramSlotOffsets[fileSelect->copyDestFileIndex + 3]; - MemCpy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); + MemCopy(sramCtx->readBuff + offset, &gSaveContext, sizeof(Save)); SRAM_WRITE(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE); offset = gSramSlotOffsets[fileSelect->copyDestFileIndex]; - MemCpy(&fileSelect->deaths[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEATHS, - sizeof(fileSelect->deaths[0])); - MemCpy(&fileSelect->fileNames[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + NAME, - sizeof(fileSelect->fileNames[0])); - MemCpy(&fileSelect->healthCapacities[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + HEALTH_CAP, - sizeof(fileSelect->healthCapacities[0])); - MemCpy(&fileSelect->questItems[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + QUEST, - sizeof(fileSelect->questItems[0])); - MemCpy(&fileSelect->n64ddFlags[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + N64DD, - sizeof(fileSelect->n64ddFlags[0])); - MemCpy(&fileSelect->defense[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEFENSE, - sizeof(fileSelect->defense[0])); + MemCopy(&fileSelect->deaths[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEATHS, + sizeof(fileSelect->deaths[0])); + MemCopy(&fileSelect->fileNames[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + NAME, + sizeof(fileSelect->fileNames[0])); + MemCopy(&fileSelect->healthCapacities[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + HEALTH_CAP, + sizeof(fileSelect->healthCapacities[0])); + MemCopy(&fileSelect->questItems[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + QUEST, + sizeof(fileSelect->questItems[0])); + MemCopy(&fileSelect->n64ddFlags[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + N64DD, + sizeof(fileSelect->n64ddFlags[0])); + MemCopy(&fileSelect->defense[fileSelect->copyDestFileIndex], sramCtx->readBuff + offset + DEFENSE, + sizeof(fileSelect->defense[0])); #if OOT_PAL - MemCpy(&fileSelect->health[fileSelect->copyDestFileIndex], (sramCtx->readBuff + offset) + HEALTH, - sizeof(fileSelect->health[0])); + MemCopy(&fileSelect->health[fileSelect->copyDestFileIndex], (sramCtx->readBuff + offset) + HEALTH, + sizeof(fileSelect->health[0])); #endif PRINTF("f_64dd[%d]=%d\n", gSaveContext.fileNum, fileSelect->n64ddFlags[gSaveContext.fileNum]); @@ -1026,7 +1029,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) { gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE]; #endif - MemCpy(sramCtx->readBuff, sSramDefaultHeader, sizeof(sSramDefaultHeader)); + MemCopy(sramCtx->readBuff, sSramDefaultHeader, sizeof(sSramDefaultHeader)); #if PLATFORM_GC && OOT_PAL sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language; diff --git a/src/code/z_view.c b/src/code/z_view.c index 4c37194cfd7..1819da015ae 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -35,7 +35,7 @@ View* View_New(GraphicsContext* gfxCtx) { View* view = SYSTEM_ARENA_MALLOC(sizeof(View), "../z_view.c", 285); if (view != NULL) { - memset(view, 0, sizeof(View)); + func_80106860(view, 0, sizeof(View)); // memset View_Init(view, gfxCtx); } @@ -563,8 +563,8 @@ s32 View_UpdateViewingMatrix(View* view) { return 1; } -s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) { - Gfx* gfx = *gfxP; +s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxp) { + Gfx* gfx = *gfxp; GraphicsContext* gfxCtx = view->gfxCtx; s32 width; s32 height; @@ -631,7 +631,7 @@ s32 View_ApplyTo(View* view, s32 mask, Gfx** gfxP) { } view->flags = 0; - *gfxP = gfx; + *gfxp = gfx; return 1; } diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c deleted file mode 100644 index 1616b661c04..00000000000 --- a/src/code/z_viscvg.c +++ /dev/null @@ -1,146 +0,0 @@ -/** - * @file z_viscvg.c - * - * This file implements full-screen frame buffer effects involving the visualization of Coverage in various ways. - * - * Coverage is roughly how much of a pixel is covered by a primitive; the final coverage for a frame is stored in the - * color image alpha component where it is used for antialiasing, see PreRender.c and §15 of the programming manual for - * details. - * - * To understand this file, it is helpful to remember that A_MEM is essentially synonymous with coverage, and that - * `GBL_c1/2(p, a, m, b)` usually represents the RDP blender calculation `(p * a + m * b)`. - * Note the division step that is often included in the blender calculation is omitted; the division is skipped if - * force blending (FORCE_BL) is set, which is the case for all render modes used in this file. - * - * Coverage is full when not on an edge, while on an edge it is usually lower. Since coverage is treated as an alpha - * value, edges of primitives where coverage is lower will show up darker than primitive interiors in all of the - * available modes. - * - * Coverage is abbreviated to "cvg"; "FB RGB" ("framebuffer red/green/blue") is the color the pixel originally had - * before the filter is applied. - */ - -#include "gfx.h" -#include "vis.h" - -/** - * Draws only coverage: does not retain any of the original pixel RGB, primColor is used as background color. - */ -Gfx sCoverageOnlyDL[] = { - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), - // (blendColor RGB) * (cvg) - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsDPPipeSync(), - gsDPSetBlendColor(0, 0, 0, 8), - gsSPEndDisplayList(), -}; - -/** - * Draws fog + coverage * RGB of pixels - * - * @bug This easily overflows the blender because the fog value is added to the coverage value. - */ -Gfx sCoverageRGBFogDL[] = { - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), - // (fog RGB) * (fog alpha) + (FB RGB) * (cvg) - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsSPEndDisplayList(), -}; - -/** - * Draws coverage and RGB of pixels - */ -Gfx sCoverageRGBDL[] = { - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - // (FB RGB) * (cvg) - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsSPEndDisplayList(), -}; - -/** - * Two stage filtering: - * - * 1. Apply a uniform color filter by transparently blending primColor with original frame. The "cloud surface" - * RenderMode is used to preserve the coverage for the second stage. - * 2. Second half is the same as `sCoverageRGBDL`'s, i.e. (RGB from stage 1) * cvg - */ -Gfx sCoverageRGBUniformDL[] = { - gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), - gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), - // stage 1 color = (primColor RGB) * (primColor Alpha) + (FB RGB) * (1 - primColor Alpha) - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - - gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | - GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | - GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - // final color = (stage 1 RGB) * (cvg) - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), - gsSPEndDisplayList(), -}; - -void VisCvg_Init(VisCvg* this) { - this->vis.type = FB_FILTER_NONE; - this->vis.scissorType = VIS_NO_SETSCISSOR; - this->vis.primColor.r = 255; - this->vis.primColor.g = 255; - this->vis.primColor.b = 255; - this->vis.primColor.a = 255; -} - -void VisCvg_Destroy(VisCvg* this) { -} - -void VisCvg_Draw(VisCvg* this, Gfx** gfxP) { - Gfx* gfx = *gfxP; - - gDPPipeSync(gfx++); - gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); - - if (this->vis.scissorType == VIS_SETSCISSOR) { - gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - } - - switch (this->vis.type) { - case FB_FILTER_CVG_RGB: - gSPDisplayList(gfx++, sCoverageRGBDL); - break; - - case FB_FILTER_CVG_RGB_UNIFORM: - // Set primitive color for uniform color filter in custom RenderMode - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba); - gSPDisplayList(gfx++, sCoverageRGBUniformDL); - break; - - case FB_FILTER_CVG_ONLY: - // Set background color for G_RM_VISCVG - gDPSetColor(gfx++, G_SETBLENDCOLOR, this->vis.primColor.rgba); - gSPDisplayList(gfx++, sCoverageOnlyDL); - break; - - case FB_FILTER_CVG_RGB_FOG: - // Set fog color for custom RenderMode, needs to be close to 0 to not overflow - gDPSetColor(gfx++, G_SETFOGCOLOR, this->vis.primColor.rgba); - gSPDisplayList(gfx++, sCoverageRGBFogDL); - break; - - default: - break; - } - - gDPPipeSync(gfx++); - *gfxP = gfx; -} diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 632d00a6e7d..90446d59be1 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,11 +1,5 @@ /** - * @file z_vismono.c - * - * This file implements a full-screen framebuffer effect for desaturating the contents of the framebuffer image. - * - * Broadly, this effect is achieved by reinterpreting the contents of the RGBA16 color image as indices into an IA16 - * color palette that converts each color into the desaturated equivalent. More precise details can be found in inline - * comments. + * Color frame buffer effect to desaturate the colors. */ #include "libc64/malloc.h" @@ -13,12 +7,14 @@ #include "attributes.h" #include "gfx.h" #include "gfxalloc.h" -#include "vis.h" + +#include "functions.h" +#include "z64.h" // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into -// the half of TMEM dedicated to color-indexed data. -#define VISMONO_CFBFRAG_HEIGHT ((TMEM_SIZE / 2) / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) +// the half of tmem (0x800 bytes) dedicated to color-indexed data. +#define VISMONO_CFBFRAG_HEIGHT (0x800 / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) // Maximum size of the dlist written by `VisMono_DesaturateDList`. // `VisMono_DesaturateDList` consistently uses `VISMONO_DLSIZE - 2` double words, so this can be 2 less. @@ -37,16 +33,16 @@ extern u16 D_0F000000[]; void VisMono_Init(VisMono* this) { bzero(this, sizeof(VisMono)); - this->vis.type = 0; - this->vis.scissorType = VIS_NO_SETSCISSOR; - this->vis.primColor.r = 255; - this->vis.primColor.g = 255; - this->vis.primColor.b = 255; - this->vis.primColor.a = 255; - this->vis.envColor.r = 0; - this->vis.envColor.g = 0; - this->vis.envColor.b = 0; - this->vis.envColor.a = 0; + this->unk_00 = 0; + this->setScissor = false; + this->primColor.r = 255; + this->primColor.g = 255; + this->primColor.b = 255; + this->primColor.a = 255; + this->envColor.r = 0; + this->envColor.g = 0; + this->envColor.b = 0; + this->envColor.a = 0; } void VisMono_Destroy(VisMono* this) { @@ -105,8 +101,6 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) { // Set texel 1 to be a CI8 image with width `SCREEN_WIDTH * 2` and height `VISMONO_CFBFRAG_HEIGHT` // Its position in texture image space is shifted along +S by 1 - // Note the palette index for this tile has also been incremented from 0 to 1, however the palette index is - // ignored for CI8 texture sampling. gDPSetTile(gfx++, G_IM_FMT_CI, G_IM_SIZ_8b, SCREEN_WIDTH * 2 * G_IM_SIZ_8b_LINE_BYTES / 8, 0x0, 1, 1, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0); gDPSetTileSize(gfx++, 1, 1 << 2, 0, (SCREEN_WIDTH * 2) << 2, (height - 1) << 2); @@ -141,8 +135,8 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) { return gfx; } -void VisMono_Draw(VisMono* this, Gfx** gfxP) { - Gfx* gfx = *gfxP; +void VisMono_Draw(VisMono* this, Gfx** gfxp) { + Gfx* gfx = *gfxp; u16* tlut; Gfx* dList; Gfx* dListEnd; @@ -171,12 +165,12 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP) { gDPPipeSync(gfx++); - if (this->vis.scissorType == VIS_SETSCISSOR) { + if (this->setScissor == true) { gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba); - gDPSetColor(gfx++, G_SETENVCOLOR, this->vis.envColor.rgba); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); gDPLoadTLUT_pal256(gfx++, tlut); @@ -184,7 +178,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxP) { gDPPipeSync(gfx++); - *gfxP = gfx; + *gfxp = gfx; } void VisMono_DrawOld(VisMono* this) { diff --git a/src/code/z_viszbuf.c b/src/code/z_viszbuf.c deleted file mode 100644 index aa722897420..00000000000 --- a/src/code/z_viszbuf.c +++ /dev/null @@ -1,117 +0,0 @@ -/** - * @file z_viszbuf.c - * - * This file implements a full-screen framebuffer effect for visualizing the z-buffer (AKA depth buffer), using either - * cycling RGBA or a single fading color. - * - * This is done by reading the z-buffer as if it were a color image, the format of which is specified by the selected - * vis type: - * - VIS_ZBUF_TYPE_IA : Produces a monotonic fade from primColor to envColor as depth increases. - * - VIS_ZBUF_TYPE_RGBA : Produces vibrant almost-periodic-looking bands. - * - * In both cases this occurs because of the format the depth information takes: it is 18-bit, and is a nonnegative - * floating-point number with - * bbb mmmmmmmmmmm dd|dd - * exponent mantissa dz value (only first 16 bits visible to CPU, the least significant 2 bits of dz are ignored) - * - * Reading z-buffer as IA16: - * bbbmmmmm mmmmmmdd - * iiiiiiii aaaaaaaa - * - * Since floating-point numbers of this format have the same ordering as their binary/hex representation, increasing - * the depth also increases the intensity in the IA16 representation and hence the interpolation parameter used to - * combine primColor and envColor. The alpha is ignored by the RenderMode. - * - * Reading z-buffer as RGBA16: - * bbbmm mmmmm mmmmd d - * rrrrr ggggg bbbbb a - * - * The red increases monotonically with the depth. The significant visible oscillation is the green component, because - * it rolls over every time the second-most-significant bit of the mantissa increments. The blue component oscillates - * too rapidly to be particularly visible (it rolls over when the 7th-most-significant bit increments). The alpha is - * again ignored by the RenderMode. - */ - -#include "gfx.h" -#include "vis.h" - -// Height of the fragments the z-buffer is split into. -// It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into TMEM. -#define VISZBUF_ZBUFFRAG_HEIGHT (TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) - -// z-buffer -extern u16 D_0E000000[]; - -/** - * Initialise to IA type with white and black as default colors. - */ -void VisZBuf_Init(VisZBuf* this) { - this->vis.type = VIS_ZBUF_TYPE_IA; - this->vis.scissorType = VIS_NO_SETSCISSOR; - - this->vis.primColor.r = 255; - this->vis.primColor.g = 255; - this->vis.primColor.b = 255; - this->vis.primColor.a = 255; - - // clang-format off - this->vis.envColor.r = 0; \ - this->vis.envColor.g = 0; \ - this->vis.envColor.b = 0; \ - this->vis.envColor.a = 255; - // clang-format on -} - -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; - s32 height; - - if (this->vis.type == VIS_ZBUF_TYPE_IA) { - fmt = G_IM_FMT_IA; - } else { // VIS_ZBUF_TYPE_RGBA - fmt = G_IM_FMT_RGBA; - } - - height = VISZBUF_ZBUFFRAG_HEIGHT; - - gDPPipeSync(gfx++); - // Scissoring is only required if the scissor has not been set prior. - if (this->vis.scissorType == VIS_SETSCISSOR) { - gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); - } - - // No palette so can use all of TMEM. - // G_RM_OPA_SURF discards all information previously in the pixel, and the current alpha, leaving only the color - // from this filter. - gDPSetOtherMode(gfx++, - G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_NONE | G_TL_TILE | - G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, - G_AC_NONE | G_ZS_PRIM | G_RM_OPA_SURF | G_RM_OPA_SURF2); - - // LERP between primColor and envColor in 1-cycle mode using the z-buffer value. - gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, - PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->vis.primColor.rgba); - gDPSetColor(gfx++, G_SETENVCOLOR, this->vis.envColor.rgba); - - for (y = 0; y <= SCREEN_HEIGHT - height; y += height) { - // Load a few lines of the z-buffer, as many as can fit in TMEM at once. - gDPLoadTextureBlock(gfx++, zbufFrag, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, - G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - - // Overwrite them with the calculated colors. - gSPTextureRectangle(gfx++, 0, y << 2, SCREEN_WIDTH << 2, (y + height) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, - 1 << 10); - zbufFrag += SCREEN_WIDTH * height; - } - - gDPPipeSync(gfx++); - *gfxP = gfx; -} diff --git a/src/code/z_vr_box_draw.c b/src/code/z_vr_box_draw.c index 46c38291f6d..43be3ffe090 100644 --- a/src/code/z_vr_box_draw.c +++ b/src/code/z_vr_box_draw.c @@ -19,9 +19,9 @@ void Skybox_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyboxId Gfx_SetupDL_40Opa(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x7, skyboxCtx->staticSegments[0]); - gSPSegment(POLY_OPA_DISP++, 0x8, skyboxCtx->staticSegments[1]); - gSPSegment(POLY_OPA_DISP++, 0x9, skyboxCtx->palettes); + gSPSegment(POLY_OPA_DISP++, 7, skyboxCtx->staticSegments[0]); + gSPSegment(POLY_OPA_DISP++, 8, skyboxCtx->staticSegments[1]); + gSPSegment(POLY_OPA_DISP++, 9, skyboxCtx->palettes); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 0, 0, 0, blend); gSPTexture(POLY_OPA_DISP++, 0x8000, 0x8000, 0, G_TX_RENDERTILE, G_ON); diff --git a/src/libc/code_80106860.c b/src/libc/code_80106860.c new file mode 100644 index 00000000000..5c8fee0d831 --- /dev/null +++ b/src/libc/code_80106860.c @@ -0,0 +1,12 @@ +#include "string.h" + +// memset used in __osMalloc, z_quake, z_view, and z_camera +void* func_80106860(void* ptr, int val, size_t size) { + char* sp4 = ptr; + register int a3; + + for (a3 = size--; a3 != 0; a3 = size--) { + *sp4++ = val; + } + return ptr; +} diff --git a/src/libc/code_801068B0.c b/src/libc/code_801068B0.c new file mode 100644 index 00000000000..397389577ec --- /dev/null +++ b/src/libc/code_801068B0.c @@ -0,0 +1,23 @@ +#include "string.h" + +// memmove used in __osMalloc.c +void* func_801068B0(void* dst, void* src, size_t size) { + char* spC = dst; + char* sp8 = src; + + if (spC == sp8) { + return dst; + } + if (spC < sp8) { + while (size--) { + *spC++ = *sp8++; + } + } else { + spC += size - 1; + sp8 += size - 1; + while (size--) { + *spC-- = *sp8--; + } + } + return dst; +} diff --git a/src/libc/fmodf.c b/src/libc/fmodf.c index 4ebec43bdc1..e414ba2b623 100644 --- a/src/libc/fmodf.c +++ b/src/libc/fmodf.c @@ -1,27 +1,12 @@ #include "ultra64.h" -/** - * Computes one `x` modulo `y` for floats. - * - * Acts like the standard C fmodf except does not handle Infinity. See https://en.cppreference.com/w/c/numeric/math/fmod - * for the details. It summarizes this function as follows: - * "The floating-point remainder of the division operation x/y calculated by this function is exactly the value x - n*y, - * where n is x/y with its fractional part truncated. - * - * The returned value has the same sign as x and is less or equal to y in magnitude." - * - * @param x dividend - * @param y modulus - * - * @return f32 0.0f if y is 0.0f, or x modulo y otherwise - */ f32 fmodf(f32 x, f32 y) { - s32 n; + s32 quot; if (y == 0.0f) { return 0.0f; } - n = x / y; + quot = x / y; - return x - (n * y); + return x - (quot * y); } diff --git a/src/libc/memmove.c b/src/libc/memmove.c deleted file mode 100644 index 302981f5801..00000000000 --- a/src/libc/memmove.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "string.h" - -/** - * memmove: copies `len` bytes from memory starting at `src` to memory starting at `dest`. - * - * Unlike memcpy(), the regions of memory may overlap. - * - * @param dest address of start of buffer to write to - * @param src address of start of buffer to read from - * @param len number of bytes to copy. - * - * @return dest - */ -void* memmove(void* dest, const void* src, size_t len) { - char* d = dest; - const char* 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; -} diff --git a/src/libc/memset.c b/src/libc/memset.c deleted file mode 100644 index 31dba02ed89..00000000000 --- a/src/libc/memset.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "string.h" - -/** - * memset: sets `len` bytes to `val` starting at address `dest`. - * - * @see There are two other memsets in this codebase, Lib_MemSet(), MemSet() - * - * @param dest address to start at - * @param val value to write (int, but interpreted as u8) - * @param len number of bytes to write - * - * @return dest - */ -void* memset(void* dest, int val, size_t len) { - char* ptr = dest; - - while (len--) { - *ptr++ = val; - } - return dest; -} diff --git a/src/libc64/__osMalloc_gc.c b/src/libc64/__osMalloc_gc.c index d6e4e17d13a..c7c0dec8e36 100644 --- a/src/libc64/__osMalloc_gc.c +++ b/src/libc64/__osMalloc_gc.c @@ -28,19 +28,19 @@ #define SET_DEBUG_INFO(node, file, line, arena) ArenaImpl_SetDebugInfo(node, file, line, arena) -#define FILL_UNINIT_BLOCK(arena, node, size) memset(node, BLOCK_UNINIT_MAGIC, size) +#define FILL_UNINIT_BLOCK(arena, node, size) func_80106860(node, BLOCK_UNINIT_MAGIC, size) // memset #define FILL_ALLOC_BLOCK(arena, alloc, size) \ if ((arena)->flag & FILL_ALLOC_BLOCK_FLAG) \ - memset(alloc, BLOCK_ALLOC_MAGIC, size) + func_80106860(alloc, BLOCK_ALLOC_MAGIC, size) #define FILL_FREE_BLOCK_HEADER(arena, node) \ if ((arena)->flag & FILL_FREE_BLOCK_FLAG) \ - memset(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode)) + func_80106860(node, BLOCK_FREE_MAGIC, sizeof(ArenaNode)) #define FILL_FREE_BLOCK_CONTENTS(arena, node) \ if ((arena)->flag & FILL_FREE_BLOCK_FLAG) \ - memset((void*)((u32)(node) + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, (node)->size) + func_80106860((void*)((u32)(node) + sizeof(ArenaNode)), BLOCK_FREE_MAGIC, (node)->size) #define CHECK_FREE_BLOCK(arena, node) \ if ((arena)->flag & CHECK_FREE_BLOCK_FLAG) \ @@ -222,7 +222,7 @@ void ArenaImpl_RemoveAllBlocks(Arena* arena) { iter = arena->head; while (iter != NULL) { next = NODE_GET_NEXT(iter); - memset(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); + func_80106860(iter, BLOCK_UNINIT_MAGIC, iter->size + sizeof(ArenaNode)); // memset iter = next; } @@ -653,7 +653,7 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { } node->next = newNext; node->size = newSize; - memmove(node->next, next, sizeof(ArenaNode)); + func_801068B0(node->next, next, sizeof(ArenaNode)); // memcpy } else { osSyncPrintf(T("新たにメモリブロックを確保して内容を移動します\n", "Allocate a new memory block and move the contents\n")); diff --git a/src/libc64/__osMalloc_n64.c b/src/libc64/__osMalloc_n64.c index 6b81212963d..0d154db8cd1 100644 --- a/src/libc64/__osMalloc_n64.c +++ b/src/libc64/__osMalloc_n64.c @@ -404,7 +404,7 @@ void* __osRealloc(Arena* arena, void* ptr, u32 newSize) { } node->next = newNext; node->size = newSize; - memmove(node->next, next, sizeof(ArenaNode)); + func_801068B0(node->next, next, sizeof(ArenaNode)); } else { newAlloc = __osMalloc(arena, newSize); if (newAlloc != NULL) { diff --git a/src/libc64/aprintf.c b/src/libc64/aprintf.c index 44cedac9757..73f3622734b 100644 --- a/src/libc64/aprintf.c +++ b/src/libc64/aprintf.c @@ -6,13 +6,8 @@ s32 PrintUtils_VPrintf(PrintCallback* pfn, const char* fmt, va_list args) { } s32 PrintUtils_Printf(PrintCallback* pfn, const char* fmt, ...) { - s32 ret; va_list args; va_start(args, fmt); - ret = PrintUtils_VPrintf(pfn, fmt, args); - - va_end(args); - - return ret; + return PrintUtils_VPrintf(pfn, fmt, args); } diff --git a/src/libc64/sprintf.c b/src/libc64/sprintf.c index 12286697c99..6b5010c0e85 100644 --- a/src/libc64/sprintf.c +++ b/src/libc64/sprintf.c @@ -30,8 +30,5 @@ int sprintf(char* dst, const char* fmt, ...) { if (ret > -1) { dst[ret] = '\0'; } - - va_end(args); - return ret; } diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c deleted file mode 100644 index 4ae1c7bd9e9..00000000000 --- a/src/libleo/api/cacreateleomanager.c +++ /dev/null @@ -1,83 +0,0 @@ -#include "ultra64/asm.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "stdint.h" -#include "attributes.h" - -#include "ultra64.h" - -s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { - OSPiHandle* driveRomHandle; - UNUSED OSPiHandle* leoDiskHandle; - volatile LEOCmdInquiry cmdBlockInq; - volatile LEOCmd cmdBlockID; - LEODiskID thisID; - u32 stat; - u32 data; - - if (__leoActive) { - return LEO_ERROR_GOOD; - } - - if (!LeoDriveExist()) { - return LEO_ERROR_DEVICE_COMMUNICATION_FAILURE; - } - - leoDiskHandle = osLeoDiskInit(); - driveRomHandle = osDriveRomInit(); - __leoActive = true; - - __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, (u8*)STACK_TOP(leoDiskStack) - FRAMESZ(SZREG * NARGSAVE)); - leoInitialize(comPri, intPri, cmdBuf, cmdMsgCnt); - - if (osResetType == 1) { // NMI - __leoSetReset(); - } - - cmdBlockInq.header.command = 2; - cmdBlockInq.header.reserve1 = 0; - cmdBlockInq.header.control = 0; - cmdBlockInq.header.reserve3 = 0; - leoCommand((void*)&cmdBlockInq); - - { - volatile s32 dummy = (uintptr_t)__osSetHWIntrRoutine & 0xA48D3C; - - while (dummy < 0xE00000) { - dummy += (((uintptr_t)leoCommand & 0xFF) | 0x8A) << 0x10; - } - } - - while (cmdBlockInq.header.status == 8) {} - - if (cmdBlockInq.header.status != 0) { - return GET_ERROR(cmdBlockInq); - } - - __leoVersion.driver = cmdBlockInq.version; - __leoVersion.drive = 6; - __leoVersion.deviceType = cmdBlockInq.devType; - __leoVersion.nDevices = cmdBlockInq.devNum; - - stat = __leoVersion.driver & 0xF; - if (stat == 4) { - LEO_country_code = 0; - } else if ((stat == 3) || (stat == 1)) { - volatile u32 dummy; - - osEPiReadIo(driveRomHandle, 0x9FF00, &data); - data = (data & 0xFF000000) >> 24; - if (data != 4) { - while (true) {} - } - - dummy = 0x32F8EB20; - LEO_country_code = 0x2263EE56; - dummy += (uintptr_t)&__leoActive; - } else { - while (true) {} - } - - return LEO_ERROR_GOOD; -} diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c deleted file mode 100644 index 1daf54ca124..00000000000 --- a/src/libleo/api/cjcreateleomanager.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "ultra64/asm.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "stdint.h" -#include "attributes.h" - -#include "ultra64.h" - -s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, OSMesg* cmdBuf, s32 cmdMsgCnt) { - OSPiHandle* driveRomHandle; - UNUSED OSPiHandle* leoDiskHandle; - volatile LEOCmdInquiry cmdBlockInq; - volatile LEOCmd cmdBlockID; - LEODiskID thisID; - u32 stat; - u32 data; - - if (__leoActive) { - return LEO_ERROR_GOOD; - } - - if (!LeoDriveExist()) { - return LEO_ERROR_DEVICE_COMMUNICATION_FAILURE; - } - - leoDiskHandle = osLeoDiskInit(); - driveRomHandle = osDriveRomInit(); - __leoActive = true; - - __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, (u8*)STACK_TOP(leoDiskStack) - FRAMESZ(SZREG * NARGSAVE)); - leoInitialize(comPri, intPri, cmdBuf, cmdMsgCnt); - - if (osResetType == 1) { // NMI - __leoSetReset(); - } - - cmdBlockInq.header.command = 2; - cmdBlockInq.header.reserve1 = 0; - cmdBlockInq.header.control = 0; - cmdBlockInq.header.reserve3 = 0; - leoCommand((void*)&cmdBlockInq); - - { - volatile s32 dummy = (uintptr_t)&cmdBlockInq & 0xFFFFFF; - - while (dummy > 0) { - dummy -= ((uintptr_t)__leoSetReset & 0xFFFFFF) | 0x403DF4; - } - } - - while (cmdBlockInq.header.status == 8) {} - - if (cmdBlockInq.header.status != 0) { - return GET_ERROR(cmdBlockInq); - } - - __leoVersion.driver = cmdBlockInq.version; - __leoVersion.drive = 6; - __leoVersion.deviceType = cmdBlockInq.devType; - __leoVersion.nDevices = cmdBlockInq.devNum; - - stat = __leoVersion.driver & 0xF; - if (stat == 4) { - LEO_country_code = 0; - } else if ((stat == 3) || (stat == 1)) { - volatile u32 dummy; - - osEPiReadIo(driveRomHandle, 0x9FF00, &data); - data = (data & 0xFF000000) >> 24; - dummy = 0x3ED98F23; - if (data != 0xC3) { - while (true) {} - } - - dummy *= data; - dummy -= (uintptr_t)&cmdBlockInq; - LEO_country_code = 0xE848D316; - } else { - while (true) {} - } - - return LEO_ERROR_GOOD; -} diff --git a/src/libleo/api/getaadr.s b/src/libleo/api/getaadr.s deleted file mode 100644 index 95c1cfb14d6..00000000000 --- a/src/libleo/api/getaadr.s +++ /dev/null @@ -1,323 +0,0 @@ -#include "ultra64/asm.h" -#include "ultra64/regdef.h" - -.text - -LEAF(LeoGetAAdr) - bltz a0, .out_of_range - bge a0, 0x908, .out_of_range - sll t0, a0, 2 - la v1, asc2tbl - add t1, t0, v1 - lbu t8, 2(t1) - lhu t9, 0(t1) - andi t2, t8, 0xF - addi t3, t2, 1 - sw t3, (a2) - lb t0, 3(t1) - srl t4, t8, 4 - andi t5, t0, 1 - sll t6, t5, 4 - or t7, t6, t4 - sw t7, (a1) - sll v0, t9, 1 - sra v1, t0, 1 - sw v1, (a3) - add v0, v0, 0x7EE80 - jr ra -.out_of_range: - li v0, -1 - jr ra -END(LeoGetAAdr) - -DATA(asc2tbl) -.word 0x00009D14, 0x00232A14, 0x00296314, 0x002F8A14, 0x00457E18, 0x0063CA14, 0x0084AA14, 0x00A03314 -.word 0x00A45E14, 0x00BB4E14, 0x00CA6514, 0x00D3770E, 0x00E33302, 0x00E78108, 0x00EB2102, 0x00EC6C14 -.word 0x01008A14, 0x01163A14, 0x01217A14, 0x01377A14, 0x014D8A14, 0x01638A14, 0x01798A14, 0x018F7A14 -.word 0x01A58A14, 0x01BB8A14, 0x01D1170E, 0x01D5490E, 0x01DF770E, 0x01EF740A, 0x01F9770E, 0x02097A14 -.word 0x021FDC16, 0x024DBA14, 0x026E7A14, 0x0284BA14, 0x02A59A14, 0x02C16A14, 0x02D26A14, 0x02E3BA14 -.word 0x03048A14, 0x031A1A14, 0x03206A14, 0x03318A14, 0x03476A14, 0x0358CA14, 0x03799A14, 0x0395CA14 -.word 0x03B67A14, 0x03CCCA14, 0x03ED8A14, 0x04037A14, 0x04196A14, 0x042A8A14, 0x0440AA14, 0x045CDA14 -.word 0x04839A14, 0x049F9A14, 0x04BB7A14, 0x04D14D14, 0x04DF5C14, 0x04F33D14, 0x05015216, 0x050681FA -.word 0x050A9D14, 0x052D9810, 0x05449A14, 0x05609810, 0x05779A14, 0x05939810, 0x05AA5A14, 0x05BB9C10 -.word 0x05DC7A14, 0x05F22A14, 0x05F83D14, 0x06067A14, 0x061C2A14, 0x0622D810, 0x06427810, 0x06549810 -.word 0x066B9B10, 0x06899B10, 0x06A74810, 0x06B06810, 0x06BE5A14, 0x06CF770E, 0x06DF870E, 0x06EFB70E -.word 0x0707670E, 0x07138A0E, 0x0729670E, 0x07356D14, 0x074A1F16, 0x07526D14, 0x07675216, 0x076C9D14 -.word 0x078F9D14, 0x07B22A0E, 0x07B88B14, 0x07D08A14, 0x07E69816, 0x07FD9A14, 0x08193F16, 0x08296C14 -.word 0x083D5114, 0x0840CA14, 0x08616614, 0x086C650C, 0x0875830A, 0x087D9D14, 0x08A0CA14, 0x08C14114 -.word 0x08C35318, 0x08C98810, 0x08DB9D14, 0x08FE9D14, 0x09213216, 0x09249A0E, 0x09407A14, 0x0956440E -.word 0x095B3302, 0x095F9D14, 0x09826614, 0x098D650C, 0x09960A15, 0x09C2C514, 0x09D4070F, 0x09F47A0E -.word 0x0A0ABE1C, 0x0A37BE1C, 0x0A64BE1C, 0x0A91BD1A, 0x0ABBBD1A, 0x0AE5BE1C, 0x0B12FA14, 0x0B3EBE14 -.word 0x0B6B7E1C, 0x0B897E1C, 0x0BA77E1C, 0x0BC57D1A, 0x0BE13E1C, 0x0BF04E1C, 0x0BFF4E1C, 0x0C0E5D1A -.word 0x0C239D14, 0x0C469D1A, 0x0C69BE1C, 0x0C96BE1C, 0x0CC3BE1C, 0x0CF0BD1A, 0x0D1ABD1A, 0x0D44770E -.word 0x0D54CC16, 0x0D7B8E1C, 0x0D998E1C, 0x0DB77E1C, 0x0DD57D1A, 0x0DF19D14, 0x0E149D14, 0x0E379A14 -.word 0x0E539B16, 0x0E719B16, 0x0E8F9B16, 0x0EAD9B16, 0x0ECB9A14, 0x0EE79B16, 0x0F050811, 0x0F299B10 -.word 0x0F479B16, 0x0F659B16, 0x0F839B16, 0x0FA19A14, 0x0FBD3B16, 0x0FC93A16, 0x0FD44B16, 0x0FE04A14 -.word 0x0FEB7912, 0x0FFF8B16, 0x10179B16, 0x10359B16, 0x10539B16, 0x10719B16, 0x108F9A14, 0x10AB760C -.word 0x10B99910, 0x10D28B16, 0x10EA8B16, 0x11028B16, 0x111A8A14, 0x11309D14, 0x11539D14, 0x11769D14 -.word 0x11996F18, 0x11B13A14, 0x11BC7514, 0x11C88912, 0x11DC9D16, 0x11FFEA14, 0x1226CA14, 0x12474514 -.word 0x124D4D14, 0x125B4D14, 0x12696614, 0x1274870E, 0x12843404, 0x12899108, 0x128E4204, 0x12916C14 -.word 0x12A5AA14, 0x12C17A14, 0x12D79A14, 0x12F3AA14, 0x130FAA14, 0x132B9B16, 0x1349AA14, 0x1365AA14 -.word 0x1381AA14, 0x139DAA14, 0x13B9370E, 0x13C1390E, 0x13CB770E, 0x13DB750C, 0x13E7770E, 0x13F79A14 -.word 0x1413CC14, 0x143ACA14, 0x145BBA14, 0x147CBA14, 0x149DBA14, 0x14BEBA14, 0x14DFBA14, 0x1500BA14 -.word 0x1521CA14, 0x15426A14, 0x1553AA14, 0x156FCA14, 0x1590AA14, 0x15ACFA14, 0x15D8CA14, 0x15F9BA14 -.word 0x161AAA14, 0x1636CE14, 0x1663CA14, 0x16849A14, 0x16A0CA14, 0x16C1BA14, 0x16E2CA14, 0x1703EA14 -.word 0x172ACA14, 0x174BCA14, 0x176CAA14, 0x17883D14, 0x17966C14, 0x17AA3D14, 0x17B85214, 0x17BD92FC -.word 0x17C55F1A, 0x17DD870E, 0x17EDAA14, 0x1809870E, 0x18199A14, 0x1835970E, 0x18497A14, 0x185F9C10 -.word 0x1880BA14, 0x18A15A14, 0x18B26E14, 0x18C9AA14, 0x18E55A14, 0x18F6F70E, 0x1916A70E, 0x192A970E -.word 0x193EAB0E, 0x195C9B0E, 0x197A770E, 0x198A770E, 0x199A6912, 0x19A9A70E, 0x19BDA60E, 0x19CFD70E -.word 0x19EBA70E, 0x19FFAB0E, 0x1A1D870E, 0x1A2D6D14, 0x1A423F16, 0x1A526D14, 0x1A675214, 0x1A6C6F18 -.word 0x1A846F16, 0x1A9C3A0E, 0x1AA78B14, 0x1ABFAA14, 0x1ADB8614, 0x1AE9BA14, 0x1B0A2F16, 0x1B128A14 -.word 0x1B285214, 0x1B2DBB14, 0x1B516614, 0x1B5C860C, 0x1B6A730A, 0x1B726E16, 0x1B89BB14, 0x1BAD5012 -.word 0x1BAF5316, 0x1BB58910, 0x1BC95F18, 0x1BE15F18, 0x1BF95316, 0x1BFFA90C, 0x1C188A14, 0x1C2E540E -.word 0x1C363404, 0x1C3B6D14, 0x1C506614, 0x1C5B860C, 0x1C690913, 0x1C91C512, 0x1CA3D70E, 0x1CBF9A0E -.word 0x1CDBCD1A, 0x1D05CD1A, 0x1D2FCD1A, 0x1D59CD1A, 0x1D83CD1A, 0x1DADCE1C, 0x1DDA2A15, 0x1E0CBD14 -.word 0x1E36BD1A, 0x1E60BD1A, 0x1E8ABD1A, 0x1EB4BC18, 0x1EDB6D1A, 0x1EF06D1A, 0x1F056D1A, 0x1F1A6D1A -.word 0x1F2F5F1A, 0x1F47BD1A, 0x1F71CD1A, 0x1F9BCD1A, 0x1FC5CD1A, 0x1FEFCD1A, 0x2019CD1A, 0x2043970E -.word 0x2057CB14, 0x207BAD1A, 0x209EBD1A, 0x20C8BD1A, 0x20F2BD1A, 0x211C6F1A, 0x21345F1A, 0x214CAA14 -.word 0x21689B16, 0x21869B16, 0x21A49A14, 0x21C0AA14, 0x21DC9A14, 0x21F89B16, 0x2216D70E, 0x22329B0E -.word 0x22508B16, 0x22689B16, 0x22869A14, 0x22A29A14, 0x22BE5B16, 0x22D05B16, 0x22E25A14, 0x22F35A14 -.word 0x23048912, 0x2318AA14, 0x23349B16, 0x23529B16, 0x23709A14, 0x238C9A14, 0x23A89A14, 0x23C49910 -.word 0x23DD9A10, 0x23F9AB16, 0x2417AB16, 0x2435AA14, 0x2451AA14, 0x246D5F18, 0x24855F18, 0x249DAE14 -.word 0x24C39D14, 0x24E62A14, 0x24EC5314, 0x24F28912, 0x25068D16, 0x2522CA14, 0x2543CA14, 0x25642314 -.word 0x25663C14, 0x25733C14, 0x25806514, 0x2589770E, 0x25993302, 0x259D9006, 0x25A03102, 0x25A26C14 -.word 0x25B69A14, 0x25D26A14, 0x25E38A14, 0x25F99A14, 0x26159A14, 0x26318A14, 0x26478A14, 0x265D9912 -.word 0x26769A14, 0x26928A14, 0x26A8260C, 0x26AC480C, 0x26B5870E, 0x26C5740A, 0x26CF770E, 0x26DF8A14 -.word 0x26F5DC14, 0x2723CA14, 0x2744A912, 0x275DAA14, 0x2779B912, 0x2797A912, 0x27B0A912, 0x27C9BA14 -.word 0x27EAC912, 0x28085912, 0x28179912, 0x2830B912, 0x284E9912, 0x2867D912, 0x288AB912, 0x28A8CA14 -.word 0x28C99912, 0x28E2CD14, 0x290CB912, 0x292A9A14, 0x2946A912, 0x295FB912, 0x297DC912, 0x299B0913 -.word 0x29C3C912, 0x29E1B912, 0x29FF9912, 0x2A183B12, 0x2A246C14, 0x2A383B12, 0x2A445214, 0x2A4981FA -.word 0x2A4D9D14, 0x2A70970E, 0x2A849A14, 0x2AA0770E, 0x2AB09A14, 0x2ACC870E, 0x2ADC6A14, 0x2AED9C10 -.word 0x2B0E9A14, 0x2B2A4912, 0x2B346D12, 0x2B499A14, 0x2B655A14, 0x2B76F70E, 0x2B96A70E, 0x2BAA970E -.word 0x2BBE9B0E, 0x2BDCAB0E, 0x2BFA770E, 0x2C0A770E, 0x2C1A6912, 0x2C29A70E, 0x2C3D970E, 0x2C51C70E -.word 0x2C69A70E, 0x2C7D9B0E, 0x2C9B770E, 0x2CAB5C12, 0x2CBF2F16, 0x2CC76C12, 0x2CDB5214, 0x2CE08D14 -.word 0x2CFC9D14, 0x2D1F2A0E, 0x2D257B14, 0x2D3D9A14, 0x2D599714, 0x2D6DB912, 0x2D8B2F16, 0x2D937A14 -.word 0x2DA95112, 0x2DACCB14, 0x2DD07714, 0x2DE0760C, 0x2DEE730A, 0x2DF69D14, 0x2E19BB14, 0x2E3D5112 -.word 0x2E405316, 0x2E468810, 0x2E589D14, 0x2E7B9D14, 0x2E9E4214, 0x2EA19A0C, 0x2EBD7A14, 0x2ED3440E -.word 0x2ED82302, 0x2EDA8D14, 0x2EF66714, 0x2F02760C, 0x2F100A15, 0x2F3CC614, 0x2F51C70E, 0x2F698A0E -.word 0x2F7FCD1A, 0x2FA9CD1A, 0x2FD3BD1A, 0x2FFDCD1A, 0x3027CC18, 0x304ECE1C, 0x307B0913, 0x30A3BD14 -.word 0x30CDAD1A, 0x30F0BD1A, 0x311ABD1A, 0x3144AC18, 0x31654D1A, 0x31734D1A, 0x31814D1A, 0x318F5C18 -.word 0x31A39D14, 0x31C6BD1A, 0x31F0CD1A, 0x321ACD1A, 0x3244CD1A, 0x326ECD1A, 0x3298CC18, 0x32BFA70E -.word 0x32D3BB14, 0x32F7BD1A, 0x3321CD1A, 0x334BBD1A, 0x3375BC18, 0x339C8D14, 0x33B88D14, 0x33D49A14 -.word 0x33F09A14, 0x340C9A14, 0x34289A14, 0x34449A14, 0x34609912, 0x34799B16, 0x3497C70E, 0x34AF7A0E -.word 0x34C58A14, 0x34DB8A14, 0x34F17A14, 0x35077912, 0x351B5A14, 0x352C5A14, 0x353D5A14, 0x354E6912 -.word 0x355D7912, 0x35719A14, 0x358D8A14, 0x35A38A14, 0x35B98A14, 0x35CF8A14, 0x35E58912, 0x35F9870E -.word 0x36099910, 0x3622AA14, 0x363EAA14, 0x365AAA14, 0x36769912, 0x368F8D14, 0x36AB8D14, 0x36C79D12 -.word 0x36EA6F18, 0x37024912, 0x370C7412, 0x37166B14, 0x37288C14, 0x37427912, 0x37568810, 0x37684412 -.word 0x376D5C12, 0x37815C12, 0x37957612, 0x37A39710, 0x37B74404, 0x37BCA108, 0x37C13306, 0x37C57B14 -.word 0x37DD8912, 0x37F17912, 0x38057912, 0x38198912, 0x382D8912, 0x38417912, 0x38557912, 0x38697912 -.word 0x387D8912, 0x38918912, 0x38A5370E, 0x38AD480C, 0x38B69710, 0x38CA940E, 0x38D79710, 0x38EB7912 -.word 0x38FF8B14, 0x3917A912, 0x39309912, 0x39498912, 0x395D8912, 0x39719912, 0x398A9912, 0x39A39912 -.word 0x39BC9912, 0x39D57912, 0x39E99912, 0x3A029912, 0x3A1B9912, 0x3A34A912, 0x3A4D9912, 0x3A669912 -.word 0x3A7F8912, 0x3A939B12, 0x3AB19912, 0x3ACA8912, 0x3ADE8912, 0x3AF29912, 0x3B0B9912, 0x3B24A912 -.word 0x3B3D8912, 0x3B518912, 0x3B657912, 0x3B794C12, 0x3B867B14, 0x3B9E4C12, 0x3BAB6214, 0x3BB0A2FC -.word 0x3BB85F1A, 0x3BD0870E, 0x3BE09912, 0x3BF9870E, 0x3C098912, 0x3C1D870E, 0x3C2D8912, 0x3C419A0E -.word 0x3C5D8912, 0x3C718A14, 0x3C877D14, 0x3CA39912, 0x3CBC8912, 0x3CD0A70E, 0x3CE4970E, 0x3CF8970E -.word 0x3D0C9B0E, 0x3D2AAB0E, 0x3D48970E, 0x3D5C770E, 0x3D6C8912, 0x3D80970E, 0x3D94970E, 0x3DA8A70E -.word 0x3DBC870E, 0x3DCC9A0E, 0x3DE8770E, 0x3DF86D12, 0x3E0D2F16, 0x3E156D12, 0x3E2A6212, 0x3E2F6F16 -.word 0x3E476F16, 0x3E5F4912, 0x3E697A14, 0x3E7F7912, 0x3E938612, 0x3EA19912, 0x3EBA3F16, 0x3ECA8A12 -.word 0x3EE06112, 0x3EE3A812, 0x3EFA7712, 0x3F0A550C, 0x3F13950E, 0x3F226E16, 0x3F399812, 0x3F506112 -.word 0x3F534316, 0x3F578812, 0x3F695F18, 0x3F815F18, 0x3F995214, 0x3F9E9A0E, 0x3FBA7912, 0x3FCE320C -.word 0x3FD14404, 0x3FD66D14, 0x3FEB7712, 0x3FFB650C, 0x40048710, 0x40148310, 0x401C860E, 0x402A7912 -.word 0x403EAC18, 0x405FAC18, 0x4080AC18, 0x40A1AB16, 0x40BFAB16, 0x40DDAD1A, 0x4100B912, 0x411E8C12 -.word 0x41388C18, 0x41529C18, 0x41739C18, 0x41948B16, 0x41AC7C18, 0x41C67C18, 0x41E07C18, 0x41FA7B16 -.word 0x42125F1A, 0x422AAB16, 0x42489C18, 0x42699C18, 0x428A9C18, 0x42AB9B16, 0x42C99B16, 0x42E7870E -.word 0x42F79A12, 0x43139C18, 0x43349C18, 0x4355AC18, 0x4376AB16, 0x43946F1A, 0x43AC5F1A, 0x43C48912 -.word 0x43D88A14, 0x43EE8A14, 0x44049A14, 0x44209912, 0x44398912, 0x444D8B16, 0x4465970E, 0x44798A0E -.word 0x448F8A14, 0x44A58A14, 0x44BB9A14, 0x44D79912, 0x44F08A14, 0x45068A14, 0x451C7A14, 0x45327912 -.word 0x45468912, 0x455A9912, 0x45738A14, 0x45898A14, 0x459F9912, 0x45B89912, 0x45D19912, 0x45EAA912 -.word 0x46039910, 0x461C9A14, 0x46389A14, 0x46548A14, 0x466A9912, 0x46835F18, 0x469B5F18, 0x46B38C12 -.word 0x46CD3C16, 0x46DA3C16, 0x46E77516, 0x46F39A14, 0x470F7E18, 0x472DDC16, 0x475BBC16, 0x47824516 -.word 0x47884F18, 0x47984F18, 0x47A85516, 0x47B1870E, 0x47C15504, 0x47CA810A, 0x47CE4304, 0x47D28F18 -.word 0x47F29C16, 0x48134B16, 0x481F8B16, 0x48378C16, 0x48519B16, 0x486F8C16, 0x48898C16, 0x48A38B16 -.word 0x48BB8C16, 0x48D58C16, 0x48EF380E, 0x48F84A0E, 0x4903970E, 0x4917850C, 0x4923870E, 0x49337C16 -.word 0x494DCC16, 0x4974BB16, 0x49988B16, 0x49B09C16, 0x49D1AB16, 0x49EF7B16, 0x4A077B16, 0x4A1FBC16 -.word 0x4A46AB16, 0x4A643B16, 0x4A706C16, 0x4A849B16, 0x4AA26B16, 0x4AB4DC16, 0x4AE2AC16, 0x4B03CC16 -.word 0x4B2A8B16, 0x4B42CC16, 0x4B698B16, 0x4B818C16, 0x4B9B7B16, 0x4BB39C16, 0x4BD4BC16, 0x4BFBFC16 -.word 0x4C2FAB16, 0x4C4DAB16, 0x4C6B9B16, 0x4C893E18, 0x4C988C18, 0x4CB24E18, 0x4CC16316, 0x4CC781FC -.word 0x4CCB3C16, 0x4CD8880E, 0x4CEA8D18, 0x4D06680E, 0x4D149D18, 0x4D37880E, 0x4D495C18, 0x4D5D8B0E -.word 0x4D757C18, 0x4D8F3B16, 0x4D9B3F16, 0x4DAB8C18, 0x4DC53C18, 0x4DD2B70E, 0x4DEA770E, 0x4DFA980E -.word 0x4E119B0E, 0x4E2F9B0E, 0x4E4D670E, 0x4E59680E, 0x4E674912, 0x4E71780E, 0x4E83980E, 0x4E9AD80E -.word 0x4EBAA70E, 0x4ECE9B0E, 0x4EEC770E, 0x4EFC5F18, 0x4F142C18, 0x4F1B4F18, 0x4F2B7114, 0x4F2F3C16 -.word 0x4F3C3C10, 0x4F493B0E, 0x4F556A14, 0x4F669C16, 0x4F879810, 0x4F9E9B16, 0x4FBC2C18, 0x4FC38E18 -.word 0x4FE16216, 0x4FE6DC16, 0x50146616, 0x501F7710, 0x502F840C, 0x50393C1A, 0x5046DC16, 0x50747116 -.word 0x50784316, 0x507C8912, 0x50903C14, 0x509D3C14, 0x50AA4316, 0x50AE7B0E, 0x50C6AE16, 0x50EC6610 -.word 0x50F75504, 0x51003C18, 0x510D6616, 0x51188710, 0x5128FC16, 0x515CE616, 0x5175D80E, 0x51958B0E -.word 0x51ADCC18, 0x51D4BC18, 0x51FBBC18, 0x5222BC18, 0x5249CC18, 0x5270BC18, 0x5297FB16, 0x52C79E16 -.word 0x52ED6C18, 0x53016C18, 0x53157C18, 0x532F7C18, 0x53494C18, 0x53564C18, 0x53636C18, 0x53777C18 -.word 0x53913C18, 0x539EAD18, 0x53C1CD18, 0x53EBCD18, 0x5415CD18, 0x543FCD18, 0x5469CC18, 0x5490970E -.word 0x54A4CC16, 0x54CB9D18, 0x54EE9D18, 0x55119D18, 0x55349D18, 0x55573C18, 0x55643C18, 0x55719D18 -.word 0x55948C16, 0x55AE9C16, 0x55CF8C16, 0x55E99B14, 0x56078C16, 0x56219C16, 0x5642C80E, 0x565D6A0E -.word 0x566E8C16, 0x56887C16, 0x56A28C16, 0x56BC7C16, 0x56D64B16, 0x56E24B16, 0x56EE6B16, 0x57007B16 -.word 0x57187B16, 0x57307A14, 0x57469C16, 0x57678C16, 0x57818C16, 0x579B9B14, 0x57B99C16, 0x57DA880E -.word 0x57EC980E, 0x58038C16, 0x581D8C16, 0x58378C16, 0x58518C16, 0x586B3C16, 0x58783C16, 0x58859F16 -.word 0x58AD6F18, 0x58C55C16, 0x58D98516, 0x58E59B14, 0x59038E18, 0x5921BC16, 0x5948AC16, 0x59695516 -.word 0x59724F18, 0x59825F18, 0x599A6516, 0x59A3970E, 0x59B75504, 0x59C0810A, 0x59C43304, 0x59C8AF18 -.word 0x59F09C16, 0x5A115B16, 0x5A239B16, 0x5A418C16, 0x5A5B9B16, 0x5A799C16, 0x5A9A9C16, 0x5ABBAC16 -.word 0x5ADC8C16, 0x5AF69C16, 0x5B17480E, 0x5B206A0E, 0x5B31970E, 0x5B45950C, 0x5B54970E, 0x5B687C16 -.word 0x5B82CC16, 0x5BA9BB16, 0x5BCD9B16, 0x5BEB9C16, 0x5C0CBB16, 0x5C309B16, 0x5C4E9B16, 0x5C6CBC16 -.word 0x5C93BB16, 0x5CB75B16, 0x5CC98C16, 0x5CE3BB16, 0x5D077B16, 0x5D1FDC16, 0x5D4DCC16, 0x5D74DC16 -.word 0x5DA29B16, 0x5DC0CC16, 0x5DE79B16, 0x5E059C16, 0x5E268B16, 0x5E3EAC16, 0x5E5FBC16, 0x5E860C17 -.word 0x5EBABB16, 0x5EDEAB16, 0x5EFCBB16, 0x5F205E18, 0x5F376E18, 0x5F4E6E18, 0x5F655316, 0x5F6B91FC -.word 0x5F706F1A, 0x5F88980E, 0x5F9F9D18, 0x5FC2680E, 0x5FD0AD18, 0x5FF3880E, 0x60056C18, 0x60199B0E -.word 0x60378C18, 0x60515B16, 0x60636F16, 0x607B9C18, 0x609C5C18, 0x60B0C70E, 0x60C8870E, 0x60D8880E -.word 0x60EA9B0E, 0x61089B0E, 0x6126770E, 0x6136680E, 0x61446912, 0x6153780E, 0x6165980E, 0x617CD80E -.word 0x619CA70E, 0x61B0AB0E, 0x61CEA70E, 0x61E26F18, 0x61FA4C18, 0x62076F18, 0x621F7114, 0x62236F18 -.word 0x623B6F16, 0x62534B0E, 0x625F7A14, 0x6275AC16, 0x6296A810, 0x62ADAB16, 0x62CB4C18, 0x62D88E18 -.word 0x62F66216, 0x62FBDC16, 0x63297616, 0x63378710, 0x6347940C, 0x63546F18, 0x636CDC16, 0x639A6116 -.word 0x639D4316, 0x63A19912, 0x63BA6F18, 0x63D26F18, 0x63EA5316, 0x63F09B0E, 0x640E9E16, 0x64346610 -.word 0x643F5504, 0x64486F18, 0x64607616, 0x646E8710, 0x647EFA14, 0x64AAD514, 0x64BFC60C, 0x64D47B0E -.word 0x64ECCC18, 0x6513BC18, 0x653ABC18, 0x6561CC18, 0x6588CC18, 0x65AFBC18, 0x65D6FB16, 0x6606AE16 -.word 0x662C8C18, 0x66468C18, 0x66609C18, 0x66819C18, 0x66A25C18, 0x66B66C18, 0x66CA7C18, 0x66E47C18 -.word 0x66FE6F1A, 0x6716CD18, 0x6740DD18, 0x6771CD18, 0x679BCD18, 0x67C5CD18, 0x67EFDD18, 0x6820A70E -.word 0x6834FC16, 0x6868AD18, 0x688BAD18, 0x68AEAD18, 0x68D1AD18, 0x68F46F1A, 0x690C6F1A, 0x69249D18 -.word 0x69479C16, 0x69689C16, 0x69899C16, 0x69AA9B14, 0x69C89C16, 0x69E99C16, 0x6A0AD80E, 0x6A2A7A0E -.word 0x6A408C16, 0x6A5A8C16, 0x6A748C16, 0x6A8E8C16, 0x6AA85B16, 0x6ABA5B16, 0x6ACC6B16, 0x6ADE6B16 -.word 0x6AF07B16, 0x6B089A14, 0x6B248C16, 0x6B3E9C16, 0x6B5F9C16, 0x6B808B14, 0x6B988C16, 0x6BB2980E -.word 0x6BC9980E, 0x6BE08C16, 0x6BFA8C16, 0x6C148C16, 0x6C2E8C16, 0x6C486F18, 0x6C606F18, 0x6C78AF16 -.word 0x6CA06F18, 0x6CB82A14, 0x6CBE4314, 0x6CC29A14, 0x6CDE8D16, 0x6CFADB14, 0x6D249B14, 0x6D422314 -.word 0x6D445D14, 0x6D594D14, 0x6D675414, 0x6D6F870E, 0x6D7F2402, 0x6D829108, 0x6D872102, 0x6D885A14 -.word 0x6D998B14, 0x6DB15A14, 0x6DC28A14, 0x6DD88B14, 0x6DF08A14, 0x6E068B14, 0x6E1E8B14, 0x6E368A14 -.word 0x6E4C8B14, 0x6E648B14, 0x6E7C270E, 0x6E802A0E, 0x6E86970E, 0x6E9A850C, 0x6EA6970E, 0x6EBA7A14 -.word 0x6ED0DB14, 0x6EFAAA14, 0x6F169A14, 0x6F32AB14, 0x6F509A14, 0x6F6C9A14, 0x6F889A14, 0x6FA4AB14 -.word 0x6FC2AA14, 0x6FDE2A14, 0x6FE47B14, 0x6FFC9A14, 0x70188A14, 0x702EBA14, 0x704F9A14, 0x706BBB14 -.word 0x708F9A14, 0x70ABBB14, 0x70CF9A14, 0x70EB9B14, 0x7109AA14, 0x71259B14, 0x7143AA14, 0x715FEA14 -.word 0x7186AA14, 0x71A2AA14, 0x71BE9A14, 0x71DA3D14, 0x71E87A14, 0x71FE4D14, 0x720C5214, 0x721190FC -.word 0x72145F1A, 0x722C8910, 0x72408B14, 0x72588910, 0x726C7C16, 0x72868910, 0x729A6A14, 0x72AB8C10 -.word 0x72C57A14, 0x72DB2A14, 0x72E14E14, 0x72F07A14, 0x73062A14, 0x730CB810, 0x73277810, 0x73398910 -.word 0x734D8C10, 0x73678C10, 0x73815810, 0x738F7910, 0x73A34A12, 0x73AE780E, 0x73C0870E, 0x73D0B70E -.word 0x73E8770E, 0x73F88B0E, 0x7410770E, 0x74205D14, 0x74352A14, 0x743B6D14, 0x74506114, 0x74536F18 -.word 0x746B6F16, 0x74832A0E, 0x74898B12, 0x74A18B14, 0x74B98710, 0x74C99A14, 0x74E52A14, 0x74EB7E14 -.word 0x75094114, 0x750BBA14, 0x752C5414, 0x7534650C, 0x753D840A, 0x75476E16, 0x755EBA14, 0x757F6114 -.word 0x75823316, 0x7586870E, 0x75965F18, 0x75AE5F18, 0x75C64214, 0x75C99B0E, 0x75E78D14, 0x7603430C -.word 0x76072402, 0x760A6D14, 0x761F5414, 0x7627550C, 0x7630FB14, 0x7660C514, 0x7672E80E, 0x76928A0E -.word 0x76A8AD1A, 0x76CBAD1A, 0x76EEAD1A, 0x7711AD1A, 0x7734AD1A, 0x7757AE1C, 0x777DFA14, 0x77A9AD14 -.word 0x77CC8D1A, 0x77E88D1A, 0x78048D1A, 0x78208C18, 0x783A4D1A, 0x78483D1A, 0x78565D1A, 0x786B5D1A -.word 0x78805F1A, 0x7898AD1A, 0x78BBCE1A, 0x78E8BE1A, 0x7915BE1A, 0x7942BE1A, 0x796FCD18, 0x7999870E -.word 0x79A9BB14, 0x79CD9E1A, 0x79F39E1A, 0x7A199E1A, 0x7A3FAE1A, 0x7A656F1A, 0x7A7D5F1A, 0x7A958B14 -.word 0x7AAD8C16, 0x7AC78C16, 0x7AE18C16, 0x7AFB8B14, 0x7B138B14, 0x7B2B8C16, 0x7B45D910, 0x7B687C10 -.word 0x7B828C16, 0x7B9C8C16, 0x7BB68C16, 0x7BD08B14, 0x7BE84B16, 0x7BF44B16, 0x7C005B16, 0x7C124B16 -.word 0x7C1E7B14, 0x7C367A14, 0x7C4C8C16, 0x7C668C16, 0x7C808C16, 0x7C9A8B14, 0x7CB28B14, 0x7CCA870E -.word 0x7CDA8910, 0x7CEE7C16, 0x7D088C16, 0x7D227C16, 0x7D3C7B14, 0x7D545F18, 0x7D6C5F18, 0x7D848E14 -.word 0x7DA26F16, 0x7DBA3A14, 0x7DC56414, 0x7DCD9A14, 0x7DE98D16, 0x7E05EB14, 0x7E2FBB14, 0x7E533414 -.word 0x7E584D14, 0x7E664D14, 0x7E746414, 0x7E7C870E, 0x7E8C3402, 0x7E91920A, 0x7E993102, 0x7E9B7A14 -.word 0x7EB18B14, 0x7EC95A14, 0x7EDA8A14, 0x7EF08B14, 0x7F088A14, 0x7F1E8B14, 0x7F368B14, 0x7F4E8A14 -.word 0x7F648B14, 0x7F7C9B14, 0x7F9A370E, 0x7FA23A0E, 0x7FADA80E, 0x7FC4960C, 0x7FD6980E, 0x7FED9A14 -.word 0x8009DC16, 0x8037BA14, 0x8058AA14, 0x8074BB14, 0x8098AA14, 0x80B49A14, 0x80D09A14, 0x80ECBB14 -.word 0x8110AA14, 0x812C3A14, 0x81378B14, 0x814FAA14, 0x816B9A14, 0x8187BA14, 0x81A8AA14, 0x81C4BB14 -.word 0x81E89A14, 0x8204BB14, 0x8228AA14, 0x8244AB14, 0x8262AA14, 0x827E9B14, 0x829CAA14, 0x82B8FA14 -.word 0x82E4AA14, 0x8300AA14, 0x831C9A14, 0x83384D14, 0x83466A14, 0x83575D14, 0x836C6216, 0x837190FC -.word 0x83745F18, 0x838C8910, 0x83A09B14, 0x83BE8910, 0x83D29B14, 0x83F09910, 0x84095A14, 0x841A8C10 -.word 0x84348A14, 0x844A3A14, 0x84554E14, 0x84648A14, 0x847A2A14, 0x8480C810, 0x849B8810, 0x84AD9910 -.word 0x84C68C10, 0x84E09C10, 0x85015810, 0x850F8910, 0x85235A14, 0x8534880E, 0x8546870E, 0x8556C70E -.word 0x856E870E, 0x857E8B0E, 0x8596870E, 0x85A65D14, 0x85BB3A14, 0x85C66D14, 0x85DB7216, 0x85E16F18 -.word 0x85F96F14, 0x86113A0E, 0x861C8B12, 0x86348B14, 0x864C8710, 0x865C9A14, 0x86783A14, 0x86838D14 -.word 0x869F6114, 0x86A2BA14, 0x86C36514, 0x86CC750C, 0x86D8950C, 0x86E75F16, 0x86FFBA14, 0x87206114 -.word 0x87234318, 0x8727970E, 0x873B5F16, 0x87535F16, 0x876B4114, 0x876DAB0E, 0x878B9D14, 0x87AE430C -.word 0x87B23402, 0x87B76F16, 0x87CF6514, 0x87D8650C, 0x87E1EC14, 0x880FC512, 0x8821E90E, 0x88448A0E -.word 0x885AAD1A, 0x887DBD1A, 0x88A7BD1A, 0x88D1BD1A, 0x88FBAD1A, 0x891EBE1C, 0x894BFA14, 0x8977AE14 -.word 0x899D9D1A, 0x89C09D1A, 0x89E39D1A, 0x8A069D1A, 0x8A294D1A, 0x8A374D1A, 0x8A456D1A, 0x8A5A6D1A -.word 0x8A6F5F18, 0x8A87AD1A, 0x8AAABE1A, 0x8AD7BE1A, 0x8B04BE1A, 0x8B31BE1A, 0x8B5EBE1A, 0x8B8B870E -.word 0x8B9BBB14, 0x8BBF9E1A, 0x8BE59E1A, 0x8C0BAE1A, 0x8C31AE1A, 0x8C575F18, 0x8C6F5F18, 0x8C878B14 -.word 0x8C9F8B14, 0x8CB79B14, 0x8CD58C16, 0x8CEF8C16, 0x8D098B14, 0x8D219D18, 0x8D44D910, 0x8D678C10 -.word 0x8D818B14, 0x8D999B14, 0x8DB79C16, 0x8DD88B14, 0x8DF05A14, 0x8E015A14, 0x8E125A14, 0x8E236A14 -.word 0x8E348B14, 0x8E4C8B16, 0x8E649B14, 0x8E829B14, 0x8EA09C16, 0x8EC19C16, 0x8EE29B14, 0x8F00870E -.word 0x8F10A910, 0x8F298B14, 0x8F418B14, 0x8F598C16, 0x8F738C16, 0x8F8D5F18, 0x8FA55F18, 0x8FBD8F16 -.word 0x8FDD6F16, 0x8FF54A12, 0x90004312, 0x90049A12, 0x90209C14, 0x9041BA12, 0x90628A12, 0x90782312 -.word 0x907A6C12, 0x908E5C12, 0x90A25412, 0x90AA870C, 0x90BA3300, 0x90BE8006, 0x90C02100, 0x90C17A12 -.word 0x90D78A12, 0x90ED5A12, 0x90FE9A12, 0x911A8A12, 0x91308A12, 0x91469A12, 0x91628A12, 0x91788A12 -.word 0x918E8A12, 0x91A47A12, 0x91BA370E, 0x91C24A0E, 0x91CD980E, 0x91E4940A, 0x91F1980E, 0x92087A12 -.word 0x921ECB14, 0x9242AA12, 0x925E9A12, 0x927ABB14, 0x929EAA12, 0x92BABA12, 0x92DBAA12, 0x92F7BB14 -.word 0x931BBA12, 0x933C4A12, 0x93478A12, 0x935DBA12, 0x937E8A12, 0x9394CA12, 0x93B5AA12, 0x93D1BB14 -.word 0x93F5AA12, 0x9411BB14, 0x9435AA12, 0x94519B14, 0x946F9A12, 0x948BAA12, 0x94A7AA12, 0x94C3DA12 -.word 0x94EABA12, 0x950B9A12, 0x9527BA12, 0x95485C12, 0x955C3A12, 0x95675C12, 0x957B5112, 0x957E80FC -.word 0x95803F18, 0x9590780E, 0x95A29A12, 0x95BE880E, 0x95D09A12, 0x95EC880E, 0x95FE5A12, 0x960F9B0E -.word 0x962D8A12, 0x96434A12, 0x964E6D12, 0x96638A12, 0x96794A12, 0x9684C80E, 0x969F880E, 0x96B1880E -.word 0x96C39B0E, 0x96E18B0E, 0x96F9680E, 0x9707780E, 0x97195A12, 0x972A880E, 0x973C880E, 0x974EA80E -.word 0x9765980E, 0x977C9B0E, 0x979A880E, 0x97AC7C12, 0x97C63A12, 0x97D16C12, 0x97E56112, 0x97E86F18 -.word 0x98004F14, 0x98104A0E, 0x981B8A10, 0x98319A12, 0x984D860E, 0x985B9A12, 0x98774A12, 0x98827D12 -.word 0x989E5112, 0x98A1BA12, 0x98C25514, 0x98CB740A, 0x98D5840A, 0x98DF5F14, 0x98F7BA12, 0x99185112 -.word 0x991B3214, 0x991E870C, 0x992E5F16, 0x99465F16, 0x995E3112, 0x9960BB0E, 0x99848C12, 0x999E330C -.word 0x99A22300, 0x99A46F16, 0x99BC5514, 0x99C5640A, 0x99CDFB14, 0x99FDB412, 0x9A0CD80E, 0x9A2C7A0E -.word 0x9A42AD18, 0x9A65AD18, 0x9A889D18, 0x9AABAD18, 0x9ACEAD18, 0x9AF1AE1A, 0x9B17FA12, 0x9B43BE14 -.word 0x9B70BD18, 0x9B9AAD18, 0x9BBDAD18, 0x9BE0AD18, 0x9C035D18, 0x9C186D18, 0x9C2D6D18, 0x9C426D18 -.word 0x9C573F18, 0x9C67BD18, 0x9C91BD18, 0x9CBBBD18, 0x9CE5BD18, 0x9D0FBD18, 0x9D39BD18, 0x9D63980E -.word 0x9D7ADB14, 0x9DA4AD18, 0x9DC7AD18, 0x9DEAAD18, 0x9E0DAD18, 0x9E305F18, 0x9E485F18, 0x9E608A12 -.word 0x9E768B14, 0x9E8E8B14, 0x9EA68B14, 0x9EBE8B14, 0x9ED68A12, 0x9EEC8C16, 0x9F06D80E, 0x9F267B0E -.word 0x9F3E8B14, 0x9F567B14, 0x9F6E8B14, 0x9F868A12, 0x9F9C3B14, 0x9FA85B14, 0x9FBA5B14, 0x9FCC5A12 -.word 0x9FDD8A12, 0x9FF38B14, 0xA00B8B14, 0xA0238B14, 0xA03B8B14, 0xA0538B14, 0xA06B8A12, 0xA081860C -.word 0xA08F980E, 0xA0A67B14, 0xA0BE8B14, 0xA0D68B14, 0xA0EE8A12, 0xA1045E16, 0xA11B5E16, 0xA1329D12 -.word 0xA1556F1A, 0xA16D1B16, 0xA1735316, 0xA1797B16, 0xA1915D18, 0xA1A67B16, 0xA1BE5B16, 0xA1D02316 -.word 0xA1D22F18, 0xA1DA2F18, 0xA1E23316, 0xA1E6540C, 0xA1EE2404, 0xA1F15008, 0xA1F31204, 0xA1F53A16 -.word 0xA2004B16, 0xA20C2B16, 0xA2124B16, 0xA21E5B16, 0xA2304B16, 0xA23C5B16, 0xA24E4B16, 0xA25A5B16 -.word 0xA26C4B16, 0xA2785B16, 0xA28A1710, 0xA28E280E, 0xA2936810, 0xA2A1530C, 0xA2A75810, 0xA2B54B16 -.word 0xA2C17C18, 0xA2DB5B16, 0xA2ED4B16, 0xA2F96C18, 0xA30D5B16, 0xA31F5B16, 0xA3315C18, 0xA3456C18 -.word 0xA3595B16, 0xA36B2A16, 0xA3714B16, 0xA37D6B16, 0xA38F5B16, 0xA3A17B16, 0xA3B96B16, 0xA3CB6C18 -.word 0xA3DF5B16, 0xA3F16D18, 0xA4065C18, 0xA41A6C18, 0xA42E6A16, 0xA43F5B16, 0xA4516B16, 0xA4638C18 -.word 0xA47D5B16, 0xA48F5B16, 0xA4A15B16, 0xA4B32E16, 0xA4BB3A16, 0xA4C62E16, 0xA4CE531A, 0xA4D470FC -.word 0xA4D65F1C, 0xA4EE4810, 0xA4F75B16, 0xA5095912, 0xA5185B16, 0xA52A5810, 0xA5383C18, 0xA5454B10 -.word 0xA5514B16, 0xA55D2B16, 0xA5632E16, 0xA56B4B16, 0xA5772B16, 0xA57D6810, 0xA58B4810, 0xA5945912 -.word 0xA5A34B10, 0xA5AF5B10, 0xA5C13810, 0xA5CA5912, 0xA5D93A14, 0xA5E44810, 0xA5ED5810, 0xA5FB6810 -.word 0xA6094810, 0xA6125B10, 0xA6245810, 0xA6324E16, 0xA6412E16, 0xA6494E16, 0xA6586116, 0xA65B6C18 -.word 0xA66F5E16, 0xA6862B10, 0xA68C5C14, 0xA6A04B16, 0xA6AC5712, 0xA6B84A16, 0xA6C32B16, 0xA6C94E16 -.word 0xA6D83116, 0xA6DA7B16, 0xA6F23618, 0xA6F9650E, 0xA702440C, 0xA7076B16, 0xA7197B16, 0xA7317016 -.word 0xA7332218, 0xA735570E, 0xA7415F1A, 0xA7595F1A, 0xA7712116, 0xA7725B10, 0xA7845E16, 0xA79B230E -.word 0xA79D2300, 0xA79F6D16, 0xA7B43618, 0xA7BB640C, 0xA7C38B16, 0xA7DB7516, 0xA7E78810, 0xA7F95B10 -.word 0xA80B5E1C, 0xA8225E1C, 0xA8395E1C, 0xA8506E1C, 0xA8675D1A, 0xA87C5F1E, 0xA8948B16, 0xA8AC6F18 -.word 0xA8C45F1E, 0xA8DC5E1C, 0xA8F35F1E, 0xA90B5D1A, 0xA9202E1C, 0xA9282E1C, 0xA9305F1E, 0xA9484D1A -.word 0xA9565F1C, 0xA96E6E1C, 0xA9857E1C, 0xA9A37E1C, 0xA9C17F1E, 0xA9E17E1C, 0xA9FF7D1A, 0xAA1B4810 -.word 0xAA246C18, 0xAA386E1C, 0xAA4F6E1C, 0xAA666F1E, 0xAA7E6D1A, 0xAA936F1C, 0xAAAB5F1C, 0xAAC34B16 -.word 0xAACF5B16, 0xAAE15B16, 0xAAF35C18, 0xAB076B16, 0xAB194A14, 0xAB245C18, 0xAB387810, 0xAB4A4B10 -.word 0xAB565B16, 0xAB685B16, 0xAB7A5C18, 0xAB8E4A14, 0xAB992B16, 0xAB9F2B16, 0xABA55B16, 0xABB74A14 -.word 0xABC24B16, 0xABCE6B16, 0xABE05B16, 0xABF25B16, 0xAC045C18, 0xAC186B16, 0xAC2A4A14, 0xAC35560E -.word 0xAC405810, 0xAC4E5B16, 0xAC604B16, 0xAC6C5C18, 0xAC804A14, 0xAC8B5F1A, 0xACA36F1A, 0xACBB4D14 -.word 0xACC96F1A, 0xACE12C18, 0xACE85318, 0xACEE8C18, 0xAD087E18, 0xAD266B16, 0xAD388C18, 0xAD522318 -.word 0xAD543F18, 0xAD643F18, 0xAD745318, 0xAD7A8710, 0xAD8A2302, 0xAD8C710A, 0xAD902102, 0xAD915E1A -.word 0xADA85B16, 0xADBA4B16, 0xADC65B16, 0xADD85B16, 0xADEA7B16, 0xAE025B16, 0xAE145B16, 0xAE267B16 -.word 0xAE3E5B16, 0xAE505B16, 0xAE622710, 0xAE662910, 0xAE6B7A12, 0xAE81740C, 0xAE8B7A12, 0xAEA16C18 -.word 0xAEB58C18, 0xAECF7C18, 0xAEE96C18, 0xAEFD6C18, 0xAF116C18, 0xAF255C18, 0xAF395C18, 0xAF4D6C18 -.word 0xAF616C18, 0xAF752C18, 0xAF7C6C18, 0xAF908C18, 0xAFAA5C18, 0xAFBE8C18, 0xAFD87C18, 0xAFF26C18 -.word 0xB0066C18, 0xB01A7C18, 0xB0346C18, 0xB0486C18, 0xB05C6C18, 0xB0706C18, 0xB0847C18, 0xB09EAC18 -.word 0xB0BF8C18, 0xB0D98C18, 0xB0F36C18, 0xB1073F1C, 0xB1175E1A, 0xB12E3F1C, 0xB13E5216, 0xB14380FC -.word 0xB1455F1C, 0xB15D5912, 0xB16C5C18, 0xB1805810, 0xB18E5C18, 0xB1A25912, 0xB1B14C18, 0xB1BE5C12 -.word 0xB1D25C18, 0xB1E62C18, 0xB1ED4F18, 0xB1FD6C18, 0xB2112C18, 0xB2187912, 0xB22C5912, 0xB23B5912 -.word 0xB24A5C12, 0xB25E5C12, 0xB2725912, 0xB2815A14, 0xB2924B16, 0xB29E5810, 0xB2AC7810, 0xB2BE8810 -.word 0xB2D07810, 0xB2E27A10, 0xB2F85810, 0xB3065E16, 0xB31D1C18, 0xB3245E16, 0xB33B6116, 0xB33E6C18 -.word 0xB3525E16, 0xB3692B10, 0xB36F6C14, 0xB3837B16, 0xB39B7914, 0xB3AF8B16, 0xB3C71C18, 0xB3CE7D16 -.word 0xB3EA4016, 0xB3EB7B16, 0xB4033618, 0xB40AA912, 0xB423820C, 0xB4296B16, 0xB43B7B16, 0xB4538016 -.word 0xB4553218, 0xB4588A14, 0xB46E3418, 0xB4733418, 0xB4783118, 0xB47A8A10, 0xB4906E16, 0xB4A7430E -.word 0xB4AB2302, 0xB4AD3418, 0xB4B23618, 0xB4B9A912, 0xB4D28B16, 0xB4EA8216, 0xB4F08910, 0xB5046B10 -.word 0xB5167E1C, 0xB5347E1C, 0xB5527F1E, 0xB5727E1C, 0xB5907E1C, 0xB5AE7F1E, 0xB5CE8C18, 0xB5E86E18 -.word 0xB5FF5F1E, 0xB6175F1E, 0xB62F5F1E, 0xB6475E1C, 0xB65E3F1E, 0xB66E3F1E, 0xB67E5F1E, 0xB6964E1C -.word 0xB6A57C18, 0xB6BF7E1C, 0xB6DD6F1E, 0xB6F56F1E, 0xB70D6F1E, 0xB7256F1E, 0xB73D6E1C, 0xB7547812 -.word 0xB7668C18, 0xB7806E1C, 0xB7976E1C, 0xB7AE6E1C, 0xB7C56D1A, 0xB7DA8D1A, 0xB7F68E1C, 0xB8146D1A -.word 0xB8295B16, 0xB83B5B16, 0xB84D5C18, 0xB8616B16, 0xB8735A14, 0xB8845C18, 0xB8988912, 0xB8AC5D12 -.word 0xB8C15B16, 0xB8D35B16, 0xB8E55B16, 0xB8F75A14, 0xB9083B16, 0xB9143B16, 0xB9205B16, 0xB9324A14 -.word 0xB93D5B16, 0xB94F6B16, 0xB9615B16, 0xB9735B16, 0xB9855C18, 0xB9996B16, 0xB9AB5A14, 0xB9BC8710 -.word 0xB9CC7B14, 0xB9E45B16, 0xB9F65B16, 0xBA085B16, 0xBA1A5A14, 0xBA2B7C16, 0xBA455C16, 0xBA597B14 -.word 0xBA716F18, 0xBA893B16, 0xBA956414, 0xBA9D6912, 0xBAAC6D16, 0xBAC17B14, 0xBAD97B14, 0xBAF14414 -.word 0xBAF64D16, 0xBB043D16, 0xBB127912, 0xBB266912, 0xBB353302, 0xBB39610A, 0xBB3C3202, 0xBB3F8D16 -.word 0xBB5B6B16, 0xBB6D5B16, 0xBB7F7B16, 0xBB976B16, 0xBBA97B16, 0xBBC17B16, 0xBBD97B16, 0xBBF16B16 -.word 0xBC037B16, 0xBC1B7B16, 0xBC333810, 0xBC3C3910, 0xBC467C18, 0xBC60730E, 0xBC687C18, 0xBC826B16 -.word 0xBC947B16, 0xBCAC7B16, 0xBCC47B16, 0xBCDC6B16, 0xBCEE7B16, 0xBD067B16, 0xBD1E7B16, 0xBD367B16 -.word 0xBD4E8B16, 0xBD665B16, 0xBD786B16, 0xBD8A8B16, 0xBDA27B16, 0xBDBA7B16, 0xBDD27B16, 0xBDEA6B16 -.word 0xBDFC8B16, 0xBE147C16, 0xBE2E7B16, 0xBE466B16, 0xBE587B16, 0xBE707B16, 0xBE887B16, 0xBEA08B16 -.word 0xBEB87B16, 0xBED07B16, 0xBEE87B16, 0xBF003D18, 0xBF0E8D16, 0xBF2A3D18, 0xBF387114, 0xBF3CA0FA -.word 0xBF3F6F1A, 0xBF577810, 0xBF69AB16, 0xBF878810, 0xBF997B16, 0xBFB17810, 0xBFC36B16, 0xBFD58910 -.word 0xBFE97B16, 0xC0015B16, 0xC0134C16, 0xC0208B16, 0xC0384B16, 0xC0447810, 0xC0567810, 0xC0686810 -.word 0xC0767910, 0xC08A7910, 0xC09E6810, 0xC0AC6810, 0xC0BA5A14, 0xC0CB7810, 0xC0DD7810, 0xC0EF8810 -.word 0xC1018810, 0xC1137910, 0xC1276810, 0xC1354D18, 0xC1432D18, 0xC14A4D18, 0xC1585116, 0xC15B6F1C -.word 0xC2276F16, 0xC23F6F16, 0xC1738A16, 0xC189AB16, 0xC2576F16, 0xC1A7C914, 0xC1C52D16, 0xC1CC6A16 -.word 0xC1DD6116, 0xC26F6F16, 0xC2876F16, 0xC1E07D18, 0xC1FCC40C, 0xC20B7D18, 0xC29F6F16, 0xC2B76F16 -.word 0xC2CF4318, 0xC2D3A914, 0xC2ECA912, 0xC305AB16, 0xC4126F18, 0xC323A910, 0xC33C8914, 0xC350430E -.word 0xC3543404, 0xC359DB14, 0xC383A016, 0xC386DB16, 0xC3B0ED18, 0xC3E1ED18, 0xC42A6F18, 0xC4426F18 -.word 0xC45AA20E, 0xC4624306, 0xC4666D18, 0xC47BA810, 0xC4925A18, 0xC4A35A12, 0xC4B46A18, 0xC4C57A12 -.word 0xC4DB5D18, 0xC4F05D18, 0xC5055D18, 0xC51A6D18, 0xC52FD914, 0xC552D914, 0xC575B914, 0xC593E510 -.word 0xC5A8F50E, 0xC5C07D16, 0xC5DC6D16, 0xC5F1EB14, 0xC61BEB14, 0xC645D912, 0xC668D912, 0xC68BAD16 -.word 0xC6AEAD16, 0xC6D1FA14, 0xC6FD9C16, 0xC71E6F16, 0xC7366F16, 0xC74E6F16, 0xC7666F16, 0xC77E6F16 -.word 0xC796E612, 0xC7AFA810, 0xC7C65118, 0xC7C96318, 0xC7CF3418, 0xC7D44810, 0xC7DDD30E, 0xC7EBA30E -.word 0xC7F55D18, 0xC80AC20E, 0xC8138B16, 0xC82BB912, 0xC8496F1A, 0xC8616F1A, 0xC8796F1A, 0xC8916F1A -.word 0xC8A90F17, 0xC8E9960E, 0xC8FB7810, 0xC90D960E, 0xC91F7810, 0xC9319E14, 0xC957F810, 0xC97B9E16 -.word 0xC9A1F810, 0xC9C5CC14, 0xC9ECDC16, 0xCA1ADC14, 0xCA48DC14, 0xCA76EF16, 0xCAAE070F, 0xCACE070F -.word 0xCAEE8F16, 0xCB0EED14, 0xCB3FED14, 0xCB70ED14, 0xCBA1EF16, 0xCBD9CB12, 0xCBFDCB12, 0xCC21CB12 -ENDDATA(asc2tbl) diff --git a/src/libleo/api/getkadr.s b/src/libleo/api/getkadr.s deleted file mode 100644 index d71719525a2..00000000000 --- a/src/libleo/api/getkadr.s +++ /dev/null @@ -1,212 +0,0 @@ -#include "ultra64/asm.h" -#include "ultra64/regdef.h" - -.text - -/** - * int LeoGetKAdr(int sjis); - * - * Returns the storage offset address into the N64 Disk Drive mask ROM for - * a kanji character corresponding to a given 2-byte Shift-JIS codepoint. - * An error value -1 will be returned if `sjis` is outside the range 0x8140 to 0x9872. - * - * A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/ - * The Mask ROM contains the 'Level 1' kanji (0x889F-0x9872), and a reworked - * version of the non-kanji section that includes extra English and Hylian glyphs. - * - * @param sjis Shift-JIS Codepoint of glyph. - * @return int Storage offset address into the N64 Disk Drive mask ROM. - */ -LEAF(LeoGetKAdr) - /* Check if the codepoint is in the range 0x8140 to 0x9872. */ - blt a0, 0x8140, .out_of_range - bge a0, 0x9873, .out_of_range - /* Characters with codepoints >= 0x8800 are kanji. Arrangement is regular, - * so convert index directly. */ - li a2, 0xBC - blt a0, 0x8800, .nonkanji - /* 0xBC is number of glyphs in one block in the `kanji` file: - * 0x100 possible codepoints with the same byte1 - * - 0x40 unused at beginning - * - 1 unused at 0x7F - * - 3 unused at 0xFD, 0xFE, 0xFF */ - /* Get byte1 and adjust so starts at 0 */ - srl a1, a0, 8 - addi a1, a1, -0x88 - mul a2, a2, a1 - /* Get byte2 and adjust so starts at 0 */ - andi a3, a0, 0xFF - addi a3, a3, -0x40 - /* 0x__7F is always empty and elided in the file, so decrement if larger */ - blt a3, 0x40, .kanji_lower_halfblock - addi a3, a3, -1 -.kanji_lower_halfblock: - mflo a2 - addi a3, a3, 0x30A - add a3, a3, a2 - sll v0, a3, 7 - jr ra - /* returns (0x30A + (adjusted byte2) + (adjusted byte1) * 0xBC) * FONT_CHAR_TEX_SIZE */ - -/* Non-kanji are arranged with irregular gaps, use the lookup table. */ -.nonkanji: - /* Get byte1 and adjust so starts at 0 */ - srl a1, a0, 8 - addi a1, a1, -0x81 - mul a2, a2, a1 - /* Get byte2 and adjust so starts at 0 */ - andi a3, a0, 0xFF - addi a3, a3, -0x40 - /* 0x__7F is always empty and elided in the file, so decrement if larger */ - blt a3, 0x40, .nonkanji_lower_halfblock - addi a3, a3, -1 -.nonkanji_lower_halfblock: - mflo a2 - add a3, a3, a2 - sll a3, a3, 1 - la a2, kantbl - add a3, a3, a2 - lh a2, (a3) - sll v0, a2, 7 - jr ra - /* returns kantbl[(adjusted byte2) + (adjusted byte1) * 0xBC] * FONT_CHAR_TEX_SIZE */ -.out_of_range: - li v0, -1 - jr ra -END(LeoGetKAdr) - -/** - * Nearly equivalent C code (Equivalent for all valid input, will behave differently on overflow due to the use of `add` in the original): - * - * extern u16 kantbl[]; - * - * int LeoGetKAdr(int sjis) { - * u32 byte1; - * u32 byte2; - * - * if (sjis < 0x8140 || sjis > 0x9872) { - * return -1; - * } - * - * byte1 = (u32)sjis >> 8; - * byte2 = sjis & 0xFF; - * - * byte2 -= 0x40; - * if (byte2 >= 0x40) { - * byte2--; - * } - * - * if (sjis >= 0x8800) { - * byte1 -= 0x88; - * return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE; - * } else { - * byte1 -= 0x81; - * return kantbl[byte2 + byte1 * 0xBC] * FONT_CHAR_TEX_SIZE; - * } - * } - */ - -/** - * Index table, formatting follows conventional Shift-JIS character table layout, - * with space for the missing 0x__7F,0x__FD,0x__FE,0x__FF entries, and split - * into blocks by high byte. - */ -DATA(kantbl) -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x814_ */ .half 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F -/* 0x815_ */ .half 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F -/* 0x816_ */ .half 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F -/* 0x817_ */ .half 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E -/* 0x818_ */ .half 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E -/* 0x819_ */ .half 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E -/* 0x81A_ */ .half 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x0000, 0x0000, 0x0000 -/* 0x81B_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073 -/* 0x81C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0000 -/* 0x81D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F -/* 0x81E_ */ .half 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x81F_ */ .half 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0000, 0x0000, 0x0000, 0x0000, 0x0091 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092 -/* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB -/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4 -/* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0 -/* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0 -/* 0x82B_ */ .half 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0 -/* 0x82C_ */ .half 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100 -/* 0x82D_ */ .half 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F, 0x0110 -/* 0x82E_ */ .half 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, 0x011F, 0x0120 -/* 0x82F_ */ .half 0x0121, 0x0122, 0x0123, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x834_ */ .half 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133 -/* 0x835_ */ .half 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143 -/* 0x836_ */ .half 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x014F, 0x0150, 0x0151, 0x0152, 0x0153 -/* 0x837_ */ .half 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162 -/* 0x838_ */ .half 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0170, 0x0171, 0x0172 -/* 0x839_ */ .half 0x0173, 0x0174, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x017A -/* 0x83A_ */ .half 0x017B, 0x017C, 0x017D, 0x017E, 0x017F, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018A -/* 0x83B_ */ .half 0x018B, 0x018C, 0x018D, 0x018E, 0x018F, 0x0190, 0x0191, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192 -/* 0x83C_ */ .half 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x0198, 0x0199, 0x019A, 0x019B, 0x019C, 0x019D, 0x019E, 0x019F, 0x01A0, 0x01A1, 0x01A2 -/* 0x83D_ */ .half 0x01A3, 0x01A4, 0x01A5, 0x01A6, 0x01A7, 0x01A8, 0x01A9, 0x01AA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x83E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x83F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x844_ */ .half 0x01AB, 0x01AC, 0x01AD, 0x01AE, 0x01AF, 0x01B0, 0x01B1, 0x01B2, 0x01B3, 0x01B4, 0x01B5, 0x01B6, 0x01B7, 0x01B8, 0x01B9, 0x01BA -/* 0x845_ */ .half 0x01BB, 0x01BC, 0x01BD, 0x01BE, 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C5, 0x01C6, 0x01C7, 0x01C8, 0x01C9, 0x01CA -/* 0x846_ */ .half 0x01CB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x847_ */ .half 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01D0, 0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA -/* 0x848_ */ .half 0x01DB, 0x01DC, 0x01DD, 0x01DE, 0x01DF, 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E4, 0x01E5, 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA -/* 0x849_ */ .half 0x01EB, 0x01EC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01ED -/* 0x84A_ */ .half 0x01EE, 0x01EF, 0x01F0, 0x01F1, 0x01F2, 0x01F3, 0x01F4, 0x01F5, 0x01F6, 0x01F7, 0x01F8, 0x01F9, 0x01FA, 0x01FB, 0x01FC, 0x01FD -/* 0x84B_ */ .half 0x01FE, 0x01FF, 0x0200, 0x0201, 0x0202, 0x0203, 0x0204, 0x0205, 0x0206, 0x0207, 0x0208, 0x0209, 0x020A, 0x020B, 0x020C, 0x020D -/* 0x84C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x84D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x84E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x84F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x854_ */ .half 0x020E, 0x020F, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021A, 0x021B, 0x021C, 0x021D -/* 0x855_ */ .half 0x021E, 0x021F, 0x0220, 0x0221, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0222, 0x0223 -/* 0x856_ */ .half 0x0224, 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, 0x022C, 0x022D, 0x022E, 0x022F, 0x0230, 0x0231, 0x0232, 0x0233 -/* 0x857_ */ .half 0x0234, 0x0235, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0236, 0x0237, 0x0238 -/* 0x858_ */ .half 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x859_ */ .half 0x0000, 0x023F, 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0000, 0x0000, 0x0000, 0x0000, 0x0249 -/* 0x85A_ */ .half 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, 0x0000, 0x0000 -/* 0x85B_ */ .half 0x0000, 0x0000, 0x0000, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, 0x0262, 0x0263, 0x0264 -/* 0x85C_ */ .half 0x0265, 0x0266, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x85D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0267, 0x0268, 0x0269, 0x026A, 0x026B -/* 0x85E_ */ .half 0x026C, 0x026D, 0x026E, 0x026F, 0x0270, 0x0271, 0x0272, 0x0273, 0x0274, 0x0275, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B -/* 0x85F_ */ .half 0x027C, 0x027D, 0x027E, 0x027F, 0x0280, 0x0281, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x864_ */ .half 0x0282, 0x0283, 0x0284, 0x0285, 0x0286, 0x0287, 0x0288, 0x0289, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291 -/* 0x865_ */ .half 0x0292, 0x0293, 0x0294, 0x0295, 0x0296, 0x0297, 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x0000, 0x0000 -/* 0x866_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x867_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x868_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x869_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02A0, 0x02A1, 0x02A2, 0x02A3, 0x02A4 -/* 0x86A_ */ .half 0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86B_ */ .half 0x0000, 0x0000, 0x0000, 0x02AC, 0x02AD, 0x02AE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86C_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02AF, 0x02B0, 0x02B1, 0x02B2, 0x02B3, 0x02B4, 0x02B5, 0x02B6, 0x02B7 -/* 0x86D_ */ .half 0x02B8, 0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x86F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 - -/* 0x___0 0x___1 0x___2 0x___3 0x___4 0x___5 0x___6 0x___7 0x___8 0x___9 0x___A 0x___B 0x___C 0x___D 0x___E 0x___F */ -/* 0x874_ */ .half 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, 0x02C5, 0x02C6, 0x02C7, 0x02C8, 0x02C9, 0x02CA, 0x02CB, 0x02CC, 0x02CD, 0x02CE, 0x02CF -/* 0x875_ */ .half 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, 0x02D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x876_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x877_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x878_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x879_ */ .half 0x0000, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x02DE, 0x02DF, 0x02E0, 0x02E1, 0x02E2, 0x02E3, 0x02E4, 0x02E5, 0x02E6, 0x02E7 -/* 0x87A_ */ .half 0x02E8, 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, 0x02F0, 0x02F1, 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7 -/* 0x87B_ */ .half 0x02F8, 0x02F9, 0x02FA, 0x02FB, 0x02FC, 0x02FD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02FE, 0x02FF, 0x0300 -/* 0x87C_ */ .half 0x0301, 0x0302, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x87D_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x87E_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0303, 0x0304, 0x0305, 0x0306, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -/* 0x87F_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0307, 0x0308, 0x0309 -ENDDATA(kantbl) diff --git a/src/libleo/api/readwrite.c b/src/libleo/api/readwrite.c deleted file mode 100644 index 570b94b203a..00000000000 --- a/src/libleo/api/readwrite.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -s32 LeoReadWrite(LEOCmd* cmdBlock, s32 direction, u32 LBA, void* vAddr, u32 nLBAs, OSMesgQueue* mq) { - if (!__leoActive) { - return -1; - } - - if (direction == OS_READ) { - cmdBlock->header.command = 5; - } else { - cmdBlock->header.command = 6; - } - - cmdBlock->header.reserve1 = 0; - - if (mq != NULL) { - cmdBlock->header.control = 0x80; - } else { - cmdBlock->header.control = 0; - } - - cmdBlock->header.reserve3 = 0; - cmdBlock->header.post = mq; - cmdBlock->data.readWrite.lba = LBA; - cmdBlock->data.readWrite.transferBlks = nLBAs; - cmdBlock->data.readWrite.buffPtr = vAddr; - - leoCommand(cmdBlock); - return LEO_ERROR_GOOD; -} diff --git a/src/libleo/leo/leo_tbl.c b/src/libleo/leo/leo_tbl.c deleted file mode 100644 index 083fabb728c..00000000000 --- a/src/libleo/leo/leo_tbl.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -const char LEOfirmware_rev[] = "B014A26"; - -const u8 LEOBYTE_TBL1[] = { - 0xE8, 0xD8, 0xD0, 0xC0, 0xB0, 0xA0, 0x90, 0x80, 0x70, -}; - -const u16 LEOBYTE_TBL2[] = { - 0x4D08, 0x47B8, 0x4510, 0x3FC0, 0x3A70, 0x3520, 0x2FD0, 0x2A80, 0x2530, -}; - -const u16 LEOVZONE_TBL[][0x10] = { - { 0x0124, 0x0248, 0x035A, 0x047E, 0x05A2, 0x06B4, 0x07C6, 0x08D8, 0x09EA, 0x0AB6, 0x0B82, 0x0C94, 0x0DA6, 0x0EB8, - 0x0FCA, 0x10DC }, - { 0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x06A2, 0x07C6, 0x08D8, 0x09EA, 0x0AFC, 0x0BC8, 0x0C94, 0x0DA6, 0x0EB8, - 0x0FCA, 0x10DC }, - { 0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x08C6, 0x09EA, 0x0AFC, 0x0C0E, 0x0CDA, 0x0DA6, 0x0EB8, - 0x0FCA, 0x10DC }, - { 0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x08B4, 0x09C6, 0x0AEA, 0x0C0E, 0x0D20, 0x0DEC, 0x0EB8, - 0x0FCA, 0x10DC }, - { 0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x08B4, 0x09C6, 0x0AD8, 0x0BEA, 0x0D0E, 0x0E32, 0x0EFE, - 0x0FCA, 0x10DC }, - { 0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x086E, 0x0980, 0x0A92, 0x0BA4, 0x0CB6, 0x0DC8, 0x0EEC, - 0x1010, 0x10DC }, - { 0x0124, 0x0248, 0x035A, 0x046C, 0x057E, 0x0690, 0x07A2, 0x086E, 0x093A, 0x0A4C, 0x0B5E, 0x0C70, 0x0D82, 0x0E94, - 0x0FB8, 0x10DC }, -}; - -const u16 LEOZONE_SCYL_TBL[] = { - 0x0000, 0x009E, 0x013C, 0x01D1, 0x0266, 0x02FB, 0x0390, 0x0425, - 0x0091, 0x012F, 0x01C4, 0x0259, 0x02EE, 0x0383, 0x0418, 0x048A, -}; - -const u8 LEOVZONE_PZONEHD_TBL[][0x10] = { - { 0x00, 0x01, 0x02, 0x09, 0x08, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A }, - { 0x00, 0x01, 0x02, 0x03, 0x0A, 0x09, 0x08, 0x04, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x0B, 0x0A, 0x09, 0x08, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x06, 0x07, 0x0F, 0x0E, 0x0D }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x07, 0x0F, 0x0E }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08, 0x0F }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }, -}; - -const u16 LEOZONE_OUTERCYL_TBL[] = { - 0x0000, 0x009E, 0x013C, 0x01D1, 0x0266, 0x02FB, 0x0390, 0x0425, -}; - -const u16 LEORAM_START_LBA[] = { - 0x05A2, 0x07C6, 0x09EA, 0x0C0E, 0x0E32, 0x1010, 0x10DC, -}; - -const s32 LEORAM_BYTE[] = { - 0x024A9DC0, 0x01C226C0, 0x01450F00, 0x00D35680, 0x006CFD40, 0x001DA240, 0x00000000, -}; diff --git a/src/libleo/leo/leoc2_syndrome.c b/src/libleo/leo/leoc2_syndrome.c deleted file mode 100644 index fe72a3e89ef..00000000000 --- a/src/libleo/leo/leoc2_syndrome.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "n64dd.h" - -u8 LEOC2_Syndrome[2][0xE8 * 4]; diff --git a/src/libleo/leo/leofunc.c b/src/libleo/leo/leofunc.c deleted file mode 100644 index 35ba14005f5..00000000000 --- a/src/libleo/leo/leofunc.c +++ /dev/null @@ -1,135 +0,0 @@ -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "array_count.h" -#include "ultra64.h" - -static s32 __leoResetCalled = false; -static s32 __leoQueuesCreated = false; - -static OSMesgQueue LEOpost_que; -static OSMesg LEOpost_que_buf[1]; - -void leoInitialize(OSPri compri, OSPri intpri, OSMesg* command_que_buf, u32 cmd_buff_size) { - u32 savedMask; - OSPri oldPri; - OSPri myPri; - OSPri pri; - - if (intpri < compri) { - pri = compri; - } else { - pri = intpri; - } - - oldPri = -1; - - myPri = osGetThreadPri(NULL); - if (myPri < pri) { - oldPri = myPri; - osSetThreadPri(NULL, pri); - } - - savedMask = __osDisableInt(); - - __leoQueuesCreated = true; - osCreateMesgQueue(&LEOcommand_que, command_que_buf, cmd_buff_size); - osCreateMesgQueue(&LEOcontrol_que, LEOcontrol_que_buf, ARRAY_COUNT(LEOcontrol_que_buf)); - osCreateMesgQueue(&LEOevent_que, LEOevent_que_buf, ARRAY_COUNT(LEOevent_que_buf)); - osCreateMesgQueue(&LEOdma_que, LEOdma_que_buf, ARRAY_COUNT(LEOdma_que_buf)); - osCreateMesgQueue(&LEOblock_que, LEOblock_que_buf, ARRAY_COUNT(LEOblock_que_buf)); - osCreateMesgQueue(&LEOpost_que, LEOpost_que_buf, ARRAY_COUNT(LEOpost_que_buf)); - osCreateThread(&LEOcommandThread, 1, leomain, NULL, STACK_TOP(LEOcommandThreadStack), compri); - osStartThread(&LEOcommandThread); - osCreateThread(&LEOinterruptThread, 1, leointerrupt, NULL, STACK_TOP(LEOinterruptThreadStack), intpri); - osStartThread(&LEOinterruptThread); - osSetEventMesg(2, &LEOevent_que, (OSMesg)0x30000); - osSendMesg(&LEOblock_que, NULL, OS_MESG_NOBLOCK); - __osRestoreInt(savedMask); - - if (oldPri != -1) { - osSetThreadPri(NULL, oldPri); - } -} - -void leoCommand(void* cmd_blk_addr) { - if (__leoResetCalled != 0) { - ((LEOCmd*)cmd_blk_addr)->header.status = LEO_STATUS_CHECK_CONDITION; - ((LEOCmd*)cmd_blk_addr)->header.sense = LEO_SENSE_WAITING_NMI; - if ((((LEOCmd*)cmd_blk_addr)->header.control & LEO_CONTROL_POST) != 0) { - osSendMesg(((LEOCmd*)cmd_blk_addr)->header.post, (OSMesg)LEO_SENSE_WAITING_NMI, OS_MESG_BLOCK); - } - return; - } - osRecvMesg(&LEOblock_que, NULL, OS_MESG_BLOCK); - ((LEOCmd*)cmd_blk_addr)->header.status = LEO_STATUS_BUSY; - ((LEOCmd*)cmd_blk_addr)->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; - - switch (((LEOCmd*)cmd_blk_addr)->header.command) { - case 1: - LEOclr_que_flag = 0xFF; - leoClr_queue(); - LEOclr_que_flag = 0; - ((LEOCmd*)cmd_blk_addr)->header.status = LEO_STATUS_GOOD; - if (((LEOCmd*)cmd_blk_addr)->header.control & LEO_CONTROL_POST) { - osSendMesg(((LEOCmd*)cmd_blk_addr)->header.post, (OSMesg)0, OS_MESG_BLOCK); - } - break; - - case 5: - case 6: - ((LEOCmd*)cmd_blk_addr)->data.readWrite.rwBytes = 0; - goto cmd_queing; - - default: - if ((u32)(((LEOCmd*)cmd_blk_addr)->header.command - 1) >= 0xE) { - ((LEOCmd*)cmd_blk_addr)->header.sense = LEO_SENSE_INVALID_COMMAND_OPERATION_CODE; - ((LEOCmd*)cmd_blk_addr)->header.status = LEO_STATUS_CHECK_CONDITION; - break; - } - - cmd_queing: - if (osSendMesg(&LEOcommand_que, (OSMesg)cmd_blk_addr, OS_MESG_NOBLOCK) != 0) { - ((LEOCmd*)cmd_blk_addr)->header.sense = LEO_SENSE_QUEUE_FULL; - ((LEOCmd*)cmd_blk_addr)->header.status = LEO_STATUS_CHECK_CONDITION; - } - } - osSendMesg(&LEOblock_que, (OSMesg)0, OS_MESG_BLOCK); -} - -static const u8 zero[] = { 0 }; - -void LeoReset(void) { - __leoResetCalled = true; - if (__leoQueuesCreated) { - LEOclr_que_flag = 0xFF; - leoClr_queue(); - LEOclr_que_flag = 0; - osRecvMesg(&LEOevent_que, NULL, OS_MESG_NOBLOCK); - osSendMesg(&LEOevent_que, (OSMesg)0xA0000, OS_MESG_BLOCK); - osSendMesg(&LEOcommand_que, (OSMesg)zero, OS_MESG_BLOCK); - } -} - -s32 __leoSetReset(void) { - leoDrive_reset(); - return 0; -} - -// SENSE or ERROR? -s32 LeoResetClear(void) { - LEOCmdHeader resetclear; - - resetclear.command = 0xF; - resetclear.control = LEO_CONTROL_POST; - resetclear.status = 0; - resetclear.post = &LEOpost_que; - if (osSendMesg(&LEOcommand_que, &resetclear.command, OS_MESG_NOBLOCK) != 0) { - return LEO_SENSE_QUEUE_FULL; - } - osRecvMesg(&LEOpost_que, NULL, OS_MESG_BLOCK); - if (resetclear.status == LEO_STATUS_GOOD) { - return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; - } - return resetclear.sense; -} diff --git a/src/libleo/leo/leoglobals.c b/src/libleo/leo/leoglobals.c deleted file mode 100644 index 28a99f626d2..00000000000 --- a/src/libleo/leo/leoglobals.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -s32 __leoActive = false; - -LEOVersion __leoVersion; diff --git a/src/libleo/leo/leoinquiry.c b/src/libleo/leo/leoinquiry.c deleted file mode 100644 index b23a9ab4548..00000000000 --- a/src/libleo/leo/leoinquiry.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -void leoInquiry(void) { - u32 asic_id; - u32 asic_data; - - osEPiReadIo(LEOPiInfo, ASIC_ID_REG, &asic_id); - if (leoSend_asic_cmd_w(0x1B0000, 0) == 0) { - osEPiReadIo(LEOPiInfo, ASIC_DATA, &asic_data); - if (asic_data & 0x10000) { - asic_id |= 0x100000; - } - } - - ((LEOCmdInquiry*)LEOcur_command)->devType = 0; - ((LEOCmdInquiry*)LEOcur_command)->version = asic_id >> 0x10; - ((LEOCmdInquiry*)LEOcur_command)->devNum = 1; - ((LEOCmdInquiry*)LEOcur_command)->leoBiosVer = 0; - LEOcur_command->header.status = LEO_STATUS_GOOD; -} diff --git a/src/libleo/leo/leointerrupt.c b/src/libleo/leo/leointerrupt.c deleted file mode 100644 index fc547cfd5c7..00000000000 --- a/src/libleo/leo/leointerrupt.c +++ /dev/null @@ -1,208 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "ultra64/internal.h" - -extern OSThread* __osRunQueue; -extern OSIntMask __OSGlobalIntMask; -void __osLeoAbnormalResume(void); -void __osLeoResume(void); - -STACK(leoDiskStack, 0x1000); - -s32 __osLeoInterrupt(void) { - u32 stat = 0; - volatile u32 pi_stat; - u32 bm_stat; - __OSTranxInfo* info = &__osDiskHandle->transferInfo; - __OSBlockInfo* blockInfo = &info->block[info->blockNum]; - - pi_stat = IO_READ(PI_STATUS_REG); - if (pi_stat & PI_STATUS_DMA_BUSY) { - __OSGlobalIntMask &= ~0x800; - blockInfo->errStatus = 0x1D; - __osLeoResume(); - return 1; - } - - pi_stat = IO_READ(PI_STATUS_REG); - while (pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - pi_stat = IO_READ(PI_STATUS_REG); - } - - stat = IO_READ(ASIC_STATUS); - if (stat & 0x2000000) { - pi_stat = IO_READ(PI_STATUS_REG); - while (pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - pi_stat = IO_READ(PI_STATUS_REG); - } - - IO_WRITE(ASIC_BM_CTL, info->bmCtlShadow | 0x1000000); - blockInfo->errStatus = 0; - return 0; - } - if (info->cmdType == 2) { - return 1; - } - if (stat & 0x8000000) { - pi_stat = IO_READ(PI_STATUS_REG); - while (pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - pi_stat = IO_READ(PI_STATUS_REG); - } - - stat = IO_READ(ASIC_STATUS); - blockInfo->errStatus = 0x16; - __osLeoResume(); - IO_WRITE(PI_STATUS_REG, 2); - __OSGlobalIntMask |= 0x100401; - return 1; - } - if (info->cmdType == 1) { - if (!(stat & 0x40000000)) { - if ((info->sectorNum + 1) != (info->transferMode * 0x55)) { - blockInfo->errStatus = 0x18; - __osLeoAbnormalResume(); - return 1; - } - IO_WRITE(PI_STATUS_REG, 2); - __OSGlobalIntMask |= 0x100401; - blockInfo->errStatus = 0; - __osLeoResume(); - return 1; - } else { - blockInfo->dramAddr = (u8*)(blockInfo->dramAddr) + blockInfo->sectorSize; - info->sectorNum++; - __osEPiRawStartDma(__osDiskHandle, 1, ASIC_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); - return 1; - } - } else if (info->cmdType == 0) { - if (info->transferMode == 3) { - if (((s32)blockInfo->C1ErrNum + 0x11) < info->sectorNum) { - blockInfo->errStatus = 0; - __osLeoAbnormalResume(); - return 1; - } - if ((stat & 0x40000000) == 0) { - blockInfo->errStatus = 0x17; - __osLeoAbnormalResume(); - return 1; - } - } else { - blockInfo->dramAddr = (u8*)(blockInfo->dramAddr) + blockInfo->sectorSize; - } - - bm_stat = IO_READ(ASIC_BM_STATUS); - if (((bm_stat & 0x200000) && (bm_stat & 0x400000)) || (bm_stat & 0x2000000)) { - if (blockInfo->C1ErrNum >= 4) { - if ((info->transferMode != 3) || (info->sectorNum >= 0x53)) { - blockInfo->errStatus = 0x17; - __osLeoAbnormalResume(); - return 1; - } - } else { - int errNum = blockInfo->C1ErrNum; - - blockInfo->C1ErrSector[errNum] = info->sectorNum + 1; - } - blockInfo->C1ErrNum++; - } - - if (stat & 0x10000000) { - if (info->sectorNum != 0x57) { - blockInfo->errStatus = 0x18; - __osLeoAbnormalResume(); - return 1; - } - if ((info->transferMode == 2) && (info->blockNum == 0)) { - info->blockNum = 1; - info->sectorNum = -1; - info->block[1].dramAddr = (u8*)(info->block[1].dramAddr) - info->block[1].sectorSize; - blockInfo->errStatus = 0x16; - } else { - IO_WRITE(PI_STATUS_REG, 2); - __OSGlobalIntMask |= 0x100401; - info->cmdType = 2; - blockInfo->errStatus = 0; - } - __osEPiRawStartDma(__osDiskHandle, 0, ASIC_C2_BUFF, blockInfo->C2Addr, blockInfo->sectorSize * 4); - return 1; - } - if ((info->sectorNum == -1) && (info->transferMode == 2) && (info->blockNum == 1)) { - __OSBlockInfo* bptr = info->block; - - if (bptr->C1ErrNum == 0) { - if (((u32*)bptr->C2Addr)[0] | ((u32*)bptr->C2Addr)[1] | ((u32*)bptr->C2Addr)[2] | - ((u32*)bptr->C2Addr)[3]) { - bptr->errStatus = 0x17; - __osLeoAbnormalResume(); - return 1; - } - } - bptr->errStatus = 0; - __osLeoResume(); - } - info->sectorNum++; - if (stat & 0x40000000) { - if (info->sectorNum >= 0x55) { - blockInfo->errStatus = 0x18; - __osLeoAbnormalResume(); - return 1; - } - __osEPiRawStartDma(__osDiskHandle, 0, ASIC_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); - blockInfo->errStatus = 0; - return 1; - } else if (info->sectorNum < 0x55) { - blockInfo->errStatus = 0x18; - __osLeoAbnormalResume(); - return 1; - } - return 1; - } else { - blockInfo->errStatus = 4; - __osLeoAbnormalResume(); - return 1; - } -} - -// static -void __osLeoAbnormalResume(void) { - __OSTranxInfo* info; - u32 pi_stat; - - info = &__osDiskHandle->transferInfo; - pi_stat = IO_READ(PI_STATUS_REG); - while (pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - pi_stat = IO_READ(PI_STATUS_REG); - } - - IO_WRITE(ASIC_BM_CTL, info->bmCtlShadow | 0x10000000); - pi_stat = IO_READ(PI_STATUS_REG); - while (pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) { - pi_stat = IO_READ(PI_STATUS_REG); - } - - IO_WRITE(ASIC_BM_CTL, info->bmCtlShadow); - __osLeoResume(); - IO_WRITE(PI_STATUS_REG, 2); - __OSGlobalIntMask |= 0x100401; -} - -// static -void __osLeoResume(void) { - __OSEventState* es; - OSMesgQueue* mq; - s32 last; - - es = &__osEventStateTab[8]; - mq = es->queue; - if ((mq == 0) || (mq->validCount >= mq->msgCount)) { - return; - } - last = (mq->first + mq->validCount) % mq->msgCount; - mq->msg[last] = es->msg; - mq->validCount++; - if (mq->mtqueue->next != NULL) { - __osEnqueueThread(&__osRunQueue, __osPopThread(&mq->mtqueue)); - } -} diff --git a/src/libleo/leo/leomode_sel.c b/src/libleo/leo/leomode_sel.c deleted file mode 100644 index fe36bc16afc..00000000000 --- a/src/libleo/leo/leomode_sel.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -void leoMode_sel(void) { - u32 sense; - - sense = leoSend_asic_cmd_w_nochkDiskChange(0x60000, LEOcur_command->data.time.yearlo << 0x10); - if (sense != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { - goto mselerror; - } - sense = leoSend_asic_cmd_w_nochkDiskChange(0x70000, LEOcur_command->data.time.month << 0x10); - if (sense != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { - goto mselerror; - } - sense = leoSend_asic_cmd_w_nochkDiskChange(0x150000, LEOcur_command->data.readWrite.transferBlks); - if (sense != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { - mselerror: - LEOcur_command->header.sense = sense; - LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; - return; - } - - LEOcur_command->header.sense = sense; - LEOcur_command->header.status = LEO_STATUS_GOOD; -} diff --git a/src/libleo/leo/leomseq_tbl.c b/src/libleo/leo/leomseq_tbl.c deleted file mode 100644 index f94979f623c..00000000000 --- a/src/libleo/leo/leomseq_tbl.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -extern OSIoMesg LEOPiDmaParam; -extern vu16 LEOrw_flags; - -// bss -static u32 mseq_tbl[0x10]; - -// rodata -static const u32 rd_mseq_code[0x10] = { - 0x00010000, 0x00020200, 0x80030100, 0x82040000, 0xA8050000, 0xA0060600, 0x31760000, 0x00020300, - 0, 0, 0, 0, 0, 0, 0, 0x4060000, -}; -static const u32 wt_mseq_code[0x10] = { - 0x40020000, 0x00020000, 0x40130B00, 0x42140100, 0x68050000, 0x50060600, 0x401702FF, 0x01870000, - 0x40020000, 0, 0, 0, 0, 0, 0, 0x40F0000, -}; - -void leoSet_mseq(u16 rwmode) { - const u32* tbl; - u32 sct_byte_x; - u32 sct_byte_u; - u8 i; - - LEOasic_seq_ctl_shadow &= 0xBFFFFFFF; - osEPiWriteIo(LEOPiInfo, ASIC_SEQ_CTL, LEOasic_seq_ctl_shadow); - if (rwmode == 1) { - tbl = wt_mseq_code; - } else { - tbl = rd_mseq_code; - } - for (i = 0; i < 0x10; i++, tbl++) { - mseq_tbl[i] = *tbl; - } - - sct_byte_x = sct_byte_u = LEOtgt_param.sec_bytes - 1; - sct_byte_u += 7; - sct_byte_x <<= 8; - mseq_tbl[4] |= sct_byte_x; - - osWritebackDCache(mseq_tbl, 0x40); - LEOPiDmaParam.dramAddr = mseq_tbl; - LEOPiDmaParam.devAddr = MSEQ_RAM_ADDR; - LEOPiDmaParam.size = 0x40; - LEOPiInfo->transferInfo.cmdType = 2; - osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, 1); - osRecvMesg(&LEOdma_que, NULL, OS_MESG_BLOCK); - osEPiWriteIo(LEOPiInfo, ASIC_SEC_BYTE, (sct_byte_u | 0x5900) << 0x10); - - if (LEOrw_flags & 0x800) { - sct_byte_x += 0x100; - } - - osEPiWriteIo(LEOPiInfo, ASIC_HOST_SECBYTE, sct_byte_x << 8); - LEOasic_seq_ctl_shadow |= 0x40000000; - osEPiWriteIo(LEOPiInfo, ASIC_SEQ_CTL, LEOasic_seq_ctl_shadow); -} diff --git a/src/libleo/leo/leord_capa.c b/src/libleo/leo/leord_capa.c deleted file mode 100644 index 86b71ac903e..00000000000 --- a/src/libleo/leo/leord_capa.c +++ /dev/null @@ -1,17 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -void leoRd_capacity(void) { - if (LEOcur_command->header.control & LEO_CONTROL_WRT) { // Possibly LEO_CONTROL_TBL - LEOcur_command->data.readWrite.lba = LEORAM_START_LBA[LEOdisk_type] - 0x18; - LEOcur_command->data.readWrite.transferBlks = 0x10C3; - LEOcur_command->data.readWrite.buffPtr = (void*)LEORAM_BYTE[LEOdisk_type]; - } else { - LEOcur_command->data.readWrite.lba = 0; - LEOcur_command->data.readWrite.transferBlks = 0x10C3; - LEOcur_command->data.readWrite.buffPtr = (void*)0x3D78F40; // Total capacity, approx. 64.45 MB - } - LEOcur_command->header.status = LEO_STATUS_GOOD; -} diff --git a/src/libleo/leo/leoreset.c b/src/libleo/leo/leoreset.c deleted file mode 100644 index 40eb56482c5..00000000000 --- a/src/libleo/leo/leoreset.c +++ /dev/null @@ -1,29 +0,0 @@ -#include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -void leoClr_queue(void) { - OSMesg clr_cmd; - - while (osRecvMesg(&LEOcommand_que, &clr_cmd, OS_MESG_NOBLOCK) == 0) { - ((LEOCmd*)clr_cmd)->header.sense = LEO_SENSE_COMMAND_TERMINATED; - ((LEOCmd*)clr_cmd)->header.status = LEO_STATUS_CHECK_CONDITION; - if (((LEOCmd*)clr_cmd)->header.control & LEO_CONTROL_POST) { - osSendMesg(((LEOCmd*)clr_cmd)->header.post, (OSMesg)LEO_SENSE_COMMAND_TERMINATED, OS_MESG_BLOCK); - } - } -} - -void leoClr_reset(void) { - u32 code = leoAnalize_asic_status(); - - if ((code == LEO_SENSE_COMMAND_PHASE_ERROR) || (code == LEO_SENSE_DEVICE_COMMUNICATION_FAILURE) || - (code == LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED)) { - LEOcur_command->header.sense = code; - LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; - } else { - LEOcur_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; - LEOcur_command->header.status = LEO_STATUS_GOOD; - } -} diff --git a/src/libleo/leo/leotempbuffer.c b/src/libleo/leo/leotempbuffer.c deleted file mode 100644 index 5016051caff..00000000000 --- a/src/libleo/leo/leotempbuffer.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "n64dd.h" - -u8 LEO_TempBuffer[0xE8]; diff --git a/src/libu64/gfxprint.c b/src/libu64/gfxprint.c index 1131dc51026..670baab59d2 100644 --- a/src/libu64/gfxprint.c +++ b/src/libu64/gfxprint.c @@ -410,13 +410,8 @@ s32 GfxPrint_VPrintf(GfxPrint* this, const char* fmt, va_list args) { } s32 GfxPrint_Printf(GfxPrint* this, const char* fmt, ...) { - s32 ret; va_list args; va_start(args, fmt); - ret = GfxPrint_VPrintf(this, fmt, args); - - va_end(args); - - return ret; + return GfxPrint_VPrintf(this, fmt, args); } diff --git a/src/libleo/api/bytetolba.c b/src/n64dd/libleo/bytetolba.c similarity index 91% rename from src/libleo/api/bytetolba.c rename to src/n64dd/libleo/bytetolba.c index 9b25ac840f0..4e6db7bca84 100644 --- a/src/libleo/api/bytetolba.c +++ b/src/n64dd/libleo/bytetolba.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" s32 LeoByteToLBA(s32 startlba, u32 nbytes, s32* lba) { u32 reslba; diff --git a/src/n64dd/libleo/cacreateleomanager.c b/src/n64dd/libleo/cacreateleomanager.c new file mode 100644 index 00000000000..02cbac78a74 --- /dev/null +++ b/src/n64dd/libleo/cacreateleomanager.c @@ -0,0 +1,64 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) { + OSPiHandle* driveRomHandle; + OSPiHandle* leoDiskHandle; + volatile LEOCmdInquiry cmdBlockInq; + volatile LEOCmd cmdBlockID; + LEODiskID thisID; + u32 stat; + u32 data; + + if (__leoActive != 0) { + return 0; + } + if (LeoDriveExist() == 0) { + return 0x29; + } + osLeoDiskInit(); + driveRomHandle = osDriveRomInit(); + __leoActive = 1; + __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - 0x10); + leoInitialize(comPri, intPri, cmdBuf, (u32)cmdMsgCnt); + if (osResetType == 1) { + __leoSetReset(); + } + cmdBlockInq.header.command = LEO_COMMAND_INQUIRY; + cmdBlockInq.header.reserve1 = 0; + cmdBlockInq.header.control = 0; + cmdBlockInq.header.reserve3 = 0; + leoCommand((void*)&cmdBlockInq); + { + vs32 dummy = (u32)__osSetHWIntrRoutine & 0xA48D3C; + + while (dummy < 0xE00000) { + dummy += (((s32)leoCommand & 0xFF) | 0x8A) << 16; + } + } + while (cmdBlockInq.header.status == LEO_STATUS_BUSY) {} + if (cmdBlockInq.header.status != 0) { + return cmdBlockInq.header.sense; + } + __leoVersion.drive = cmdBlockInq.version; + __leoVersion.driver = 6; + __leoVersion.deviceType = cmdBlockInq.dev_type; + __leoVersion.ndevices = cmdBlockInq.dev_num; + if ((__leoVersion.drive & 0xF) == 4) { + LEO_country_code = 0; + } else if (((__leoVersion.drive & 0xF) == 3) || ((__leoVersion.drive & 0xF) == 1)) { + vu32 dummy; + + osEPiReadIo(driveRomHandle, 0x9FF00, &data); + data = ((data & 0xFF000000) >> 24); + if (data != 4) { + while (true) {} + } + dummy = 0x32F8EB20; + LEO_country_code = 0x2263EE56; + dummy += (u32)&__leoActive; + } else { + while (true) {} + } + return 0; +} diff --git a/src/n64dd/libleo/cjcreateleomanager.c b/src/n64dd/libleo/cjcreateleomanager.c new file mode 100644 index 00000000000..f20671ba362 --- /dev/null +++ b/src/n64dd/libleo/cjcreateleomanager.c @@ -0,0 +1,65 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) { + OSPiHandle* driveRomHandle; + OSPiHandle* leoDiskHandle; + volatile LEOCmdInquiry cmdBlockInq; + volatile LEOCmd cmdBlockID; + LEODiskID thisID; + u32 stat; + u32 data; + + if (__leoActive != 0) { + return 0; + } + if (LeoDriveExist() == 0) { + return 0x29; + } + osLeoDiskInit(); + driveRomHandle = osDriveRomInit(); + __leoActive = 1; + __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - 0x10); + leoInitialize(comPri, intPri, cmdBuf, (u32)cmdMsgCnt); + if (osResetType == 1) { + __leoSetReset(); + } + cmdBlockInq.header.command = LEO_COMMAND_INQUIRY; + cmdBlockInq.header.reserve1 = 0; + cmdBlockInq.header.control = 0; + cmdBlockInq.header.reserve3 = 0; + leoCommand((void*)&cmdBlockInq); + { + vs32 dummy = (u32)&cmdBlockInq & 0xFFFFFF; + + while (dummy > 0) { + dummy -= ((s32)__leoSetReset & 0xFFFFFF) | 0x403DF4; + } + } + while (cmdBlockInq.header.status == LEO_STATUS_BUSY) {} + if (cmdBlockInq.header.status != 0) { + return (s32)cmdBlockInq.header.sense; + } + __leoVersion.drive = cmdBlockInq.version; + __leoVersion.driver = 6; + __leoVersion.deviceType = cmdBlockInq.dev_type; + __leoVersion.ndevices = cmdBlockInq.dev_num; + if ((__leoVersion.drive & 0xF) == 4) { + LEO_country_code = 0; + } else if (((__leoVersion.drive & 0xF) == 3) || ((__leoVersion.drive & 0xF) == 1)) { + vu32 dummy; + + osEPiReadIo(driveRomHandle, 0x9FF00, &data); + data = ((u32)(data & 0xFF000000) >> 24); + dummy = 0x3ED98F23; + if (data != 0xC3) { + while (true) {} + } + dummy *= data; + dummy -= (u32)&cmdBlockInq; + LEO_country_code = 0xE848D316; + } else { + while (true) {} + } + return 0; +} diff --git a/src/libleo/api/clearqueue.c b/src/n64dd/libleo/clearqueue.c similarity index 50% rename from src/libleo/api/clearqueue.c rename to src/n64dd/libleo/clearqueue.c index 1972b6080f6..c9556942460 100644 --- a/src/libleo/api/clearqueue.c +++ b/src/n64dd/libleo/clearqueue.c @@ -1,20 +1,16 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" s32 LeoClearQueue(void) { - LEOCmdClearQueue cmdBlock; + LEOCmdClearQue cmdBlock; - if (!__leoActive) { + if (__leoActive == 0) { return -1; } - - cmdBlock.header.command = 1; + cmdBlock.header.command = LEO_COMMAND_CLEAR_QUE; cmdBlock.header.reserve1 = 0; cmdBlock.header.control = 0; cmdBlock.header.reserve3 = 0; - leoCommand(&cmdBlock); - return LEO_ERROR_GOOD; + return 0; } diff --git a/src/libleo/api/driveexist.c b/src/n64dd/libleo/driveexist.c similarity index 72% rename from src/libleo/api/driveexist.c rename to src/n64dd/libleo/driveexist.c index f658817a3de..ed4759434e0 100644 --- a/src/libleo/api/driveexist.c +++ b/src/n64dd/libleo/driveexist.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" u32 LeoDriveExist(void) { u32 data; @@ -13,29 +11,23 @@ u32 LeoDriveExist(void) { u32 relDuration; __osPiGetAccess(); - - while ((stat = IO_READ(PI_STATUS_REG)) & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) {} - + while (((stat = IO_READ(PI_STATUS_REG)) & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) {} latency = IO_READ(PI_BSD_DOM1_LAT_REG); pageSize = IO_READ(PI_BSD_DOM1_PGS_REG); relDuration = IO_READ(PI_BSD_DOM1_RLS_REG); pulse = IO_READ(PI_BSD_DOM1_PWD_REG); - IO_WRITE(PI_BSD_DOM1_LAT_REG, 0xFF); IO_WRITE(PI_BSD_DOM1_PGS_REG, 0); IO_WRITE(PI_BSD_DOM1_RLS_REG, 3); IO_WRITE(PI_BSD_DOM1_PWD_REG, 0xFF); - - data = IO_READ(0x06001010); // Something in the n64dd address space? - + data = IO_READ(0x06001010); IO_WRITE(PI_BSD_DOM1_LAT_REG, latency); IO_WRITE(PI_BSD_DOM1_PGS_REG, pageSize); IO_WRITE(PI_BSD_DOM1_RLS_REG, relDuration); IO_WRITE(PI_BSD_DOM1_PWD_REG, pulse); - __osPiRelAccess(); if (data == 0x2129FFF8) { - return true; + return 1; } - return false; + return 0; } diff --git a/src/n64dd/libleo/getaadr.s b/src/n64dd/libleo/getaadr.s new file mode 100644 index 00000000000..ea3cc38049e --- /dev/null +++ b/src/n64dd/libleo/getaadr.s @@ -0,0 +1,2346 @@ +#include "ultra64/asm.h" +#include "ultra64/regdef.h" + +.text + +LEAF(LeoGetAAdr) + bltz a0, .L801D0498 + bge a0, 0x908, .L801D0498 + sll t0, a0, 2 + la v1, D_801D04A0 + add t1, t0, v1 + lbu t8, 2(t1) + lhu t9, 0(t1) + andi t2, t8, 0xF + addi t3, t2, 1 + sw t3, (a2) + lb t0, 3(t1) + srl t4, t8, 4 + andi t5, t0, 1 + sll t6, t5, 4 + or t7, t6, t4 + sw t7, (a1) + sll v0, t9, 1 + sra v1, t0, 1 + sw v1, (a3) + add v0, v0, 0x7EE80 + jr ra + .L801D0498: + li v0, -1 + jr ra +END(LeoGetAAdr) + +DATA(D_801D04A0) + .word 0x00009D14 + .word 0x00232A14 + .word 0x00296314 + .word 0x002F8A14 + .word 0x00457E18 + .word 0x0063CA14 + .word 0x0084AA14 + .word 0x00A03314 + .word 0x00A45E14 + .word 0x00BB4E14 + .word 0x00CA6514 + .word 0x00D3770E + .word 0x00E33302 + .word 0x00E78108 + .word 0x00EB2102 + .word 0x00EC6C14 + .word 0x01008A14 + .word 0x01163A14 + .word 0x01217A14 + .word 0x01377A14 + .word 0x014D8A14 + .word 0x01638A14 + .word 0x01798A14 + .word 0x018F7A14 + .word 0x01A58A14 + .word 0x01BB8A14 + .word 0x01D1170E + .word 0x01D5490E + .word 0x01DF770E + .word 0x01EF740A + .word 0x01F9770E + .word 0x02097A14 + .word 0x021FDC16 + .word 0x024DBA14 + .word 0x026E7A14 + .word 0x0284BA14 + .word 0x02A59A14 + .word 0x02C16A14 + .word 0x02D26A14 + .word 0x02E3BA14 + .word 0x03048A14 + .word 0x031A1A14 + .word 0x03206A14 + .word 0x03318A14 + .word 0x03476A14 + .word 0x0358CA14 + .word 0x03799A14 + .word 0x0395CA14 + .word 0x03B67A14 + .word 0x03CCCA14 + .word 0x03ED8A14 + .word 0x04037A14 + .word 0x04196A14 + .word 0x042A8A14 + .word 0x0440AA14 + .word 0x045CDA14 + .word 0x04839A14 + .word 0x049F9A14 + .word 0x04BB7A14 + .word 0x04D14D14 + .word 0x04DF5C14 + .word 0x04F33D14 + .word 0x05015216 + .word 0x050681FA + .word 0x050A9D14 + .word 0x052D9810 + .word 0x05449A14 + .word 0x05609810 + .word 0x05779A14 + .word 0x05939810 + .word 0x05AA5A14 + .word 0x05BB9C10 + .word 0x05DC7A14 + .word 0x05F22A14 + .word 0x05F83D14 + .word 0x06067A14 + .word 0x061C2A14 + .word 0x0622D810 + .word 0x06427810 + .word 0x06549810 + .word 0x066B9B10 + .word 0x06899B10 + .word 0x06A74810 + .word 0x06B06810 + .word 0x06BE5A14 + .word 0x06CF770E + .word 0x06DF870E + .word 0x06EFB70E + .word 0x0707670E + .word 0x07138A0E + .word 0x0729670E + .word 0x07356D14 + .word 0x074A1F16 + .word 0x07526D14 + .word 0x07675216 + .word 0x076C9D14 + .word 0x078F9D14 + .word 0x07B22A0E + .word 0x07B88B14 + .word 0x07D08A14 + .word 0x07E69816 + .word 0x07FD9A14 + .word 0x08193F16 + .word 0x08296C14 + .word 0x083D5114 + .word 0x0840CA14 + .word 0x08616614 + .word 0x086C650C + .word 0x0875830A + .word 0x087D9D14 + .word 0x08A0CA14 + .word 0x08C14114 + .word 0x08C35318 + .word 0x08C98810 + .word 0x08DB9D14 + .word 0x08FE9D14 + .word 0x09213216 + .word 0x09249A0E + .word 0x09407A14 + .word 0x0956440E + .word 0x095B3302 + .word 0x095F9D14 + .word 0x09826614 + .word 0x098D650C + .word 0x09960A15 + .word 0x09C2C514 + .word 0x09D4070F + .word 0x09F47A0E + .word 0x0A0ABE1C + .word 0x0A37BE1C + .word 0x0A64BE1C + .word 0x0A91BD1A + .word 0x0ABBBD1A + .word 0x0AE5BE1C + .word 0x0B12FA14 + .word 0x0B3EBE14 + .word 0x0B6B7E1C + .word 0x0B897E1C + .word 0x0BA77E1C + .word 0x0BC57D1A + .word 0x0BE13E1C + .word 0x0BF04E1C + .word 0x0BFF4E1C + .word 0x0C0E5D1A + .word 0x0C239D14 + .word 0x0C469D1A + .word 0x0C69BE1C + .word 0x0C96BE1C + .word 0x0CC3BE1C + .word 0x0CF0BD1A + .word 0x0D1ABD1A + .word 0x0D44770E + .word 0x0D54CC16 + .word 0x0D7B8E1C + .word 0x0D998E1C + .word 0x0DB77E1C + .word 0x0DD57D1A + .word 0x0DF19D14 + .word 0x0E149D14 + .word 0x0E379A14 + .word 0x0E539B16 + .word 0x0E719B16 + .word 0x0E8F9B16 + .word 0x0EAD9B16 + .word 0x0ECB9A14 + .word 0x0EE79B16 + .word 0x0F050811 + .word 0x0F299B10 + .word 0x0F479B16 + .word 0x0F659B16 + .word 0x0F839B16 + .word 0x0FA19A14 + .word 0x0FBD3B16 + .word 0x0FC93A16 + .word 0x0FD44B16 + .word 0x0FE04A14 + .word 0x0FEB7912 + .word 0x0FFF8B16 + .word 0x10179B16 + .word 0x10359B16 + .word 0x10539B16 + .word 0x10719B16 + .word 0x108F9A14 + .word 0x10AB760C + .word 0x10B99910 + .word 0x10D28B16 + .word 0x10EA8B16 + .word 0x11028B16 + .word 0x111A8A14 + .word 0x11309D14 + .word 0x11539D14 + .word 0x11769D14 + .word 0x11996F18 + .word 0x11B13A14 + .word 0x11BC7514 + .word 0x11C88912 + .word 0x11DC9D16 + .word 0x11FFEA14 + .word 0x1226CA14 + .word 0x12474514 + .word 0x124D4D14 + .word 0x125B4D14 + .word 0x12696614 + .word 0x1274870E + .word 0x12843404 + .word 0x12899108 + .word 0x128E4204 + .word 0x12916C14 + .word 0x12A5AA14 + .word 0x12C17A14 + .word 0x12D79A14 + .word 0x12F3AA14 + .word 0x130FAA14 + .word 0x132B9B16 + .word 0x1349AA14 + .word 0x1365AA14 + .word 0x1381AA14 + .word 0x139DAA14 + .word 0x13B9370E + .word 0x13C1390E + .word 0x13CB770E + .word 0x13DB750C + .word 0x13E7770E + .word 0x13F79A14 + .word 0x1413CC14 + .word 0x143ACA14 + .word 0x145BBA14 + .word 0x147CBA14 + .word 0x149DBA14 + .word 0x14BEBA14 + .word 0x14DFBA14 + .word 0x1500BA14 + .word 0x1521CA14 + .word 0x15426A14 + .word 0x1553AA14 + .word 0x156FCA14 + .word 0x1590AA14 + .word 0x15ACFA14 + .word 0x15D8CA14 + .word 0x15F9BA14 + .word 0x161AAA14 + .word 0x1636CE14 + .word 0x1663CA14 + .word 0x16849A14 + .word 0x16A0CA14 + .word 0x16C1BA14 + .word 0x16E2CA14 + .word 0x1703EA14 + .word 0x172ACA14 + .word 0x174BCA14 + .word 0x176CAA14 + .word 0x17883D14 + .word 0x17966C14 + .word 0x17AA3D14 + .word 0x17B85214 + .word 0x17BD92FC + .word 0x17C55F1A + .word 0x17DD870E + .word 0x17EDAA14 + .word 0x1809870E + .word 0x18199A14 + .word 0x1835970E + .word 0x18497A14 + .word 0x185F9C10 + .word 0x1880BA14 + .word 0x18A15A14 + .word 0x18B26E14 + .word 0x18C9AA14 + .word 0x18E55A14 + .word 0x18F6F70E + .word 0x1916A70E + .word 0x192A970E + .word 0x193EAB0E + .word 0x195C9B0E + .word 0x197A770E + .word 0x198A770E + .word 0x199A6912 + .word 0x19A9A70E + .word 0x19BDA60E + .word 0x19CFD70E + .word 0x19EBA70E + .word 0x19FFAB0E + .word 0x1A1D870E + .word 0x1A2D6D14 + .word 0x1A423F16 + .word 0x1A526D14 + .word 0x1A675214 + .word 0x1A6C6F18 + .word 0x1A846F16 + .word 0x1A9C3A0E + .word 0x1AA78B14 + .word 0x1ABFAA14 + .word 0x1ADB8614 + .word 0x1AE9BA14 + .word 0x1B0A2F16 + .word 0x1B128A14 + .word 0x1B285214 + .word 0x1B2DBB14 + .word 0x1B516614 + .word 0x1B5C860C + .word 0x1B6A730A + .word 0x1B726E16 + .word 0x1B89BB14 + .word 0x1BAD5012 + .word 0x1BAF5316 + .word 0x1BB58910 + .word 0x1BC95F18 + .word 0x1BE15F18 + .word 0x1BF95316 + .word 0x1BFFA90C + .word 0x1C188A14 + .word 0x1C2E540E + .word 0x1C363404 + .word 0x1C3B6D14 + .word 0x1C506614 + .word 0x1C5B860C + .word 0x1C690913 + .word 0x1C91C512 + .word 0x1CA3D70E + .word 0x1CBF9A0E + .word 0x1CDBCD1A + .word 0x1D05CD1A + .word 0x1D2FCD1A + .word 0x1D59CD1A + .word 0x1D83CD1A + .word 0x1DADCE1C + .word 0x1DDA2A15 + .word 0x1E0CBD14 + .word 0x1E36BD1A + .word 0x1E60BD1A + .word 0x1E8ABD1A + .word 0x1EB4BC18 + .word 0x1EDB6D1A + .word 0x1EF06D1A + .word 0x1F056D1A + .word 0x1F1A6D1A + .word 0x1F2F5F1A + .word 0x1F47BD1A + .word 0x1F71CD1A + .word 0x1F9BCD1A + .word 0x1FC5CD1A + .word 0x1FEFCD1A + .word 0x2019CD1A + .word 0x2043970E + .word 0x2057CB14 + .word 0x207BAD1A + .word 0x209EBD1A + .word 0x20C8BD1A + .word 0x20F2BD1A + .word 0x211C6F1A + .word 0x21345F1A + .word 0x214CAA14 + .word 0x21689B16 + .word 0x21869B16 + .word 0x21A49A14 + .word 0x21C0AA14 + .word 0x21DC9A14 + .word 0x21F89B16 + .word 0x2216D70E + .word 0x22329B0E + .word 0x22508B16 + .word 0x22689B16 + .word 0x22869A14 + .word 0x22A29A14 + .word 0x22BE5B16 + .word 0x22D05B16 + .word 0x22E25A14 + .word 0x22F35A14 + .word 0x23048912 + .word 0x2318AA14 + .word 0x23349B16 + .word 0x23529B16 + .word 0x23709A14 + .word 0x238C9A14 + .word 0x23A89A14 + .word 0x23C49910 + .word 0x23DD9A10 + .word 0x23F9AB16 + .word 0x2417AB16 + .word 0x2435AA14 + .word 0x2451AA14 + .word 0x246D5F18 + .word 0x24855F18 + .word 0x249DAE14 + .word 0x24C39D14 + .word 0x24E62A14 + .word 0x24EC5314 + .word 0x24F28912 + .word 0x25068D16 + .word 0x2522CA14 + .word 0x2543CA14 + .word 0x25642314 + .word 0x25663C14 + .word 0x25733C14 + .word 0x25806514 + .word 0x2589770E + .word 0x25993302 + .word 0x259D9006 + .word 0x25A03102 + .word 0x25A26C14 + .word 0x25B69A14 + .word 0x25D26A14 + .word 0x25E38A14 + .word 0x25F99A14 + .word 0x26159A14 + .word 0x26318A14 + .word 0x26478A14 + .word 0x265D9912 + .word 0x26769A14 + .word 0x26928A14 + .word 0x26A8260C + .word 0x26AC480C + .word 0x26B5870E + .word 0x26C5740A + .word 0x26CF770E + .word 0x26DF8A14 + .word 0x26F5DC14 + .word 0x2723CA14 + .word 0x2744A912 + .word 0x275DAA14 + .word 0x2779B912 + .word 0x2797A912 + .word 0x27B0A912 + .word 0x27C9BA14 + .word 0x27EAC912 + .word 0x28085912 + .word 0x28179912 + .word 0x2830B912 + .word 0x284E9912 + .word 0x2867D912 + .word 0x288AB912 + .word 0x28A8CA14 + .word 0x28C99912 + .word 0x28E2CD14 + .word 0x290CB912 + .word 0x292A9A14 + .word 0x2946A912 + .word 0x295FB912 + .word 0x297DC912 + .word 0x299B0913 + .word 0x29C3C912 + .word 0x29E1B912 + .word 0x29FF9912 + .word 0x2A183B12 + .word 0x2A246C14 + .word 0x2A383B12 + .word 0x2A445214 + .word 0x2A4981FA + .word 0x2A4D9D14 + .word 0x2A70970E + .word 0x2A849A14 + .word 0x2AA0770E + .word 0x2AB09A14 + .word 0x2ACC870E + .word 0x2ADC6A14 + .word 0x2AED9C10 + .word 0x2B0E9A14 + .word 0x2B2A4912 + .word 0x2B346D12 + .word 0x2B499A14 + .word 0x2B655A14 + .word 0x2B76F70E + .word 0x2B96A70E + .word 0x2BAA970E + .word 0x2BBE9B0E + .word 0x2BDCAB0E + .word 0x2BFA770E + .word 0x2C0A770E + .word 0x2C1A6912 + .word 0x2C29A70E + .word 0x2C3D970E + .word 0x2C51C70E + .word 0x2C69A70E + .word 0x2C7D9B0E + .word 0x2C9B770E + .word 0x2CAB5C12 + .word 0x2CBF2F16 + .word 0x2CC76C12 + .word 0x2CDB5214 + .word 0x2CE08D14 + .word 0x2CFC9D14 + .word 0x2D1F2A0E + .word 0x2D257B14 + .word 0x2D3D9A14 + .word 0x2D599714 + .word 0x2D6DB912 + .word 0x2D8B2F16 + .word 0x2D937A14 + .word 0x2DA95112 + .word 0x2DACCB14 + .word 0x2DD07714 + .word 0x2DE0760C + .word 0x2DEE730A + .word 0x2DF69D14 + .word 0x2E19BB14 + .word 0x2E3D5112 + .word 0x2E405316 + .word 0x2E468810 + .word 0x2E589D14 + .word 0x2E7B9D14 + .word 0x2E9E4214 + .word 0x2EA19A0C + .word 0x2EBD7A14 + .word 0x2ED3440E + .word 0x2ED82302 + .word 0x2EDA8D14 + .word 0x2EF66714 + .word 0x2F02760C + .word 0x2F100A15 + .word 0x2F3CC614 + .word 0x2F51C70E + .word 0x2F698A0E + .word 0x2F7FCD1A + .word 0x2FA9CD1A + .word 0x2FD3BD1A + .word 0x2FFDCD1A + .word 0x3027CC18 + .word 0x304ECE1C + .word 0x307B0913 + .word 0x30A3BD14 + .word 0x30CDAD1A + .word 0x30F0BD1A + .word 0x311ABD1A + .word 0x3144AC18 + .word 0x31654D1A + .word 0x31734D1A + .word 0x31814D1A + .word 0x318F5C18 + .word 0x31A39D14 + .word 0x31C6BD1A + .word 0x31F0CD1A + .word 0x321ACD1A + .word 0x3244CD1A + .word 0x326ECD1A + .word 0x3298CC18 + .word 0x32BFA70E + .word 0x32D3BB14 + .word 0x32F7BD1A + .word 0x3321CD1A + .word 0x334BBD1A + .word 0x3375BC18 + .word 0x339C8D14 + .word 0x33B88D14 + .word 0x33D49A14 + .word 0x33F09A14 + .word 0x340C9A14 + .word 0x34289A14 + .word 0x34449A14 + .word 0x34609912 + .word 0x34799B16 + .word 0x3497C70E + .word 0x34AF7A0E + .word 0x34C58A14 + .word 0x34DB8A14 + .word 0x34F17A14 + .word 0x35077912 + .word 0x351B5A14 + .word 0x352C5A14 + .word 0x353D5A14 + .word 0x354E6912 + .word 0x355D7912 + .word 0x35719A14 + .word 0x358D8A14 + .word 0x35A38A14 + .word 0x35B98A14 + .word 0x35CF8A14 + .word 0x35E58912 + .word 0x35F9870E + .word 0x36099910 + .word 0x3622AA14 + .word 0x363EAA14 + .word 0x365AAA14 + .word 0x36769912 + .word 0x368F8D14 + .word 0x36AB8D14 + .word 0x36C79D12 + .word 0x36EA6F18 + .word 0x37024912 + .word 0x370C7412 + .word 0x37166B14 + .word 0x37288C14 + .word 0x37427912 + .word 0x37568810 + .word 0x37684412 + .word 0x376D5C12 + .word 0x37815C12 + .word 0x37957612 + .word 0x37A39710 + .word 0x37B74404 + .word 0x37BCA108 + .word 0x37C13306 + .word 0x37C57B14 + .word 0x37DD8912 + .word 0x37F17912 + .word 0x38057912 + .word 0x38198912 + .word 0x382D8912 + .word 0x38417912 + .word 0x38557912 + .word 0x38697912 + .word 0x387D8912 + .word 0x38918912 + .word 0x38A5370E + .word 0x38AD480C + .word 0x38B69710 + .word 0x38CA940E + .word 0x38D79710 + .word 0x38EB7912 + .word 0x38FF8B14 + .word 0x3917A912 + .word 0x39309912 + .word 0x39498912 + .word 0x395D8912 + .word 0x39719912 + .word 0x398A9912 + .word 0x39A39912 + .word 0x39BC9912 + .word 0x39D57912 + .word 0x39E99912 + .word 0x3A029912 + .word 0x3A1B9912 + .word 0x3A34A912 + .word 0x3A4D9912 + .word 0x3A669912 + .word 0x3A7F8912 + .word 0x3A939B12 + .word 0x3AB19912 + .word 0x3ACA8912 + .word 0x3ADE8912 + .word 0x3AF29912 + .word 0x3B0B9912 + .word 0x3B24A912 + .word 0x3B3D8912 + .word 0x3B518912 + .word 0x3B657912 + .word 0x3B794C12 + .word 0x3B867B14 + .word 0x3B9E4C12 + .word 0x3BAB6214 + .word 0x3BB0A2FC + .word 0x3BB85F1A + .word 0x3BD0870E + .word 0x3BE09912 + .word 0x3BF9870E + .word 0x3C098912 + .word 0x3C1D870E + .word 0x3C2D8912 + .word 0x3C419A0E + .word 0x3C5D8912 + .word 0x3C718A14 + .word 0x3C877D14 + .word 0x3CA39912 + .word 0x3CBC8912 + .word 0x3CD0A70E + .word 0x3CE4970E + .word 0x3CF8970E + .word 0x3D0C9B0E + .word 0x3D2AAB0E + .word 0x3D48970E + .word 0x3D5C770E + .word 0x3D6C8912 + .word 0x3D80970E + .word 0x3D94970E + .word 0x3DA8A70E + .word 0x3DBC870E + .word 0x3DCC9A0E + .word 0x3DE8770E + .word 0x3DF86D12 + .word 0x3E0D2F16 + .word 0x3E156D12 + .word 0x3E2A6212 + .word 0x3E2F6F16 + .word 0x3E476F16 + .word 0x3E5F4912 + .word 0x3E697A14 + .word 0x3E7F7912 + .word 0x3E938612 + .word 0x3EA19912 + .word 0x3EBA3F16 + .word 0x3ECA8A12 + .word 0x3EE06112 + .word 0x3EE3A812 + .word 0x3EFA7712 + .word 0x3F0A550C + .word 0x3F13950E + .word 0x3F226E16 + .word 0x3F399812 + .word 0x3F506112 + .word 0x3F534316 + .word 0x3F578812 + .word 0x3F695F18 + .word 0x3F815F18 + .word 0x3F995214 + .word 0x3F9E9A0E + .word 0x3FBA7912 + .word 0x3FCE320C + .word 0x3FD14404 + .word 0x3FD66D14 + .word 0x3FEB7712 + .word 0x3FFB650C + .word 0x40048710 + .word 0x40148310 + .word 0x401C860E + .word 0x402A7912 + .word 0x403EAC18 + .word 0x405FAC18 + .word 0x4080AC18 + .word 0x40A1AB16 + .word 0x40BFAB16 + .word 0x40DDAD1A + .word 0x4100B912 + .word 0x411E8C12 + .word 0x41388C18 + .word 0x41529C18 + .word 0x41739C18 + .word 0x41948B16 + .word 0x41AC7C18 + .word 0x41C67C18 + .word 0x41E07C18 + .word 0x41FA7B16 + .word 0x42125F1A + .word 0x422AAB16 + .word 0x42489C18 + .word 0x42699C18 + .word 0x428A9C18 + .word 0x42AB9B16 + .word 0x42C99B16 + .word 0x42E7870E + .word 0x42F79A12 + .word 0x43139C18 + .word 0x43349C18 + .word 0x4355AC18 + .word 0x4376AB16 + .word 0x43946F1A + .word 0x43AC5F1A + .word 0x43C48912 + .word 0x43D88A14 + .word 0x43EE8A14 + .word 0x44049A14 + .word 0x44209912 + .word 0x44398912 + .word 0x444D8B16 + .word 0x4465970E + .word 0x44798A0E + .word 0x448F8A14 + .word 0x44A58A14 + .word 0x44BB9A14 + .word 0x44D79912 + .word 0x44F08A14 + .word 0x45068A14 + .word 0x451C7A14 + .word 0x45327912 + .word 0x45468912 + .word 0x455A9912 + .word 0x45738A14 + .word 0x45898A14 + .word 0x459F9912 + .word 0x45B89912 + .word 0x45D19912 + .word 0x45EAA912 + .word 0x46039910 + .word 0x461C9A14 + .word 0x46389A14 + .word 0x46548A14 + .word 0x466A9912 + .word 0x46835F18 + .word 0x469B5F18 + .word 0x46B38C12 + .word 0x46CD3C16 + .word 0x46DA3C16 + .word 0x46E77516 + .word 0x46F39A14 + .word 0x470F7E18 + .word 0x472DDC16 + .word 0x475BBC16 + .word 0x47824516 + .word 0x47884F18 + .word 0x47984F18 + .word 0x47A85516 + .word 0x47B1870E + .word 0x47C15504 + .word 0x47CA810A + .word 0x47CE4304 + .word 0x47D28F18 + .word 0x47F29C16 + .word 0x48134B16 + .word 0x481F8B16 + .word 0x48378C16 + .word 0x48519B16 + .word 0x486F8C16 + .word 0x48898C16 + .word 0x48A38B16 + .word 0x48BB8C16 + .word 0x48D58C16 + .word 0x48EF380E + .word 0x48F84A0E + .word 0x4903970E + .word 0x4917850C + .word 0x4923870E + .word 0x49337C16 + .word 0x494DCC16 + .word 0x4974BB16 + .word 0x49988B16 + .word 0x49B09C16 + .word 0x49D1AB16 + .word 0x49EF7B16 + .word 0x4A077B16 + .word 0x4A1FBC16 + .word 0x4A46AB16 + .word 0x4A643B16 + .word 0x4A706C16 + .word 0x4A849B16 + .word 0x4AA26B16 + .word 0x4AB4DC16 + .word 0x4AE2AC16 + .word 0x4B03CC16 + .word 0x4B2A8B16 + .word 0x4B42CC16 + .word 0x4B698B16 + .word 0x4B818C16 + .word 0x4B9B7B16 + .word 0x4BB39C16 + .word 0x4BD4BC16 + .word 0x4BFBFC16 + .word 0x4C2FAB16 + .word 0x4C4DAB16 + .word 0x4C6B9B16 + .word 0x4C893E18 + .word 0x4C988C18 + .word 0x4CB24E18 + .word 0x4CC16316 + .word 0x4CC781FC + .word 0x4CCB3C16 + .word 0x4CD8880E + .word 0x4CEA8D18 + .word 0x4D06680E + .word 0x4D149D18 + .word 0x4D37880E + .word 0x4D495C18 + .word 0x4D5D8B0E + .word 0x4D757C18 + .word 0x4D8F3B16 + .word 0x4D9B3F16 + .word 0x4DAB8C18 + .word 0x4DC53C18 + .word 0x4DD2B70E + .word 0x4DEA770E + .word 0x4DFA980E + .word 0x4E119B0E + .word 0x4E2F9B0E + .word 0x4E4D670E + .word 0x4E59680E + .word 0x4E674912 + .word 0x4E71780E + .word 0x4E83980E + .word 0x4E9AD80E + .word 0x4EBAA70E + .word 0x4ECE9B0E + .word 0x4EEC770E + .word 0x4EFC5F18 + .word 0x4F142C18 + .word 0x4F1B4F18 + .word 0x4F2B7114 + .word 0x4F2F3C16 + .word 0x4F3C3C10 + .word 0x4F493B0E + .word 0x4F556A14 + .word 0x4F669C16 + .word 0x4F879810 + .word 0x4F9E9B16 + .word 0x4FBC2C18 + .word 0x4FC38E18 + .word 0x4FE16216 + .word 0x4FE6DC16 + .word 0x50146616 + .word 0x501F7710 + .word 0x502F840C + .word 0x50393C1A + .word 0x5046DC16 + .word 0x50747116 + .word 0x50784316 + .word 0x507C8912 + .word 0x50903C14 + .word 0x509D3C14 + .word 0x50AA4316 + .word 0x50AE7B0E + .word 0x50C6AE16 + .word 0x50EC6610 + .word 0x50F75504 + .word 0x51003C18 + .word 0x510D6616 + .word 0x51188710 + .word 0x5128FC16 + .word 0x515CE616 + .word 0x5175D80E + .word 0x51958B0E + .word 0x51ADCC18 + .word 0x51D4BC18 + .word 0x51FBBC18 + .word 0x5222BC18 + .word 0x5249CC18 + .word 0x5270BC18 + .word 0x5297FB16 + .word 0x52C79E16 + .word 0x52ED6C18 + .word 0x53016C18 + .word 0x53157C18 + .word 0x532F7C18 + .word 0x53494C18 + .word 0x53564C18 + .word 0x53636C18 + .word 0x53777C18 + .word 0x53913C18 + .word 0x539EAD18 + .word 0x53C1CD18 + .word 0x53EBCD18 + .word 0x5415CD18 + .word 0x543FCD18 + .word 0x5469CC18 + .word 0x5490970E + .word 0x54A4CC16 + .word 0x54CB9D18 + .word 0x54EE9D18 + .word 0x55119D18 + .word 0x55349D18 + .word 0x55573C18 + .word 0x55643C18 + .word 0x55719D18 + .word 0x55948C16 + .word 0x55AE9C16 + .word 0x55CF8C16 + .word 0x55E99B14 + .word 0x56078C16 + .word 0x56219C16 + .word 0x5642C80E + .word 0x565D6A0E + .word 0x566E8C16 + .word 0x56887C16 + .word 0x56A28C16 + .word 0x56BC7C16 + .word 0x56D64B16 + .word 0x56E24B16 + .word 0x56EE6B16 + .word 0x57007B16 + .word 0x57187B16 + .word 0x57307A14 + .word 0x57469C16 + .word 0x57678C16 + .word 0x57818C16 + .word 0x579B9B14 + .word 0x57B99C16 + .word 0x57DA880E + .word 0x57EC980E + .word 0x58038C16 + .word 0x581D8C16 + .word 0x58378C16 + .word 0x58518C16 + .word 0x586B3C16 + .word 0x58783C16 + .word 0x58859F16 + .word 0x58AD6F18 + .word 0x58C55C16 + .word 0x58D98516 + .word 0x58E59B14 + .word 0x59038E18 + .word 0x5921BC16 + .word 0x5948AC16 + .word 0x59695516 + .word 0x59724F18 + .word 0x59825F18 + .word 0x599A6516 + .word 0x59A3970E + .word 0x59B75504 + .word 0x59C0810A + .word 0x59C43304 + .word 0x59C8AF18 + .word 0x59F09C16 + .word 0x5A115B16 + .word 0x5A239B16 + .word 0x5A418C16 + .word 0x5A5B9B16 + .word 0x5A799C16 + .word 0x5A9A9C16 + .word 0x5ABBAC16 + .word 0x5ADC8C16 + .word 0x5AF69C16 + .word 0x5B17480E + .word 0x5B206A0E + .word 0x5B31970E + .word 0x5B45950C + .word 0x5B54970E + .word 0x5B687C16 + .word 0x5B82CC16 + .word 0x5BA9BB16 + .word 0x5BCD9B16 + .word 0x5BEB9C16 + .word 0x5C0CBB16 + .word 0x5C309B16 + .word 0x5C4E9B16 + .word 0x5C6CBC16 + .word 0x5C93BB16 + .word 0x5CB75B16 + .word 0x5CC98C16 + .word 0x5CE3BB16 + .word 0x5D077B16 + .word 0x5D1FDC16 + .word 0x5D4DCC16 + .word 0x5D74DC16 + .word 0x5DA29B16 + .word 0x5DC0CC16 + .word 0x5DE79B16 + .word 0x5E059C16 + .word 0x5E268B16 + .word 0x5E3EAC16 + .word 0x5E5FBC16 + .word 0x5E860C17 + .word 0x5EBABB16 + .word 0x5EDEAB16 + .word 0x5EFCBB16 + .word 0x5F205E18 + .word 0x5F376E18 + .word 0x5F4E6E18 + .word 0x5F655316 + .word 0x5F6B91FC + .word 0x5F706F1A + .word 0x5F88980E + .word 0x5F9F9D18 + .word 0x5FC2680E + .word 0x5FD0AD18 + .word 0x5FF3880E + .word 0x60056C18 + .word 0x60199B0E + .word 0x60378C18 + .word 0x60515B16 + .word 0x60636F16 + .word 0x607B9C18 + .word 0x609C5C18 + .word 0x60B0C70E + .word 0x60C8870E + .word 0x60D8880E + .word 0x60EA9B0E + .word 0x61089B0E + .word 0x6126770E + .word 0x6136680E + .word 0x61446912 + .word 0x6153780E + .word 0x6165980E + .word 0x617CD80E + .word 0x619CA70E + .word 0x61B0AB0E + .word 0x61CEA70E + .word 0x61E26F18 + .word 0x61FA4C18 + .word 0x62076F18 + .word 0x621F7114 + .word 0x62236F18 + .word 0x623B6F16 + .word 0x62534B0E + .word 0x625F7A14 + .word 0x6275AC16 + .word 0x6296A810 + .word 0x62ADAB16 + .word 0x62CB4C18 + .word 0x62D88E18 + .word 0x62F66216 + .word 0x62FBDC16 + .word 0x63297616 + .word 0x63378710 + .word 0x6347940C + .word 0x63546F18 + .word 0x636CDC16 + .word 0x639A6116 + .word 0x639D4316 + .word 0x63A19912 + .word 0x63BA6F18 + .word 0x63D26F18 + .word 0x63EA5316 + .word 0x63F09B0E + .word 0x640E9E16 + .word 0x64346610 + .word 0x643F5504 + .word 0x64486F18 + .word 0x64607616 + .word 0x646E8710 + .word 0x647EFA14 + .word 0x64AAD514 + .word 0x64BFC60C + .word 0x64D47B0E + .word 0x64ECCC18 + .word 0x6513BC18 + .word 0x653ABC18 + .word 0x6561CC18 + .word 0x6588CC18 + .word 0x65AFBC18 + .word 0x65D6FB16 + .word 0x6606AE16 + .word 0x662C8C18 + .word 0x66468C18 + .word 0x66609C18 + .word 0x66819C18 + .word 0x66A25C18 + .word 0x66B66C18 + .word 0x66CA7C18 + .word 0x66E47C18 + .word 0x66FE6F1A + .word 0x6716CD18 + .word 0x6740DD18 + .word 0x6771CD18 + .word 0x679BCD18 + .word 0x67C5CD18 + .word 0x67EFDD18 + .word 0x6820A70E + .word 0x6834FC16 + .word 0x6868AD18 + .word 0x688BAD18 + .word 0x68AEAD18 + .word 0x68D1AD18 + .word 0x68F46F1A + .word 0x690C6F1A + .word 0x69249D18 + .word 0x69479C16 + .word 0x69689C16 + .word 0x69899C16 + .word 0x69AA9B14 + .word 0x69C89C16 + .word 0x69E99C16 + .word 0x6A0AD80E + .word 0x6A2A7A0E + .word 0x6A408C16 + .word 0x6A5A8C16 + .word 0x6A748C16 + .word 0x6A8E8C16 + .word 0x6AA85B16 + .word 0x6ABA5B16 + .word 0x6ACC6B16 + .word 0x6ADE6B16 + .word 0x6AF07B16 + .word 0x6B089A14 + .word 0x6B248C16 + .word 0x6B3E9C16 + .word 0x6B5F9C16 + .word 0x6B808B14 + .word 0x6B988C16 + .word 0x6BB2980E + .word 0x6BC9980E + .word 0x6BE08C16 + .word 0x6BFA8C16 + .word 0x6C148C16 + .word 0x6C2E8C16 + .word 0x6C486F18 + .word 0x6C606F18 + .word 0x6C78AF16 + .word 0x6CA06F18 + .word 0x6CB82A14 + .word 0x6CBE4314 + .word 0x6CC29A14 + .word 0x6CDE8D16 + .word 0x6CFADB14 + .word 0x6D249B14 + .word 0x6D422314 + .word 0x6D445D14 + .word 0x6D594D14 + .word 0x6D675414 + .word 0x6D6F870E + .word 0x6D7F2402 + .word 0x6D829108 + .word 0x6D872102 + .word 0x6D885A14 + .word 0x6D998B14 + .word 0x6DB15A14 + .word 0x6DC28A14 + .word 0x6DD88B14 + .word 0x6DF08A14 + .word 0x6E068B14 + .word 0x6E1E8B14 + .word 0x6E368A14 + .word 0x6E4C8B14 + .word 0x6E648B14 + .word 0x6E7C270E + .word 0x6E802A0E + .word 0x6E86970E + .word 0x6E9A850C + .word 0x6EA6970E + .word 0x6EBA7A14 + .word 0x6ED0DB14 + .word 0x6EFAAA14 + .word 0x6F169A14 + .word 0x6F32AB14 + .word 0x6F509A14 + .word 0x6F6C9A14 + .word 0x6F889A14 + .word 0x6FA4AB14 + .word 0x6FC2AA14 + .word 0x6FDE2A14 + .word 0x6FE47B14 + .word 0x6FFC9A14 + .word 0x70188A14 + .word 0x702EBA14 + .word 0x704F9A14 + .word 0x706BBB14 + .word 0x708F9A14 + .word 0x70ABBB14 + .word 0x70CF9A14 + .word 0x70EB9B14 + .word 0x7109AA14 + .word 0x71259B14 + .word 0x7143AA14 + .word 0x715FEA14 + .word 0x7186AA14 + .word 0x71A2AA14 + .word 0x71BE9A14 + .word 0x71DA3D14 + .word 0x71E87A14 + .word 0x71FE4D14 + .word 0x720C5214 + .word 0x721190FC + .word 0x72145F1A + .word 0x722C8910 + .word 0x72408B14 + .word 0x72588910 + .word 0x726C7C16 + .word 0x72868910 + .word 0x729A6A14 + .word 0x72AB8C10 + .word 0x72C57A14 + .word 0x72DB2A14 + .word 0x72E14E14 + .word 0x72F07A14 + .word 0x73062A14 + .word 0x730CB810 + .word 0x73277810 + .word 0x73398910 + .word 0x734D8C10 + .word 0x73678C10 + .word 0x73815810 + .word 0x738F7910 + .word 0x73A34A12 + .word 0x73AE780E + .word 0x73C0870E + .word 0x73D0B70E + .word 0x73E8770E + .word 0x73F88B0E + .word 0x7410770E + .word 0x74205D14 + .word 0x74352A14 + .word 0x743B6D14 + .word 0x74506114 + .word 0x74536F18 + .word 0x746B6F16 + .word 0x74832A0E + .word 0x74898B12 + .word 0x74A18B14 + .word 0x74B98710 + .word 0x74C99A14 + .word 0x74E52A14 + .word 0x74EB7E14 + .word 0x75094114 + .word 0x750BBA14 + .word 0x752C5414 + .word 0x7534650C + .word 0x753D840A + .word 0x75476E16 + .word 0x755EBA14 + .word 0x757F6114 + .word 0x75823316 + .word 0x7586870E + .word 0x75965F18 + .word 0x75AE5F18 + .word 0x75C64214 + .word 0x75C99B0E + .word 0x75E78D14 + .word 0x7603430C + .word 0x76072402 + .word 0x760A6D14 + .word 0x761F5414 + .word 0x7627550C + .word 0x7630FB14 + .word 0x7660C514 + .word 0x7672E80E + .word 0x76928A0E + .word 0x76A8AD1A + .word 0x76CBAD1A + .word 0x76EEAD1A + .word 0x7711AD1A + .word 0x7734AD1A + .word 0x7757AE1C + .word 0x777DFA14 + .word 0x77A9AD14 + .word 0x77CC8D1A + .word 0x77E88D1A + .word 0x78048D1A + .word 0x78208C18 + .word 0x783A4D1A + .word 0x78483D1A + .word 0x78565D1A + .word 0x786B5D1A + .word 0x78805F1A + .word 0x7898AD1A + .word 0x78BBCE1A + .word 0x78E8BE1A + .word 0x7915BE1A + .word 0x7942BE1A + .word 0x796FCD18 + .word 0x7999870E + .word 0x79A9BB14 + .word 0x79CD9E1A + .word 0x79F39E1A + .word 0x7A199E1A + .word 0x7A3FAE1A + .word 0x7A656F1A + .word 0x7A7D5F1A + .word 0x7A958B14 + .word 0x7AAD8C16 + .word 0x7AC78C16 + .word 0x7AE18C16 + .word 0x7AFB8B14 + .word 0x7B138B14 + .word 0x7B2B8C16 + .word 0x7B45D910 + .word 0x7B687C10 + .word 0x7B828C16 + .word 0x7B9C8C16 + .word 0x7BB68C16 + .word 0x7BD08B14 + .word 0x7BE84B16 + .word 0x7BF44B16 + .word 0x7C005B16 + .word 0x7C124B16 + .word 0x7C1E7B14 + .word 0x7C367A14 + .word 0x7C4C8C16 + .word 0x7C668C16 + .word 0x7C808C16 + .word 0x7C9A8B14 + .word 0x7CB28B14 + .word 0x7CCA870E + .word 0x7CDA8910 + .word 0x7CEE7C16 + .word 0x7D088C16 + .word 0x7D227C16 + .word 0x7D3C7B14 + .word 0x7D545F18 + .word 0x7D6C5F18 + .word 0x7D848E14 + .word 0x7DA26F16 + .word 0x7DBA3A14 + .word 0x7DC56414 + .word 0x7DCD9A14 + .word 0x7DE98D16 + .word 0x7E05EB14 + .word 0x7E2FBB14 + .word 0x7E533414 + .word 0x7E584D14 + .word 0x7E664D14 + .word 0x7E746414 + .word 0x7E7C870E + .word 0x7E8C3402 + .word 0x7E91920A + .word 0x7E993102 + .word 0x7E9B7A14 + .word 0x7EB18B14 + .word 0x7EC95A14 + .word 0x7EDA8A14 + .word 0x7EF08B14 + .word 0x7F088A14 + .word 0x7F1E8B14 + .word 0x7F368B14 + .word 0x7F4E8A14 + .word 0x7F648B14 + .word 0x7F7C9B14 + .word 0x7F9A370E + .word 0x7FA23A0E + .word 0x7FADA80E + .word 0x7FC4960C + .word 0x7FD6980E + .word 0x7FED9A14 + .word 0x8009DC16 + .word 0x8037BA14 + .word 0x8058AA14 + .word 0x8074BB14 + .word 0x8098AA14 + .word 0x80B49A14 + .word 0x80D09A14 + .word 0x80ECBB14 + .word 0x8110AA14 + .word 0x812C3A14 + .word 0x81378B14 + .word 0x814FAA14 + .word 0x816B9A14 + .word 0x8187BA14 + .word 0x81A8AA14 + .word 0x81C4BB14 + .word 0x81E89A14 + .word 0x8204BB14 + .word 0x8228AA14 + .word 0x8244AB14 + .word 0x8262AA14 + .word 0x827E9B14 + .word 0x829CAA14 + .word 0x82B8FA14 + .word 0x82E4AA14 + .word 0x8300AA14 + .word 0x831C9A14 + .word 0x83384D14 + .word 0x83466A14 + .word 0x83575D14 + .word 0x836C6216 + .word 0x837190FC + .word 0x83745F18 + .word 0x838C8910 + .word 0x83A09B14 + .word 0x83BE8910 + .word 0x83D29B14 + .word 0x83F09910 + .word 0x84095A14 + .word 0x841A8C10 + .word 0x84348A14 + .word 0x844A3A14 + .word 0x84554E14 + .word 0x84648A14 + .word 0x847A2A14 + .word 0x8480C810 + .word 0x849B8810 + .word 0x84AD9910 + .word 0x84C68C10 + .word 0x84E09C10 + .word 0x85015810 + .word 0x850F8910 + .word 0x85235A14 + .word 0x8534880E + .word 0x8546870E + .word 0x8556C70E + .word 0x856E870E + .word 0x857E8B0E + .word 0x8596870E + .word 0x85A65D14 + .word 0x85BB3A14 + .word 0x85C66D14 + .word 0x85DB7216 + .word 0x85E16F18 + .word 0x85F96F14 + .word 0x86113A0E + .word 0x861C8B12 + .word 0x86348B14 + .word 0x864C8710 + .word 0x865C9A14 + .word 0x86783A14 + .word 0x86838D14 + .word 0x869F6114 + .word 0x86A2BA14 + .word 0x86C36514 + .word 0x86CC750C + .word 0x86D8950C + .word 0x86E75F16 + .word 0x86FFBA14 + .word 0x87206114 + .word 0x87234318 + .word 0x8727970E + .word 0x873B5F16 + .word 0x87535F16 + .word 0x876B4114 + .word 0x876DAB0E + .word 0x878B9D14 + .word 0x87AE430C + .word 0x87B23402 + .word 0x87B76F16 + .word 0x87CF6514 + .word 0x87D8650C + .word 0x87E1EC14 + .word 0x880FC512 + .word 0x8821E90E + .word 0x88448A0E + .word 0x885AAD1A + .word 0x887DBD1A + .word 0x88A7BD1A + .word 0x88D1BD1A + .word 0x88FBAD1A + .word 0x891EBE1C + .word 0x894BFA14 + .word 0x8977AE14 + .word 0x899D9D1A + .word 0x89C09D1A + .word 0x89E39D1A + .word 0x8A069D1A + .word 0x8A294D1A + .word 0x8A374D1A + .word 0x8A456D1A + .word 0x8A5A6D1A + .word 0x8A6F5F18 + .word 0x8A87AD1A + .word 0x8AAABE1A + .word 0x8AD7BE1A + .word 0x8B04BE1A + .word 0x8B31BE1A + .word 0x8B5EBE1A + .word 0x8B8B870E + .word 0x8B9BBB14 + .word 0x8BBF9E1A + .word 0x8BE59E1A + .word 0x8C0BAE1A + .word 0x8C31AE1A + .word 0x8C575F18 + .word 0x8C6F5F18 + .word 0x8C878B14 + .word 0x8C9F8B14 + .word 0x8CB79B14 + .word 0x8CD58C16 + .word 0x8CEF8C16 + .word 0x8D098B14 + .word 0x8D219D18 + .word 0x8D44D910 + .word 0x8D678C10 + .word 0x8D818B14 + .word 0x8D999B14 + .word 0x8DB79C16 + .word 0x8DD88B14 + .word 0x8DF05A14 + .word 0x8E015A14 + .word 0x8E125A14 + .word 0x8E236A14 + .word 0x8E348B14 + .word 0x8E4C8B16 + .word 0x8E649B14 + .word 0x8E829B14 + .word 0x8EA09C16 + .word 0x8EC19C16 + .word 0x8EE29B14 + .word 0x8F00870E + .word 0x8F10A910 + .word 0x8F298B14 + .word 0x8F418B14 + .word 0x8F598C16 + .word 0x8F738C16 + .word 0x8F8D5F18 + .word 0x8FA55F18 + .word 0x8FBD8F16 + .word 0x8FDD6F16 + .word 0x8FF54A12 + .word 0x90004312 + .word 0x90049A12 + .word 0x90209C14 + .word 0x9041BA12 + .word 0x90628A12 + .word 0x90782312 + .word 0x907A6C12 + .word 0x908E5C12 + .word 0x90A25412 + .word 0x90AA870C + .word 0x90BA3300 + .word 0x90BE8006 + .word 0x90C02100 + .word 0x90C17A12 + .word 0x90D78A12 + .word 0x90ED5A12 + .word 0x90FE9A12 + .word 0x911A8A12 + .word 0x91308A12 + .word 0x91469A12 + .word 0x91628A12 + .word 0x91788A12 + .word 0x918E8A12 + .word 0x91A47A12 + .word 0x91BA370E + .word 0x91C24A0E + .word 0x91CD980E + .word 0x91E4940A + .word 0x91F1980E + .word 0x92087A12 + .word 0x921ECB14 + .word 0x9242AA12 + .word 0x925E9A12 + .word 0x927ABB14 + .word 0x929EAA12 + .word 0x92BABA12 + .word 0x92DBAA12 + .word 0x92F7BB14 + .word 0x931BBA12 + .word 0x933C4A12 + .word 0x93478A12 + .word 0x935DBA12 + .word 0x937E8A12 + .word 0x9394CA12 + .word 0x93B5AA12 + .word 0x93D1BB14 + .word 0x93F5AA12 + .word 0x9411BB14 + .word 0x9435AA12 + .word 0x94519B14 + .word 0x946F9A12 + .word 0x948BAA12 + .word 0x94A7AA12 + .word 0x94C3DA12 + .word 0x94EABA12 + .word 0x950B9A12 + .word 0x9527BA12 + .word 0x95485C12 + .word 0x955C3A12 + .word 0x95675C12 + .word 0x957B5112 + .word 0x957E80FC + .word 0x95803F18 + .word 0x9590780E + .word 0x95A29A12 + .word 0x95BE880E + .word 0x95D09A12 + .word 0x95EC880E + .word 0x95FE5A12 + .word 0x960F9B0E + .word 0x962D8A12 + .word 0x96434A12 + .word 0x964E6D12 + .word 0x96638A12 + .word 0x96794A12 + .word 0x9684C80E + .word 0x969F880E + .word 0x96B1880E + .word 0x96C39B0E + .word 0x96E18B0E + .word 0x96F9680E + .word 0x9707780E + .word 0x97195A12 + .word 0x972A880E + .word 0x973C880E + .word 0x974EA80E + .word 0x9765980E + .word 0x977C9B0E + .word 0x979A880E + .word 0x97AC7C12 + .word 0x97C63A12 + .word 0x97D16C12 + .word 0x97E56112 + .word 0x97E86F18 + .word 0x98004F14 + .word 0x98104A0E + .word 0x981B8A10 + .word 0x98319A12 + .word 0x984D860E + .word 0x985B9A12 + .word 0x98774A12 + .word 0x98827D12 + .word 0x989E5112 + .word 0x98A1BA12 + .word 0x98C25514 + .word 0x98CB740A + .word 0x98D5840A + .word 0x98DF5F14 + .word 0x98F7BA12 + .word 0x99185112 + .word 0x991B3214 + .word 0x991E870C + .word 0x992E5F16 + .word 0x99465F16 + .word 0x995E3112 + .word 0x9960BB0E + .word 0x99848C12 + .word 0x999E330C + .word 0x99A22300 + .word 0x99A46F16 + .word 0x99BC5514 + .word 0x99C5640A + .word 0x99CDFB14 + .word 0x99FDB412 + .word 0x9A0CD80E + .word 0x9A2C7A0E + .word 0x9A42AD18 + .word 0x9A65AD18 + .word 0x9A889D18 + .word 0x9AABAD18 + .word 0x9ACEAD18 + .word 0x9AF1AE1A + .word 0x9B17FA12 + .word 0x9B43BE14 + .word 0x9B70BD18 + .word 0x9B9AAD18 + .word 0x9BBDAD18 + .word 0x9BE0AD18 + .word 0x9C035D18 + .word 0x9C186D18 + .word 0x9C2D6D18 + .word 0x9C426D18 + .word 0x9C573F18 + .word 0x9C67BD18 + .word 0x9C91BD18 + .word 0x9CBBBD18 + .word 0x9CE5BD18 + .word 0x9D0FBD18 + .word 0x9D39BD18 + .word 0x9D63980E + .word 0x9D7ADB14 + .word 0x9DA4AD18 + .word 0x9DC7AD18 + .word 0x9DEAAD18 + .word 0x9E0DAD18 + .word 0x9E305F18 + .word 0x9E485F18 + .word 0x9E608A12 + .word 0x9E768B14 + .word 0x9E8E8B14 + .word 0x9EA68B14 + .word 0x9EBE8B14 + .word 0x9ED68A12 + .word 0x9EEC8C16 + .word 0x9F06D80E + .word 0x9F267B0E + .word 0x9F3E8B14 + .word 0x9F567B14 + .word 0x9F6E8B14 + .word 0x9F868A12 + .word 0x9F9C3B14 + .word 0x9FA85B14 + .word 0x9FBA5B14 + .word 0x9FCC5A12 + .word 0x9FDD8A12 + .word 0x9FF38B14 + .word 0xA00B8B14 + .word 0xA0238B14 + .word 0xA03B8B14 + .word 0xA0538B14 + .word 0xA06B8A12 + .word 0xA081860C + .word 0xA08F980E + .word 0xA0A67B14 + .word 0xA0BE8B14 + .word 0xA0D68B14 + .word 0xA0EE8A12 + .word 0xA1045E16 + .word 0xA11B5E16 + .word 0xA1329D12 + .word 0xA1556F1A + .word 0xA16D1B16 + .word 0xA1735316 + .word 0xA1797B16 + .word 0xA1915D18 + .word 0xA1A67B16 + .word 0xA1BE5B16 + .word 0xA1D02316 + .word 0xA1D22F18 + .word 0xA1DA2F18 + .word 0xA1E23316 + .word 0xA1E6540C + .word 0xA1EE2404 + .word 0xA1F15008 + .word 0xA1F31204 + .word 0xA1F53A16 + .word 0xA2004B16 + .word 0xA20C2B16 + .word 0xA2124B16 + .word 0xA21E5B16 + .word 0xA2304B16 + .word 0xA23C5B16 + .word 0xA24E4B16 + .word 0xA25A5B16 + .word 0xA26C4B16 + .word 0xA2785B16 + .word 0xA28A1710 + .word 0xA28E280E + .word 0xA2936810 + .word 0xA2A1530C + .word 0xA2A75810 + .word 0xA2B54B16 + .word 0xA2C17C18 + .word 0xA2DB5B16 + .word 0xA2ED4B16 + .word 0xA2F96C18 + .word 0xA30D5B16 + .word 0xA31F5B16 + .word 0xA3315C18 + .word 0xA3456C18 + .word 0xA3595B16 + .word 0xA36B2A16 + .word 0xA3714B16 + .word 0xA37D6B16 + .word 0xA38F5B16 + .word 0xA3A17B16 + .word 0xA3B96B16 + .word 0xA3CB6C18 + .word 0xA3DF5B16 + .word 0xA3F16D18 + .word 0xA4065C18 + .word 0xA41A6C18 + .word 0xA42E6A16 + .word 0xA43F5B16 + .word 0xA4516B16 + .word 0xA4638C18 + .word 0xA47D5B16 + .word 0xA48F5B16 + .word 0xA4A15B16 + .word 0xA4B32E16 + .word 0xA4BB3A16 + .word 0xA4C62E16 + .word 0xA4CE531A + .word 0xA4D470FC + .word 0xA4D65F1C + .word 0xA4EE4810 + .word 0xA4F75B16 + .word 0xA5095912 + .word 0xA5185B16 + .word 0xA52A5810 + .word 0xA5383C18 + .word 0xA5454B10 + .word 0xA5514B16 + .word 0xA55D2B16 + .word 0xA5632E16 + .word 0xA56B4B16 + .word 0xA5772B16 + .word 0xA57D6810 + .word 0xA58B4810 + .word 0xA5945912 + .word 0xA5A34B10 + .word 0xA5AF5B10 + .word 0xA5C13810 + .word 0xA5CA5912 + .word 0xA5D93A14 + .word 0xA5E44810 + .word 0xA5ED5810 + .word 0xA5FB6810 + .word 0xA6094810 + .word 0xA6125B10 + .word 0xA6245810 + .word 0xA6324E16 + .word 0xA6412E16 + .word 0xA6494E16 + .word 0xA6586116 + .word 0xA65B6C18 + .word 0xA66F5E16 + .word 0xA6862B10 + .word 0xA68C5C14 + .word 0xA6A04B16 + .word 0xA6AC5712 + .word 0xA6B84A16 + .word 0xA6C32B16 + .word 0xA6C94E16 + .word 0xA6D83116 + .word 0xA6DA7B16 + .word 0xA6F23618 + .word 0xA6F9650E + .word 0xA702440C + .word 0xA7076B16 + .word 0xA7197B16 + .word 0xA7317016 + .word 0xA7332218 + .word 0xA735570E + .word 0xA7415F1A + .word 0xA7595F1A + .word 0xA7712116 + .word 0xA7725B10 + .word 0xA7845E16 + .word 0xA79B230E + .word 0xA79D2300 + .word 0xA79F6D16 + .word 0xA7B43618 + .word 0xA7BB640C + .word 0xA7C38B16 + .word 0xA7DB7516 + .word 0xA7E78810 + .word 0xA7F95B10 + .word 0xA80B5E1C + .word 0xA8225E1C + .word 0xA8395E1C + .word 0xA8506E1C + .word 0xA8675D1A + .word 0xA87C5F1E + .word 0xA8948B16 + .word 0xA8AC6F18 + .word 0xA8C45F1E + .word 0xA8DC5E1C + .word 0xA8F35F1E + .word 0xA90B5D1A + .word 0xA9202E1C + .word 0xA9282E1C + .word 0xA9305F1E + .word 0xA9484D1A + .word 0xA9565F1C + .word 0xA96E6E1C + .word 0xA9857E1C + .word 0xA9A37E1C + .word 0xA9C17F1E + .word 0xA9E17E1C + .word 0xA9FF7D1A + .word 0xAA1B4810 + .word 0xAA246C18 + .word 0xAA386E1C + .word 0xAA4F6E1C + .word 0xAA666F1E + .word 0xAA7E6D1A + .word 0xAA936F1C + .word 0xAAAB5F1C + .word 0xAAC34B16 + .word 0xAACF5B16 + .word 0xAAE15B16 + .word 0xAAF35C18 + .word 0xAB076B16 + .word 0xAB194A14 + .word 0xAB245C18 + .word 0xAB387810 + .word 0xAB4A4B10 + .word 0xAB565B16 + .word 0xAB685B16 + .word 0xAB7A5C18 + .word 0xAB8E4A14 + .word 0xAB992B16 + .word 0xAB9F2B16 + .word 0xABA55B16 + .word 0xABB74A14 + .word 0xABC24B16 + .word 0xABCE6B16 + .word 0xABE05B16 + .word 0xABF25B16 + .word 0xAC045C18 + .word 0xAC186B16 + .word 0xAC2A4A14 + .word 0xAC35560E + .word 0xAC405810 + .word 0xAC4E5B16 + .word 0xAC604B16 + .word 0xAC6C5C18 + .word 0xAC804A14 + .word 0xAC8B5F1A + .word 0xACA36F1A + .word 0xACBB4D14 + .word 0xACC96F1A + .word 0xACE12C18 + .word 0xACE85318 + .word 0xACEE8C18 + .word 0xAD087E18 + .word 0xAD266B16 + .word 0xAD388C18 + .word 0xAD522318 + .word 0xAD543F18 + .word 0xAD643F18 + .word 0xAD745318 + .word 0xAD7A8710 + .word 0xAD8A2302 + .word 0xAD8C710A + .word 0xAD902102 + .word 0xAD915E1A + .word 0xADA85B16 + .word 0xADBA4B16 + .word 0xADC65B16 + .word 0xADD85B16 + .word 0xADEA7B16 + .word 0xAE025B16 + .word 0xAE145B16 + .word 0xAE267B16 + .word 0xAE3E5B16 + .word 0xAE505B16 + .word 0xAE622710 + .word 0xAE662910 + .word 0xAE6B7A12 + .word 0xAE81740C + .word 0xAE8B7A12 + .word 0xAEA16C18 + .word 0xAEB58C18 + .word 0xAECF7C18 + .word 0xAEE96C18 + .word 0xAEFD6C18 + .word 0xAF116C18 + .word 0xAF255C18 + .word 0xAF395C18 + .word 0xAF4D6C18 + .word 0xAF616C18 + .word 0xAF752C18 + .word 0xAF7C6C18 + .word 0xAF908C18 + .word 0xAFAA5C18 + .word 0xAFBE8C18 + .word 0xAFD87C18 + .word 0xAFF26C18 + .word 0xB0066C18 + .word 0xB01A7C18 + .word 0xB0346C18 + .word 0xB0486C18 + .word 0xB05C6C18 + .word 0xB0706C18 + .word 0xB0847C18 + .word 0xB09EAC18 + .word 0xB0BF8C18 + .word 0xB0D98C18 + .word 0xB0F36C18 + .word 0xB1073F1C + .word 0xB1175E1A + .word 0xB12E3F1C + .word 0xB13E5216 + .word 0xB14380FC + .word 0xB1455F1C + .word 0xB15D5912 + .word 0xB16C5C18 + .word 0xB1805810 + .word 0xB18E5C18 + .word 0xB1A25912 + .word 0xB1B14C18 + .word 0xB1BE5C12 + .word 0xB1D25C18 + .word 0xB1E62C18 + .word 0xB1ED4F18 + .word 0xB1FD6C18 + .word 0xB2112C18 + .word 0xB2187912 + .word 0xB22C5912 + .word 0xB23B5912 + .word 0xB24A5C12 + .word 0xB25E5C12 + .word 0xB2725912 + .word 0xB2815A14 + .word 0xB2924B16 + .word 0xB29E5810 + .word 0xB2AC7810 + .word 0xB2BE8810 + .word 0xB2D07810 + .word 0xB2E27A10 + .word 0xB2F85810 + .word 0xB3065E16 + .word 0xB31D1C18 + .word 0xB3245E16 + .word 0xB33B6116 + .word 0xB33E6C18 + .word 0xB3525E16 + .word 0xB3692B10 + .word 0xB36F6C14 + .word 0xB3837B16 + .word 0xB39B7914 + .word 0xB3AF8B16 + .word 0xB3C71C18 + .word 0xB3CE7D16 + .word 0xB3EA4016 + .word 0xB3EB7B16 + .word 0xB4033618 + .word 0xB40AA912 + .word 0xB423820C + .word 0xB4296B16 + .word 0xB43B7B16 + .word 0xB4538016 + .word 0xB4553218 + .word 0xB4588A14 + .word 0xB46E3418 + .word 0xB4733418 + .word 0xB4783118 + .word 0xB47A8A10 + .word 0xB4906E16 + .word 0xB4A7430E + .word 0xB4AB2302 + .word 0xB4AD3418 + .word 0xB4B23618 + .word 0xB4B9A912 + .word 0xB4D28B16 + .word 0xB4EA8216 + .word 0xB4F08910 + .word 0xB5046B10 + .word 0xB5167E1C + .word 0xB5347E1C + .word 0xB5527F1E + .word 0xB5727E1C + .word 0xB5907E1C + .word 0xB5AE7F1E + .word 0xB5CE8C18 + .word 0xB5E86E18 + .word 0xB5FF5F1E + .word 0xB6175F1E + .word 0xB62F5F1E + .word 0xB6475E1C + .word 0xB65E3F1E + .word 0xB66E3F1E + .word 0xB67E5F1E + .word 0xB6964E1C + .word 0xB6A57C18 + .word 0xB6BF7E1C + .word 0xB6DD6F1E + .word 0xB6F56F1E + .word 0xB70D6F1E + .word 0xB7256F1E + .word 0xB73D6E1C + .word 0xB7547812 + .word 0xB7668C18 + .word 0xB7806E1C + .word 0xB7976E1C + .word 0xB7AE6E1C + .word 0xB7C56D1A + .word 0xB7DA8D1A + .word 0xB7F68E1C + .word 0xB8146D1A + .word 0xB8295B16 + .word 0xB83B5B16 + .word 0xB84D5C18 + .word 0xB8616B16 + .word 0xB8735A14 + .word 0xB8845C18 + .word 0xB8988912 + .word 0xB8AC5D12 + .word 0xB8C15B16 + .word 0xB8D35B16 + .word 0xB8E55B16 + .word 0xB8F75A14 + .word 0xB9083B16 + .word 0xB9143B16 + .word 0xB9205B16 + .word 0xB9324A14 + .word 0xB93D5B16 + .word 0xB94F6B16 + .word 0xB9615B16 + .word 0xB9735B16 + .word 0xB9855C18 + .word 0xB9996B16 + .word 0xB9AB5A14 + .word 0xB9BC8710 + .word 0xB9CC7B14 + .word 0xB9E45B16 + .word 0xB9F65B16 + .word 0xBA085B16 + .word 0xBA1A5A14 + .word 0xBA2B7C16 + .word 0xBA455C16 + .word 0xBA597B14 + .word 0xBA716F18 + .word 0xBA893B16 + .word 0xBA956414 + .word 0xBA9D6912 + .word 0xBAAC6D16 + .word 0xBAC17B14 + .word 0xBAD97B14 + .word 0xBAF14414 + .word 0xBAF64D16 + .word 0xBB043D16 + .word 0xBB127912 + .word 0xBB266912 + .word 0xBB353302 + .word 0xBB39610A + .word 0xBB3C3202 + .word 0xBB3F8D16 + .word 0xBB5B6B16 + .word 0xBB6D5B16 + .word 0xBB7F7B16 + .word 0xBB976B16 + .word 0xBBA97B16 + .word 0xBBC17B16 + .word 0xBBD97B16 + .word 0xBBF16B16 + .word 0xBC037B16 + .word 0xBC1B7B16 + .word 0xBC333810 + .word 0xBC3C3910 + .word 0xBC467C18 + .word 0xBC60730E + .word 0xBC687C18 + .word 0xBC826B16 + .word 0xBC947B16 + .word 0xBCAC7B16 + .word 0xBCC47B16 + .word 0xBCDC6B16 + .word 0xBCEE7B16 + .word 0xBD067B16 + .word 0xBD1E7B16 + .word 0xBD367B16 + .word 0xBD4E8B16 + .word 0xBD665B16 + .word 0xBD786B16 + .word 0xBD8A8B16 + .word 0xBDA27B16 + .word 0xBDBA7B16 + .word 0xBDD27B16 + .word 0xBDEA6B16 + .word 0xBDFC8B16 + .word 0xBE147C16 + .word 0xBE2E7B16 + .word 0xBE466B16 + .word 0xBE587B16 + .word 0xBE707B16 + .word 0xBE887B16 + .word 0xBEA08B16 + .word 0xBEB87B16 + .word 0xBED07B16 + .word 0xBEE87B16 + .word 0xBF003D18 + .word 0xBF0E8D16 + .word 0xBF2A3D18 + .word 0xBF387114 + .word 0xBF3CA0FA + .word 0xBF3F6F1A + .word 0xBF577810 + .word 0xBF69AB16 + .word 0xBF878810 + .word 0xBF997B16 + .word 0xBFB17810 + .word 0xBFC36B16 + .word 0xBFD58910 + .word 0xBFE97B16 + .word 0xC0015B16 + .word 0xC0134C16 + .word 0xC0208B16 + .word 0xC0384B16 + .word 0xC0447810 + .word 0xC0567810 + .word 0xC0686810 + .word 0xC0767910 + .word 0xC08A7910 + .word 0xC09E6810 + .word 0xC0AC6810 + .word 0xC0BA5A14 + .word 0xC0CB7810 + .word 0xC0DD7810 + .word 0xC0EF8810 + .word 0xC1018810 + .word 0xC1137910 + .word 0xC1276810 + .word 0xC1354D18 + .word 0xC1432D18 + .word 0xC14A4D18 + .word 0xC1585116 + .word 0xC15B6F1C + .word 0xC2276F16 + .word 0xC23F6F16 + .word 0xC1738A16 + .word 0xC189AB16 + .word 0xC2576F16 + .word 0xC1A7C914 + .word 0xC1C52D16 + .word 0xC1CC6A16 + .word 0xC1DD6116 + .word 0xC26F6F16 + .word 0xC2876F16 + .word 0xC1E07D18 + .word 0xC1FCC40C + .word 0xC20B7D18 + .word 0xC29F6F16 + .word 0xC2B76F16 + .word 0xC2CF4318 + .word 0xC2D3A914 + .word 0xC2ECA912 + .word 0xC305AB16 + .word 0xC4126F18 + .word 0xC323A910 + .word 0xC33C8914 + .word 0xC350430E + .word 0xC3543404 + .word 0xC359DB14 + .word 0xC383A016 + .word 0xC386DB16 + .word 0xC3B0ED18 + .word 0xC3E1ED18 + .word 0xC42A6F18 + .word 0xC4426F18 + .word 0xC45AA20E + .word 0xC4624306 + .word 0xC4666D18 + .word 0xC47BA810 + .word 0xC4925A18 + .word 0xC4A35A12 + .word 0xC4B46A18 + .word 0xC4C57A12 + .word 0xC4DB5D18 + .word 0xC4F05D18 + .word 0xC5055D18 + .word 0xC51A6D18 + .word 0xC52FD914 + .word 0xC552D914 + .word 0xC575B914 + .word 0xC593E510 + .word 0xC5A8F50E + .word 0xC5C07D16 + .word 0xC5DC6D16 + .word 0xC5F1EB14 + .word 0xC61BEB14 + .word 0xC645D912 + .word 0xC668D912 + .word 0xC68BAD16 + .word 0xC6AEAD16 + .word 0xC6D1FA14 + .word 0xC6FD9C16 + .word 0xC71E6F16 + .word 0xC7366F16 + .word 0xC74E6F16 + .word 0xC7666F16 + .word 0xC77E6F16 + .word 0xC796E612 + .word 0xC7AFA810 + .word 0xC7C65118 + .word 0xC7C96318 + .word 0xC7CF3418 + .word 0xC7D44810 + .word 0xC7DDD30E + .word 0xC7EBA30E + .word 0xC7F55D18 + .word 0xC80AC20E + .word 0xC8138B16 + .word 0xC82BB912 + .word 0xC8496F1A + .word 0xC8616F1A + .word 0xC8796F1A + .word 0xC8916F1A + .word 0xC8A90F17 + .word 0xC8E9960E + .word 0xC8FB7810 + .word 0xC90D960E + .word 0xC91F7810 + .word 0xC9319E14 + .word 0xC957F810 + .word 0xC97B9E16 + .word 0xC9A1F810 + .word 0xC9C5CC14 + .word 0xC9ECDC16 + .word 0xCA1ADC14 + .word 0xCA48DC14 + .word 0xCA76EF16 + .word 0xCAAE070F + .word 0xCACE070F + .word 0xCAEE8F16 + .word 0xCB0EED14 + .word 0xCB3FED14 + .word 0xCB70ED14 + .word 0xCBA1EF16 + .word 0xCBD9CB12 + .word 0xCBFDCB12 + .word 0xCC21CB12 +ENDDATA(D_801D04A0) diff --git a/src/libleo/api/getaadr2.s b/src/n64dd/libleo/getaadr2.s similarity index 100% rename from src/libleo/api/getaadr2.s rename to src/n64dd/libleo/getaadr2.s diff --git a/src/n64dd/libleo/getkadr.s b/src/n64dd/libleo/getkadr.s new file mode 100644 index 00000000000..85169a26f97 --- /dev/null +++ b/src/n64dd/libleo/getkadr.s @@ -0,0 +1,705 @@ +#include "ultra64/asm.h" +#include "ultra64/regdef.h" + +.text + +LEAF(LeoGetKAdr) + blt a0, 0x8140, .L801CF9E0 + bge a0, 0x9873, .L801CF9E0 + li a2, 0xBC + blt a0, 0x8800, .L801CF994 + srl a1, a0, 8 + addi a1, a1, -0x88 + mul a2, a2, a1 + andi a3, a0, 0xFF + addi a3, a3, -0x40 + blt a3, 0x40, .L801CF984 + addi a3, a3, -1 + .L801CF984: + mflo a2 + addi a3, a3, 0x30A + add a3, a3, a2 + sll v0, a3, 7 + jr ra + .L801CF994: + srl a1, a0, 8 + addi a1, a1, -0x81 + mul a2, a2, a1 + andi a3, a0, 0xFF + addi a3, a3, -0x40 + blt a3, 0x40, .L801CF9C0 + addi a3, a3, -1 + .L801CF9C0: + mflo a2 + add a3, a3, a2 + sll a3, a3, 1 + la a2, D_801CF9E8 + add a3, a3, a2 + lh a2, (a3) + sll v0, a2, 7 + jr ra + .L801CF9E0: + li v0, -1 + jr ra +END(LeoGetKAdr) + +DATA(D_801CF9E8) + .word 0x00000001 + .word 0x00020003 + .word 0x00040005 + .word 0x00060007 + .word 0x00080009 + .word 0x000A000B + .word 0x000C000D + .word 0x000E000F + .word 0x00100011 + .word 0x00120013 + .word 0x00140015 + .word 0x00160017 + .word 0x00180019 + .word 0x001A001B + .word 0x001C001D + .word 0x001E001F + .word 0x00200021 + .word 0x00220023 + .word 0x00240025 + .word 0x00260027 + .word 0x00280029 + .word 0x002A002B + .word 0x002C002D + .word 0x002E002F + .word 0x00300031 + .word 0x00320033 + .word 0x00340035 + .word 0x00360037 + .word 0x00380039 + .word 0x003A003B + .word 0x003C003D + .word 0x003E003F + .word 0x00400041 + .word 0x00420043 + .word 0x00440045 + .word 0x00460047 + .word 0x00480049 + .word 0x004A004B + .word 0x004C004D + .word 0x004E004F + .word 0x00500051 + .word 0x00520053 + .word 0x00540055 + .word 0x00560057 + .word 0x00580059 + .word 0x005A005B + .word 0x005C005D + .word 0x005E005F + .word 0x00600061 + .word 0x00620063 + .word 0x00640065 + .word 0x00660067 + .word 0x00680069 + .word 0x006A006B + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x0000006C + .word 0x006D006E + .word 0x006F0070 + .word 0x00710072 + .word 0x00730000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000074 + .word 0x00750076 + .word 0x00770078 + .word 0x0079007A + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x007B007C + .word 0x007D007E + .word 0x007F0080 + .word 0x00810082 + .word 0x00830084 + .word 0x00850086 + .word 0x00870088 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000089 + .word 0x008A008B + .word 0x008C008D + .word 0x008E008F + .word 0x00900000 + .word 0x00000000 + .word 0x00000091 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000092 + .word 0x00930094 + .word 0x00950096 + .word 0x00970098 + .word 0x0099009A + .word 0x009B0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x009C009D + .word 0x009E009F + .word 0x00A000A1 + .word 0x00A200A3 + .word 0x00A400A5 + .word 0x00A600A7 + .word 0x00A800A9 + .word 0x00AA00AB + .word 0x00AC00AD + .word 0x00AE00AF + .word 0x00B000B1 + .word 0x00B200B3 + .word 0x00B400B5 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00B600B7 + .word 0x00B800B9 + .word 0x00BA00BB + .word 0x00BC00BD + .word 0x00BE00BF + .word 0x00C000C1 + .word 0x00C200C3 + .word 0x00C400C5 + .word 0x00C600C7 + .word 0x00C800C9 + .word 0x00CA00CB + .word 0x00CC00CD + .word 0x00CE00CF + .word 0x00000000 + .word 0x00000000 + .word 0x00D000D1 + .word 0x00D200D3 + .word 0x00D400D5 + .word 0x00D600D7 + .word 0x00D800D9 + .word 0x00DA00DB + .word 0x00DC00DD + .word 0x00DE00DF + .word 0x00E000E1 + .word 0x00E200E3 + .word 0x00E400E5 + .word 0x00E600E7 + .word 0x00E800E9 + .word 0x00EA00EB + .word 0x00EC00ED + .word 0x00EE00EF + .word 0x00F000F1 + .word 0x00F200F3 + .word 0x00F400F5 + .word 0x00F600F7 + .word 0x00F800F9 + .word 0x00FA00FB + .word 0x00FC00FD + .word 0x00FE00FF + .word 0x01000101 + .word 0x01020103 + .word 0x01040105 + .word 0x01060107 + .word 0x01080109 + .word 0x010A010B + .word 0x010C010D + .word 0x010E010F + .word 0x01100111 + .word 0x01120113 + .word 0x01140115 + .word 0x01160117 + .word 0x01180119 + .word 0x011A011B + .word 0x011C011D + .word 0x011E011F + .word 0x01200121 + .word 0x01220123 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x01240125 + .word 0x01260127 + .word 0x01280129 + .word 0x012A012B + .word 0x012C012D + .word 0x012E012F + .word 0x01300131 + .word 0x01320133 + .word 0x01340135 + .word 0x01360137 + .word 0x01380139 + .word 0x013A013B + .word 0x013C013D + .word 0x013E013F + .word 0x01400141 + .word 0x01420143 + .word 0x01440145 + .word 0x01460147 + .word 0x01480149 + .word 0x014A014B + .word 0x014C014D + .word 0x014E014F + .word 0x01500151 + .word 0x01520153 + .word 0x01540155 + .word 0x01560157 + .word 0x01580159 + .word 0x015A015B + .word 0x015C015D + .word 0x015E015F + .word 0x01600161 + .word 0x01620163 + .word 0x01640165 + .word 0x01660167 + .word 0x01680169 + .word 0x016A016B + .word 0x016C016D + .word 0x016E016F + .word 0x01700171 + .word 0x01720173 + .word 0x01740175 + .word 0x01760177 + .word 0x01780179 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x017A017B + .word 0x017C017D + .word 0x017E017F + .word 0x01800181 + .word 0x01820183 + .word 0x01840185 + .word 0x01860187 + .word 0x01880189 + .word 0x018A018B + .word 0x018C018D + .word 0x018E018F + .word 0x01900191 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x01920193 + .word 0x01940195 + .word 0x01960197 + .word 0x01980199 + .word 0x019A019B + .word 0x019C019D + .word 0x019E019F + .word 0x01A001A1 + .word 0x01A201A3 + .word 0x01A401A5 + .word 0x01A601A7 + .word 0x01A801A9 + .word 0x01AA0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x01AB01AC + .word 0x01AD01AE + .word 0x01AF01B0 + .word 0x01B101B2 + .word 0x01B301B4 + .word 0x01B501B6 + .word 0x01B701B8 + .word 0x01B901BA + .word 0x01BB01BC + .word 0x01BD01BE + .word 0x01BF01C0 + .word 0x01C101C2 + .word 0x01C301C4 + .word 0x01C501C6 + .word 0x01C701C8 + .word 0x01C901CA + .word 0x01CB0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x01CC01CD + .word 0x01CE01CF + .word 0x01D001D1 + .word 0x01D201D3 + .word 0x01D401D5 + .word 0x01D601D7 + .word 0x01D801D9 + .word 0x01DA01DB + .word 0x01DC01DD + .word 0x01DE01DF + .word 0x01E001E1 + .word 0x01E201E3 + .word 0x01E401E5 + .word 0x01E601E7 + .word 0x01E801E9 + .word 0x01EA01EB + .word 0x01EC0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x01ED01EE + .word 0x01EF01F0 + .word 0x01F101F2 + .word 0x01F301F4 + .word 0x01F501F6 + .word 0x01F701F8 + .word 0x01F901FA + .word 0x01FB01FC + .word 0x01FD01FE + .word 0x01FF0200 + .word 0x02010202 + .word 0x02030204 + .word 0x02050206 + .word 0x02070208 + .word 0x0209020A + .word 0x020B020C + .word 0x020D0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x020E020F + .word 0x02100211 + .word 0x02120213 + .word 0x02140215 + .word 0x02160217 + .word 0x02180219 + .word 0x021A021B + .word 0x021C021D + .word 0x021E021F + .word 0x02200221 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02220223 + .word 0x02240225 + .word 0x02260227 + .word 0x02280229 + .word 0x022A022B + .word 0x022C022D + .word 0x022E022F + .word 0x02300231 + .word 0x02320233 + .word 0x02340235 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02360237 + .word 0x02380239 + .word 0x023A023B + .word 0x023C023D + .word 0x023E0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x023F0240 + .word 0x02410242 + .word 0x02430244 + .word 0x02450246 + .word 0x02470248 + .word 0x00000000 + .word 0x00000000 + .word 0x0249024A + .word 0x024B024C + .word 0x024D024E + .word 0x024F0250 + .word 0x02510252 + .word 0x02530254 + .word 0x02550256 + .word 0x02570000 + .word 0x00000000 + .word 0x00000000 + .word 0x02580259 + .word 0x025A025B + .word 0x025C025D + .word 0x025E025F + .word 0x02600261 + .word 0x02620263 + .word 0x02640265 + .word 0x02660000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02670268 + .word 0x0269026A + .word 0x026B026C + .word 0x026D026E + .word 0x026F0270 + .word 0x02710272 + .word 0x02730274 + .word 0x02750276 + .word 0x02770278 + .word 0x0279027A + .word 0x027B027C + .word 0x027D027E + .word 0x027F0280 + .word 0x02810000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02820283 + .word 0x02840285 + .word 0x02860287 + .word 0x02880289 + .word 0x028A028B + .word 0x028C028D + .word 0x028E028F + .word 0x02900291 + .word 0x02920293 + .word 0x02940295 + .word 0x02960297 + .word 0x02980299 + .word 0x029A029B + .word 0x029C029D + .word 0x029E029F + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02A002A1 + .word 0x02A202A3 + .word 0x02A402A5 + .word 0x02A602A7 + .word 0x02A802A9 + .word 0x02AA02AB + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02AC02AD + .word 0x02AE0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02AF02B0 + .word 0x02B102B2 + .word 0x02B302B4 + .word 0x02B502B6 + .word 0x02B702B8 + .word 0x02B902BA + .word 0x02BB02BC + .word 0x02BD02BE + .word 0x02BF0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02C002C1 + .word 0x02C202C3 + .word 0x02C402C5 + .word 0x02C602C7 + .word 0x02C802C9 + .word 0x02CA02CB + .word 0x02CC02CD + .word 0x02CE02CF + .word 0x02D002D1 + .word 0x02D202D3 + .word 0x02D402D5 + .word 0x02D602D7 + .word 0x02D80000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02D902DA + .word 0x02DB02DC + .word 0x02DD02DE + .word 0x02DF02E0 + .word 0x02E102E2 + .word 0x02E302E4 + .word 0x02E502E6 + .word 0x02E702E8 + .word 0x02E902EA + .word 0x02EB02EC + .word 0x02ED02EE + .word 0x02EF02F0 + .word 0x02F102F2 + .word 0x02F302F4 + .word 0x02F502F6 + .word 0x02F702F8 + .word 0x02F902FA + .word 0x02FB02FC + .word 0x02FD0000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x02FE02FF + .word 0x03000301 + .word 0x03020000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x03030304 + .word 0x03050306 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000000 + .word 0x00000307 + .word 0x03080309 +ENDDATA(D_801CF9E8) diff --git a/src/libleo/api/lbatobyte.c b/src/n64dd/libleo/lbatobyte.c similarity index 91% rename from src/libleo/api/lbatobyte.c rename to src/n64dd/libleo/lbatobyte.c index e260fced18c..e705b46dc3c 100644 --- a/src/libleo/api/lbatobyte.c +++ b/src/n64dd/libleo/lbatobyte.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" s32 LeoLBAToByte(s32 startlba, u32 nlbas, s32* bytes) { u32 resbytes; diff --git a/src/n64dd/libleo/leo_tbl.c b/src/n64dd/libleo/leo_tbl.c new file mode 100644 index 00000000000..30bebe8f8cc --- /dev/null +++ b/src/n64dd/libleo/leo_tbl.c @@ -0,0 +1,32 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +const char LEOfirmware_rev[] = "B014A26"; + +const u8 LEOBYTE_TBL1[0xC] = { 0xE8, 0xD8, 0xD0, 0xC0, 0xB0, 0xA0, 0x90, 0x80, 0x70, 0, 0, 0 }; +const u16 LEOBYTE_TBL2[9] = { 0x4D08, 0x47B8, 0x4510, 0x3FC0, 0x3A70, 0x3520, 0x2FD0, 0x2A80, 0x2530 }; +const u16 LEOVZONE_TBL[7][0x10] = { + { 0x124, 0x248, 0x35A, 0x47E, 0x5A2, 0x6B4, 0x7C6, 0x8D8, 0x9EA, 0xAB6, 0xB82, 0xC94, 0xDA6, 0xEB8, 0xFCA, 0x10DC }, + { 0x124, 0x248, 0x35A, 0x46C, 0x57E, 0x6A2, 0x7C6, 0x8D8, 0x9EA, 0xAFC, 0xBC8, 0xC94, 0xDA6, 0xEB8, 0xFCA, 0x10DC }, + { 0x124, 0x248, 0x35A, 0x46C, 0x57E, 0x690, 0x7A2, 0x8C6, 0x9EA, 0xAFC, 0xC0E, 0xCDA, 0xDA6, 0xEB8, 0xFCA, 0x10DC }, + { 0x124, 0x248, 0x35A, 0x46C, 0x57E, 0x690, 0x7A2, 0x8B4, 0x9C6, 0xAEA, 0xC0E, 0xD20, 0xDEC, 0xEB8, 0xFCA, 0x10DC }, + { 0x124, 0x248, 0x35A, 0x46C, 0x57E, 0x690, 0x7A2, 0x8B4, 0x9C6, 0xAD8, 0xBEA, 0xD0E, 0xE32, 0xEFE, 0xFCA, 0x10DC }, + { 0x124, 0x248, 0x35A, 0x46C, 0x57E, 0x690, 0x7A2, 0x86E, 0x980, 0xA92, 0xBA4, 0xCB6, 0xDC8, 0xEEC, 0x1010, + 0x10DC }, + { 0x124, 0x248, 0x35A, 0x46C, 0x57E, 0x690, 0x7A2, 0x86E, 0x93A, 0xA4C, 0xB5E, 0xC70, 0xD82, 0xE94, 0xFB8, 0x10DC }, +}; +const u16 LEOZONE_SCYL_TBL[0x10] = { + 0, 0x9E, 0x13C, 0x1D1, 0x266, 0x2FB, 0x390, 0x425, 0x91, 0x12F, 0x1C4, 0x259, 0x2EE, 0x383, 0x418, 0x48A, +}; +const u8 LEOVZONE_PZONEHD_TBL[][0x10] = { + { 0, 1, 2, 9, 8, 3, 4, 5, 6, 7, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA }, + { 0, 1, 2, 3, 0xA, 9, 8, 4, 5, 6, 7, 0xF, 0xE, 0xD, 0xC, 0xB }, + { 0, 1, 2, 3, 4, 0xB, 0xA, 9, 8, 5, 6, 7, 0xF, 0xE, 0xD, 0xC }, + { 0, 1, 2, 3, 4, 5, 0xC, 0xB, 0xA, 9, 8, 6, 7, 0xF, 0xE, 0xD }, + { 0, 1, 2, 3, 4, 5, 6, 0xD, 0xC, 0xB, 0xA, 9, 8, 7, 0xF, 0xE }, + { 0, 1, 2, 3, 4, 5, 6, 7, 0xE, 0xD, 0xC, 0xB, 0xA, 9, 8, 0xF }, + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }, +}; +const u16 LEOZONE_OUTERCYL_TBL[8] = { 0, 0x9E, 0x13C, 0x1D1, 0x266, 0x2FB, 0x390, 0x425 }; +const u16 LEORAM_START_LBA[8] = { 0x5A2, 0x7C6, 0x9EA, 0xC0E, 0xE32, 0x1010, 0x10DC, 0 }; +const u32 LEORAM_BYTE[0xA] = { 0x024A9DC0, 0x01C226C0, 0x01450F00, 0xD35680, 0x6CFD40, 0x1DA240, 0, 0, 0, 0 }; diff --git a/src/n64dd/libleo/leoc2_syndrome.c b/src/n64dd/libleo/leoc2_syndrome.c new file mode 100644 index 00000000000..cf0dec7805e --- /dev/null +++ b/src/n64dd/libleo/leoc2_syndrome.c @@ -0,0 +1,4 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +u8 LEOC2_Syndrome[2][0xE8 * 4]; diff --git a/src/libleo/leo/leoc2ecc.c b/src/n64dd/libleo/leoc2ecc.c similarity index 97% rename from src/libleo/leo/leoc2ecc.c rename to src/n64dd/libleo/leoc2ecc.c index 5b770b138db..573fdf543b1 100644 --- a/src/libleo/leo/leoc2ecc.c +++ b/src/n64dd/libleo/leoc2ecc.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" void leoC2_single_ecc(void); void leoC2_double_ecc(void); @@ -10,8 +8,6 @@ void leoC2_4_ecc(void); int leoAlpha_mult(int i, int k); int leoAlpha_div(int i, int k); -extern u8 LEO_TempBuffer[0xE8]; - const u8 ganlog[512] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1D, 0x3A, 0x74, 0xE8, 0xCD, 0x87, 0x13, 0x26, 0x4C, 0x98, 0x2D, 0x5A, 0xB4, 0x75, 0xEA, 0xC9, 0x8F, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x9D, 0x27, 0x4E, 0x9C, 0x25, 0x4A, @@ -96,8 +92,7 @@ int leoC2_Correction(void) { return 0; } -// static -void leoC2_single_ecc(void) { +STATIC void leoC2_single_ecc(void) { u8* pointer; unsigned int byte; u8* p_s; @@ -113,8 +108,7 @@ void leoC2_single_ecc(void) { } } -// static -void leoC2_double_ecc(void) { +STATIC void leoC2_double_ecc(void) { unsigned int s0; unsigned int error_k; u8* pointer1; @@ -140,7 +134,6 @@ void leoC2_double_ecc(void) { goto c2_2_1; } return; - c2_2_2: pointer2 = &LEOc2_param.pntr[(LEOc2_param.err_pos[1] + 1) * byte]; c2_2_1: @@ -167,8 +160,7 @@ void leoC2_double_ecc(void) { } while (--byte != 0); } -// static -void leoC2_3_ecc(void) { +STATIC void leoC2_3_ecc(void) { unsigned int s0; unsigned int error_i; unsigned int error_j; @@ -235,7 +227,6 @@ void leoC2_3_ecc(void) { goto c2_3_1; } return; - c2_3_3: pointer3 = &LEOc2_param.pntr[(LEOc2_param.err_pos[2] + 1) * byte]; c2_3_2: @@ -284,8 +275,7 @@ void leoC2_3_ecc(void) { } while (--byte != 0); } -// static -void leoC2_4_ecc(void) { +STATIC void leoC2_4_ecc(void) { unsigned int s0; unsigned int R0; unsigned int R1; @@ -478,16 +468,14 @@ void leoC2_4_ecc(void) { } while (--byte != 0); } -// static -int leoAlpha_mult(int i, int k) { +STATIC int leoAlpha_mult(int i, int k) { if (i == 0 || k == 0) { return 0; } return ganlog[glog[i] + glog[k]]; } -// static -int leoAlpha_div(int i, int k) { +STATIC int leoAlpha_div(int i, int k) { if (i == 0 || k == 0) { return 0; } diff --git a/src/libleo/leo/leocmdex.c b/src/n64dd/libleo/leocmdex.c similarity index 68% rename from src/libleo/leo/leocmdex.c rename to src/n64dd/libleo/leocmdex.c index d7887d4944e..17b8b130071 100644 --- a/src/libleo/leo/leocmdex.c +++ b/src/n64dd/libleo/leocmdex.c @@ -1,30 +1,22 @@ -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "attributes.h" - #include "ultra64.h" +#include "ultra64/leo_internal.h" +#include "attributes.h" -extern vu16 LEOrw_flags; +extern u16 LEOrw_flags; -static void (*cmd_tbl[16])(void) = { +void (*cmd_tbl[])() = { NULL, leoClr_queue, leoInquiry, leoTest_unit_rdy, leoRezero, leoRead, leoWrite, leoSeek, leoStart_stop, leoRd_capacity, leoTranslate, leoMode_sel, leoReadDiskId, leoReadTimer, leoSetTimer, leoClr_reset, }; +const LEOCmdRead system_read_cmd = { { LEO_COMMAND_READ, 0, 0, 0, 0, 0, 0, 0, NULL }, 0xC, 1, NULL, 0 }; -static LEOCmdRead system_read_cmd = { - { LEO_COMMAND_READ, 0, 0, 0, 0, 0, 0, 0, 0 }, 12, 1, 0, 0, -}; - -static const u8 system_lba[8] = { 0, 1, 8, 9, 0, 0, 0, 0 }; +const u8 system_lba[] = { 0, 1, 8, 9, 0, 0, 0, 0 }; OSPiHandle* LEOPiInfo; OSIoMesg LEOPiDmaParam; s32 currentCommand; -u8 leoRead_system_area(void); - void leomain(void* arg0) { u32 cur_status; u32 sense_code; @@ -43,9 +35,11 @@ void leomain(void* arg0) { LEOPiInfo = osLeoDiskInit(); LEOPiDmaParam.hdr.pri = 1; LEOPiDmaParam.hdr.retQueue = &LEOdma_que; - osEPiReadIo(LEOPiInfo, ASIC_STATUS, &cur_status); - if (!(cur_status & 0x400000) && (cur_status & 0x06800000)) { - leoDrive_reset(); + osEPiReadIo(LEOPiInfo, 0x05000508, &cur_status); + if (!(cur_status & 0x400000)) { + if ((cur_status & 0x06800000) != 0) { + leoDrive_reset(); + } } while (true) { @@ -67,14 +61,14 @@ void leomain(void* arg0) { } } else { switch (sense_code) { - case 3: - case 37: - case 41: - case 43: + case LEO_SENSE_COMMAND_PHASE_ERROR: + case LEO_SENSE_WAITING_NMI: + case LEO_SENSE_DEVICE_COMMUNICATION_FAILURE: + case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: break; - case 49: - if (leoRetUnit_atten() == 43) { - sense_code = 43; + case LEO_SENSE_EJECTED_ILLEGALLY_RESUME: + if (leoRetUnit_atten() == LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED) { + sense_code = LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED; } break; default: @@ -83,38 +77,38 @@ void leomain(void* arg0) { } switch (sense_code) { - case 47: + case LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED: switch (LEOcur_command->header.command) { - case 2: - case 8: - case 11: - case 12: - case 13: - case 14: - case 15: + case LEO_COMMAND_INQUIRY: + case LEO_COMMAND_START_STOP: + case LEO_COMMAND_MODE_SELECT: + case LEO_COMMAND_READ_DISK_ID: + case LEO_COMMAND_READ_TIMER: + case LEO_COMMAND_SET_TIMER: + case 0xF: continue; } break; - case 49: + case LEO_SENSE_EJECTED_ILLEGALLY_RESUME: switch (LEOcur_command->header.command) { - case 2: - case 11: - case 13: - case 14: - case 15: + case LEO_COMMAND_INQUIRY: + case LEO_COMMAND_MODE_SELECT: + case LEO_COMMAND_READ_TIMER: + case LEO_COMMAND_SET_TIMER: + case 0xF: continue; default: sense_code = 42; } break; - case 43: + case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: switch (LEOcur_command->header.command) { - case 15: + case 0xF: leoClrUA_RESET(); FALLTHROUGH; - case 2: - case 13: - case 14: + case LEO_COMMAND_INQUIRY: + case LEO_COMMAND_READ_TIMER: + case LEO_COMMAND_SET_TIMER: continue; } break; @@ -122,40 +116,40 @@ void leomain(void* arg0) { /* empty */; } - if (LEOcur_command->header.command == 3) { - LEOcur_command->data.modeSelect.reserve1 = leoChk_cur_drvmode(); + if (LEOcur_command->header.command == LEO_COMMAND_TEST_UNIT_READY) { + LEOcur_command->data.modeselect.reserve1 = leoChk_cur_drvmode(); } LEOcur_command->header.sense = sense_code; - LEOcur_command->header.status = 2; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; goto post_exe; } while (0); if (LEOdrive_flag == 0) { switch (LEOcur_command->header.command) { - case 2: - case 3: - case 8: - case 11: - case 13: - case 14: - case 15: + case LEO_COMMAND_INQUIRY: + case LEO_COMMAND_TEST_UNIT_READY: + case LEO_COMMAND_START_STOP: + case LEO_COMMAND_MODE_SELECT: + case LEO_COMMAND_READ_TIMER: + case LEO_COMMAND_SET_TIMER: + case 0xF: break; default: if (LEO_country_code == 0) { - osEPiReadIo(LEOPiInfo, ASIC_ID_REG, &cur_status); + osEPiReadIo(LEOPiInfo, 0x05000540, &cur_status); if ((cur_status & 0x70000) != 0x40000) { while (true) {} } } if (leoRead_system_area() != 0) { - LEOcur_command->header.status = 2; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; goto post_exe; } if ((LEOcur_command->header.sense = leoSend_asic_cmd_w(0xB0001, LEO_sys_data.param.disk_type << 16)) != 0) { - LEOcur_command->header.status = 2; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; goto post_exe; } @@ -166,8 +160,8 @@ void leomain(void* arg0) { LEOdisk_type = (LEO_sys_data.param.disk_type & 0xF); if (LEOdisk_type >= 7) { invalid_disktype: - LEOcur_command->header.sense = 0xBU; - LEOcur_command->header.status = 2; + LEOcur_command->header.sense = 11; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; goto post_exe; } @@ -178,7 +172,7 @@ void leomain(void* arg0) { cmd_tbl[LEOcur_command->header.command](); post_exe: - if (LEOcur_command->header.control & 0x80) { + if (LEOcur_command->header.control & LEO_CONTROL_POST) { osSendMesg(LEOcur_command->header.post, (void*)(s32)LEOcur_command->header.sense, OS_MESG_BLOCK); } if (LEOclr_que_flag != 0) { @@ -204,7 +198,7 @@ u8 leoRead_system_area(void) { LEO_sys_data.param.defect_num[0] = 0; LEOrw_flags = 0x3000; dummy_cmd = system_read_cmd; - dummy_cmd.buffPtr = &LEO_sys_data; + dummy_cmd.buff_ptr = &LEO_sys_data; if (read_mode == 0) { // read System LBA 12 (+0, this is an offset value for leoRead_common) @@ -242,10 +236,10 @@ u8 leoRead_system_area(void) { } system_retry: - if (leoChk_err_retry(dummy_cmd.header.sense) != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { + if (leoChk_err_retry(dummy_cmd.header.sense) != 0) { break; } - if (retry_cntr++ >= 0x40U) { + if (retry_cntr++ >= 64) { break; } if ((retry_cntr & 7) == 0) { @@ -260,5 +254,5 @@ u8 leoRead_system_area(void) { sys_read_end: LEOcur_command = backup_pointer; LEOcur_command->header.sense = dummy_cmd.header.sense; - return GET_ERROR(*LEOcur_command); + return LEOcur_command->header.sense; } diff --git a/src/libleo/leo/leodiskinit.c b/src/n64dd/libleo/leodiskinit.c similarity index 59% rename from src/libleo/leo/leodiskinit.c rename to src/n64dd/libleo/leodiskinit.c index 92020029eaf..ffc4089fc57 100644 --- a/src/libleo/leo/leodiskinit.c +++ b/src/n64dd/libleo/leodiskinit.c @@ -1,9 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" - -extern OSPiHandle* __osPiTable; +#include "ultra64/leo_internal.h" OSPiHandle __LeoDiskHandle; OSPiHandle* __osDiskHandle; @@ -11,23 +7,19 @@ OSPiHandle* __osDiskHandle; OSPiHandle* osLeoDiskInit(void) { u32 saveMask; - __LeoDiskHandle.type = DEVICE_TYPE_64DD; - __LeoDiskHandle.baseAddress = (u32)OS_PHYSICAL_TO_K1(ASIC_C2_BUFF); + __LeoDiskHandle.type = 2; + __LeoDiskHandle.baseAddress = 0xA5000000; __LeoDiskHandle.latency = 3; __LeoDiskHandle.pulse = 6; __LeoDiskHandle.pageSize = 6; __LeoDiskHandle.relDuration = 2; - __LeoDiskHandle.domain = PI_DOMAIN2; + __LeoDiskHandle.domain = 1; __LeoDiskHandle.speed = 0; - - bzero(&__LeoDiskHandle.transferInfo, sizeof(__OSTranxInfo)); + bzero(&__LeoDiskHandle.transferInfo, sizeof(__LeoDiskHandle.transferInfo)); saveMask = __osDisableInt(); - __LeoDiskHandle.next = __osPiTable; __osPiTable = &__LeoDiskHandle; __osDiskHandle = &__LeoDiskHandle; - __osRestoreInt(saveMask); - return &__LeoDiskHandle; } diff --git a/src/n64dd/libleo/leofunc.c b/src/n64dd/libleo/leofunc.c new file mode 100644 index 00000000000..a015c9c694a --- /dev/null +++ b/src/n64dd/libleo/leofunc.c @@ -0,0 +1,127 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" +#include "array_count.h" + +s32 __leoResetCalled = 0; +s32 __leoQueuesCreated = 0; + +OSMesgQueue LEOpost_que; +OSMesg LEOpost_que_buf; + +void leoInitialize(OSPri compri, OSPri intpri, void** command_que_buf, u32 cmd_buff_size) { + u32 savedMask; + OSPri oldPri; + OSPri myPri; + OSPri pri; + + if (intpri < compri) { + pri = compri; + } else { + pri = intpri; + } + oldPri = -1; + myPri = osGetThreadPri(NULL); + if (myPri < pri) { + oldPri = myPri; + osSetThreadPri(NULL, pri); + } + savedMask = __osDisableInt(); + __leoQueuesCreated = 1; + osCreateMesgQueue(&LEOcommand_que, command_que_buf, (s32)cmd_buff_size); + osCreateMesgQueue(&LEOcontrol_que, &LEOcontrol_que_buf, 1); + osCreateMesgQueue(&LEOevent_que, &LEOevent_que_buf, 1); + osCreateMesgQueue(&LEOdma_que, LEOdma_que_buf, ARRAY_COUNT(LEOdma_que_buf)); + osCreateMesgQueue(&LEOblock_que, &LEOblock_que_buf, 1); + osCreateMesgQueue(&LEOpost_que, &LEOpost_que_buf, 1); + osCreateThread(&LEOcommandThread, 1, leomain, NULL, STACK_TOP(LEOcommandThreadStack), compri); + osStartThread(&LEOcommandThread); + osCreateThread(&LEOinterruptThread, 1, leointerrupt, NULL, STACK_TOP(LEOinterruptThreadStack), intpri); + osStartThread(&LEOinterruptThread); + osSetEventMesg(OS_EVENT_CART, &LEOevent_que, (OSMesg)0x30000); + osSendMesg(&LEOblock_que, NULL, OS_MESG_NOBLOCK); + __osRestoreInt(savedMask); + if (oldPri != -1) { + osSetThreadPri(NULL, oldPri); + } +} + +void leoCommand(void* cmd_blk_addr) { + LEOCmdHeader* header = cmd_blk_addr; + + if (__leoResetCalled != 0) { + header->status = LEO_STATUS_CHECK_CONDITION; + header->sense = LEO_SENSE_WAITING_NMI; + if (header->control & LEO_CONTROL_POST) { + osSendMesg(header->post, (OSMesg)0x25, OS_MESG_BLOCK); + } + } else { + osRecvMesg(&LEOblock_que, NULL, OS_MESG_BLOCK); + header->status = LEO_STATUS_BUSY; + header->sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; + switch (header->command) { + case LEO_COMMAND_CLEAR_QUE: + LEOclr_que_flag = 0xFF; + leoClr_queue(); + LEOclr_que_flag = 0; + header->status = LEO_STATUS_GOOD; + if (header->control & LEO_CONTROL_POST) { + osSendMesg(header->post, NULL, OS_MESG_BLOCK); + } + break; + case LEO_COMMAND_READ: + case LEO_COMMAND_WRITE: + ((LEOCmdRead*)cmd_blk_addr)->rw_bytes = 0; + goto cmd_queing; + default: + if ((u32)(header->command - 1) >= 0xE) { + header->sense = LEO_SENSE_INVALID_COMMAND_OPERATION_CODE; + header->status = LEO_STATUS_CHECK_CONDITION; + } else { + cmd_queing: + if (osSendMesg(&LEOcommand_que, cmd_blk_addr, OS_MESG_NOBLOCK) != 0) { + header->sense = LEO_SENSE_QUEUE_FULL; + header->status = LEO_STATUS_CHECK_CONDITION; + } + } + break; + } + osSendMesg(&LEOblock_que, NULL, OS_MESG_BLOCK); + } +} + +const u8 zero[] = { 0 }; + +void LeoReset(void) { + __leoResetCalled = 1; + if (__leoQueuesCreated != 0) { + LEOclr_que_flag = 0xFF; + leoClr_queue(); + LEOclr_que_flag = 0; + osRecvMesg(&LEOevent_que, NULL, OS_MESG_NOBLOCK); + osSendMesg(&LEOevent_que, (OSMesg)0xA0000, OS_MESG_BLOCK); + osSendMesg(&LEOcommand_que, (OSMesg)zero, OS_MESG_BLOCK); + } +} + +s32 __leoSetReset(void) { + leoDrive_reset(); + return 0; +} + +s32 LeoResetClear(void) { + LEOCmdHeader resetclear; + + resetclear.command = 0xF; + resetclear.control = LEO_CONTROL_POST; + resetclear.status = LEO_STATUS_GOOD; + resetclear.post = &LEOpost_que; + if (osSendMesg(&LEOcommand_que, &resetclear, OS_MESG_NOBLOCK) != 0) { + return LEO_SENSE_QUEUE_FULL; + } + osRecvMesg(&LEOpost_que, NULL, OS_MESG_BLOCK); + if (resetclear.status == LEO_STATUS_GOOD) { + return 0; + } else { + return resetclear.sense; + } +} diff --git a/src/n64dd/libleo/leoglobals.c b/src/n64dd/libleo/leoglobals.c new file mode 100644 index 00000000000..377c6e87590 --- /dev/null +++ b/src/n64dd/libleo/leoglobals.c @@ -0,0 +1,5 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +s32 __leoActive = 0; +LEOVersion __leoVersion; diff --git a/src/n64dd/libleo/leoinquiry.c b/src/n64dd/libleo/leoinquiry.c new file mode 100644 index 00000000000..c241f9a9d66 --- /dev/null +++ b/src/n64dd/libleo/leoinquiry.c @@ -0,0 +1,20 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +void leoInquiry(void) { + u32 asic_id; + u32 asic_data; + + osEPiReadIo(LEOPiInfo, 0x05000540, &asic_id); + if (leoSend_asic_cmd_w(0x1B0000, 0) == 0) { + osEPiReadIo(LEOPiInfo, 0x05000500, &asic_data); + if (asic_data & 0x10000) { + asic_id |= 0x100000; + } + } + LEOcur_command->data.time.pad = 0; + LEOcur_command->data.time.yearhi = (u8)(asic_id >> 16); + LEOcur_command->data.time.yearlo = 1; + LEOcur_command->data.time.month = 0; + LEOcur_command->header.status = LEO_STATUS_GOOD; +} diff --git a/src/libleo/leo/leoint.c b/src/n64dd/libleo/leoint.c similarity index 81% rename from src/libleo/leo/leoint.c rename to src/n64dd/libleo/leoint.c index 33ac3d2010d..02ec19897e9 100644 --- a/src/libleo/leo/leoint.c +++ b/src/n64dd/libleo/leoint.c @@ -1,32 +1,26 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" extern vu16 LEOrw_flags; -extern u8 LEOC2_Syndrome[2][0xE8 * 4]; -extern OSIoMesg LEOPiDmaParam; -extern block_param_form LEOc2_param; - -u8 LEOc2ctrl_que_buf[8]; -OSMesgQueue LEOc2ctrl_que; - u32 read_write_track(void); u32 leoChk_mecha_int(void); void leosetup_BM(void); u32 leochk_err_reg(void); +OSMesg LEOc2ctrl_que_buf; +OSMesgQueue LEOc2ctrl_que; + void leointerrupt(void* arg) { u32 result; u32 tg_blocks; - osCreateMesgQueue(&LEOc2ctrl_que, (OSMesg*)&LEOc2ctrl_que_buf, 1); + osCreateMesgQueue(&LEOc2ctrl_que, &LEOc2ctrl_que_buf, 1); - while (true) { + while (1) { osStopThread(&LEOinterruptThread); - tg_blocks = LEOcur_command->data.readWrite.transferBlks; - LEOwrite_pointer = LEOcur_command->data.readWrite.buffPtr; + tg_blocks = LEOcur_command->data.readwrite.xfer_blks; + LEOwrite_pointer = LEOcur_command->data.readwrite.buff_ptr; do { leoLba_to_phys(LEOtgt_param.lba); @@ -35,11 +29,9 @@ void leointerrupt(void* arg) { } else { result = leoSeek_i(0); } - if (result != 0) { goto complete; } - if (LEOrw_flags & 0x2000) { LEOtgt_param.rdwr_blocks = 1; } else if (LEOtgt_param.rdwr_blocks > tg_blocks) { @@ -51,17 +43,16 @@ void leointerrupt(void* arg) { if (result != 0) { goto complete; } - - LEOcur_command->data.readWrite.rwBytes = LEOwrite_pointer - (u8*)LEOcur_command->data.readWrite.buffPtr; + LEOcur_command->data.readwrite.rw_bytes = + (uintptr_t)LEOwrite_pointer - (uintptr_t)LEOcur_command->data.readwrite.buff_ptr; } while (tg_blocks != 0); - result = 0x90000; // Inaccessible? + result = 0x90000; complete: osSendMesg(&LEOcontrol_que, (OSMesg)result, OS_MESG_BLOCK); } } -// static u32 read_write_track(void) { u32 message; u32 block; @@ -151,9 +142,9 @@ u32 read_write_track(void) { u32 c2datasize; if (LEOtgt_param.rdwr_blocks == 1) { - osEPiReadIo(LEOPiInfo, ASIC_ERR_SECTOR, &message); + osEPiReadIo(LEOPiInfo, 0x05000514, &message); if (message & 0x10000000) { - message = 4; + message = LEO_SENSE_DATA_PHASE_ERROR; goto track_end; } } @@ -180,7 +171,7 @@ u32 read_write_track(void) { if (LEOtgt_param.rdwr_blocks == 1) { if ((*(u32*)&LEOC2_Syndrome[block][0x00] | *(u32*)&LEOC2_Syndrome[block][0x04] | *(u32*)&LEOC2_Syndrome[block][0x08] | *(u32*)&LEOC2_Syndrome[block][0x0C]) != 0) { - message = 0x17; + message = LEO_SENSE_UNRECOVERED_READ_ERROR; goto track_end; } } @@ -194,11 +185,11 @@ u32 read_write_track(void) { return 0; } track_end: - if (message == 0x16) { + if (message == LEO_SENSE_WRITE_FAULT) { message = leochk_err_reg(); } do_retry: - if (leoChk_err_retry(message) || (LEOrw_flags & 0x1000) || retry_cntr++ == 0x40) { + if ((leoChk_err_retry(message) != 0) || (LEOrw_flags & 0x1000) || (retry_cntr++ == 64)) { break; } if ((retry_cntr & 7) == 0) { @@ -207,7 +198,8 @@ u32 read_write_track(void) { goto do_retry; } } - if (message == 0x18 || (message == 0x17 && retry_cntr == 0x20)) { + if ((message == LEO_SENSE_NO_REFERENCE_POSITION_FOUND) || + ((message == LEO_SENSE_UNRECOVERED_READ_ERROR) && (retry_cntr == 32))) { message = leoDetect_index_w(); if (message != 0) { goto do_retry; @@ -225,74 +217,62 @@ u32 read_write_track(void) { return message; } -// static u32 leoChk_mecha_int(void) { - u32 stat = leoWait_mecha_cmd_done(0x10001); + u32 stat; u32 index_stat; + stat = leoWait_mecha_cmd_done(0x10001); if (stat == 0) { - osEPiReadIo(LEOPiInfo, ASIC_CUR_TK, &index_stat); + osEPiReadIo(LEOPiInfo, 0x0500050C, &index_stat); if ((index_stat & 0x60000000) != 0x60000000) { - stat = 0x18; + stat = LEO_SENSE_NO_REFERENCE_POSITION_FOUND; } } return stat; } -// static void leosetup_BM(void) { - osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow | 0x10000000); - osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow); - + osEPiWriteIo(LEOPiInfo, 0x05000510, LEOasic_bm_ctl_shadow | 0x10000000); + osEPiWriteIo(LEOPiInfo, 0x05000510, (u32)LEOasic_bm_ctl_shadow); if (LEOtgt_param.start_block != 0) { LEOasic_bm_ctl_shadow = 0x5A0000; } else { LEOasic_bm_ctl_shadow = 0; } - if (!(LEOrw_flags & 0x8000)) { LEOasic_bm_ctl_shadow |= 0x40000000; } - if (LEOtgt_param.rdwr_blocks == 2) { LEOasic_bm_ctl_shadow |= 0x02000000; } - - osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow); + osEPiWriteIo(LEOPiInfo, 0x05000510, (u32)LEOasic_bm_ctl_shadow); } -// static u32 leochk_err_reg(void) { u32 sense; u32 index_status; - osEPiReadIo(LEOPiInfo, ASIC_ERR_SECTOR, &sense); - osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow | 0x10000000); - osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow); - + osEPiReadIo(LEOPiInfo, 0x05000514, &sense); + osEPiWriteIo(LEOPiInfo, 0x05000510, LEOasic_bm_ctl_shadow | 0x10000000); + osEPiWriteIo(LEOPiInfo, 0x05000510, (u32)LEOasic_bm_ctl_shadow); if (sense & 0x04000000) { - return LEO_ERROR_EJECTED_ILLEGALLY_RESUME; + return LEO_SENSE_EJECTED_ILLEGALLY_RESUME; } - if (sense & 0x10000000) { - return LEO_ERROR_DATA_PHASE_ERROR; + return LEO_SENSE_DATA_PHASE_ERROR; } - - if (sense & (0x40000000 | 0x2000000)) { + if (sense & 0x42000000) { if (LEOrw_flags & 0x8000) { - return LEO_ERROR_WRITE_FAULT; + return LEO_SENSE_WRITE_FAULT; } - return LEO_ERROR_UNRECOVERED_READ_ERROR; + return LEO_SENSE_UNRECOVERED_READ_ERROR; } - if (sense & 0x80000000) { - return LEO_ERROR_NO_REFERENCE_POSITION_FOUND; + return LEO_SENSE_NO_REFERENCE_POSITION_FOUND; } - - osEPiReadIo(LEOPiInfo, ASIC_CUR_TK, &index_status); + osEPiReadIo(LEOPiInfo, 0x0500050C, &index_status); if ((index_status & 0x60000000) == 0x60000000) { - return LEO_ERROR_TRACK_FOLLOWING_ERROR; + return LEO_SENSE_TRACK_FOLLOWING_ERROR; } - - return LEO_ERROR_NO_REFERENCE_POSITION_FOUND; + return LEO_SENSE_NO_REFERENCE_POSITION_FOUND; } diff --git a/src/n64dd/libleo/leointerrupt.c b/src/n64dd/libleo/leointerrupt.c new file mode 100644 index 00000000000..48d0ab99e43 --- /dev/null +++ b/src/n64dd/libleo/leointerrupt.c @@ -0,0 +1,192 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" +#include "ultra64/internal.h" + +void __osLeoAbnormalResume(void); +void __osLeoResume(void); + +STACK(leoDiskStack, 0x1000); + +s32 __osLeoInterrupt(void) { + u32 stat; + volatile u32 pi_stat; + u32 bm_stat; + __OSTranxInfo* info; + __OSBlockInfo* blockInfo; + + info = &__osDiskHandle->transferInfo; + blockInfo = &info->block[info->blockNum]; + pi_stat = IO_READ(PI_STATUS_REG); + if (pi_stat & PI_STATUS_DMA_BUSY) { + __OSGlobalIntMask &= ~(OS_IM_CART & ~OS_IM_RCP); + blockInfo->errStatus = 0x1D; + __osLeoResume(); + return 1; + } + pi_stat = IO_READ(PI_STATUS_REG); + while ((pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) { + pi_stat = IO_READ(PI_STATUS_REG); + } + stat = IO_READ(0xA5000508); + if (stat & 0x02000000) { + pi_stat = IO_READ(PI_STATUS_REG); + while ((pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) { + pi_stat = IO_READ(PI_STATUS_REG); + } + IO_WRITE(0xA5000510, info->bmCtlShadow | 0x01000000); + blockInfo->errStatus = 0; + return 0; + } + if (info->cmdType == 2) { + return 1; + } + if (stat & 0x08000000) { + pi_stat = IO_READ(PI_STATUS_REG); + while ((pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) { + pi_stat = IO_READ(PI_STATUS_REG); + } + IO_READ(0xA5000508); + blockInfo->errStatus = 0x16; + __osLeoResume(); + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; + return 1; + } + if (info->cmdType == 1) { + if (!(stat & 0x40000000)) { + if ((info->sectorNum + 1) != (info->transferMode * 0x55)) { + blockInfo->errStatus = 0x18; + __osLeoAbnormalResume(); + } else { + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; + blockInfo->errStatus = 0; + __osLeoResume(); + } + } else { + blockInfo->dramAddr = BADCASTP((u32)blockInfo->dramAddr + blockInfo->sectorSize); + info->sectorNum += 1; + __osEPiRawStartDma(__osDiskHandle, 1, 0x05000400, blockInfo->dramAddr, blockInfo->sectorSize); + } + return 1; + } + if (info->cmdType == 0) { + if (info->transferMode == 3) { + if ((s32)(blockInfo->C1ErrNum + 0x11) < info->sectorNum) { + blockInfo->errStatus = 0; + __osLeoAbnormalResume(); + return 1; + } + if (!(stat & 0x40000000)) { + blockInfo->errStatus = 0x17; + __osLeoAbnormalResume(); + return 1; + } + } else { + blockInfo->dramAddr = BADCASTP((u32)blockInfo->dramAddr + blockInfo->sectorSize); + } + bm_stat = IO_READ(0xA5000510); + if (((bm_stat & 0x200000) && (bm_stat & 0x400000)) || (bm_stat & 0x02000000)) { + if (blockInfo->C1ErrNum >= 4) { + if ((info->transferMode != 3) || (info->sectorNum >= 0x53)) { + blockInfo->errStatus = 0x17; + __osLeoAbnormalResume(); + return 1; + } + } else { + int errNum; + + errNum = blockInfo->C1ErrNum; + blockInfo->C1ErrSector[errNum] = info->sectorNum + 1; + } + blockInfo->C1ErrNum += 1; + } + if (stat & 0x10000000) { + if (info->sectorNum != 0x57) { + blockInfo->errStatus = 0x18; + __osLeoAbnormalResume(); + } else { + if ((info->transferMode == 2) && (info->blockNum == 0)) { + info->blockNum = 1; + info->sectorNum = -1; + info->block[1].dramAddr = BADCASTP((u32)info->block[1].dramAddr - info->block[1].sectorSize); + blockInfo->errStatus = 0x16; + } else { + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; + info->cmdType = 2; + blockInfo->errStatus = 0; + } + __osEPiRawStartDma(__osDiskHandle, 0, 0x05000000, blockInfo->C2Addr, blockInfo->sectorSize * 4); + } + return 1; + } + if ((info->sectorNum == -1) && (info->transferMode == 2) && (info->blockNum == 1)) { + __OSBlockInfo* bptr = info->block; + + if (info->block[0].C1ErrNum == 0) { + if ((((u32*)bptr->C2Addr)[0] | ((u32*)bptr->C2Addr)[1] | ((u32*)bptr->C2Addr)[2] | + ((u32*)bptr->C2Addr)[3]) != 0) { + bptr->errStatus = 0x17; + __osLeoAbnormalResume(); + return 1; + } + } + info->block[0].errStatus = 0; + __osLeoResume(); + } + info->sectorNum += 1; + if (stat & 0x40000000) { + if (info->sectorNum >= 0x55) { + blockInfo->errStatus = 0x18; + __osLeoAbnormalResume(); + return 1; + } + __osEPiRawStartDma(__osDiskHandle, 0, 0x05000400, blockInfo->dramAddr, blockInfo->sectorSize); + blockInfo->errStatus = 0; + return 1; + } + if (info->sectorNum < 0x55) { + blockInfo->errStatus = 0x18; + __osLeoAbnormalResume(); + return 1; + } + return 1; + } + blockInfo->errStatus = 4; + __osLeoAbnormalResume(); + return 1; +} + +void __osLeoAbnormalResume(void) { + __OSTranxInfo* info; + u32 pi_stat; + + info = &__osDiskHandle->transferInfo; + while (((pi_stat = IO_READ(PI_STATUS_REG)) & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) {} + IO_WRITE(0xA5000510, info->bmCtlShadow | 0x10000000); + while (((pi_stat = IO_READ(PI_STATUS_REG)) & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) {} + IO_WRITE(0xA5000510, info->bmCtlShadow); + __osLeoResume(); + IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); + __OSGlobalIntMask |= OS_IM_PI; +} + +void __osLeoResume(void) { + __OSEventState* es; + OSMesgQueue* mq; + s32 last; + + es = &__osEventStateTab[OS_EVENT_PI]; + mq = es->queue; + if (mq != NULL) { + if (mq->validCount < mq->msgCount) { + last = (mq->first + mq->validCount) % mq->msgCount; + mq->msg[last] = es->msg; + mq->validCount++; + if (mq->mtqueue->next != NULL) { + __osEnqueueThread(&__osRunQueue, __osPopThread(&mq->mtqueue)); + } + } + } +} diff --git a/src/libleo/leo/leomecha.c b/src/n64dd/libleo/leomecha.c similarity index 53% rename from src/libleo/leo/leomecha.c rename to src/n64dd/libleo/leomecha.c index d0804f033c2..6cd5caef423 100644 --- a/src/libleo/leo/leomecha.c +++ b/src/n64dd/libleo/leomecha.c @@ -1,194 +1,178 @@ -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "attributes.h" - #include "ultra64.h" +#include "ultra64/leo_internal.h" +#include "attributes.h" -extern s32 currentCommand; +u8 leoRecv_event_mesg(s32 control); -static u32 asic_cur_status; -static u32 unit_atten; +u32 asic_cur_status; +u32 unit_atten; u8 leoAnalize_asic_status(void) { u32 curr_stat; - osEPiReadIo(LEOPiInfo, ASIC_STATUS, &asic_cur_status); - curr_stat = asic_cur_status ^ 0x1000000; - - // 0xFE3C0000? - if (curr_stat & 0x1C3FFFF) { - // 0xFE3E0000? - if (curr_stat & 0x1C1FFFF) { + osEPiReadIo(LEOPiInfo, 0x05000508, &asic_cur_status); + curr_stat = asic_cur_status ^ 0x01000000; + if (curr_stat & 0x01C3FFFF) { + if (curr_stat & 0x01C1FFFF) { LEOdrive_flag = 0; } if (curr_stat & 0xFFFF) { - return 41; + return LEO_SENSE_DEVICE_COMMUNICATION_FAILURE; } if ((curr_stat & 0xC00000) == 0x800000) { - return 3; + return LEO_SENSE_COMMAND_PHASE_ERROR; } if (curr_stat & 0x400000) { unit_atten |= 2; - return 43; + return LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED; } - if (curr_stat & 0x1000000) { - return 49; + if (curr_stat & 0x01000000) { + return LEO_SENSE_EJECTED_ILLEGALLY_RESUME; } if (curr_stat & 0x10000) { unit_atten |= 1; - return 47; + return LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED; } if (curr_stat & 0x20000) { - return 21; + return LEO_SENSE_NO_SEEK_COMPLETE; } } - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } u8 leoChk_asic_ready(u32 asic_cmd) { - u32 sense_code = leoAnalize_asic_status(); + u32 sense_code; + sense_code = leoAnalize_asic_status(); switch (sense_code) { - case 47: + case LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED: if (asic_cmd == 0x80000) { - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } FALLTHROUGH; - case 43: + case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: if (!(asic_cur_status & 0x800000)) { if (asic_cmd == 0x90000) { - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { - return 37; + return LEO_SENSE_WAITING_NMI; } - osEPiWriteIo(LEOPiInfo, ASIC_CMD, 0x90000); + osEPiWriteIo(LEOPiInfo, 0x05000508, 0x90000); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { - return 37; + return LEO_SENSE_WAITING_NMI; } } - FALLTHROUGH; - default: break; - - case 49: + case LEO_SENSE_EJECTED_ILLEGALLY_RESUME: if (asic_cmd & 1) { break; } FALLTHROUGH; - case 21: + case LEO_SENSE_NO_SEEK_COMPLETE: return 0; + default: + break; } return sense_code; } -// Which of LEO_ERROR or LEO_SENSE should be used where? u8 leoChk_done_status(u32 asic_cmd) { u32 asic_data; - u32 code = leoAnalize_asic_status(); + u32 code; + code = leoAnalize_asic_status(); switch (code) { - case 43: - case 47: + case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: + case LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED: if (!(asic_cur_status & 0x800000)) { if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { - return 37; + return LEO_SENSE_WAITING_NMI; } - - osEPiWriteIo(LEOPiInfo, ASIC_CMD, 0x90000); + osEPiWriteIo(LEOPiInfo, 0x05000508, 0x90000); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { - return 37; + return LEO_SENSE_WAITING_NMI; } } break; - - case 49: - if (asic_cmd & 1) { - break; + default: + break; + case LEO_SENSE_EJECTED_ILLEGALLY_RESUME: + if (!(asic_cmd & 1)) { + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } - return 0; - - case 21: - osEPiWriteIo(LEOPiInfo, ASIC_DATA, 0); + break; + case LEO_SENSE_NO_SEEK_COMPLETE: + osEPiWriteIo(LEOPiInfo, 0x05000500, 0); if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { - return 37; + return LEO_SENSE_WAITING_NMI; } - - osEPiWriteIo(LEOPiInfo, ASIC_CMD, 0xC0000); + osEPiWriteIo(LEOPiInfo, 0x05000508, 0xC0000); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { - return 37; + return LEO_SENSE_WAITING_NMI; } - - osEPiReadIo(LEOPiInfo, ASIC_DATA, &asic_data); + osEPiReadIo(LEOPiInfo, 0x05000500, &asic_data); code = leoChk_asic_ready(0xC0000); if (code != 0) { return code; } - if (asic_data & 0x10000) { - return 2; + return LEO_SENSE_DIAGNOSTIC_FAILURE; } if (asic_data & 0x20000) { - return 24; + return LEO_SENSE_NO_REFERENCE_POSITION_FOUND; } if (asic_data & 0x40000) { - return 1; + return LEO_SENSE_DRIVE_NOT_READY; } if (asic_data & 0x80000) { - return 21; + return LEO_SENSE_NO_SEEK_COMPLETE; } if (asic_data & 0x200000) { return 11; } - return 41; - - default: - break; + return LEO_SENSE_DEVICE_COMMUNICATION_FAILURE; } - return code; } u8 leoSend_asic_cmd_i(u32 asic_cmd, u32 asic_data) { - u8 status = leoChk_asic_ready(asic_cmd); + u8 status; + status = leoChk_asic_ready(asic_cmd); if (status != 0) { - return LEOcur_command->header.sense = status; + LEOcur_command->header.sense = status; + return LEOcur_command->header.sense; } - - osEPiWriteIo(LEOPiInfo, ASIC_DATA, asic_data); + osEPiWriteIo(LEOPiInfo, 0x05000500, asic_data); if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { - return LEOcur_command->header.sense = 37; + LEOcur_command->header.sense = LEO_SENSE_WAITING_NMI; + return LEOcur_command->header.sense; } - - osEPiWriteIo(LEOPiInfo, ASIC_CMD, asic_cmd); + osEPiWriteIo(LEOPiInfo, 0x05000508, asic_cmd); return 0; } -// Is this using the sense defines? u8 leoWait_mecha_cmd_done(u32 asic_cmd) { u32 done_stat; - if (leoRecv_event_mesg(OS_MESG_BLOCK)) { - return 37; + if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { + return LEO_SENSE_WAITING_NMI; } - done_stat = leoChk_done_status(asic_cmd); - if (done_stat != 0) { + if (done_stat != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { return done_stat; } - - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } u8 leoSend_asic_cmd_w(u32 asic_cmd, u32 asic_data) { - u32 wstatus = leoSend_asic_cmd_i(asic_cmd, asic_data); + u32 wstatus; + wstatus = leoSend_asic_cmd_i(asic_cmd, asic_data); if (wstatus != 0) { return wstatus; } - return leoWait_mecha_cmd_done(asic_cmd); } @@ -197,26 +181,24 @@ u8 leoSend_asic_cmd_w_nochkDiskChange(u32 asic_cmd, u32 asic_data) { u32 done_stat; status = leoChk_asic_ready(asic_cmd); - if ((status != 0x2F) && (status != 0)) { - return LEOcur_command->header.sense = status; + if ((status != LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED) && (status != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION)) { + LEOcur_command->header.sense = status; + return LEOcur_command->header.sense; } - - osEPiWriteIo(LEOPiInfo, ASIC_DATA, asic_data); + osEPiWriteIo(LEOPiInfo, 0x05000500, asic_data); if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { - return LEOcur_command->header.sense = 0x25; + LEOcur_command->header.sense = LEO_SENSE_WAITING_NMI; + return LEOcur_command->header.sense; } - - osEPiWriteIo(LEOPiInfo, ASIC_CMD, asic_cmd); + osEPiWriteIo(LEOPiInfo, 0x05000508, asic_cmd); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { - return 0x25; + return LEO_SENSE_WAITING_NMI; } - done_stat = leoChk_done_status(asic_cmd); - if ((done_stat != 0x2F) && (done_stat != 0)) { + if ((done_stat != LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED) && (done_stat != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION)) { return done_stat; } - - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } u8 leoDetect_index_w(void) { @@ -232,35 +214,32 @@ u8 leoRecal_w(void) { } u8 leoSeek_i(u16 rwmode) { - u32 tgt_tk = ((LEOtgt_param.head << 0xC) + LEOtgt_param.cylinder) << 0x10; + s32 tgt_tk; - if (rwmode == 0) { + tgt_tk = ((LEOtgt_param.head << 12) + LEOtgt_param.cylinder) << 16; + if (!rwmode) { return leoSend_asic_cmd_i(0x10001, tgt_tk); - } else { - return leoSend_asic_cmd_i(0x20001, tgt_tk); } + return leoSend_asic_cmd_i(0x20001, tgt_tk); } u8 leoSeek_w(void) { - u8 sksense = leoSeek_i(0); + u8 sksense; + sksense = leoSeek_i(0); if (sksense != 0) { return sksense; } - return leoWait_mecha_cmd_done(0x10001); } u8 leoRecv_event_mesg(s32 control) { - u32 done_mesg; + OSMesg done_mesg; - if (osRecvMesg(&LEOevent_que, (OSMesg*)&done_mesg, control) == 0) { - if (done_mesg == 0xA0000) { - leoDrive_reset(); - return -1; - } + if ((osRecvMesg(&LEOevent_que, &done_mesg, control) == 0) && (done_mesg == (OSMesg)0xA0000)) { + leoDrive_reset(); + return 0xFF; } - return 0; } @@ -277,7 +256,9 @@ u32 leoChk_err_retry(u32 sense) { case LEO_SENSE_MEDIUM_NOT_PRESENT: case LEO_SENSE_EJECTED_ILLEGALLY_RESUME: LEOdrive_flag = 0; - return -1; + return -1U; + default: + break; } } else { switch (sense) { @@ -294,17 +275,19 @@ u32 leoChk_err_retry(u32 sense) { case LEO_SENSE_MEDIUM_NOT_PRESENT: case LEO_SENSE_EJECTED_ILLEGALLY_RESUME: LEOdrive_flag = 0; - return -1; + return -1U; + default: + break; } } - return 0; } u8 leoChk_cur_drvmode(void) { - u8 devstat = 0; + u8 devstat; - if (!(asic_cur_status & 0x1000000)) { + devstat = 0; + if (!(asic_cur_status & 0x01000000)) { devstat |= 1; } if (asic_cur_status & 0x80000) { @@ -316,22 +299,22 @@ u8 leoChk_cur_drvmode(void) { return devstat; } -void leoDrive_reset() { - osEPiWriteIo(LEOPiInfo, ASIC_HARD_RESET, 0xAAAA0000); +void leoDrive_reset(void) { + osEPiWriteIo(LEOPiInfo, 0x05000520, 0xAAAA0000); } u32 leoChkUnit_atten(void) { - return unit_atten; + return (u32)unit_atten; } u32 leoRetUnit_atten(void) { if (unit_atten & 2) { - return 43; + return LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED; } if (unit_atten & 1) { - return 47; + return LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED; } - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } void leoClrUA_RESET(void) { diff --git a/src/n64dd/libleo/leomode_sel.c b/src/n64dd/libleo/leomode_sel.c new file mode 100644 index 00000000000..09d607c1ce8 --- /dev/null +++ b/src/n64dd/libleo/leomode_sel.c @@ -0,0 +1,19 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +void leoMode_sel(void) { + u8 sense; + + sense = leoSend_asic_cmd_w_nochkDiskChange(0x60000, LEOcur_command->data.time.yearlo << 16); + if ((sense != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) || + (sense = leoSend_asic_cmd_w_nochkDiskChange(0x70000, LEOcur_command->data.time.month << 16), + (sense != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION)) || + (sense = leoSend_asic_cmd_w_nochkDiskChange(0x150000, LEOcur_command->data.readwrite.xfer_blks), + (sense != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION))) { + LEOcur_command->header.sense = sense; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; + return; + } + LEOcur_command->header.sense = sense; + LEOcur_command->header.status = LEO_STATUS_GOOD; +} diff --git a/src/libleo/leo/leomotor.c b/src/n64dd/libleo/leomotor.c similarity index 50% rename from src/libleo/leo/leomotor.c rename to src/n64dd/libleo/leomotor.c index 652b626ee05..6455306d531 100644 --- a/src/libleo/leo/leomotor.c +++ b/src/n64dd/libleo/leomotor.c @@ -1,36 +1,34 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" void leoStart_stop(void) { u32 send_cmd; u8 sense_code; - u8 retry_cntr = 8; + u8 retry_cntr; u32 send_data; + retry_cntr = 8; do { send_data = 0; - if ((LEOcur_command->header.control & 1)) { + if (LEOcur_command->header.control & 1) { send_cmd = 0x50001; - } else if ((LEOcur_command->header.control & 2)) { + } else if (LEOcur_command->header.control & LEO_CONTROL_STBY) { send_cmd = 0xD0000; } else { - if ((LEOcur_command->header.control & 4)) { + if (LEOcur_command->header.control & LEO_CONTROL_BRAKE) { send_data = 0x10000; } send_cmd = 0x40000; } sense_code = leoSend_asic_cmd_w_nochkDiskChange(send_cmd, send_data); - if (sense_code == 0) { - LEOcur_command->header.status = 0; + if (sense_code == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { + LEOcur_command->header.status = LEO_STATUS_GOOD; return; } - if (leoChk_err_retry(sense_code)) { + if (leoChk_err_retry(sense_code) != 0) { break; } } while (retry_cntr--); - LEOcur_command->header.sense = sense_code; - LEOcur_command->header.status = 2; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; } diff --git a/src/n64dd/libleo/leomseq_tbl.c b/src/n64dd/libleo/leomseq_tbl.c new file mode 100644 index 00000000000..ce71288fadf --- /dev/null +++ b/src/n64dd/libleo/leomseq_tbl.c @@ -0,0 +1,51 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +extern vu16 LEOrw_flags; + +STATIC s32 mseq_tbl[0x10]; + +STATIC const u32 rd_mseq_code[0x10] = { + 0x10000, 0x20200, 0x80030100, 0x82040000, 0xA8050000, 0xA0060600, 0x31760000, 0x20300, + 0, 0, 0, 0, 0, 0, 0, 0x04060000, +}; +STATIC const u32 wt_mseq_code[0x10] = { + 0x40020000, 0x20000, 0x40130B00, 0x42140100, 0x68050000, 0x50060600, 0x401702FF, 0x01870000, + 0x40020000, 0, 0, 0, 0, 0, 0, 0x040F0000, +}; + +void leoSet_mseq(u16 rwmode) { + u32* tbl; + u32 sct_byte_x; + u32 sct_byte_u; + u8 i; + + LEOasic_seq_ctl_shadow &= 0xBFFFFFFF; + osEPiWriteIo(LEOPiInfo, 0x05000518, LEOasic_seq_ctl_shadow); + if (rwmode == 1) { + tbl = wt_mseq_code; + } else { + tbl = rd_mseq_code; + } + for (i = 0; i < 0x10; i++, tbl++) { + mseq_tbl[i] = *tbl; + } + sct_byte_x = sct_byte_u = LEOtgt_param.sec_bytes - 1; + sct_byte_u += 7; + sct_byte_x <<= 8; + mseq_tbl[4] |= sct_byte_x; + osWritebackDCache(mseq_tbl, 0x40); + LEOPiDmaParam.dramAddr = mseq_tbl; + LEOPiDmaParam.devAddr = 0x05000580; + LEOPiDmaParam.size = 0x40; + LEOPiInfo->transferInfo.cmdType = 2; + osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, 1); + osRecvMesg(&LEOdma_que, NULL, OS_MESG_BLOCK); + osEPiWriteIo(LEOPiInfo, 0x05000530, (sct_byte_u | 0x5900) << 16); + if (LEOrw_flags & 0x800) { + sct_byte_x += 0x100; + } + osEPiWriteIo(LEOPiInfo, 0x05000528, sct_byte_x << 8); + LEOasic_seq_ctl_shadow |= 0x40000000; + osEPiWriteIo(LEOPiInfo, 0x05000518, LEOasic_seq_ctl_shadow); +} diff --git a/src/libleo/leo/leoram.c b/src/n64dd/libleo/leoram.c similarity index 64% rename from src/libleo/leo/leoram.c rename to src/n64dd/libleo/leoram.c index 159aaaae279..9998f012bfa 100644 --- a/src/libleo/leo/leoram.c +++ b/src/n64dd/libleo/leoram.c @@ -1,41 +1,29 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" +// should be in another file leosysdata.c but alignment prevents that leo_sys_form LEO_sys_data; OSThread LEOcommandThread; OSThread LEOinterruptThread; - STACK(LEOcommandThreadStack, 0x400); STACK(LEOinterruptThreadStack, 0x400); - OSMesgQueue LEOcommand_que; OSMesgQueue LEOevent_que; OSMesgQueue LEOcontrol_que; OSMesgQueue LEOdma_que; OSMesgQueue LEOblock_que; - -OSMesg LEOevent_que_buf[1]; -OSMesg LEOcontrol_que_buf[1]; +OSMesg LEOevent_que_buf; +OSMesg LEOcontrol_que_buf; OSMesg LEOdma_que_buf[2]; -OSMesg LEOblock_que_buf[1]; - +OSMesg LEOblock_que_buf; u8* LEOwrite_pointer; LEOCmd* LEOcur_command; - -u32 LEOasic_bm_ctl_shadow; -u32 LEOasic_seq_ctl_shadow; - +s32 LEOasic_bm_ctl_shadow; +s32 LEOasic_seq_ctl_shadow; u8 LEOdrive_flag; vu8 LEOclr_que_flag; - -// volatile? -vu16 LEOrw_flags; - +u16 LEOrw_flags; u8 LEOdisk_type; - tgt_param_form LEOtgt_param; - u32 LEO_country_code; diff --git a/src/n64dd/libleo/leord_capa.c b/src/n64dd/libleo/leord_capa.c new file mode 100644 index 00000000000..0d0a00d2003 --- /dev/null +++ b/src/n64dd/libleo/leord_capa.c @@ -0,0 +1,15 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +void leoRd_capacity(void) { + if (LEOcur_command->header.control & 1) { + LEOcur_command->data.readwrite.lba = LEORAM_START_LBA[LEOdisk_type] - 0x18; + LEOcur_command->data.readwrite.xfer_blks = 0x10C3; + LEOcur_command->data.readwrite.buff_ptr = BADCASTP LEORAM_BYTE[LEOdisk_type]; + } else { + LEOcur_command->data.readwrite.lba = 0; + LEOcur_command->data.readwrite.xfer_blks = 0x10C3; + LEOcur_command->data.readwrite.buff_ptr = (void*)0x03D78F40; + } + LEOcur_command->header.status = LEO_STATUS_GOOD; +} diff --git a/src/libleo/leo/leord_diskid.c b/src/n64dd/libleo/leord_diskid.c similarity index 74% rename from src/libleo/leo/leord_diskid.c rename to src/n64dd/libleo/leord_diskid.c index df4d6bf24b9..715723a850b 100644 --- a/src/libleo/leo/leord_diskid.c +++ b/src/n64dd/libleo/leord_diskid.c @@ -1,16 +1,11 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" extern vu16 LEOrw_flags; -extern u8 LEO_TempBuffer[0xE8]; -const u8 leo_disk_id_lba[] = { 14, 15 }; +STATIC const LEOCmdRead read_id_cmd = { { LEO_COMMAND_READ, 0, 0, 0, 0, 0, 0, 0, NULL }, 0xE, 1, LEO_TempBuffer, 0 }; -LEOCmdRead read_id_cmd = { - { LEO_COMMAND_READ, 0, 0, 0, 0, 0, 0, 0, 0 }, 14, 1, LEO_TempBuffer, 0, -}; +STATIC const u8 leo_disk_id_lba[2] = { 0xE, 0xF }; void leoReadDiskId(void) { LEOCmdRead dummy_cmd; @@ -22,7 +17,7 @@ void leoReadDiskId(void) { // Read Disk ID to Temp Buffer LEOcur_command = (LEOCmd*)&dummy_cmd; - for (cntr = 0; cntr < (sizeof(leo_disk_id_lba)); cntr++) { + for (cntr = 0; cntr < 2; cntr++) { LEOrw_flags = 0x2000; dummy_cmd = read_id_cmd; dummy_cmd.lba = leo_disk_id_lba[cntr]; @@ -36,7 +31,7 @@ void leoReadDiskId(void) { LEOcur_command = (LEOCmd*)temp_pointer; // Copy Disk ID to buffer pointed by ReadDiskID command - temp_pointer = (u8*)LEOcur_command->data.readdiskid.bufferPointer; + temp_pointer = (u8*)LEOcur_command->data.readdiskid.buffer_pointer; for (cntr = 0; cntr < (sizeof(LEODiskID)); cntr += sizeof(u32)) { *(u32*)temp_pointer = *((u32*)&LEO_TempBuffer[cntr]); temp_pointer += sizeof(u32); diff --git a/src/libleo/leo/leoread.c b/src/n64dd/libleo/leoread.c similarity index 76% rename from src/libleo/leo/leoread.c rename to src/n64dd/libleo/leoread.c index 11dc28c41c0..c50d26e9944 100644 --- a/src/libleo/leo/leoread.c +++ b/src/n64dd/libleo/leoread.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" extern vu16 LEOrw_flags; @@ -10,26 +8,24 @@ void leoRead(void) { leoRead_common(0x18); } -extern OSMesgQueue LEOc2ctrl_que; - void leoRead_common(unsigned int offset) { - u32 tg_lba = LEOcur_command->data.readWrite.lba; - u32 tg_blocks = LEOcur_command->data.readWrite.transferBlks; + u32 tg_lba; + u32 tg_blocks; u32 message; u16 retry_cnt; - if ((tg_lba | tg_blocks) & 0xFFFF0000) { + tg_lba = LEOcur_command->data.readwrite.lba; + tg_blocks = LEOcur_command->data.readwrite.xfer_blks; + if (((tg_lba | tg_blocks) & 0xFFFF0000) != 0) { goto invalid_lba; } - tg_lba += offset; - if ((tg_lba + tg_blocks) > 0x10DC) { // Unclear what this number represents + if ((tg_lba + tg_blocks) >= 0x10DD) { invalid_lba: LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - if (tg_blocks == 0) { if (tg_lba >= 0x10DC) { goto invalid_lba; @@ -38,32 +34,28 @@ void leoRead_common(unsigned int offset) { LEOcur_command->header.status = LEO_STATUS_GOOD; return; } - LEOtgt_param.lba = tg_lba; LEOrw_flags &= ~0xC000; osSendMesg(&LEOc2ctrl_que, NULL, OS_MESG_NOBLOCK); osStartThread(&LEOinterruptThread); - for (;;) { + while (1) { osRecvMesg(&LEOcontrol_que, (OSMesg*)&message, OS_MESG_BLOCK); - switch (message) { case 0x90000: goto read_complete; - case 0x80000: leoC2_Correction(); LEOrw_flags &= ~0x4000; + if (LEOcur_command) {} osSendMesg(&LEOc2ctrl_que, NULL, OS_MESG_NOBLOCK); break; - default: - LEOcur_command->header.sense = message; + LEOcur_command->header.sense = (u8)message; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } } - read_complete: LEOcur_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; LEOcur_command->header.status = LEO_STATUS_GOOD; diff --git a/src/n64dd/libleo/leoreset.c b/src/n64dd/libleo/leoreset.c new file mode 100644 index 00000000000..56a808c645e --- /dev/null +++ b/src/n64dd/libleo/leoreset.c @@ -0,0 +1,28 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +void leoClr_queue(void) { + OSMesg clr_cmd; + + while (osRecvMesg(&LEOcommand_que, &clr_cmd, OS_MESG_NOBLOCK) == 0) { + ((LEOCmdHeader*)clr_cmd)->sense = LEO_SENSE_COMMAND_TERMINATED; + ((LEOCmdHeader*)clr_cmd)->status = LEO_STATUS_CHECK_CONDITION; + if (((LEOCmdHeader*)clr_cmd)->control & LEO_CONTROL_POST) { + osSendMesg(((LEOCmdHeader*)clr_cmd)->post, (OSMesg)0x22, OS_MESG_BLOCK); + } + } +} + +void leoClr_reset(void) { + u32 code; + + code = leoAnalize_asic_status(); + if (code == LEO_SENSE_COMMAND_PHASE_ERROR || code == LEO_SENSE_DEVICE_COMMUNICATION_FAILURE || + code == LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED) { + LEOcur_command->header.sense = code; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; + } else { + LEOcur_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; + LEOcur_command->header.status = LEO_STATUS_GOOD; + } +} diff --git a/src/libleo/leo/leoseek.c b/src/n64dd/libleo/leoseek.c similarity index 67% rename from src/libleo/leo/leoseek.c rename to src/n64dd/libleo/leoseek.c index 2f530ac726f..e55b6032921 100644 --- a/src/libleo/leo/leoseek.c +++ b/src/n64dd/libleo/leoseek.c @@ -1,33 +1,27 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" void leoSeek(void) { - u32 tgt_tk; // Unused + u32 tgt_tk; u8 sense_code; u8 retry_cntr = 20; - if (LEOcur_command->data.seek.lba > LEO_LBA_MAX) { + if (LEOcur_command->data.readwrite.lba >= 0x10C4) { LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - - leoLba_to_phys(LEOcur_command->data.seek.lba + 0x18); - + leoLba_to_phys(LEOcur_command->data.readwrite.lba + 0x18); do { sense_code = leoSeek_w(); if (sense_code == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { LEOcur_command->header.status = LEO_STATUS_GOOD; return; } - if (leoChk_err_retry(sense_code) != 0) { break; } } while (retry_cntr--); - LEOcur_command->header.sense = sense_code; - LEOcur_command->header.status = LEO_SENSE_DIAGNOSTIC_FAILURE; + LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; } diff --git a/src/n64dd/libleo/leotempbuffer.c b/src/n64dd/libleo/leotempbuffer.c new file mode 100644 index 00000000000..2115409c43b --- /dev/null +++ b/src/n64dd/libleo/leotempbuffer.c @@ -0,0 +1,4 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +u8 LEO_TempBuffer[0xE8]; diff --git a/src/libleo/leo/leotestunit.c b/src/n64dd/libleo/leotestunit.c similarity index 53% rename from src/libleo/leo/leotestunit.c rename to src/n64dd/libleo/leotestunit.c index 4c81d7970a4..88a045f3e4c 100644 --- a/src/libleo/leo/leotestunit.c +++ b/src/n64dd/libleo/leotestunit.c @@ -1,10 +1,8 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" void leoTest_unit_rdy(void) { - ((LEOCmdTestUnitReady*)LEOcur_command)->test = leoChk_cur_drvmode(); + LEOcur_command->data.time.pad = leoChk_cur_drvmode(); LEOcur_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; LEOcur_command->header.status = LEO_STATUS_GOOD; } diff --git a/src/libleo/leo/leotimer.c b/src/n64dd/libleo/leotimer.c similarity index 70% rename from src/libleo/leo/leotimer.c rename to src/n64dd/libleo/leotimer.c index f6c7fdfc05f..6ebf8b5fe48 100644 --- a/src/libleo/leo/leotimer.c +++ b/src/n64dd/libleo/leotimer.c @@ -1,9 +1,6 @@ -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "attributes.h" - #include "ultra64.h" +#include "ultra64/leo_internal.h" +#include "attributes.h" typedef struct { /* 0x0 */ u8 year; @@ -12,13 +9,14 @@ typedef struct { /* 0x3 */ u8 hour; /* 0x4 */ u8 minute; /* 0x5 */ u8 second; -} __LOCTime; +} __LOCTime; // size = 0x6 u8 __locReadTimer(__LOCTime* time); u8 __locSetTimer(__LOCTime* time); -static const u8 ymdupper[6] = { 99, 12, 31, 23, 59, 59 }; -static const u8 dayupper[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; +STATIC const u8 ymdupper[] = { 99, 12, 31, 23, 59, 59 }; + +STATIC const u8 dayupper[] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; void leoReadTimer(void) { u8* rdparam; @@ -33,17 +31,17 @@ void leoReadTimer(void) { LEOcur_command->data.time.hour = time.hour; LEOcur_command->data.time.minute = time.minute; LEOcur_command->data.time.second = time.second; - if (sense_code != 0) { + if (sense_code != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { LEOcur_command->header.sense = sense_code; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - if ((u8)LEOcur_command->data.time.yearlo >= 0x96U) { + if (LEOcur_command->data.time.yearlo >= 0x96U) { LEOcur_command->data.time.yearhi = 0x19; } else { LEOcur_command->data.time.yearhi = 0x20; } - LEOcur_command->header.status = 0; + LEOcur_command->header.status = LEO_STATUS_GOOD; } void leoSetTimer(void) { @@ -115,7 +113,7 @@ void leoSetTimer(void) { // Set the new time result = __locSetTimer(&time); - if (result != 0) { + if (result != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { LEOcur_command->header.sense = result; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; @@ -138,55 +136,55 @@ void leoSetTimer(void) { LEOcur_command->header.status = LEO_STATUS_GOOD; } -// static -u8 __locReadTimer(__LOCTime* time) { +STATIC u8 __locReadTimer(__LOCTime* time) { u32 data; u8 sense_code; - sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x140000, 0U); + sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x140000, 0); if (sense_code != 0) { return sense_code; } - osEPiReadIo(LEOPiInfo, ASIC_DATA, &data); - time->minute = (u8)((u32)(data & 0xFF000000) >> 0x18); - time->second = (s8)((u32)(data & 0xFF0000) >> 0x10); - sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x130000, 0U); - if (sense_code != 0) { - time->minute = (u8)(time->minute & 0xFF7F); + osEPiReadIo(LEOPiInfo, 0x05000500, &data); + time->minute = (u8)((u32)(data & 0xFF000000) >> 24); + time->second = (s8)((u32)(data & 0xFF0000) >> 16); + sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x130000, 0); + if (sense_code != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { + time->minute &= ~0x80; return sense_code; } - osEPiReadIo(LEOPiInfo, ASIC_DATA, &data); - time->day = (s8)((u32)(data & 0xFF000000) >> 0x18); - time->hour = (s8)((u32)(data & 0xFF0000) >> 0x10); - sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x120000, 0U); - if (sense_code != 0) { - time->minute = (u8)(time->minute & 0xFF7F); + osEPiReadIo(LEOPiInfo, 0x05000500, &data); + time->day = (s8)((u32)(data & 0xFF000000) >> 24); + time->hour = (s8)((u32)(data & 0xFF0000) >> 16); + sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x120000, 0); + if (sense_code != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { + time->minute &= ~0x80; return sense_code; } - osEPiReadIo(LEOPiInfo, ASIC_DATA, &data); - sense_code = time->minute; - time->year = (s8)((u32)(data & 0xFF000000) >> 0x18); - time->month = (s8)((u32)(data & 0xFF0000) >> 0x10); - if (sense_code & 0x80) { - time->minute = (u8)(sense_code & 0xFF7F); - return 5; + osEPiReadIo(LEOPiInfo, 0x05000500, &data); + time->year = (s8)((u32)(data & 0xFF000000) >> 24); + time->month = (s8)((u32)(data & 0xFF0000) >> 16); + if (time->minute & 0x80) { + time->minute &= ~0x80; + return LEO_SENSE_REAL_TIME_CLOCK_FAILURE; } - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } -// static -u8 __locSetTimer(__LOCTime* time) { +STATIC u8 __locSetTimer(__LOCTime* time) { u32 YearMonthX10000h; u32 DayHourX10000h; u32 MinuteSecondX10000h; u8 result; - YearMonthX10000h = (time->year << 0x18) + (time->month << 0x10); - DayHourX10000h = (time->day << 0x18) + (time->hour << 0x10); - MinuteSecondX10000h = (time->minute << 0x18) + (time->second << 0x10); - if ((result = leoSend_asic_cmd_w_nochkDiskChange(0xF0000, YearMonthX10000h)) != 0 || - (result = leoSend_asic_cmd_w_nochkDiskChange(0x100000, DayHourX10000h)) != 0 || - (result = leoSend_asic_cmd_w_nochkDiskChange(0x110000, MinuteSecondX10000h)) != 0) { + YearMonthX10000h = (time->year << 24) + (time->month << 16); + DayHourX10000h = (time->day << 24) + (time->hour << 16); + MinuteSecondX10000h = (time->minute << 24) + (time->second << 16); + if ((result = leoSend_asic_cmd_w_nochkDiskChange(0xF0000, YearMonthX10000h)) != + LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION || + (result = leoSend_asic_cmd_w_nochkDiskChange(0x100000, DayHourX10000h)) != + LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION || + (result = leoSend_asic_cmd_w_nochkDiskChange(0x110000, MinuteSecondX10000h)) != + LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { return result; } return 0; diff --git a/src/libleo/leo/leotranslat.c b/src/n64dd/libleo/leotranslat.c similarity index 68% rename from src/libleo/leo/leotranslat.c rename to src/n64dd/libleo/leotranslat.c index 6eb2011367b..f29b1b94535 100644 --- a/src/libleo/leo/leotranslat.c +++ b/src/n64dd/libleo/leotranslat.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" void leoTranslate(void) { u32 lba; @@ -10,32 +8,28 @@ void leoTranslate(void) { u32 byte_p_blk; u16 zone; u16 vzone; - u8 flag; // boolean + u8 flag; - if (LEOcur_command->data.readWrite.lba >= NUM_LBAS) { + if (LEOcur_command->data.readwrite.lba >= 0x10C4) { LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - - lba = LEOcur_command->data.readWrite.lba + 0x18; + lba = LEOcur_command->data.readwrite.lba + 0x18; calc_blks = 0; calc_bytes = 0; flag = vzone = 1; - - if (LEOcur_command->header.control & LEO_CONTROL_TBL) { - calc_bytes = LEOcur_command->data.readWrite.transferBlks; - + if (LEOcur_command->header.control & 1) { + calc_bytes = LEOcur_command->data.readwrite.xfer_blks; while (calc_bytes != 0) { - if (flag || (LEOVZONE_TBL[LEOdisk_type][vzone] == lba)) { + if ((flag != 0) || (LEOVZONE_TBL[LEOdisk_type][vzone] == lba)) { vzone = leoLba_to_vzone(lba); zone = LEOVZONE_PZONEHD_TBL[LEOdisk_type][vzone]; - if (zone >= 8) { + if (zone > 7) { zone -= 7; } byte_p_blk = LEOBYTE_TBL2[zone]; } - if (calc_bytes < byte_p_blk) { calc_bytes = 0; } else { @@ -43,41 +37,36 @@ void leoTranslate(void) { } calc_blks++; lba++; - if ((calc_bytes != 0) && (lba >= 0x10DC)) { LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - flag = false; + flag = 0; } - LEOcur_command->data.readWrite.buffPtr = (void*)calc_blks; + LEOcur_command->data.readwrite.buff_ptr = BADCASTP calc_blks; } else { - calc_blks = LEOcur_command->data.readWrite.transferBlks; - + calc_blks = LEOcur_command->data.readwrite.xfer_blks; while (calc_blks != 0) { - if (flag || (LEOVZONE_TBL[LEOdisk_type][vzone] == lba)) { + if ((flag != 0) || (LEOVZONE_TBL[LEOdisk_type][vzone] == lba)) { vzone = leoLba_to_vzone(lba); zone = LEOVZONE_PZONEHD_TBL[LEOdisk_type][vzone]; - if (zone >= 8) { + if (zone > 7) { zone -= 7; } byte_p_blk = LEOBYTE_TBL2[zone]; } - calc_bytes += byte_p_blk; calc_blks--; lba++; - if ((calc_blks != 0) && (lba >= 0x10DC)) { LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - flag = false; + flag = 0; } - LEOcur_command->data.readWrite.buffPtr = (void*)calc_bytes; + LEOcur_command->data.readwrite.buff_ptr = BADCASTP calc_bytes; } - LEOcur_command->header.status = LEO_STATUS_GOOD; } diff --git a/src/libleo/leo/leoutil.c b/src/n64dd/libleo/leoutil.c similarity index 97% rename from src/libleo/leo/leoutil.c rename to src/n64dd/libleo/leoutil.c index e90ea1f678e..5c4e2a0a081 100644 --- a/src/libleo/leo/leoutil.c +++ b/src/n64dd/libleo/leoutil.c @@ -1,8 +1,6 @@ -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" -#include "array_count.h" #include "ultra64.h" +#include "ultra64/leo_internal.h" +#include "array_count.h" u16 leoLba_to_phys(u32 lba) { u16 vzone_num; diff --git a/src/libleo/leo/leowrite.c b/src/n64dd/libleo/leowrite.c similarity index 63% rename from src/libleo/leo/leowrite.c rename to src/n64dd/libleo/leowrite.c index 91b2163f0be..f9ff9a30c50 100644 --- a/src/libleo/leo/leowrite.c +++ b/src/n64dd/libleo/leowrite.c @@ -1,54 +1,45 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" -extern u16 LEOrw_flags; // N.B. NOT volatile in this file! +extern u16 LEOrw_flags; void leoWrite(void) { u32 message; u32 start_lba; u32 xfer_blk; - u32 write_bytes = 0; - u8 retry_count = 0; + u32 temp_v1; - start_lba = LEOcur_command->data.readWrite.lba; - xfer_blk = LEOcur_command->data.readWrite.transferBlks; - if (((start_lba | xfer_blk) & 0xFFFF0000) != 0) { + start_lba = LEOcur_command->data.readwrite.lba; + xfer_blk = LEOcur_command->data.readwrite.xfer_blks; + if ((((u32)(LEOcur_command->data.readwrite.lba | xfer_blk) >> 16) != 0)) { goto invalid_lba; } - - start_lba += 0x18; - if ((start_lba >= 0x10DC) || (start_lba + xfer_blk > 0x10DC)) { + temp_v1 = start_lba + 0x18; + if ((temp_v1 >= 0x10DC) || ((u32)(temp_v1 + xfer_blk) >= 0x10DD)) { invalid_lba: LEOcur_command->header.sense = LEO_SENSE_LBA_OUT_OF_RANGE; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - - if (start_lba < LEORAM_START_LBA[LEOdisk_type]) { + if (temp_v1 < (u16)LEORAM_START_LBA[LEOdisk_type]) { LEOcur_command->header.sense = LEO_SENSE_WRITE_PROTECT_ERROR; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - if (xfer_blk == 0) { LEOcur_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; LEOcur_command->header.status = LEO_STATUS_GOOD; return; } - LEOrw_flags = 0x8000; - LEOtgt_param.lba = start_lba; + LEOtgt_param.lba = temp_v1; osStartThread(&LEOinterruptThread); osRecvMesg(&LEOcontrol_que, (OSMesg*)&message, OS_MESG_BLOCK); - if (message != 0x90000) { - LEOcur_command->header.sense = message; + LEOcur_command->header.sense = (u8)message; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; return; } - LEOcur_command->header.sense = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; LEOcur_command->header.status = LEO_STATUS_GOOD; } diff --git a/src/libleo/api/seek.c b/src/n64dd/libleo/readdiskid.c similarity index 59% rename from src/libleo/api/seek.c rename to src/n64dd/libleo/readdiskid.c index 8abbb0f0a56..78a9883faef 100644 --- a/src/libleo/api/seek.c +++ b/src/n64dd/libleo/readdiskid.c @@ -1,24 +1,19 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" -s32 LeoSeek(LEOCmd* cmdBlock, u32 lba, OSMesgQueue* mq) { - if (!__leoActive) { +s32 LeoReadDiskID(LEOCmd* cmdBlock, LEODiskID* vaddr, OSMesgQueue* mq) { + if (__leoActive == 0) { return -1; } - cmdBlock->header.command = LEO_COMMAND_READ_DISK_ID; cmdBlock->header.reserve1 = 0; cmdBlock->header.control = 0; cmdBlock->header.reserve3 = 0; - cmdBlock->data.readWrite.lba = lba; - + cmdBlock->data.readwrite.lba = (u32)vaddr; if (mq != NULL) { cmdBlock->header.control |= LEO_CONTROL_POST; cmdBlock->header.post = mq; } - leoCommand(cmdBlock); - return LEO_ERROR_GOOD; + return 0; } diff --git a/src/n64dd/libleo/readwrite.c b/src/n64dd/libleo/readwrite.c new file mode 100644 index 00000000000..df6bb3e6d43 --- /dev/null +++ b/src/n64dd/libleo/readwrite.c @@ -0,0 +1,26 @@ +#include "ultra64.h" +#include "ultra64/leo_internal.h" + +s32 LeoReadWrite(LEOCmd* cmdBlock, s32 direction, u32 LBA, void* vAddr, u32 nLBAs, OSMesgQueue* mq) { + if (__leoActive == 0) { + return -1; + } + if (direction == 0) { + cmdBlock->header.command = LEO_COMMAND_READ; + } else { + cmdBlock->header.command = LEO_COMMAND_WRITE; + } + cmdBlock->header.reserve1 = 0; + if (mq != NULL) { + cmdBlock->header.control = LEO_CONTROL_POST; + } else { + cmdBlock->header.control = 0; + } + cmdBlock->header.reserve3 = 0; + cmdBlock->header.post = mq; + cmdBlock->data.readwrite.lba = LBA; + cmdBlock->data.readwrite.xfer_blks = nLBAs; + cmdBlock->data.readwrite.buff_ptr = vAddr; + leoCommand(cmdBlock); + return 0; +} diff --git a/src/libleo/leo/leorezero.c b/src/n64dd/libleo/rezero.c similarity index 87% rename from src/libleo/leo/leorezero.c rename to src/n64dd/libleo/rezero.c index 9e28bf13a3c..ebbf6899280 100644 --- a/src/libleo/leo/leorezero.c +++ b/src/n64dd/libleo/rezero.c @@ -1,7 +1,5 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" void leoRezero(void) { u8 sense_code; @@ -9,7 +7,6 @@ void leoRezero(void) { do { sense_code = leoRecal_w(); - if (sense_code == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { LEOtgt_param.cylinder = 0; LEOtgt_param.head = 0; @@ -17,12 +14,10 @@ void leoRezero(void) { LEOcur_command->header.status = LEO_STATUS_GOOD; return; } - if (leoChk_err_retry(sense_code) != 0) { break; } } while (retry_cntr--); - LEOcur_command->header.sense = sense_code; LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; } diff --git a/src/libleo/api/spdlmotor.c b/src/n64dd/libleo/spdlmotor.c similarity index 51% rename from src/libleo/api/spdlmotor.c rename to src/n64dd/libleo/spdlmotor.c index 21ef2b02235..1507c5512d5 100644 --- a/src/libleo/api/spdlmotor.c +++ b/src/n64dd/libleo/spdlmotor.c @@ -1,38 +1,31 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" s32 LeoSpdlMotor(LEOCmd* cmdBlock, u8 mode, OSMesgQueue* mq) { - if (!__leoActive) { + if (__leoActive == 0) { return -1; } - - cmdBlock->header.command = 8; + cmdBlock->header.command = LEO_COMMAND_START_STOP; cmdBlock->header.reserve1 = 0; - switch (mode) { - case LEO_MOTOR_ACTIVE: + case 0: cmdBlock->header.control = 1; break; - case LEO_MOTOR_STANDBY: - cmdBlock->header.control = 2; + case 1: + cmdBlock->header.control = LEO_CONTROL_STBY; break; - case LEO_MOTOR_SLEEP: + case 2: cmdBlock->header.control = 0; break; - case LEO_MOTOR_BRAKE: - cmdBlock->header.control = 4; + case 4: + cmdBlock->header.control = LEO_CONTROL_BRAKE; break; } - cmdBlock->header.reserve3 = 0; - if (mq != NULL) { cmdBlock->header.post = mq; - cmdBlock->header.control |= 0x80; + cmdBlock->header.control |= LEO_CONTROL_POST; } - leoCommand(cmdBlock); - return LEO_ERROR_GOOD; + return 0; } diff --git a/src/libleo/api/testunitready.c b/src/n64dd/libleo/testunitready.c similarity index 52% rename from src/libleo/api/testunitready.c rename to src/n64dd/libleo/testunitready.c index 2116bc9e2af..1fd190fdc5a 100644 --- a/src/libleo/api/testunitready.c +++ b/src/n64dd/libleo/testunitready.c @@ -1,28 +1,21 @@ #include "ultra64.h" -#include "ultra64/leo.h" -#include "ultra64/leoappli.h" -#include "ultra64/leodrive.h" +#include "ultra64/leo_internal.h" -s32 LeoTestUnitReady(u8* status) { +s32 LeoTestUnitReady(LEOStatus* status) { volatile LEOCmdTestUnitReady cmdBlock; - if (!__leoActive) { + if (__leoActive == 0) { return -1; } - if (IO_READ(PI_STATUS_REG) & PI_STATUS_DMA_BUSY) { - return LEO_ERROR_BUSY; + return 8; } - - cmdBlock.header.command = 3; + cmdBlock.header.command = LEO_COMMAND_TEST_UNIT_READY; cmdBlock.header.reserve1 = 0; cmdBlock.header.control = 0; cmdBlock.header.reserve3 = 0; - leoCommand((void*)&cmdBlock); - - while (cmdBlock.header.status == 8) {} - + while (cmdBlock.header.status == LEO_STATUS_BUSY) {} *status = cmdBlock.test; - return GET_ERROR(cmdBlock); + return (s32)cmdBlock.header.sense; } diff --git a/src/n64dd/n64dd_0.c b/src/n64dd/n64dd_0.c new file mode 100644 index 00000000000..371b6e2e46d --- /dev/null +++ b/src/n64dd/n64dd_0.c @@ -0,0 +1,554 @@ +#include "ultra64.h" +#include "n64dd.h" +#include "n64dd_internal.h" +#include "libc64/sleep.h" +#include "array_count.h" +#include "fault.h" +#include "gfx.h" +#include "stackcheck.h" +#include "sys_freeze.h" +#include "versions.h" +#include "audio.h" +#include "line_numbers.h" + +#pragma increment_block_number "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + +s32 func_801C8310(struct_801E1598* arg0); + +void* D_801D36D0 = gN64DDDiskReadTemporaryBuffer; +s32 (*D_801D36D4)(struct_801E1598*) = func_801C8310; + +struct_801C79DC D_801DA410; +struct_801DA5C8 D_801DA4B0; +struct_801DA5C8* D_801DA5C8; +struct_801DA5D0 D_801DA5D0; +OSMesgQueue D_801DA600; +OSMesgQueue D_801DA618; +OSMesg D_801DA630; +OSMesg D_801DA634; +vu8 D_801DA638; +volatile OSTime D_801DA640; +s32 D_801DA648; +s32 D_801DA64C; +s32 D_801DA650; +s32 D_801DA654; +OSThread D_801DA658; +STACK(D_801DA808, 0x1000); +StackEntry D_801DB808; +STACK(D_801DB828, 0x1000); +StackEntry D_801DC828; +s32 D_801DC844; + +u32 func_801C6E80(void) { +#if OOT_NTSC + return LeoDriveExist(); +#else + return 0; +#endif +} + +void func_801C6EA0(Gfx** gfxP) { +} + +void func_801C776C(void) { + if (D_80121214 == 0) { + func_800F6BDC(); + D_80121214 = 1; + } +} + +s32 func_801C77B0(void) { + return D_80121214 != 0; +} + +s32 func_801C77C8(void) { + if (D_80121214 != 0) { + return 1; + } + return 1; +} + +void func_801C77F0(void) { + func_801C776C(); + while (func_801C77C8() == 0) { + Sleep_Usec(1000000 / 60); + } +} + +void func_801C7838(void) { + if (D_80121214 != 0) { + D_80121214 = 0; + func_800F6B3C(); + } +} + +s32 func_801C786C(void) { + if (D_80121213 == 0) { + return 0; + } + D_80121213 = 0; + return 1; +} + +void func_801C7898(void) { + while (func_801C786C() == 0) { + Sleep_Usec(1000000 / 60); + } +} + +void func_801C78D8(void) { + if (D_80121213 != 0) { + Fault_AddHungupAndCrash("../z_n64dd.c", LN2(503, 551, 573)); + } + D_80121213 = 1; +} + +s32 func_801C7924(void) { + s32 (*p)(struct_801DA5D0*); + + D_801DA5D0.unk0 = 5; + p = func_801C8860; + return p(&D_801DA5D0); +} + +s32 func_801C7958(void) { + s32 sp1C; + s32 (*p)(struct_801DA5D0*); + +#if OOT_VERSION <= NTSC_1_1 + if (1) {} +#endif + + D_801DA5D0.unk0 = 0xA; + p = func_801C8860; + sp1C = p(&D_801DA5D0); + if (sp1C < 0) { + Freeze_CurrentThread(); + } + return sp1C; +} + +s32 func_801C79A4(void) { + return D_801DA648 == 1; +} + +s32 func_801C70FC(void) { + return func_801C79A4(); +} + +void func_801C79DC(void* arg) { + static void* D_801DC848; + + struct_801C79DC* arg0 = arg; + OSMesg sp58; + s32 var_s0; + void* temp_v0; + + sp58 = NULL; + arg0->unk98 = &gIrqMgr; + osCreateMesgQueue(&arg0->unk78, arg0->unk0, ARRAY_COUNT(arg0->unk0)); + IrqMgr_AddClient(arg0->unk98, &arg0->unk90, &arg0->unk78); + var_s0 = 0; + while (var_s0 == 0) { + osRecvMesg(&arg0->unk78, &sp58, OS_MESG_BLOCK); + switch (*(s16*)sp58) { + case 1: + temp_v0 = osViGetNextFramebuffer(); + if (D_801DC848 != temp_v0) { + D_801DC848 = temp_v0; + D_801DA638 = 1; + } + func_801C9318(); + break; + case 4: + LeoReset(); + break; + case 3: + var_s0 = 1; + break; + } + } + IrqMgr_RemoveClient(arg0->unk98, &arg0->unk90); +} + +LEODiskID D_801DC850; +s32 D_801DC870; + +#if OOT_VERSION > NTSC_1_0 +void func_801C7B28(void) { + s32 temp_v1_2; + + if (D_801DA640 != 0) { + temp_v1_2 = OS_CYCLES_TO_USEC(osGetTime() - D_801DA640); + if ((1000000 - temp_v1_2) > 0) { + Sleep_Usec(1000000 - temp_v1_2); + } + } +} +#endif + +void func_801C7268(void) { + s32 pad; + s32 sp18; + + sp18 = func_801C77B0(); + if (sp18 == 0) { + func_801C77F0(); + } + D_801DA638 = 1; + D_801DA640 = 0; + if (func_801C7924() == 1) { + func_801C7958(); + } else if (D_801DA648 != 0) { + D_801DA648 = 0; + } +#if OOT_VERSION == NTSC_1_0 + if (D_801DA640 != 0) { + s32 temp_v1_2; + + temp_v1_2 = OS_CYCLES_TO_USEC(osGetTime() - D_801DA640); + + (void)(osGetTime() - D_801DA640); + (void)OS_CYCLES_TO_USEC(osGetTime() - D_801DA640); + (void)OS_CYCLES_TO_USEC(osGetTime() - D_801DA640); + + if ((1000000 - temp_v1_2) > 0) { + Sleep_Usec(1000000 - temp_v1_2); + } + } +#else + if ((D_801D3728 == 1) || (D_801E17E0 == 1) || (D_801E17E4 == 1)) { + D_801DA640 = osGetTime(); + } + func_801C7B28(); +#endif + if (sp18 == 0) { + func_801C7838(); + } +} + +void func_801C7CB8(u16* arg0) { + u16* var_v0; + + var_v0 = arg0; + while (var_v0 < (arg0 + (SCREEN_WIDTH * SCREEN_HEIGHT))) { + *var_v0 = 1; + var_v0++; + } +} + +void func_801C7CEC(s32 arg0, s32 arg1, s32 arg2) { + s32 sp2C; + + if ((arg0 != 0) || (arg1 != 0) || (arg2 != 0)) { + sp2C = (intptr_t)osViGetNextFramebuffer() + 0x20000000; + if ((sp2C & 0xFFFFFF) != 0) { + if (D_801DA638 != 0) { + D_801DA638 = 0; + func_801C7CB8((u16*)sp2C); + D_801DA640 = osGetTime(); + } + if (arg0 != 0) { + func_801CAA60(BADCASTP arg0, 0x60, 0x20, 0xC0, 0x10, 0xB, BADCASTP sp2C, 0x140); + } + if (arg1 != 0) { + func_801CAA60(BADCASTP arg1, 0, 0x50, 0x140, 0x40, 0xB, BADCASTP sp2C, 0x140); + } + if (arg2 != 0) { + func_801CAA60(BADCASTP arg2, 0, 0xB0, 0x140, 0x20, 0xB, BADCASTP sp2C, 0x140); + } +#if OOT_VERSION <= NTSC_1_1 + osViBlack(0); +#endif + } + } +} + +void func_801C7E34(s32 arg0, s32 arg1, s32 arg2) { + if ((arg0 == 0) && (arg1 == 0) && (arg2 == 0)) { + return; + } + if (D_801DA638) {} + if (arg0 != 0) { + D_801DA64C = arg0; + } + if (arg1 != 0) { + D_801DA650 = arg1; + } + if (arg2 != 0) { + D_801DA654 = arg2; + } + func_801C7CEC(arg0, arg1, arg2); +} + +void func_801C7E94(void) { + Sleep_Msec(100); + func_801C7CEC(D_801DA64C, D_801DA650, D_801DA654); +} + +s32 func_801C7658(void) { + if (D_80121212 != 0) { + return 0; + } +#if OOT_VERSION <= NTSC_1_1 + StackCheck_Init(&D_801DB808, D_801DA808, STACK_TOP(D_801DA808), 0, 0x100, "ddmsg"); + osCreateThread(&D_801DA658, 9, func_801C79DC, &D_801DA410, STACK_TOP(D_801DA808), 0xD); + osStartThread(&D_801DA658); +#endif + osCreateMesgQueue(&D_801DA600, &D_801DA630, 1); + osCreateMesgQueue(&D_801DA618, &D_801DA634, 1); + StackCheck_Init(&D_801DC828, D_801DB828, STACK_TOP(D_801DB828), 0, 0x100, "n64dd"); + D_801DA5D0.unk1C_1.unk1C = &D_801DA600; + D_801DA5D0.unk1C_1.unk20 = &D_801DA618; + D_801DA5D0.unk1C_1.unk24 = 8; + D_801DA5D0.unk1C_1.unk28 = STACK_TOP(D_801DB828); + D_801DA5D0.unk1C_1.unk2C = 0xD; + D_801DA5D0.unk0 = 1; + (&func_801C8860)(&D_801DA5D0); + D_80121213 = 1; + func_801C7898(); + D_801DA5D0.unk0 = 2; + D_801DA5D0.unk10 = 6; + D_801DA5D0.unk14 = DmaMgr_DmaFromDriveRom; + D_801DA5D0.unkC = &func_801C7E34; + (&func_801C8860)(&D_801DA5D0); + D_801DA5D0.unk0 = 0xD; + (&func_801C8860)(&D_801DA5D0); +#if OOT_VERSION > NTSC_1_1 + StackCheck_Init(&D_801DB808, D_801DA808, STACK_TOP(D_801DA808), 0, 0x100, "ddmsg"); + osCreateThread(&D_801DA658, 9, func_801C79DC, &D_801DA410, STACK_TOP(D_801DA808), 0xD); + osStartThread(&D_801DA658); +#endif + return 0; +} + +s32 func_801C7818(void) { + s32 (*p)(struct_801DA5D0*) = func_801C8860; + +#if OOT_VERSION > NTSC_1_0 + D_801DA638 = 1; + D_801DA640 = 0; +#endif + D_801DA5D0.unk0 = 0xC; + p(&D_801DA5D0); + while (func_801C8A24() == 0) { + Sleep_Usec(1000000 / 60); + } +#if OOT_VERSION > NTSC_1_0 + if ((D_801D3728 == 1) || (D_801E17E0 == 1) || (D_801E17E4 == 1)) { + D_801DA640 = osGetTime(); + } + func_801C7B28(); +#endif + if (func_801C8A24() != 2) { + func_801C7E94(); + Freeze_CurrentThread(); + return -3; + } + func_801C78D8(); + D_80121212 = 1; + return 0; +} + +s32 func_801C81AC(void) { + s32 var_v1; + + var_v1 = func_801C7658(); + if (var_v1 == 0) { + var_v1 = func_801C7818(); + } + return var_v1; +} + +void func_801C81E4(void) { + D_801DA5D0.unk0 = 0; + (&func_801C8860)(&D_801DA5D0); +} + +void func_801C8214(s32 arg0, void* arg1, s32 arg2) { + s32 (*p)(struct_801DA5D0*) = func_801C8860; + + D_801DA5D0.unk18 = arg1; + D_801DA5D0.unk1C_3_4.unk1C = arg0; + D_801DA5D0.unk1C_3_4.unk20 = arg2; + D_801DA5D0.unk0 = 3; + p(&D_801DA5D0); + osGetTime(); + D_801DA5D0.unk0 = 6; + while (p(&D_801DA5D0) != 0) { + Sleep_Usec(1000000 / 60); + } + D_801DA5D0.unk0 = 7; + if (p(&D_801DA5D0) != 0) { + Freeze_CurrentThread(); + } +} + +void func_801C82C0(void* arg0, s32 arg1, s32 arg2) { + D_801DA5D0.unk18 = arg0; + D_801DA5D0.unk1C_3_4.unk1C = arg1; + D_801DA5D0.unk1C_3_4.unk20 = arg2; + D_801DA5D0.unk0 = 4; + (&func_801C8860)(&D_801DA5D0); +} + +void func_801C8304(LEODiskID* arg0) { +} + +s32 func_801C8310(struct_801E1598* arg0) { + func_801C8304(&arg0->unk38); + if (D_801DC870 == 0) { + if ( +#if OOT_NTSC + (bcmp(&arg0->unk38, "EZLJ", 4) == 0) || (bcmp(&arg0->unk38, "EZLE", 4) == 0) +#else + (bcmp(&arg0->unk38, "EZLP", 4) == 0) +#endif + ) { + D_801DC850 = arg0->unk38; + D_801DC870 = 1; + D_801DA648 = 1; + } else { + D_801DA648 = 2; + } + } else if (bcmp(&D_801DC850, &arg0->unk38, 0x20) == 0) { + D_801DA648 = 1; + } else { + D_801DA648 = 2; + } + return D_801DA648 == 1; +} + +s32 func_801C843C(s32 arg0, s32* arg1, s32* arg2) { + s32 sp2C; + s32 pad; + u32 sp24; + s32 sp20; + s32 v; + + v = LeoByteToLBA(1, arg0 + 1, &sp2C); + if (v != 0) { + return v; + } + sp24 = sp2C - 1; + if (sp2C == 1) { + sp20 = 0; + } else { + v = LeoLBAToByte(1, sp24, &sp20); + if (v != 0) { + return v; + } + } + *arg1 = sp24 + 1; + *arg2 = arg0 - sp20; + return 0; +} + +s32 func_801C84E0(s32 arg0) { + s32 sp1C; + + if (LeoLBAToByte(arg0, 1, &sp1C) == 0) { + return sp1C; + } + return 0; +} + +void func_801C7C1C(void* arg0, s32 arg1, s32 arg2) { + s32 sp44; + s32 sp40; + s32 sp3C; + s32 sp38; + void* sp34; + s32 temp_v0; + s32 var_s0; + s32 var_s1; + + func_801C7898(); + func_801C77F0(); + D_801DA638 = 1; + D_801DA640 = 0; + func_801C843C(arg1, &sp44, &sp3C); + func_801C843C(arg1 + arg2, &sp40, &sp38); + sp34 = D_801D36D0; + if (sp44 == sp40) { + func_801C8214(sp44, sp34, func_801C84E0(sp44)); + bcopy((char*)sp34 + sp3C, arg0, arg2); + } else { + var_s1 = 0; + func_801C8214(sp44, sp34, func_801C84E0(sp44)); + bcopy((char*)sp34 + sp3C, arg0, func_801C84E0(sp44) - sp3C); + temp_v0 = sp44 + 1; + if (temp_v0 < sp40) { + var_s0 = temp_v0; + if (temp_v0 < sp40) { + do { + var_s1 += func_801C84E0(var_s0); + var_s0 += 1; + } while (var_s0 < sp40); + } + func_801C8214(sp44 + 1, (void*)((func_801C84E0(sp44) + (s32)arg0) - sp3C), var_s1); + } + if (sp38 > 0) { + func_801C8214(sp40, sp34, func_801C84E0(sp40)); + bcopy(sp34, (void*)(((func_801C84E0(sp44) + (s32)arg0) - sp3C) + var_s1), sp38); + } + } +#if OOT_VERSION == NTSC_1_0 + if (D_801DA640 != 0) { + s32 temp_v1_2; + + temp_v1_2 = OS_CYCLES_TO_USEC(osGetTime() - D_801DA640); + if ((1000000 - temp_v1_2) > 0) { + Sleep_Usec(1000000 - temp_v1_2); + } + } +#else + func_801C7B28(); +#endif + func_801C78D8(); + func_801C7838(); +} + +void func_801C7E78(void) { +} + +s32 func_801C86F8(void) { + s32 sp24; + s32 sp20; + s32 pad; + void* sp18; + + if (D_801DA5C8 != NULL) { + return -1; + } + D_801DA5C8 = &D_801DA4B0; + func_801C7C1C(D_801DA5C8, 0x1060, sizeof(*D_801DA5C8)); + sp24 = D_801DA5C8->unk4 - D_801DA5C8->unk0; + sp20 = (char*)D_801DA5C8->unkC - (char*)D_801DA5C8->unk8; + sp18 = (char*)D_801DA5C8->unk8 + sp24; + func_801C7C1C(D_801DA5C8->unk8, D_801DA5C8->unk0, sp24); + bzero(sp18, sp20 - sp24); + func_800AD4C0(D_801DA5C8->unk10); + return 0; +} + +s32 func_801C879C(void) { + if (D_801DA5C8 == NULL) { + return -1; + } + func_800AD51C(); + bzero(D_801DA5C8->unk8, (char*)D_801DA5C8->unkC - (char*)D_801DA5C8->unk8); + bzero(D_801DA5C8, sizeof(*D_801DA5C8)); + D_801DA5C8 = NULL; + return 0; +} + +void n64dd_SetDiskVersion(s32 arg0) { + if (arg0 != 0) { + if (D_801DA5C8 == 0) { + func_801C86F8(); + } + } else if (D_801DA5C8 != 0) { + func_801C879C(); + } +} diff --git a/src/n64dd/n64dd_data_buffer.c b/src/n64dd/n64dd_1.c similarity index 87% rename from src/n64dd/n64dd_data_buffer.c rename to src/n64dd/n64dd_1.c index 00a09a69b61..4b05443c758 100644 --- a/src/n64dd/n64dd_data_buffer.c +++ b/src/n64dd/n64dd_1.c @@ -1,4 +1,6 @@ +#include "ultra64.h" #include "n64dd.h" +#include "n64dd_internal.h" /** * Buffer used during the process of reading from the disk diff --git a/src/n64dd/n64dd_2.c b/src/n64dd/n64dd_2.c new file mode 100644 index 00000000000..d4e2c19c5e9 --- /dev/null +++ b/src/n64dd/n64dd_2.c @@ -0,0 +1,334 @@ +#include "ultra64.h" +#include "n64dd.h" +#include "n64dd_internal.h" +#include "z_locale.h" + +#pragma increment_block_number "" + +void func_801C8A4C(struct_801E1598*); +void func_801C8B8C(struct_801E1598*); +void func_801C8C00(struct_801E1598*); +void func_801C8C74(struct_801E1598*); +s32 func_801C9A50(struct_801E1598*); +s32 func_801C9AD0(struct_801E1598*); +s32 func_801C9C34(struct_801E1598*); +void func_801C8DB4(void); +void func_801C8DD8(OSMesgQueue*, OSMesgQueue*, s32, void*, s32); +void func_801C8E98(void (*)(s32, s32, s32), s32, void (*)(void*, uintptr_t, size_t)); +void func_801C8EEC(void*, s32, s32, u8); +s8 func_801C8FD0(void); +s32 func_801C9020(void); +s32 func_801C905C(void); +s32 func_801C90A4(void); +s32 func_801C90BC(void); +s32 func_801C9114(void); +s32 func_801C916C(void); + +s32 D_801D36E0 = 0; +s32 D_801D36E4 = 0; +struct { + void (*unk0)(struct_801E1598*); + s32 (*unk4)(struct_801E1598*); +} D_801D36E8[5] = { + { func_801C8A4C, func_801C9A50 }, { func_801C8B8C, func_801C9AD0 }, { func_801C8C00, func_801C9AD0 }, + { func_801C8C74, func_801C9BA4 }, { func_801C8C74, func_801C9C34 }, +}; +s32 D_801D3710 = 0; + +struct_801E1590 D_801E1590; +struct_801E1598 D_801E1598; +OSMesg D_801E1608; +OSMesg D_801E1610[8]; +OSThread D_801E1630; + +s32 func_801C8860(struct_801DA5D0* arg0) { + s32 temp_v0_2; + s8 temp_v0; + + switch (arg0->unk0) { + case 0: + if (func_801C90A4() != 0) { + return 1; + } + func_801C8DB4(); + return 0; + case 1: + func_801C8DD8(arg0->unk1C_1.unk1C, arg0->unk1C_1.unk20, arg0->unk1C_1.unk24, arg0->unk1C_1.unk28, + arg0->unk1C_1.unk2C); + return 0; + case 2: + func_801C8E98(arg0->unkC, arg0->unk10, arg0->unk14); + return 0; + case 3: + if (func_801C90A4() != 0) { + return 1; + } + func_801C8EEC(arg0->unk18, arg0->unk1C_3_4.unk1C, arg0->unk1C_3_4.unk20, 1); + return 0; + case 4: + if (func_801C90A4() != 0) { + return 1; + } + func_801C8EEC(arg0->unk18, arg0->unk1C_3_4.unk1C, arg0->unk1C_3_4.unk20, 2); + return 0; + case 5: + temp_v0 = func_801C8FD0(); + arg0->unk8 = temp_v0; + return temp_v0 & 0xFF; + case 7: + return func_801C905C(); + case 6: + return func_801C90A4(); + case 8: + temp_v0_2 = func_801C9020(); + arg0->unk4 = temp_v0_2; + return temp_v0_2; + case 9: + return func_801C90BC(); + case 10: + return func_801C9114(); + case 11: + return func_801C916C(); + case 12: + D_801D3720 = 0; + break; + case 13: + D_801D3720 = 1; + break; + } + return 0; +} + +void func_801C89FC(s32 arg0) { + if (arg0 != 0) { + D_801D36E0 = 1; + return; + } + D_801D36E0 = 2; +} + +s32 func_801C8A24(void) { + return D_801D36E0; +} + +s32 func_801C8A34(void) { + return D_801D36E4 == 1; +} + +void func_801C8A4C(struct_801E1598* arg0) { + s32 temp_v0; + + osCreateMesgQueue(&arg0->unk1C, &D_801E1608, 1); + if (gCurrentRegion == 1) { + arg0->unk68 = LeoCJCreateLeoManager(0x95, 0x96, D_801E1610, 8); + } else { + arg0->unk68 = LeoCACreateLeoManager(0x95, 0x96, D_801E1610, 8); + } + temp_v0 = arg0->unk68; + if ((temp_v0 == 0x29) || (temp_v0 == 0)) { + D_801D36E4 = 1; + } +} + +void func_801C8AF8(struct_801E1598* arg0) { + LEOCmd sp1C; + + LeoReadDiskID(&sp1C, &arg0->unk38, &arg0->unk1C); + osRecvMesg(&arg0->unk1C, (OSMesg*)&arg0->unk68, OS_MESG_BLOCK); +} + +void func_801C8B40(struct_801E1598* arg0) { + LEOCmd sp1C; + + LeoSpdlMotor(&sp1C, 4, &arg0->unk1C); + osRecvMesg(&arg0->unk1C, (OSMesg*)&arg0->unk68, OS_MESG_BLOCK); +} + +void func_801C8B8C(struct_801E1598* arg0) { + s32 sp34; + s32 sp30; + OSMesgQueue* sp28; + + sp30 = arg0->unk5C; + if (LeoByteToLBA(sp30, (u32)arg0->unk60, &sp34) == 0) { + sp28 = &arg0->unk1C; + LeoReadWrite(&arg0->unk0, 0, (u32)sp30, arg0->unk58, (u32)sp34, sp28); + osRecvMesg(sp28, BADCASTP & arg0->unk68, OS_MESG_BLOCK); + } +} + +void func_801C8C00(struct_801E1598* arg0) { + s32 sp34; + void* sp30; + OSMesgQueue* sp28; + + sp30 = arg0->unk58; + if (LeoByteToLBA((s32)sp30, (u32)arg0->unk60, &sp34) == 0) { + sp28 = &arg0->unk1C; + LeoReadWrite(&arg0->unk0, 1, (u32)sp30, (void*)arg0->unk5C, (u32)sp34, sp28); + osRecvMesg(sp28, (void**)&arg0->unk68, OS_MESG_BLOCK); + } +} + +void func_801C8C74(struct_801E1598* arg0) { + arg0->unk68 = 9; +} + +void func_801C8C84(struct_801E1598* arg0) { + s32 (*temp_s2)(struct_801E1598*); + s32 temp_v0_2; + void (*temp_s1)(struct_801E1598*); + + arg0->unk68 = -1; + if ((func_801C8A34() != 0) || ((u8)arg0->unk64 == 0)) { + arg0->unk66 = 1; + temp_s1 = D_801D36E8[(u8)arg0->unk64].unk0; + temp_s2 = D_801D36E8[(u8)arg0->unk64].unk4; + do { + temp_s1(arg0); + temp_v0_2 = temp_s2(arg0); + } while (temp_v0_2 == 2); + arg0->unk6C = temp_v0_2; + if ((u8)arg0->unk64 == 0) { + func_801C89FC(temp_v0_2); + } + arg0->unk66 = 0; + } +} + +void func_801C8D34(void* arg0) { + void* sp24; + + while (true) { + osRecvMesg(D_801E1590.unk0, &sp24, OS_MESG_BLOCK); + func_801C8C84(sp24); + osSendMesg(D_801E1590.unk4, NULL, OS_MESG_BLOCK); + } +} + +void func_801C8DB4(void) { + osDestroyThread(&D_801E1630); +} + +void func_801C8DD8(OSMesgQueue* arg0, OSMesgQueue* arg1, s32 arg2, void* arg3, s32 arg4) { + D_801E1590.unk0 = arg0; + D_801E1590.unk4 = arg1; + osCreateThread(&D_801E1630, arg2, func_801C8D34, NULL, arg3, arg4); + osStartThread(&D_801E1630); +} + +void func_801C8E50(struct_801E1598* arg0, s32 arg1) { + if (arg1 == 1) { + func_801C8C84(arg0); + return; + } + osSendMesg(D_801E1590.unk0, arg0, OS_MESG_BLOCK); +} + +void func_801C8E98(void (*arg0)(s32, s32, s32), s32 arg1, void (*arg2)(void*, uintptr_t, size_t)) { + struct_801E1598* ptr = &D_801E1598; + + func_801CA3C0(arg1, arg2); + D_801D3734 = BADCASTP arg0; + ptr->unk64 = 0; + ptr->unk65 = 0; + func_801C8E50(ptr, 0); +} + +void func_801C8EEC(void* arg0, s32 arg1, s32 arg2, u8 arg3) { + struct_801E1598* var = &D_801E1598; + + if (D_801D3710 == 1) { + D_801D3710 = 0; + var->unk64 = 4; + func_801C8E50(var, 1); + if ((D_801E1598.unk6C == 3) || (D_801E1598.unk6C == 4)) { + return; + } + } + var->unk58 = arg0; + var->unk5C = arg1; + var->unk60 = arg2; + var->unk64 = arg3; + func_801C8E50(var, 0); +} + +s32 func_801C8F9C(struct_801E1598* arg0) { + u8 sp1F; + + arg0->unk68 = LeoTestUnitReady(&sp1F); + return (sp1F & 1) == 0; +} + +s8 func_801C8FD0(void) { + s32 temp_v0; + + temp_v0 = func_801C8F9C(&D_801E1598); + if (D_801E1598.unk68 == 8) { + return 0; + } + if (temp_v0 == 0) { + return 2; + } + return 1; +} + +s32 func_801C9020(void) { + if ((func_801C90A4() == 0) && (D_801E1598.unk68 != 0)) { + return D_801E1598.unk68; + } + return -1; +} + +s32 func_801C905C(void) { + s32* new_var; + + new_var = &D_801E1598.unk6C; + if ((func_801C90A4() == 0) && ((*new_var == 3) || (*new_var == 4))) { + return D_801E1598.unk68; + } + return 0; +} + +s32 func_801C90A4(void) { + return D_801E1598.unk66 == 1; +} + +s32 func_801C90BC(void) { + D_801E1598.unk64 = 3; + func_801C8E50(&D_801E1598, 1); +#if OOT_VERSION > NTSC_1_0 + D_801D3710 = 0; +#endif + if ((D_801E1598.unk6C == 3) || (D_801E1598.unk6C == 4)) { + return -1; + } else { + return D_801E1598.unk6C == 0; + } +} + +s32 func_801C9114(void) { + D_801E1598.unk64 = 4; + func_801C8E50(&D_801E1598, 1); +#if OOT_VERSION > NTSC_1_0 + D_801D3710 = 0; +#endif + if ((D_801E1598.unk6C == 3) || (D_801E1598.unk6C == 4)) { + return -1; + } else { + return D_801E1598.unk6C == 0; + } +} + +s32 func_801C916C(void) { + s32 var_v1; + + if (LeoDriveExist() != 0) { + var_v1 = 8; + } else { + var_v1 = 0; + } + if (var_v1 == 0) {} + D_801E1598.unk68 = var_v1; + return var_v1 == 0; +} diff --git a/src/n64dd/n64dd_3.c b/src/n64dd/n64dd_3.c new file mode 100644 index 00000000000..543d362114b --- /dev/null +++ b/src/n64dd/n64dd_3.c @@ -0,0 +1,387 @@ +#include "ultra64.h" +#include "n64dd.h" +#include "n64dd_internal.h" +#include "libc64/sleep.h" +#include "attributes.h" + +// TODO move to a header once we can easily fix bss orderings +extern struct_801E1590 D_801E1590; + +s32 D_801D3720 = 0; +void* D_801D3724 = NULL; +s32 D_801D3728 = 0; +void* D_801D372C = NULL; +void* D_801D3730 = NULL; +void (*D_801D3734)(void*, void*, void*) = NULL; + +s32 D_801E17E0; +s32 D_801E17E4; + +void func_801C91B0(s32 arg0) { + D_801D3724 = func_801CA698(arg0); + D_801D3728 = 1; +} + +void func_801C91E4(void) { + if (D_801D3728 == 1) { + D_801D3724 = func_801CA730(); + D_801D3728 = 0; + } +} + +void func_801C9228(s32 arg0) { + D_801D372C = func_801CA800(arg0); + D_801E17E0 = 1; +} + +void func_801C925C(void) { + if (D_801E17E0 == 1) { + D_801D372C = func_801CA86C(); + D_801E17E0 = 0; + } +} + +void func_801C92A0(s32 arg0) { + D_801D3730 = func_801CA8A0(arg0); + D_801E17E4 = 1; +} + +void func_801C92D4(void) { + if (D_801E17E4 == 1) { + D_801D3730 = func_801CA8E0(); + D_801E17E4 = 0; + } +} + +void func_801C9318(void) { + u32 temp_v0; + UNK_PTR sp20; + UNK_PTR sp1C; + UNK_PTR sp18; + + osRecvMesg(D_801E1590.unk4, NULL, OS_MESG_NOBLOCK); + if ((D_801D3734 != NULL) && (D_801D3720 == 0)) { + temp_v0 = osSetIntMask(OS_IM_NONE); + sp20 = D_801D3724; + sp1C = D_801D372C; + sp18 = D_801D3730; + D_801D3724 = NULL; + D_801D372C = NULL; + D_801D3730 = NULL; + osSetIntMask(temp_v0); + D_801D3734(sp20, sp1C, sp18); + } +} + +void func_801C93C8(s32 arg0, s32 arg1, s32 arg2) { + func_801C91B0(arg0); + func_801C9228(arg1); + func_801C92A0(arg2); +} + +void func_801C9400(void) { + func_801C91E4(); + func_801C925C(); + func_801C92D4(); +} + +s32 func_801C9430(struct_801E1598* arg0) { + s32 temp_a1; + + temp_a1 = arg0->unk68; + if (((temp_a1 < 0x25) || (temp_a1 >= 0x29)) && (temp_a1 != 0x1F) && (temp_a1 != 0x20)) { + func_801C91B0(temp_a1); + func_801C9228(3); + } + LeoClearQueue(); + return 4; +} + +s32 func_801C948C(struct_801E1598* arg0) { + s32 var_s0; + + while (true) { + var_s0 = 0; + Sleep_Msec(60); + func_801C8B40(arg0); + switch (arg0->unk68) { + case 0x2A: + func_801C92D4(); + return 0; + case 0x22: + func_801C92D4(); + LeoClearQueue(); + return 3; + case 0: + func_801C92A0(6); + FALLTHROUGH; + case 0x23: + var_s0 = 1; + FALLTHROUGH; + default: + if (var_s0 == 0) { + func_801C92D4(); + return func_801C9430(arg0); + } + break; + } + var_s0 = 1; //! FAKE + } +} + +s32 func_801C955C(struct_801E1598* arg0) { + switch (arg0->unk68) { + case 34: + func_801C9400(); + LeoClearQueue(); + return 3; + case 2: + func_801C91B0(arg0->unk68); + func_801C92A0(5); + return 9; + case 0: + func_801C9400(); + return 0; + case 43: + if ((u8)arg0->unk65 == 0) { + func_801C9400(); + arg0->unk65 = 2; + return 1; + } + FALLTHROUGH; + default: + func_801C9400(); + return func_801C9430(arg0); + case 35: + return 9; + } +} + +s32 func_801C9630(struct_801E1598* arg0) { + s32 temp_v0; + + while (true) { + func_801C8AF8(arg0); + switch (arg0->unk68) { + case 0x31: + func_801C91B0(arg0->unk68); + func_801C9228(2); + return 5; + case 0x2A: + func_801C9400(); + return 5; + default: + temp_v0 = func_801C955C(arg0); + if (temp_v0 != 9) { + return temp_v0; + } + Sleep_Msec(60); + break; + } + } +} + +s32 func_801C96E0(struct_801E1598* arg0) { + s32 temp_v0; + + while (true) { + Sleep_Msec(60); + func_801C8AF8(arg0); + switch (arg0->unk68) { + case 0x23: + continue; + case 0x31: + func_801C91B0(arg0->unk68); + func_801C9228(2); + FALLTHROUGH; + case 0x2A: + func_801C92A0(4); + continue; + } + temp_v0 = func_801C955C(arg0); + if (temp_v0 != 9) { + return temp_v0; + } + } +} + +s32 func_801C978C(struct_801E1598* arg0) { + if (D_801D36D4 != NULL) { + return D_801D36D4(arg0); + } + return 1; +} + +s32 func_801C97C8(struct_801E1598* arg0) { + s32 temp_v0; + s32 temp_v0_2; + + while (true) { + temp_v0_2 = func_801C96E0(arg0); + if ((temp_v0_2 == 3) || (temp_v0_2 == 4)) { + return temp_v0_2; + } else if ((temp_v0_2 & 0xFFFFFFFF) == 0) { + if (func_801C978C(arg0) != 0) { + return 2; + } + func_801C9228(1); + temp_v0 = func_801C948C(arg0); + if (temp_v0 != 0) { + return temp_v0; + } + func_801C925C(); + } + } +} + +s32 func_801C9870(struct_801E1598* arg0) { + s32 temp_v0_3; + s32 var_s0; + + while (true) { + var_s0 = func_801C96E0(arg0); + if ((var_s0 == 3) || (var_s0 == 4)) { + return var_s0; + } + + if ((var_s0 & 0xFFFFFFFF) == 0) { + func_801C9400(); + temp_v0_3 = func_801C978C(arg0); + if (temp_v0_3 != 0) { + return 2; + } + + if (var_s0 == 3) {} + if (var_s0 == 4) {} + if (var_s0 == 3) {} + if (var_s0 == 4) {} + func_801C9228(1); + + var_s0 = func_801C948C(arg0); + if (var_s0 != 0) { + return var_s0; + } + func_801C925C(); + if (temp_v0_3 != 0) { + return var_s0; + } + } + } +} + +s32 func_801C9934(struct_801E1598* arg0) { + func_801C91B0(arg0->unk68); + func_801C9228(2); + return func_801C9870(arg0); +} + +s32 func_801C996C(struct_801E1598* arg0) { + func_801C91B0(arg0->unk68); + return func_801C9870(arg0); +} + +s32 func_801C999C(struct_801E1598* arg0) { + s32 temp_v0; + s32 var_s0 = 0; + + while (true) { + LeoResetClear(); + temp_v0 = func_801C9630(arg0); + if ((temp_v0 == 3) || (temp_v0 == 4)) { + return temp_v0; + } + if (temp_v0 != 1) { + if (temp_v0 == 0) { + return temp_v0; + } + return temp_v0; + } + if (1) {} + Sleep_Msec(250); + if (var_s0++ < 0x1E) { + } else { + return func_801C9430(arg0); + } + } +} + +s32 func_801C9A50(struct_801E1598* arg0) { + if (arg0->unk68 == 0x29) { + return func_801C9430(arg0); + } + if (osMemSize < 0x800000) { + func_801C93C8(0x2C, 0, 3); + return 4; + } + if (func_801C999C(arg0) == 0) { + D_801D3710 = 1; + } + return 0; +} + +s32 func_801C9AD0(struct_801E1598* arg0) { + s32 temp_v0; + + switch (arg0->unk68) { + case 23: + func_801C8F9C(arg0); + temp_v0 = func_801C948C(arg0); + if (temp_v0 != 0) { + return temp_v0; + } + func_801C9400(); + return 2; + case 2: + return func_801C97C8(arg0); + case 34: + LeoClearQueue(); + return 3; + case 49: + return func_801C9934(arg0); + case 47: + return func_801C9870(arg0); + case 42: + return func_801C996C(arg0); + case 0: + return 0; + case 35: + return 2; + default: + return func_801C9430(arg0); + } +} + +s32 func_801C9BA4(struct_801E1598* arg0) { + s32 temp_v0; + + while (true) { + if (1) {} + temp_v0 = func_801C9630(arg0); + if ((temp_v0 == 3) || (temp_v0 == 4) || (temp_v0 == 5)) { + return temp_v0; + } + if ((temp_v0 & 0xFFFFFFFF) == 0) { + if (func_801C978C(arg0) != 0) { + return 0; + } + return 7; + } + } +} + +s32 func_801C9C34(struct_801E1598* arg0) { + s32 v; + + while (true) { + v = func_801C9BA4(arg0); + if (v != 7) { + return v; + } + func_801C9228(1); + v = func_801C948C(arg0); + if (v != 0) { + return v; + } + func_801C925C(); + } +} diff --git a/src/n64dd/n64dd_4.c b/src/n64dd/n64dd_4.c new file mode 100644 index 00000000000..1bbc413cce0 --- /dev/null +++ b/src/n64dd/n64dd_4.c @@ -0,0 +1,230 @@ +#include "ultra64.h" +#include "n64dd.h" +#include "n64dd_internal.h" + +void (*D_801D3740)(void*, uintptr_t, size_t) = NULL; + +s32 D_801E17F0; + +int func_801C9CB0(const char* arg0) { + if (((*arg0 >= 0x8E) && (*arg0 < 0xFF)) || ((*arg0 != 0x8F) && (*arg0 != 0xA0))) { + arg0++; + return (*arg0 >= 0xA0) && (*arg0 < 0xFF); + } + return 0; +} + +int func_801C9D04(u8* arg0) { + if (((*arg0 >= 0x81) && (*arg0 < 0xA0)) || ((*arg0 >= 0xE0) && (*arg0 < 0xFD))) { + arg0++; + return (*arg0 >= 0x40) && (*arg0 < 0xFD) && (*arg0 != 0x7F); + } + return 0; +} + +void func_801C9D68(char* arg0, u16 arg1) { + arg0[0] = arg1 >> 8; + arg0[1] = arg1 & 0xFF; +} + +u16 func_801C9D84(u16 arg0) { + return arg0 - 0x8080; +} + +u16 func_801C9DA4(u16 arg0) { + u8 temp_a2; + u8 temp_v0; + + temp_v0 = (arg0 >> 8) & 0xFF; + temp_a2 = arg0 & 0xFF; + if (temp_v0 & 1) { + temp_a2 += 0x1F; + if (temp_a2 >= 0x7F) { + temp_a2 += 1; + } + } else { + temp_a2 += 0x7E; + } + temp_v0 = ((temp_v0 - 0x21) / 2) + 0x81; + if (temp_v0 >= 0xA0) { + temp_v0 += 0x40; + } + return (temp_v0 << 8) + temp_a2; +} + +void func_801C9E30(void* arg0, uintptr_t arg1, size_t arg2) { + if (D_801D3740 != NULL) { + D_801D3740(arg0, arg1, arg2); + } +} + +s32 func_801C9E60(const char* arg0) { + return LeoGetKAdr(func_801C9DA4(func_801C9D84(((arg0[0] << 8) | arg0[1])))) + 0xA0000; +} + +s32 func_801C9EAC(s32* arg0, int* arg1, int* arg2, int* arg3, char arg4) { + u16 v; + s32 temp_v0; + + v = arg4 - 0x20; + v += D_801E17F0 * 0xC0; + temp_v0 = LeoGetAAdr(v, arg1, arg2, arg3); + *arg0 = (temp_v0 - (temp_v0 & 0xF)) + 0xA0000; + return temp_v0 & 0xF; +} + +s32 func_801C9F0C(void* arg0, int* arg1, int* arg2, int* arg3, const char* arg4) { + s32 sp24; + s32 var_v1; + + if (func_801C9CB0(arg4) != 0) { + sp24 = func_801C9E60(arg4); + *arg1 = 0x10; + var_v1 = 0; + *arg2 = 0x10; + *arg3 = 0xB; + } else { + var_v1 = func_801C9EAC(&sp24, arg1, arg2, arg3, *arg4); + } + func_801C9E30(arg0, sp24, 0x80); + return var_v1; +} + +s32 func_801C9FB0(u8* arg0, s32 arg1, u8 arg2) { + if (arg1 == 1) { + *arg0 = arg2 * 0x10; + return 0; + } else { + *arg0 |= arg2; + return 1; + } +} + +void* func_801C9FE8(void* arg0, s32* arg1, s32 arg2) { + arg0 = BADCASTP((uintptr_t)arg0 + (arg2 >> 1)); + if (((*arg1 == 1) && ((arg2 & 1) == 0)) || ((*arg1 == 0) && ((arg2 & 1) != 0))) { + arg0 = BADCASTP((uintptr_t)arg0 + (arg2 & 1)); + *arg1 = 1; + } else { + *arg1 = 0; + } + return arg0; +} + +s32 func_801CA034(void** arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, u8* arg5, s32 arg6, s32 arg7, s32 arg8) { + s32 var_s0; + s32 var_s1; + s32 var_s3; + void* var_fp; + s32 sp4C; + s32 var_s4; + s32 sp44; + + sp4C = arg2; + var_s4 = 1; + sp44 = arg6 + arg3 + arg4; + var_fp = func_801C9FE8(*arg0, &sp4C, arg3); + arg1 >>= 1; + var_fp = BADCASTP((s32)var_fp + ((0xB - arg8) * arg1)); + if (arg6 & 1) { + arg6 += 1; + } + + while (arg7--) { + var_s0 = BADCASTI var_fp; + var_s1 = sp4C; + + for (var_s3 = 0; var_s3 < arg6; var_s3++, var_s4 ^= 1, var_s1 ^= 1) { + if (var_s4 == 1) { + if (func_801C9FB0(BADCASTP var_s0, var_s1, (*arg5) >> 4) != 0) { + var_s0++; + } + } else { + if (func_801C9FB0(BADCASTP var_s0, var_s1, (*arg5) & 0xF) != 0) { + var_s0++; + } + arg5++; + } + } + var_fp = BADCASTP((s32)var_fp + arg1); + } + + *arg0 = func_801C9FE8(*arg0, &arg2, sp44); + return arg2; +} + +void func_801CA1C4(const char* arg0, s32* arg1, s32* arg2) { + char v1, v2; + + if (func_801C9CB0(arg0) != 0) { + *arg2 = 0; + *arg1 = 0; + return; + } + *arg2 = 0; + *arg1 = 0; + v1 = arg0[-1]; + v2 = arg0[1]; + switch ((u8)arg0[0]) { + case 0x20: + *arg2 = 0; + *arg1 = 0; + return; + case 0x49: + case 0x69: +#if OOT_NTSC + *arg2 = 2; + if (1) {} +#endif + *arg1 = 2; + *arg2 = 2; + if (v1 == 0x20) { + *arg1 = 0; + } + if (v2 == 0x20) { + *arg2 = 0; + } + return; + } +#if OOT_NTSC + *arg2 = 1; + if (1) {} +#endif + *arg1 = 1; + *arg2 = 1; +} + +void func_801CA280(void* arg0, s32 arg1, const char* arg2) { + u8 megatemp[0xA0]; + u8* temp_s1 = (u8*)(((((u32)megatemp + 0xF)) >> 4) << 4); // align to 0x10 on the stack + int sp78; + int sp74; + int sp70; + u8* var_s0; + s32 sp68; + s32 sp64; + s32 temp_v1; + s32 var_s2 = 1; + + if (arg2 == NULL) { + return; + } + + while (*arg2 != 0) { + func_801CA1C4(arg2, &sp68, &sp64); + temp_v1 = func_801C9F0C(temp_s1, &sp78, &sp74, &sp70, arg2); + if (sp78 & 1) { + sp78++; + } + var_s2 = func_801CA034(&arg0, arg1, var_s2, sp68, sp64, &temp_s1[temp_v1], sp78, sp74, sp70); + if (func_801C9CB0(arg2) != 0) { + arg2++; + } + arg2++; + } +} + +void func_801CA3C0(s32 arg0, void (*arg1)(void*, uintptr_t, size_t)) { + D_801E17F0 = arg0; + D_801D3740 = arg1; +} diff --git a/src/n64dd/n64dd_error_headers.c b/src/n64dd/n64dd_5.c similarity index 83% rename from src/n64dd/n64dd_error_headers.c rename to src/n64dd/n64dd_5.c index bac2f97b957..7630eebe666 100644 --- a/src/n64dd/n64dd_error_headers.c +++ b/src/n64dd/n64dd_5.c @@ -1,6 +1,6 @@ +#include "ultra64.h" #include "n64dd.h" - -// Padding in .rodata suggests that this array is in a separate file +#include "n64dd_internal.h" /** * Region-specific "error number" headers used in N64DD error handling. diff --git a/src/n64dd/n64dd_6.c b/src/n64dd/n64dd_6.c new file mode 100644 index 00000000000..864e8407a68 --- /dev/null +++ b/src/n64dd/n64dd_6.c @@ -0,0 +1,1734 @@ +#include "ultra64.h" +#include "n64dd.h" +#include "n64dd_internal.h" +#include "z_locale.h" + +#pragma increment_block_number "" + +const char* D_801D3760[2][8][4] = { + { + { + "  メモリー拡張パックが正しく差し込", + "  んでありますか?        ", + NULL, + NULL, + }, + { + "  間違ったディスクが差し込まれてい", + "  る可能性があります。正しいディス", + "  クに交換してください。     ", + NULL, + }, + { + "  注意:アクセスランプ点滅中にディ", + "  スクを抜かないでください。詳しく", + "  は、取扱説明書をお読みください。", + NULL, + }, + { + "  詳しくは、取扱説明書をお読みくだ", + "  さい。             ", + NULL, + NULL, + }, + { + "   ディスクを差し込んでください。", + NULL, + NULL, + NULL, + }, + { + "  ディスクを差し込み直してください。", + NULL, + NULL, + NULL, + }, + { + "   ディスクを取り出してください。", + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + }, + }, + { + { + " Are you sure the Expansion", + " Pak is inserted correctly?", + NULL, + NULL, + }, + { + " Check to see if the proper", + " disk is inserted.", + " Please insert the disk the", + " correct disk.", + }, + { + " Do not remove the disk when", + " the access light is flashing.", + " Please read the instruction", + " manual for details.", + }, + { + " Please read the instruction", + " manual for details.", + NULL, + NULL, + }, + { + " Please insert a disk.", + NULL, + NULL, + NULL, + }, + { + " Please insert the disk again.", + NULL, + NULL, + NULL, + }, + { + " Please remove the disk.", + NULL, + NULL, + NULL, + }, + { + NULL, + NULL, + NULL, + NULL, + }, + }, +}; +UNK_TYPE1 D_801D3860[2][0x600] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x44, 0x58, 0x88, 0x9B, 0xBF, 0x70, 0, + 0, 0x3B, 0xBB, 0xBB, 0xBB, 0xBB, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -1, -1, -1, -8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xAB, -0x25, -0x31, 0x88, 0x98, 0x20, 0, + 0, 0x4F, 0x98, 0x88, 0x88, 0xBF, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x68, 0, 0, 0, 0, 0, 0, 0x4B, 0x30, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0xBF, -1, -1, -1, -1, 0x80, 0, 0, 2, 0x44, 0x44, 0x44, 0x42, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, -0x2F, 0x4F, 0, -0x27, 0, 0, + 0, 0x4F, 0x40, 0, 0, 0x8F, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 3, -0x15, 0, 0, 0, 0, 0, 0x3D, -1, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x68, 0x88, 0xBF, 0x88, 0x88, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 8, 0x88, -6, 0x9F, 0x89, -8, 0x88, 0, + 0, 0x4F, -0x35, 0xBB, 0xBB, -0x21, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x1C, -5, 0, 0, 0, 0, 0, 0x26, 0x5F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0xBB, 0xBE, -1, -2, 0xBB, 0xBB, 0, + 0, 0x28, 0x88, 0x88, 0x88, 0x88, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x9B, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0x88, 0x88, 0x88, 0x88, 0x8E, -0xF, 0, + 2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x42, 0, 0, 0, 0x7F, 0x9F, 0x6F, 0x70, 0, 0, + 0x28, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 6, -0x1E, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3F, 0x90, 0, + 8, -1, -1, -1, -1, -1, -8, 0, 0, 0x2A, -0x1A, 0x4F, 6, -5, 0x40, 0, + 0x3B, 0xBD, -5, 0xBB, 0xBB, 0xBB, 0xBB, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0x3E, 0x50, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xBE, 0x20, 0, + 4, 0x88, 0x88, 0x88, 0x88, 0x88, 0x84, 0, 0x19, -1, 0xA8, 0x88, 0x88, 0xAF, -5, 0x40, + 0, 0xB, 0xC0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1, -0x37, 0, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 8, -9, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 9, 0x6B, 0xB8, 0x9F, 0x88, 0x8F, 0x8B, 0x10, + 0, 0xF, -1, -1, -1, -1, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, -8, 0x88, -0x23, 0x82, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0x8F, 0x90, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0x94, 0x7F, 0x44, 0x4F, 0x40, 0, + 0, 0x5F, 0x74, 0x44, 0x44, 0x7F, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 0xBB, 0xBB, -0x12, 0xB3, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xF, -1, -1, -1, -1, -1, -5, 0, 0, 0, 0, 0x4B, -7, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, -0x25, -0x31, 0xBB, 0xBF, 0x40, 0, + 0, 0x27, 0, 0, 0, 0x6F, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x86, 0, 0, 4, 0x8D, -3, 0x50, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0x94, 0x7F, 0x44, 0x4F, 0x40, 0, + 0, 0, 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, -5, 0x60, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, -0x25, 0xBB, 0xBB, 0xBF, 0x40, 0, + 0, 0, 0, 0, 0x5B, -0x16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x20, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0x40, 0, 0, 8, 0x20, 0, + 0, 0, 0, 0, 0x28, 0x61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0xBB, 0xBB, 0xBB, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0x90, 0, 0, 0x86, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0x80, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x64, 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -8, 0x88, 0x88, 0x86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xF, -0xA, 0, 0, 0xB8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0xB0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, + -8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0x10, 0, 0, 0, 0, 0, 0, 0x41, 0, 0, 0, 0x41, 0, 0, 0, + 0x44, 0, 0, 0, 0, 0x41, 0, 0, 0, 0, 0xF, 0xAE, 0x10, 0, 0xB8, 0, + 0, 0, 0, 0, 0, 0, 1, 0x41, 0, 0x43, 0, 0, 8, 0xB0, 0x34, 0, + 0, 0, 0, 0x44, 0, 0, 0, 0, 0x41, 0, 0, 0, 0, 0, 0, 0x2E, + -8, 0, 2, 0x8D, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0x10, 0, 0, 0, 0, 8, 0xBB, -0xC, 0, 8, 0xBB, -0xC, 0, 0, 0x6E, + -1, -0x2D, 0, 8, 0xBB, -0xC, 0, 0, 0, 0, 0xF, 0x4B, 0xA0, 0, 0xB8, 0, + 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x7E, -2, 0x6C, -1, 0x90, 0, 8, -0x35, -1, -0x1B, + 0, 0, 0x5E, -1, -0x2D, 0, 8, 0xBB, -0xC, 0, 0, 0, 0, 0, 0, -0x36, + 0xB8, 0, 2, 0x88, -0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0xC, 0x44, 0x44, 0x41, 0, 8, -8, 0, 0, 8, -8, 0, 0, 2, -9, + 1, 0x9E, 0x10, 8, -8, 0, 0, 0, 0, 0, 0xF, 0x42, -0xC, 0, 0xB8, 0, + 0xB, 0x80, 0, 0x8B, 0, 0xF, -0x2E, 0x1B, -9, 5, -0xE, 0, 8, -7, 0x11, 0x9E, + 0x10, 2, -0x19, 1, 0x9E, 0x10, 8, -8, 0, 0, 0, 0, 0, 0, 8, -0x2F, + 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -1, -1, -1, -0xC, 0, 8, -0x30, 0, 0, 8, -0x30, 0, 0, 8, 0xC0, + 0, 0xE, 0x60, 8, -0x30, 0, 0, 0, 0, 0, 0xF, 0x40, 0x8D, 0x10, 0xB8, 0, + 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x60, 8, 0xC0, 0, -0xC, 0, 8, -0x20, 0, 0x1E, + 0x60, 8, 0x90, 0, 0xD, 0x60, 8, -0x30, 0, 0, 0, 0, 0, 0, 0x5F, 0x30, + 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0x10, 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 0xB, 0x80, + 0, 0xB, 0x80, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0xC, 0x80, 0xB8, 0, + 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, 0xB0, 0, 0xB, + 0x80, 0xB, -0x25, 0xBB, 0xBE, 0x80, 8, 0xB0, 0, 0, 0, 0, 0, 2, -0x19, 0, + 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0x10, 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 0xB, 0x80, + 0, 0xB, 0x80, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 4, -0xD, 0xB8, 0, + 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, 0xB0, 0, 0xB, + 0x80, 0xB, 0xB8, 0x88, 0x88, 0x40, 8, 0xB0, 0, 0, 0, 0, 0, 8, -5, 0xBB, + -0x13, 0xB0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0x10, 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 9, 0xB0, + 0, 0x1F, 0x50, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x8C, 0xB8, 0, + 0xB, 0x80, 0, 0xAB, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, -0x1F, 0, 0x1F, + 0x50, 8, 0xA0, 0, 7, 0x40, 8, 0xB0, 0, 0, 0, 0, 0, 4, 0x88, 0x88, + -0x25, 0x80, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -0xC, 0x44, 0x44, 0x43, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 4, -9, + 1, 0x9D, 0, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x1E, -8, 0, + 9, -0x2E, 7, -5, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, -7, 0x11, 0x9D, + 0, 3, -9, 1, 0x9F, 0x20, 8, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, -1, -1, -1, -5, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 0, 0x6F, + -1, -0x2D, 0, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 5, -8, 0, + 3, -0x11, -4, 0x8B, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, 0xBB, -1, -0x2D, + 0, 0, 0x6E, -1, -0x1A, 0, 8, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x34, 0, + 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, +}; +s8 D_801D4460[2][0x2800] = { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x24, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0x88, 0x86, 8, 0xB0, 0xC, 0x80, 0, 0, 2, 0x41, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0x30, 0, 0, 0, 0x10, 0, 0, 4, 0x81, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0x28, 0x88, 0x88, 0x88, 0, 0, 0, 0, + 0, 0x4F, 6, 0xBB, 0xBB, 0xBB, 0x20, 0, 4, 0x88, 0x86, 7, 0x70, 8, 0x90, 0, + 0, 0, 0, 0, 0x88, 0x88, 0x84, 0, 0, 0x14, 0x44, 0x9F, 0x44, 0x44, 0x10, 0, + 0, 0, 0, 0x4A, 0x30, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, 0, + 4, 0x88, 0x84, 0, 0xB, 0x80, 0, 0, 0, 0, 0, 0x46, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0x30, 0, 0, 0, 0, 8, 0x50, 0, 0, -0x37, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 0xBB, 0xB8, 2, -0xD, 0x4F, 0x40, 0, 0, 8, -0xE, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x5E, -0x2F, 0, 0, 0, 0xAC, 0, 0, 5, -0x10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0x3B, -4, 0xBD, -0x15, 0, 0, 0, 0, + 0, 0x4F, 4, 0x8D, 0xB8, 0xBF, 0, 0, 6, 0xBB, 0xB8, 8, -0x1F, 0xD, 0x90, 0, + 8, -1, -1, 0x40, -4, 0xBB, -8, 0, 0, 0x3B, 0xBB, -0x21, 0xBB, 0xBF, 0x40, 0, + 0, 0, 0, 0xBD, 0x10, 0x30, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, 0, + 6, 0xBB, 0xB6, 0x8B, 0xBE, -0x25, 0xBB, 0, 0, 0x3B, -1, -1, 0x90, 0, 0, 0, + 0, 0, 0, 0, 0x5E, -0x2F, 0, 0, 0, 0, 0x1F, 0x80, 0, 0x4C, 0x48, 0x10, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x3B, 0xBB, 0xBB, 0x8B, -0x25, -0x22, 0xBB, 0, 0, 8, -0x10, 0, 0, 0, 0, 0, + 0, 0, 0, 8, -4, 0x20, 0, 0, 0, -0x26, 0, 0, 4, -0x10, 0x11, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -0xC, 8, 0xB6, 0xBB, 0xBB, 0xB3, 0, + 0, 0x4F, 0, 0xB, 0x80, 0x8E, 0, 0, 0x3B, 0xBB, 0xBB, 0x61, -0x3E, 0x2F, 0x40, 0, + 8, -0x3C, 0x7F, 0x40, -0xC, 0, -8, 0, 0x3B, 0xBB, 0xBB, -0x21, 0xBB, 0xBF, -0x35, 0x30, + 0, 0x6B, 0xBB, -3, -0x31, -0x10, 0, 0, 0, 0, 0x4F, 0x46, 0x51, -0x17, 0x20, 0, + 0x3B, 0xBB, 0xBB, 0x68, 0x8D, 0xB8, 0x88, 0, 0, 0x28, 0x74, 0x5F, 0x40, 0, 0, 0, + 0, 0, 0, 8, -4, 0x20, 0, 0, 0, 0, 0x5F, 0x66, 0x93, 9, 0x80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x28, 0x88, 0x88, 0x68, 0x8D, -0x28, 0x88, 0, 0, 8, -0x10, 0, 0, 0, 0, 0, + 0, 0, 3, -0x31, 0x80, 0, 0, 0, 0, -9, 6, 0x88, 0x89, -4, -8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0x8B, 0xB4, 0xBD, 0x88, -9, 0, + 0x4F, -1, -8, 0xB, 0x80, 0xAB, 0, 0, 0x28, 0x88, 0x88, 0x4B, 0xBB, -0x31, 0xB6, 0, + 8, 0xB0, 0x4F, 0x40, -9, 0x44, -8, 0, 0, 0x14, 0x44, 0x9F, 0x44, 0x4F, 0x40, 0, + 0, 0x48, 0x8F, -0x38, 0x64, 0x20, 0, 0, 0, -1, -1, -2, 0x60, 0x5D, -0xA, 0, + 0x28, 0x88, 0x88, 4, 0x4C, 0x94, 0x40, 0, 0, 0, 0, 0x9D, 0, 0, 0, 0, + 0, 0, 3, -0x31, 0x80, 0, 0, 0, 4, -1, -1, -1, 0xB2, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 0xBB, 0xB8, 0, 0xB, 0xB0, 0, 0, 0, 8, 0xB0, 0, 0, 0, 0, 0, + 0, 1, 0x8F, 0xB3, 0, 0, 0, 0, 4, -0xC, 6, 0xBB, 0xBC, -8, 0x62, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0xBD, 0xB0, 0x8B, 3, -0xD, 0, + 0x14, 0x7F, 0x42, 0xB, 0x80, 0xBD, 0x85, 0, 6, 0xBB, 0xB8, 0xF, 0x98, 0x88, -0x28, 0, + 8, -0x28, 0x9F, 0x42, -1, -1, -8, 0, 0, 0x3B, 0xBB, -0x21, 0xBB, 0xBB, 0x30, 0, + 0, 0, 0x8F, 0x64, 0, 0, 0, 0, 0, 0x44, 0x9F, 0x20, 0, 0, 0x86, 0, + 6, 0xBB, 0xB6, 0xF, -1, -1, -0x10, 0, 0, 0, 1, -0x19, 0, 0x8F, 0x30, 0, + 0, 1, 0x8F, 0xB3, 0, 0, 0, 0, 2, 0x54, -0x17, 0x13, 0x58, 0x88, 0x80, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0x88, 0x86, 8, 0x8D, -0x28, 0x82, 0, 0, 8, 0xB0, 0, 0, 0, 0, 0, + 0, 0x3E, -0x2A, 0, 0, 0, 0, 0, 4, -0xF, 0, 0, 4, -0x10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -0xC, 8, 0xB0, 0x6C, 6, -0x20, 0, + 0, 0x4F, 2, 0xB, 0xA0, -0x13, -0x21, 0, 4, 0x88, 0x86, 0xF, 0x40, 0, 0xB8, 0, + 8, -0x15, -0x31, 0x44, -0x10, 0, -8, 0, 0, 0xBB, 0xBB, -0x21, 0xBB, 0xBB, 0xB0, 0, + 0, 6, -2, 0xBF, 0x80, 0x28, -0x2E, 0, 0, 0, 0x8F, 0, 2, 0x20, 0, 0, + 4, 0x88, 0x85, 0x44, 0x44, 0x44, 0x44, 0, 0, 0, 6, -0xF, 0, 0x8F, 0, 0, + 0, 0x3E, -0x2A, 0, 0, 0, 0, 0, 0, 3, -0xE, 0xE, -4, 0xBB, 0xC0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 0xBB, 0xB8, 0xB, 0xBE, -0x15, 0xB3, 0, 0, 8, 0xB0, 0, 0, 0, 0, 0, + 0, 0x7F, 0x60, 0, 0, 0, 0, 0, 6, -0x10, 0, 0, 4, -0x10, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0xBD, 0xB0, 0x3F, 0x1A, 0xA0, 0, + 0, 0x6F, -0x18, 0xE, -0x1F, 0, 0xAA, 0, 6, 0xBB, 0xB8, 0xF, 0x98, 0x88, -0x28, 0, + 8, 0xB0, 0x4F, 0x45, -0x10, 0, -8, 0, 0, 0x44, 0x44, 0x9F, 0x44, 0x44, 0x40, 0, + 0, 0x3F, 0x91, 8, -0x24, -3, 0x93, 0, 0, 0, 0x8F, 0x7B, -1, -3, 0x50, 0, + 6, 0xBB, 0xB9, -5, 0xBB, 0xBB, -0x31, 0, 0, 0x5C, -1, -5, 0x96, 0xAE, 0, 0, + 0, 0x7F, 0x60, 0, 0, 0, 0, 0, 0, 8, 0xC0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 4, 0x88, 0x86, 0, 0xB, 0xB0, 0, 0, 0, 0xB, 0xB0, 0, 0, 1, 0xA3, 0, + 0, 7, -0x16, 0x10, 0, 0, 0, 0, 8, -0x10, 0, 0, 4, -0xC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0x8B, 0xB0, 0xE, 0x7F, 0x60, 0, + 0x5D, -1, 0x50, 0x2F, -0x18, 2, -0xA, 0, 4, 0x88, 0x86, 0xB, -4, -0x13, 0xB6, 0, + 8, 0xB0, 0x4F, 0x48, -0x28, 0x88, -8, 0, 0x4F, -1, -1, -1, -1, -1, -1, 0x40, + 3, -0x17, 2, 0x9F, -0x19, 0x20, 0, 0, 0, 4, -0x31, 0xB6, 0x30, 0x29, -0xE, 0, + 4, 0x88, 0x88, -0x10, 0x82, 0x46, 0x4F, 0, 8, -0x18, 0x8F, 0x57, 0xAE, -3, 0x60, 0, + 0, 7, -0x16, 0x10, 0, 0, 0, 0, 0, 0xE, 0x60, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 8, 0xBB, 0xBB, 0x34, 0x4C, -0x3C, 0x44, 0x10, 0, 0xB, 0xB0, 0, 0, 8, -0xD, 0, + 0, 0, 0x3D, -0x1C, 0, 0, 0, 0, 8, -0x10, 0, 0x25, 0x77, -0xC, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, -0xC, 8, 0xB0, 9, -3, 0, 0, + 0x39, 0x6F, 0, 0x7D, 0x6F, 0x39, -0x30, 0, 8, 0xBB, 0xBB, 2, -0xC, 0xB8, 0, 0, + 8, -0x15, -0x31, 0x4C, -0x25, 0xBB, -8, 0, 0, 0x14, 0x44, 0x44, 0x44, 0x44, 0x10, 0, + 3, 0xB0, 0x6F, 0x8C, 0xB0, 0, 0, 0, 0, 0x8F, 0xBF, 0, 0, 0, -0x28, 0, + 8, 0xBB, 0xB7, 0x40, -0xC, 0x8B, 0x14, 0, 0x2F, 0x60, -0x37, 0, 3, -2, -3, 0x10, + 0, 0, 0x3D, -0x1C, 0, 0, 0, 0, 0, 0x6E, 0x10, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xB, -0x28, 0xBF, 0xBF, -1, -1, -1, 0x40, 0, 9, 0xB0, 0, 0, 0x4F, 0x80, 0, + 0, 0, 1, -0x31, 0x60, 0, 0, 0, 7, -0x10, 3, -0x15, 0xBE, -6, 0x30, 0, + 2, 0x30, 0, 0, 0, 0, 0, 0, 2, -7, 0xAD, 0xB0, 5, -8, 0, 0, + 0, 0x4F, 0, -0x28, 0xD, -0x21, 0x40, 0, 0xB, -0x28, 0xBF, 5, -0xE, 0xB8, 0, 0, + 8, -0x28, 0x88, 0x6F, 0x30, 0, -8, 0, 0, 0x4F, 0x98, 0x88, 0x88, 0x9F, 0x40, 0, + 0, 2, -0xC, 0xB, 0xB0, 0, 0, 0, 6, -0x1C, 0x4F, 0, 0, 0, 0xBA, 0, + 0xB, 0xB8, -0x28, 2, -0xC, 0x8B, 0, 0, 0x4F, 0x19, -0x1F, 0, 0xA, -0x1F, 0x68, 0, + 0, 0, 1, -0x31, 0x60, 0, 0, 0, 0, 0xB9, 4, -0xF, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xB, 0xB0, 0x8F, 0, 0xB, 0xB0, 0, 0, 0, 7, -0xF, 0, 7, -7, 0, 0, + 0, 0, 0, 0x1C, -0xA, 0, 0, 0, 4, -0xF, 8, 0x80, 4, -2, -8, 0, + 0xB, -0x1D, 0, 0, 0, 0, 0, 0, 0x4F, -5, 0x8B, 0xB0, 0x3E, -0x31, 0x70, 0, + 0, 0x4F, 7, -0xE, 8, -2, 0x10, 0, 0xB, 0xB0, 0x8F, 9, -0x20, 0xB8, 4, 0, + 6, 0x80, 0, -0x35, 0, 0, -8, 0, 0, 0x4F, -0x35, 0xBB, 0xBB, -0x31, 0x40, 0, + 0, 7, -0xF, 0, 0, 0, 0, 0, 7, -0x2F, 0x4F, 6, 0x80, 3, -9, 0, + 0xB, 0x80, 0xB8, 7, -0x20, 0x8B, 1, 0, 0xE, -3, 0x30, 0, 0x9F, 0x50, 0, 0, + 0, 0, 0, 0x1C, -0xA, 0, 0, 0, 4, -0xD, 0, -9, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xB, -0x15, -0x21, 0, 0xB, 0xB0, 0, 0, 0, 1, -0x12, 0xBB, -0x12, 0x80, 0, 0, + 0, 0, 0, 1, -0x31, 0x60, 0, 0, 4, -0xC, 4, -0x18, 0x8C, -0x20, 0x89, 0, + 1, -0x24, 0x10, 0, 0, 0, 0, 0, 3, 0, 8, 0xB5, -0x14, 0x18, -6, 0x20, + 0, 0x4F, 0x3E, 0x82, 0x9F, 0xBF, -0x1C, 0, 0xB, -0x28, 0xBF, 0x3F, 0x80, 0xB8, 0x1F, 0x70, + 0, 0, 9, -0x1E, 0, 0x24, -8, 0, 0, 0x4F, 0x74, 0x44, 0x44, 0x7F, 0x40, 0, + 0, 2, -0x13, 0x88, 0x88, 0x8A, 0x30, 0, 1, -0x33, 0x9F, 6, -4, 0xBE, -0x3F, 0, + 0xB, -0x25, -0x18, 0x4E, 0x80, 0x8C, 0x1F, 0x50, 2, 0x41, 0, 0x6D, -0xA, 0, 0, 0, + 0, 0, 0, 1, -0x31, 0x60, 0, 0, 9, 0xB0, 0, 0x8F, -0x25, 0xBB, 0xBA, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0xB, -0x28, 0xBF, 0, 0xB, 0xB0, 0, 0, 0, 0, 0x17, 0x98, 0x61, 0, 0, 0, + 0, 0, 0, 0, 0x1C, 0xB0, 0, 0, 1, -0x3B, 0, 0x49, 0xBA, 0x30, 0, 0, + 0, 0x4D, 0x20, 0, 0, 0, 0, 0, 0, 0, 8, -0x35, 0x80, 0, 0x6C, 0x10, + 8, -0x23, 0x8C, 0x6F, -0x1B, 4, -0x12, 0x20, 0xB, -0x15, -0x21, -0x24, 0x10, 0x9F, -1, 0x20, + 0, 0, 0x5F, 0x50, 0, 0x2F, -0xB, 0, 0, 0x4F, -1, -1, -1, -1, 0x40, 0, + 0, 0, 0x28, 0xBB, -0x25, 0xBB, 0x30, 0, 0, 8, 0xBA, 0, 0x48, 0xA7, 0x10, 0, + 0xB, 0xB8, -0x28, -0x17, 0, 0x6F, -2, 0x10, 0, 0, 0, -0x23, 0x40, 0, 0, 0, + 0, 0, 0, 0, 0x1C, 0xB0, 0, 0, 9, 0x50, 0, 3, 0x88, 0xBB, 0x86, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0x30, 0, 0, 3, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0x30, 0, 0, 0, 0, + 4, 0x61, 3, 7, 0x10, 0, 0x25, 0, 3, 0x30, 0, 0x41, 0, 4, 0x42, 0, + 0, 0, 2, 0, 0, 6, 0x20, 0, 0, 0x3B, 0x30, 0, 0, 0x28, 0x20, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0x20, 0, 0x20, 0, 3, 0x41, 0, 0, 0, 0, 0x20, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x9D, 0, 2, 0x10, 0, 0, 0x68, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x4F, 0x77, 0xAF, 0x50, 0, 0, 0xBC, 0, 0, 4, -0x1D, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x9B, 0xBB, -0x31, -3, 0x96, 0x10, 0, 0, -0x38, 0, 0, 0, -0x25, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x68, 0x88, 0x56, -0xC, 0, 0, 0, 0, -8, 0, 0, 0, 0x6F, 0x40, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x8D, 0x10, 0, 0, 0, -0xB, 0, 0, 0, 0xE, 0xA0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0x34, 0x1C, 0xB0, 0, 0, 0, -0xC, 0, 0, 0, 9, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 4, 0xAF, -1, -1, -7, 0, 0, 0, -9, 0, 0, 0, 5, -0xB, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x3F, 0xA3, 0, 3, 0x87, 0, 0, 0, -0x38, 6, 0x10, 0, 1, -8, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x8D, 0, 0, 0, 0, 0, 0, 0, 0x9C, 0x1E, 0x60, 0, 0, -0x18, 0, + 1, 0x87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x7E, 0x30, 0, 0, 0, 0, 0, 0, 0x5F, -0x22, 0, 0, 0, 0, 0, + 0xC, 0x68, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x1B, -5, 0x88, 0x88, 0x96, 0, 0, 0, 0xC, -0xB, 0, 0, 0, 0, 0, + 0xC, 1, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0x58, 0xBB, 0xBB, 0xB5, 0, 0, 0, 1, 0x30, 0, 0, 0, 0, 0, + 9, 0x9B, 0x60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 8, 0xBB, 0xBB, 0xB8, 0x10, 0, 3, 0xB0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0x3B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 6, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x3B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0x3B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0xB8, 0x88, 0x8E, 0xB0, 0, 4, -0x10, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 8, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 0, 0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 3, -0xD, 0, 4, -0x10, 0, 0, 0x44, 0, 0, 0, + 2, 0x42, 0, 0, 0, 3, 0x41, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0x41, 0, 0, 0, 0x44, 0, 0, 0, 2, 0x42, + 0, 0, 0, 2, 0x41, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 8, 0xB0, 0x34, 0x10, 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0x24, 0x10, 0, 0, 3, 0x41, 0, 0, 0, 0xB8, 0, 0, + 0, 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0x34, 0, 0, 0, 0xB8, 0, + 0, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, 0x24, 0x10, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 0, -0xC, 0, 4, -0x10, 0, 0x5E, -1, -0x2D, 0, 1, + 0xBF, -1, 0xB1, 0, 1, -0x31, -1, 0x60, 0, 0, 0x5E, -1, -0x2D, 0, 0, 0, + 0, 0, 0, 0, 8, 0xBB, -0xC, 0, 0, 0x5E, -1, -0x2D, 0, 1, 0xBF, -1, + 0xB1, 0, 0, 0x9F, -2, 0x9F, 0, 0, 0, 0, 0, 0, 0, 0xB, -1, -0x10, + 8, 0xB9, -1, -0x1B, 0, 0, 0x5E, -1, -0x2D, 0, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, 0xB9, -1, -0xA, 0, 1, -0x31, -1, 0x60, 0, 0xB, -1, -0x10, 8, + 0xBB, -0xC, 0, 0xB, 0x80, 0, 0x8B, 0, 0, 0x3D, -1, -0x1A, 0, 0xB, -1, -0x10, + 0, 0x4F, 0, 0, 0x6E, -1, -0x2D, 0, 8, 0xB9, -1, -0xA, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 7, -0xF, 0, 4, -0x10, 2, -0x19, 1, 0x9E, 0x10, 6, + -0x1D, 2, -0x29, 0, 9, 0xA1, 7, -0xE, 0, 2, -0x19, 1, 0x9E, 0x10, 0, 0, + 0, 0, 0, 0, 8, -8, 0, 0, 2, -0x19, 1, 0x9E, 0x10, 6, -0x1D, 2, + -0x29, 0, 6, -0x1C, 4, -0x11, 0, 0, 0, 0, 0, 0, 0, 3, -0x37, 0x40, + 8, -7, 0x11, 0xAD, 0, 2, -0x19, 1, 0x9E, 0x10, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, -7, 0x11, 0xAD, 0, 9, 0xA1, 7, -0xE, 0, 3, -0x37, 0x40, 8, + -8, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 0, -0x27, 0x11, 0x9E, 0, 3, -0x37, 0x40, + 0, 0x4F, 0, 2, -9, 1, 0x9E, 0x10, 8, -7, 0x11, 0xAD, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, -0x25, 0xBB, -0x31, 0x80, 0, 4, -0x10, 8, 0x90, 0, 0xD, 0x60, 2, + 0x30, 0, -0x38, 0, 0xB, 0xA1, 0, 0x41, 0, 8, 0x90, 0, 0xD, 0x60, 0, 0, + 0, 0, 0, 0, 8, -0x30, 0, 0, 8, 0x90, 0, 0xD, 0x60, 2, 0x30, 0, + -0x38, 0, 0xC, 0x80, 0, 0x7F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 8, -0x30, 0, 0x4F, 0, 8, 0x90, 0, 0xD, 0x60, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, -0x30, 0, 0x4F, 0, 0xB, 0xA1, 0, 0x41, 0, 0, 0xB8, 0, 8, + -0x30, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 5, -0xF, 0, 0x1B, 0x30, 0, 0xB8, 0, + 0, 0x4F, 0, 8, 0xC0, 0, 0xE, 0x60, 8, -0x30, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0xB8, 0x88, 0x85, 0, 0, 4, -0x10, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, + 0x7B, -0x21, -0x18, 0, 3, -0x11, 0xB7, 0x20, 0, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, 0, + 0, 0, 0, 0, 8, 0xB0, 0, 0, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, 0x7B, -0x21, + -0x18, 0, 0xF, 0x40, 0, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 8, 0xB0, 0, 0x4F, 0, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 3, -0x11, 0xB7, 0x20, 0, 0, 0xB8, 0, 8, + 0xB0, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 8, 0xB0, 0, 0, 0, 0, 0xB8, 0, + 0, 0x4F, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 0xB, 0xB8, 0x88, 0x88, 0x40, 9, + -0x18, 0x52, 0xB8, 0, 0, 0x15, 0x8D, -0xC, 0, 0xB, 0xB8, 0x88, 0x88, 0x40, 0, 0, + 0, 0, 0, 0, 8, 0xB0, 0, 0, 0xB, 0xB8, 0x88, 0x88, 0x40, 9, -0x18, 0x52, + 0xB8, 0, 0xF, 0x40, 0, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 8, 0xB0, 0, 0x4F, 0, 0xB, 0xB8, 0x88, 0x88, 0x40, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 0, 0x15, 0x8D, -0xC, 0, 0, 0xB8, 0, 8, + 0xB0, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 8, 0xB0, 0, 0, 0, 0, 0xB8, 0, + 0, 0x4F, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 8, 0xA0, 0, 7, 0x40, 0xF, + 0x50, 0, -0x28, 0, 8, 0x20, 0, -0x38, 0, 8, 0xA0, 0, 7, 0x40, 0, 0, + 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xA0, 0, 7, 0x40, 0xF, 0x50, 0, + -0x28, 0, 0xC, 0x80, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, + 8, 0xB0, 0, 0x4F, 0, 8, 0xA0, 0, 7, 0x40, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 8, 0x20, 0, -0x38, 0, 0, 0xB8, 0, 8, + 0xB0, 0, 0, 0xB, 0x80, 0, 0xAB, 0, 6, -0x20, 0, 0x1B, 0x30, 0, 0xB8, 0, + 0, 0x4F, 0, 9, 0xB0, 0, 0x1F, 0x50, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 3, -9, 1, 0x9F, 0x20, 0xD, + 0x90, 0x29, -8, 0, 0xB, 0xA1, 4, -0x1A, 0, 3, -9, 1, 0x9F, 0x20, 0, 0, + 0, 0, 0, 0, 8, 0xB0, 0, 0, 3, -9, 1, 0x9F, 0x20, 0xD, 0x90, 0x29, + -8, 0, 8, -0x1C, 4, -0x11, 0, 0, 0, 0, 0, 0, 0, 0, 0xBA, 0x40, + 8, 0xB0, 0, 0x4F, 0, 3, -9, 1, 0x9F, 0x20, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 0xB, 0xA1, 4, -0x1A, 0, 0, 0xBA, 0x40, 8, + 0xB0, 0, 0, 9, -0x2E, 7, -5, 0, 1, -0x17, 0x11, 0x9D, 0, 0, 0xBA, 0x40, + 0, 0x4F, 0, 4, -9, 1, 0x9D, 0, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 0, 0x6E, -1, -0x1A, 0, 6, + -1, -8, 0x8F, 0x40, 3, -0x11, -1, 0x90, 0, 0, 0x6E, -1, -0x1A, 0, 0, 0, + 0, 0, 0, 0, 8, 0xB0, 0, 0, 0, 0x6E, -1, -0x1A, 0, 6, -1, -8, + 0x8F, 0x40, 0, 0x9F, -2, 0x7F, 0, 0, 0, 0, 0, 0, 0, 0, 0x8F, -0x10, + 8, 0xB0, 0, 0x4F, 0, 0, 0x6E, -1, -0x1A, 0, 0, 0, 0, 0, 0, 0, + 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 3, -0x11, -1, 0x90, 0, 0, 0x8F, -0x10, 8, + 0xB0, 0, 0, 3, -0x11, -4, 0x8B, 0, 0, 0x3E, -1, -0x2D, 0, 0, 0x8F, -0x10, + 0, 0x4F, 0, 0, 0x6F, -1, -0x2D, 0, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x44, 0, 0, 0, + 0x14, 0x20, 4, 0x10, 0, 4, 0x42, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x44, 0, 0, 0, 0x14, 0x20, + 4, 0x10, 0, 2, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0x30, + 0, 0, 0, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 4, 0x42, 0, 0, 0, 4, 0x30, 0, + 0, 0, 0, 0, 4, 0x30, 0, 0, 0, 0, 0x44, 0, 0, 0, 4, 0x30, + 0, 0, 0, 0, 1, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0xB0, 0, + 0, 0, 0, 0, 0, 0, 5, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3B, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3B, 0, 3, 0xB0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xE, 0xA6, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x4F, 0, 0, 0, 0, + 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0x28, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0x41, 0, 0x43, 0, 0, 0, 2, 0x42, 0, 0, 0, 0, + 0x24, 0x10, 0, 0, 0, 0, 0, 0, 0, 2, 0x42, 0, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0, 0, 0x44, 0, 0, 0, 0, + 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0x41, 0x4F, 0, 0, 0, 0x44, + 0, 0, 0, 0xB8, 0, 0, 2, 0x42, 0, 0, 0, 0, 0, 4, -0x10, 0, + 3, 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x7E, -2, 0x6C, -1, 0x90, 0, 1, 0xBF, -1, 0xB1, 0, 8, 0xB9, + -1, -0xA, 0, 0xB, 0x80, 0, 0x8B, 0, 1, 0xBF, -1, 0xB1, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, -1, -5, 0, 0, 0x6E, -1, -0x2D, 0, 8, 0xBB, + -0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0x9F, -2, 0x9F, 0, 0, 0x5E, -1, + -0x2D, 0, 0xB, -1, -0x10, 1, 0xBF, -1, 0xB1, 0, 0, 0x4F, 0, 4, -0x10, 1, + -0x31, -1, 0x60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, -0x2E, 0x1B, -9, 5, -0xE, 0, 6, -0x1D, 2, -0x29, 0, 8, -7, + 0x11, 0xAD, 0, 0xB, 0x80, 0, 0x8B, 0, 6, -0x1D, 2, -0x29, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0x4F, 0x73, 0, 2, -9, 1, 0x9E, 0x10, 8, -8, + 0, 0, 0, 0, 0, 0, 0, 0, 6, -0x1C, 4, -0x11, 0, 2, -0x19, 1, + 0x9E, 0x10, 3, -0x37, 0x40, 6, -0x1D, 2, -0x29, 0, 0, 0x4F, 0, 4, -0x10, 9, + 0xA1, 7, -0xE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x60, 8, 0xC0, 0, -0xC, 0, 2, 0x30, 0, -0x38, 0, 8, -0x30, + 0, 0x4F, 0, 0xB, 0x80, 0, 0x8B, 0, 2, 0x30, 0, -0x38, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 8, 0xC0, 0, 0xE, 0x60, 8, -0x30, + 0, 0, 0, 0, 0, 0, 0, 0, 0xC, 0x80, 0, 0x7F, 0, 8, 0x90, 0, + 0xD, 0x60, 0, 0xB8, 0, 2, 0x30, 0, -0x38, 0, 0, 0x4F, 0, 4, -0x10, 0xB, + 0xA1, 0, 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 0, 0x7B, -0x21, -0x18, 0, 8, 0xB0, + 0, 0x4F, 0, 0xB, 0x80, 0, 0x8B, 0, 0, 0x7B, -0x21, -0x18, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, + 0, 0, 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x4F, 0, 0xB, -0x25, 0xBB, + 0xBE, 0x80, 0, 0xB8, 0, 0, 0x7B, -0x21, -0x18, 0, 0, 0x4F, 0, 4, -0x10, 3, + -0x11, 0xB7, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 9, -0x18, 0x52, 0xB8, 0, 8, 0xB0, + 0, 0x4F, 0, 0xB, 0x80, 0, 0x8B, 0, 9, -0x18, 0x52, 0xB8, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, + 0, 0, 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x4F, 0, 0xB, 0xB8, 0x88, + 0x88, 0x40, 0, 0xB8, 0, 9, -0x18, 0x52, 0xB8, 0, 0, 0x4F, 0, 4, -0x10, 0, + 0x15, 0x8D, -0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 0xF, 0x50, 0, -0x28, 0, 8, 0xB0, + 0, 0x4F, 0, 0xB, 0x80, 0, 0xAB, 0, 0xF, 0x50, 0, -0x28, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 9, 0xB0, 0, 0x1F, 0x50, 8, 0xB0, + 0, 0, 0, 0, 0, 0, 0, 0, 0xC, 0x80, 0, 0x8F, 0, 8, 0xA0, 0, + 7, 0x40, 0, 0xB8, 0, 0xF, 0x50, 0, -0x28, 0, 0, 0x4F, 0, 4, -0x10, 8, + 0x20, 0, -0x38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 0xD, 0x90, 0x29, -8, 0, 8, 0xB0, + 0, 0x4F, 0, 9, -0x2E, 7, -5, 0, 0xD, 0x90, 0x29, -8, 0, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 4, -9, 1, 0x9D, 0, 8, 0xB0, + 0, 0, 0, 0, 0, 0, 0, 0, 8, -0x1C, 4, -0x11, 0, 3, -9, 1, + 0x9F, 0x20, 0, 0xBA, 0x40, 0xD, 0x90, 0x29, -8, 0, 0, 0x4F, 0, 4, -0x10, 0xB, + 0xA1, 4, -0x1A, 0, 4, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 6, -1, -8, 0x8F, 0x40, 8, 0xB0, + 0, 0x4F, 0, 3, -0x11, -4, 0x8B, 0, 6, -1, -8, 0x8F, 0x40, 4, -0x10, 0, + 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0, 0x6F, -1, -0x2D, 0, 8, 0xB0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x9F, -2, 0x7F, 0, 0, 0x6E, -1, + -0x1A, 0, 0, 0x8F, -0x10, 6, -1, -8, 0x8F, 0x40, 0, 0x4F, 0, 4, -0x10, 3, + -0x11, -1, 0x90, 0, 0xF, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x14, 0x20, 4, 0x10, 0, 0, + 0, 0, 0, 0, 4, 0x30, 0, 0, 0, 0x14, 0x20, 4, 0x10, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x43, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0x40, 0, 0, 0, 0, 0x44, + 0, 0, 0, 4, 0x30, 0, 0x14, 0x20, 4, 0x10, 0, 0, 0, 0, 0, 0, + 4, 0x42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, +}; + +u8 D_801E1800[0x600]; +u8 D_801E1E00[0x2800]; +u8 D_801E4600[0x1400]; + +s32 func_801CA3E0(s32 arg0) { + s32 temp_t6; + s32 var_a1; + s32 var_a2; + s32 var_a2_2; + s32 var_v0; + s32 var_v1; + + var_v0 = 0; + var_v1 = 0; + if (arg0 < 0xA) { + return arg0; + } + var_a1 = 1; + if (arg0 >= 0xA) { + var_a2_2 = 0xA; + do { + var_a1 = var_a2_2; + var_v0 += 1; + var_a2_2 *= 0xA; + } while (arg0 >= var_a2_2); + } + var_a2 = arg0; + while (var_v0--) { + temp_t6 = var_a2 / var_a1; + var_v1 = (var_v1 | temp_t6) * 0x10; + var_a2 = var_a2 % var_a1; + var_a1 = var_a1 / 10; + } + return var_v1 + var_a2; +} + +s32 func_801CA4B8(void) { + return gCurrentRegion == 1 ? 0 : 1; +} + +void func_801CA4E4(u8* arg0, u8 arg1, s32 arg2) { + while (arg2--) { + *arg0++ = arg1; + } +} + +const char* func_801CA514(void) { + return gN64DDLocalizedErrorNumberHeaders[func_801CA4B8()]; +} + +void func_801CA544(const char* arg0, s32 arg1) { + s32 temp_v0; + u16 var_a1; + + temp_v0 = func_801CA3E0(arg1); + if (arg1 >= 0xA) { + var_a1 = ((temp_v0 >> 4) + 0xA3B0); + } else { + var_a1 = 0xA1A1; + } + func_801C9D68((char*)arg0, var_a1); + arg0 += 2; + func_801C9D68((char*)arg0, ((temp_v0 & 0xF) + 0xA3B0)); +} + +void func_801CA5C4(char* arg0, s32 arg1) { + s32 temp_v0; + + temp_v0 = func_801CA3E0(arg1); + if (arg1 >= 0xA) { + *arg0 = (temp_v0 >> 4) + 0x30; + } else { + *arg0 = 0x20; + } + arg0++; + *arg0 = (temp_v0 & 0xF) + 0x30; +} + +void func_801CA628(void* arg0, s32 arg1) { + const char* temp_v0; + + temp_v0 = func_801CA514(); + if (gCurrentRegion == 1) { + func_801CA544((char*)(temp_v0 + 0xC), arg1); + } else { + func_801CA5C4((char*)(temp_v0 + 0xD), arg1); + } + func_801CA280(arg0, 0xC0, temp_v0); +} + +void* func_801CA698(s32 arg0) { + func_801CA730(); + if (arg0 == 0x29) { + return D_801D3860[func_801CA4B8()]; + } + if (((arg0 >= 0x25) && (arg0 < 0x29)) || (arg0 == 0x1F) || (arg0 == 0x20)) { + return D_801E1800; + } else { + func_801CA628(D_801E1800, arg0); + return D_801E1800; + } +} + +void* func_801CA730(void) { + func_801CA4E4(D_801E1800, 0, sizeof(D_801E1800)); + return D_801E1800; +} + +void func_801CA764(void* arg0, s32 arg1, s32 arg2) { + s32 var_s0; + + for (var_s0 = 0; var_s0 < arg2; var_s0++) { + func_801CA280(arg0, 0x140, D_801D3760[func_801CA4B8()][arg1][var_s0]); + arg0 = (char*)arg0 + 0xA00; + if (1) {} + } +} + +void* func_801CA800(s32 arg0) { + func_801CA86C(); + if (arg0 == 3) { + return D_801D4460[func_801CA4B8()]; + } + func_801CA764(D_801E1E00, arg0, 4); + return D_801E1E00; +} + +void* func_801CA86C(void) { + func_801CA4E4(D_801E1E00, 0, sizeof(D_801E1E00)); + return D_801E1E00; +} + +UNK_PTR func_801CA8A0(s32 arg0) { + func_801CA8E0(); + func_801CA764(D_801E4600, arg0, 2); + return D_801E4600; +} + +void* func_801CA8E0(void) { + func_801CA4E4(D_801E4600, 0, sizeof(D_801E4600)); + return D_801E4600; +} diff --git a/src/n64dd/n64dd_7.c b/src/n64dd/n64dd_7.c new file mode 100644 index 00000000000..f6c162189b2 --- /dev/null +++ b/src/n64dd/n64dd_7.c @@ -0,0 +1,247 @@ +#include "ultra64.h" +#include "n64dd.h" +#include "n64dd_internal.h" +#include "libc64/aprintf.h" +#include "attributes.h" + +typedef struct struct_801CAF10 { + /* 0x00 */ struct struct_801CAF10* (*unk0)(struct struct_801CAF10*, u8*, s32); + /* 0x04 */ u8* unk4; + /* 0x08 */ u16 unk8; + /* 0x0A */ u16 unkA; + /* 0x0C */ u16 unkC; + /* 0x0E */ char padE[2]; + /* 0x10 */ union { + s32 unk10w; + struct { + s8 unk10; + s8 unk11; + s8 unk12; + s8 unk13; + }; + }; + /* 0x14 */ u16 unk14; + /* 0x16 */ u16 unk16; + /* 0x18 */ u16 unk18; + /* 0x1A */ u16 unk1A; + /* 0x1C */ u8 unk1C; + /* 0x1D */ char pad1D[3]; + /* 0x20 */ s16* unk20; + /* 0x24 */ u16 unk24; + /* 0x26 */ u16 unk26; +} struct_801CAF10; /* size >= 0x28 */ + +u32 D_801D9460[0x5F] = { + 0x9D14, 0x232A14, 0x296314, 0x2F8A14, 0x457E18, 0x63CA14, 0x84AA14, 0xA03314, 0xA45E14, + 0xBB4E14, 0xCA6514, 0xD3770E, 0xE33302, 0xE78108, 0xEB2102, 0xEC6C14, 0x01008A14, 0x01163A14, + 0x01217A14, 0x01377A14, 0x014D8A14, 0x01638A14, 0x01798A14, 0x018F7A14, 0x01A58A14, 0x01BB8A14, 0x01D1170E, + 0x01D5490E, 0x01DF770E, 0x01EF740A, 0x01F9770E, 0x02097A14, 0x021FDC16, 0x024DBA14, 0x026E7A14, 0x0284BA14, + 0x02A59A14, 0x02C16A14, 0x02D26A14, 0x02E3BA14, 0x03048A14, 0x031A1A14, 0x03206A14, 0x03318A14, 0x03476A14, + 0x0358CA14, 0x03799A14, 0x0395CA14, 0x03B67A14, 0x03CCCA14, 0x03ED8A14, 0x04037A14, 0x04196A14, 0x042A8A14, + 0x0440AA14, 0x045CDA14, 0x04839A14, 0x049F9A14, 0x04BB7A14, 0x04D14D14, 0x04DF5C14, 0x04F33D14, 0x05015216, + 0x050681FA, 0x050A9D14, 0x052D9810, 0x05449A14, 0x05609810, 0x05779A14, 0x05939810, 0x05AA5A14, 0x05BB9C10, + 0x05DC7A14, 0x05F22A14, 0x05F83D14, 0x06067A14, 0x061C2A14, 0x0622D810, 0x06427810, 0x06549810, 0x066B9B10, + 0x06899B10, 0x06A74810, 0x06B06810, 0x06BE5A14, 0x06CF770E, 0x06DF870E, 0x06EFB70E, 0x0707670E, 0x07138A0E, + 0x0729670E, 0x07356D14, 0x074A1F16, 0x07526D14, 0x07675216, +}; + +s32 func_801CA920(s32 arg0, u8* arg1, int* arg2, int* arg3, int* arg4) { + s32 var_s0; + OSPiHandle* sp58; + OSMesgQueue sp40; + void* sp3C; + OSIoMesg sp24; + + sp58 = osDriveRomInit(); + if ((arg0 >= 0x20) && (arg0 < 0x7F)) { + var_s0 = LeoGetAAdr2(D_801D9460[arg0 - 0x20], arg2, arg3, arg4); + } else if (arg0 >= 0x8140) { + var_s0 = LeoGetKAdr(arg0); + *arg2 = 0x10; + *arg3 = 0x10; + *arg4 = 0xB; + } else { + return -1; + } + osCreateMesgQueue(&sp40, &sp3C, 1); + // clang-format off + sp24.hdr.retQueue = &sp40; sp24.devAddr = var_s0 + 0xA0000; sp24.dramAddr = (void*)arg1; sp24.hdr.pri = 0; sp24.size = 0x80; + // clang-format on + sp58->transferInfo.cmdType = 2; + osEPiStartDma(sp58, &sp24, 0); + osRecvMesg(&sp40, NULL, OS_MESG_BLOCK); + return 0; +} + +extern const u16 D_801D9C10[]; +u16 func_801CAA44(s32 arg0) { + return D_801D9C10[arg0 & 0xF]; +} + +void func_801CAA60(u8* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s16* arg6, s32 arg7) { + s32 var_a0; + s32 var_s0; + u8* var_s1; + s32 var_s5; + s16* var_s2; + + var_s1 = arg0; + var_s2 = arg6; + for (var_s5 = 0; var_s5 < arg4; var_s5++) { + for (var_s0 = 0; var_s0 < arg3; var_s0++) { + if (!(var_s0 & 1)) { + var_a0 = (s32)*var_s1 >> 4; + } else { + var_a0 = *var_s1 & 0xF; + var_s1 += 1; + } + var_s2[arg1 + (((arg2 - arg5) + var_s5 + 0xB) * arg7) + var_s0] = func_801CAA44(var_a0); + } + if (arg3 & 1) { + var_s1 += 1; + } + } +} + +void func_801CAB68(struct_801CAF10* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + arg0->unk10 = arg1; + arg0->unk11 = arg2; + arg0->unk12 = arg3; + arg0->unk13 = arg4; +} + +void func_801CAB84(struct_801CAF10* arg0, s32 arg1, s32 arg2) { + arg0->unkA = (s16)(arg0->unk14 + arg1); + arg0->unkC = (s16)(arg0->unk16 + arg2); +} + +void func_801CABA4(struct_801CAF10* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { + arg0->unk14 = (u16)arg1; + arg0->unk16 = (u16)arg2; + arg0->unk18 = (u16)arg3; + arg0->unk1A = (u16)arg4; +} + +void func_801CABC0(struct_801CAF10* arg0, s16* arg1, s32 arg2, s32 arg3) { + arg0->unk20 = (s16*)((uintptr_t)arg1 + 0x20000000); + arg0->unk24 = (u16)arg2; + arg0->unk26 = (u16)arg3; + func_801CABA4(arg0, 0, 0, arg2 - 1, arg3 - 1); +} + +void func_801CAC24(struct_801CAF10* arg0, u8* arg1, s32 arg2) { + arg0->unk4 = (u8*)((uintptr_t)arg1 + 0x20000000); + arg0->unk8 = arg2; +} + +void func_801CAC3C(struct_801CAF10* arg0, u8 arg1) { + s32 var_a0; + int sp48; + int sp44; + int sp40; + s32 var_v0; + + if (arg0->unk1C != 0) { + var_a0 = (arg0->unk1C << 8) | arg1; + } else { + if ((arg1 >= 0x80) && (arg1 < 0x99)) { + arg0->unk1C = (u8)arg1; + return; + } + var_a0 = arg1; + } + arg0->unk1C = 0; + if (func_801CA920(var_a0, arg0->unk4, &sp48, &sp44, &sp40) == 0) { + if ((s32)arg0->unk18 < (arg0->unkA + sp48)) { + arg0->unkA = arg0->unk14; + if ((s32)arg0->unk1A < arg0->unkC + 0x10) { + arg0->unkC = arg0->unk16; + } else { + arg0->unkC = arg0->unkC + 0x10; + } + } + func_801CAA60(arg0->unk4, arg0->unkA, arg0->unkC, sp48, sp44, sp40, arg0->unk20, (s32)arg0->unk24); + if (sp48 == 0x10) { + var_v0 = sp48; + } else { + var_v0 = sp48 + 2; + } + arg0->unkA += var_v0; + } +} + +void func_801CAD64(struct_801CAF10* arg0, u8 arg1) { + if ((arg1 >= 0x20) && (arg1 < 0x100)) { + func_801CAC3C(arg0, arg1); + } else { + switch (arg1) { + case 0: + break; + case 0xA: + arg0->unkC += 0x20; + FALLTHROUGH; + case 0xD: + arg0->unkA = arg0->unk14; + break; + case 9: + do { + func_801CAC3C(arg0, 0x20); + } while ((arg0->unkA - arg0->unk14) % 256); + break; + } + } +} + +void func_801CAE2C(struct_801CAF10* arg0, u8* arg1, s32 arg2, s32 arg3) { + u8* var_s0; + s32 var_s1; + + var_s0 = arg1; + for (var_s1 = arg2 * arg3; var_s1 != 0; var_s1--) { + func_801CAD64(arg0, *var_s0++); + } +} + +void func_801CAE88(struct_801CAF10* arg0, u8* arg1) { + while (*arg1 != 0) { + func_801CAD64(arg0, *arg1++); + } +} + +struct_801CAF10* func_801CAEE0(struct_801CAF10* arg0, u8* arg1, s32 arg2) { + func_801CAE2C(arg0, arg1, 1, arg2); + return arg0; +} + +void func_801CAF10(struct_801CAF10* arg0) { + arg0->unk0 = func_801CAEE0; + arg0->unkA = 0; + arg0->unkC = 0; + arg0->unk14 = 0; + arg0->unk16 = 0; + arg0->unk18 = 0; + arg0->unk1A = 0; + arg0->unk10w = 0; + arg0->unk1C = 0; + arg0->unk4 = 0; +} + +void func_801CAF48(struct_801CAF10* arg0) { +} + +void func_801CAF54(PrintCallback* arg0, const char* arg1, va_list arg2) { + PrintUtils_VPrintf(arg0, arg1, arg2); +} + +void func_801CAF74(PrintCallback* arg0, const char* arg1, ...) { + va_list varargs; + + va_start(varargs, arg1); + func_801CAF54(arg0, arg1, varargs); + va_end(varargs); +} + +const u16 D_801D9C10[0x10] = { + 1, 0x1085, 0x2109, 0x318D, 0x4211, 0x5295, 0x6319, 0x739D, + 0x8C63, 0x9CE7, 0xAD6B, 0xBDEF, 0xCE73, 0xDEF7, 0xEF7B, 0xFFFF, +}; diff --git a/src/n64dd/n64dd_801C8000.c b/src/n64dd/n64dd_801C8000.c deleted file mode 100644 index 2212fe43fb4..00000000000 --- a/src/n64dd/n64dd_801C8000.c +++ /dev/null @@ -1,348 +0,0 @@ -// Does some command processing - -#include "n64dd.h" - -#include "array_count.h" -#include "versions.h" -#include "z_locale.h" - -void func_801C8554(void); -void func_801C8578(void* arg0, void* arg1, OSId id, void* sp, OSPri pri); -void func_801C8638(void (*arg0)(void*, void*, void*), s32 arg1, void (*arg2)(void*, uintptr_t, size_t)); -void func_801C868C(void* arg0, void* arg1, void* arg2, u8 arg3); -s8 func_801C8770(void); -s32 func_801C87C0(void); -s32 func_801C87FC(void); -s32 func_801C8844(void); -s32 func_801C885C(void); -s32 func_801C88AC(void); -s32 func_801C88FC(void); - -s32 D_801D2E60 = 0; -s32 D_801D2E64 = 0; - -typedef struct struct_801D2E68 { - /* 0x0 */ void (*unk_0)(struct_801E0D18*); - /* 0x4 */ s32 (*unk_4)(struct_801E0D18*); -} struct_801D2E68; // size = 0x8 - -struct_801D2E68 D_801D2E68[5] = { - { func_801C81EC, func_801C91E0 }, { func_801C832C, func_801C9260 }, { func_801C83A0, func_801C9260 }, - { func_801C8414, func_801C9334 }, { func_801C8414, func_801C93C4 }, -}; - -s32 D_801D2E90 = 0; - -OSMesgQueue* B_801E0D10[2]; -struct_801E0D18 B_801E0D18; -OSMesg B_801E0D88[1]; -OSMesg B_801E0D90[8]; -OSThread B_801E0DB0; - -s32 func_801C8000(struct_801D9D50* arg0) { - switch (arg0->unk_00) { - case 0: - if (func_801C8844() != 0) { - return 1; - } - func_801C8554(); - break; - case 1: - func_801C8578(arg0->unk_1C, arg0->unk_20, arg0->unk_24, arg0->unk_28, arg0->unk_2C); - break; - case 2: - func_801C8638(arg0->unk_0C, arg0->unk_10, arg0->unk_14); - break; - case 3: - if (func_801C8844() != 0) { - return 1; - } - func_801C868C(arg0->unk_18, arg0->unk_1C, arg0->unk_20, 1); - break; - case 4: - if (func_801C8844() != 0) { - return 1; - } - func_801C868C(arg0->unk_18, arg0->unk_1C, arg0->unk_20, 2); - break; - case 5: - arg0->unk_08 = func_801C8770(); - return arg0->unk_08; - case 7: - return func_801C87FC(); - case 6: - return func_801C8844(); - case 8: - arg0->unk_04 = func_801C87C0(); - return arg0->unk_04; - case 9: - return func_801C885C(); - case 10: - return func_801C88AC(); - case 11: - return func_801C88FC(); - case 12: - D_801D2EA0 = 0; - break; - case 13: - D_801D2EA0 = 1; - break; - } - return 0; -} - -void func_801C819C(UNK_TYPE arg0) { - if (arg0 != 0) { - D_801D2E60 = 1; - } else { - D_801D2E60 = 2; - } -} - -s32 func_801C81C4(void) { - return D_801D2E60; -} - -s32 func_801C81D4(void) { - return D_801D2E64 == 1; -} - -void func_801C81EC(struct_801E0D18* arg0) { - osCreateMesgQueue(&arg0->unk_1C, B_801E0D88, ARRAY_COUNT(B_801E0D88)); - - if (gCurrentRegion == 1) { - arg0->unk_68 = LeoCJCreateLeoManager(LEO_PRIORITY_WRK, LEO_PRIORITY_INT, B_801E0D90, ARRAY_COUNT(B_801E0D90)); - } else { - arg0->unk_68 = LeoCACreateLeoManager(LEO_PRIORITY_WRK, LEO_PRIORITY_INT, B_801E0D90, ARRAY_COUNT(B_801E0D90)); - } - - if ((arg0->unk_68 == LEO_ERROR_DEVICE_COMMUNICATION_FAILURE) || (arg0->unk_68 == LEO_ERROR_GOOD)) { - D_801D2E64 = 1; - } -} - -void func_801C8298(struct_801E0D18* arg0) { - LEOCmd sp1C; - - // TODO: passing a pointer as a logical block address? - LeoSeek(&sp1C, (u32)&arg0->diskId, &arg0->unk_1C); - osRecvMesg(&arg0->unk_1C, (OSMesg*)&arg0->unk_68, OS_MESG_BLOCK); -} - -void func_801C82E0(struct_801E0D18* arg0) { - LEOCmd sp1C; - - LeoSpdlMotor(&sp1C, 4, &arg0->unk_1C); - osRecvMesg(&arg0->unk_1C, (OSMesg*)&arg0->unk_68, OS_MESG_BLOCK); -} - -void func_801C832C(struct_801E0D18* arg0) { - s32 sp34; - s32 startLBA = arg0->unk_5C; - - if (LeoByteToLBA(startLBA, arg0->unk_60, &sp34) == LEO_ERROR_GOOD) { - OSMesgQueue* sp28 = &arg0->unk_1C; - - LeoReadWrite(&arg0->unk_00, OS_READ, startLBA, (void*)arg0->unk_58, sp34, sp28); - osRecvMesg(sp28, (OSMesg*)&arg0->unk_68, OS_MESG_BLOCK); - } -} - -void func_801C83A0(struct_801E0D18* arg0) { - s32 sp34; - s32 startLBA = arg0->unk_58; - - if (LeoByteToLBA(startLBA, arg0->unk_60, &sp34) == LEO_ERROR_GOOD) { - OSMesgQueue* sp28 = &arg0->unk_1C; - - LeoReadWrite(&arg0->unk_00, OS_WRITE, startLBA, (void*)arg0->unk_5C, sp34, sp28); - osRecvMesg(sp28, (OSMesg*)&arg0->unk_68, OS_MESG_BLOCK); - } -} - -void func_801C8414(struct_801E0D18* arg0) { - arg0->unk_68 = 9; -} - -void func_801C8424(struct_801E0D18* arg0) { - struct_801D2E68* temp_v0; - s32 (*temp_s2)(struct_801E0D18*); - void (*aux)(struct_801E0D18*); - s32 temp_v0_2; - - arg0->unk_68 = -1; - if ((func_801C81D4() != 0) || (arg0->unk_64 == 0)) { - arg0->unk_66 = 1; - temp_v0 = &D_801D2E68[arg0->unk_64]; - aux = temp_v0->unk_0; - temp_s2 = temp_v0->unk_4; - do { - aux(arg0); - temp_v0_2 = temp_s2(arg0); - } while (temp_v0_2 == 2); - arg0->unk_6C = temp_v0_2; - if (arg0->unk_64 == 0) { - func_801C819C(temp_v0_2); - } - arg0->unk_66 = 0; - } -} - -void func_801C84D4(void* arg) { - while (true) { - struct_801E0D18* sp24; - - osRecvMesg(B_801E0D10[0], (OSMesg*)&sp24, OS_MESG_BLOCK); - func_801C8424(sp24); - osSendMesg(B_801E0D10[1], NULL, OS_MESG_BLOCK); - } -} - -void func_801C8554(void) { - osDestroyThread(&B_801E0DB0); -} - -void func_801C8578(void* arg0, void* arg1, OSId id, void* sp, OSPri pri) { - B_801E0D10[0] = (OSMesgQueue*)arg0; - B_801E0D10[1] = (OSMesgQueue*)arg1; - osCreateThread(&B_801E0DB0, id, &func_801C84D4, NULL, sp, pri); - osStartThread(&B_801E0DB0); -} - -void func_801C85F0(struct_801E0D18* arg0, s32 arg1) { - if (arg1 == 1) { - func_801C8424(arg0); - } else { - osSendMesg(B_801E0D10[0], arg0, OS_MESG_BLOCK); - } -} - -void func_801C8638(void (*arg0)(void*, void*, void*), s32 arg1, void (*arg2)(void*, uintptr_t, size_t)) { - s32 var0 = 0; - - func_801C9B50(arg1, arg2); - D_801D2EB4 = arg0; - B_801E0D18.unk_64 = var0; - B_801E0D18.unk_65 = var0; - func_801C85F0(&B_801E0D18, 0); -} - -void func_801C868C(void* arg0, void* arg1, void* arg2, u8 arg3) { - s32 var0 = (s32)arg0; - s32 var1 = (s32)arg1; - s32 var2 = (s32)arg2; - s32 var3 = arg3; - s32 var4 = 4; - - if (D_801D2E90 == 1) { - D_801D2E90 = 0; - B_801E0D18.unk_64 = var4; - func_801C85F0(&B_801E0D18, 1); - if (B_801E0D18.unk_6C == 3 || B_801E0D18.unk_6C == 4) { - return; - } - } - - B_801E0D18.unk_58 = var0; - B_801E0D18.unk_5C = var1; - B_801E0D18.unk_60 = var2; - B_801E0D18.unk_64 = var3; - func_801C85F0(&B_801E0D18, 0); -} - -s32 func_801C873C(struct_801E0D18* arg0) { - u8 sp1F; - - arg0->unk_68 = LeoTestUnitReady(&sp1F); - return !(sp1F & LEO_TEST_UNIT_MR); -} - -s8 func_801C8770(void) { - s32 temp = func_801C873C(&B_801E0D18); - - if (B_801E0D18.unk_68 == LEO_ERROR_BUSY) { - return 0; - } - - if (!temp) { - return 2; - } - - return 1; -} - -s32 func_801C87C0(void) { - if (func_801C8844() == 0) { - if (B_801E0D18.unk_68 != 0) { - return B_801E0D18.unk_68; - } - } - - return -1; -} - -s32 func_801C87FC(void) { - s32* new_var = &B_801E0D18.unk_68; - s32 temp_v0; - - if (func_801C8844() == 0) { - temp_v0 = B_801E0D18.unk_6C; - - if ((temp_v0 == 3) || (temp_v0 == 4)) { - return *new_var; - } - } - - return 0; -} - -s32 func_801C8844(void) { - return B_801E0D18.unk_66 == 1; -} - -s32 func_801C885C(void) { - B_801E0D18.unk_64 = 3; - func_801C85F0(&B_801E0D18, 1); - -#if OOT_VERSION >= NTSC_1_1 - D_801D2E90 = 0; -#endif - - if ((B_801E0D18.unk_6C == 3) || (B_801E0D18.unk_6C == 4)) { - return -1; - } - return B_801E0D18.unk_6C == 0; -} - -s32 func_801C88AC(void) { - s32 phi_v0; - - B_801E0D18.unk_64 = 4; - func_801C85F0(&B_801E0D18, 1); - -#if OOT_VERSION >= NTSC_1_1 - D_801D2E90 = 0; -#endif - - if ((B_801E0D18.unk_6C == 3) || (B_801E0D18.unk_6C == 4)) { - return -1; - } - return B_801E0D18.unk_6C == 0; -} - -s32 func_801C88FC(void) { - s32 temp = 0; - s32 phi_v1; - - if (LeoDriveExist()) { - phi_v1 = 8; - } else { - phi_v1 = 0; - } - - temp = phi_v1 == temp; - - B_801E0D18.unk_68 = phi_v1; - - return temp; -} diff --git a/src/n64dd/n64dd_801C8940.c b/src/n64dd/n64dd_801C8940.c deleted file mode 100644 index 132222b689e..00000000000 --- a/src/n64dd/n64dd_801C8940.c +++ /dev/null @@ -1,400 +0,0 @@ -// Lower-level command processing in a background thread -#include "n64dd.h" - -#include "libc64/sleep.h" -#include "attributes.h" - -s32 D_801D2EA0 = 0; -u8* D_801D2EA4 = NULL; -s32 D_801D2EA8 = 0; -u8* D_801D2EAC = NULL; -u8* D_801D2EB0 = NULL; -void (*D_801D2EB4)(void*, void*, void*) = NULL; - -s32 B_801E0F60; -s32 B_801E0F64; - -// Set error message title texture? -void func_801C8940(s32 errorNum) { - D_801D2EA4 = func_801C9E28(errorNum); - D_801D2EA8 = 1; -} - -// Clear error message title texture? -void func_801C8974(void) { - if (D_801D2EA8 == 1) { - D_801D2EA4 = func_801C9EC0(); - D_801D2EA8 = 0; - } -} - -// Set error message something -void func_801C89B8(s32 errorNum) { - D_801D2EAC = func_801C9F90(errorNum); - B_801E0F60 = 1; -} - -// Clear error message something -void func_801C89EC(void) { - if (B_801E0F60 == 1) { - D_801D2EAC = func_801C9FFC(); - B_801E0F60 = 0; - } -} - -// Set error message something -void func_801C8A30(s32 errorNum) { - D_801D2EB0 = func_801CA030(errorNum); - B_801E0F64 = 1; -} - -// Clear error message something -void func_801C8A64(void) { - if (B_801E0F64 == 1) { - D_801D2EB0 = func_801CA070(); - B_801E0F64 = 0; - } -} - -void func_801C8AA8(void) { - osRecvMesg(B_801E0D10[1], NULL, OS_MESG_NOBLOCK); - - if ((D_801D2EB4 != NULL) && (D_801D2EA0 == 0)) { - u32 temp_v0 = osSetIntMask(OS_IM_NONE); - void* sp20 = D_801D2EA4; - void* sp1C = D_801D2EAC; - void* sp18 = D_801D2EB0; - - D_801D2EA4 = NULL; - D_801D2EAC = NULL; - D_801D2EB0 = NULL; - osSetIntMask(temp_v0); - D_801D2EB4(sp20, sp1C, sp18); - } -} - -void func_801C8B58(s32 arg0, s32 arg1, s32 arg2) { - func_801C8940(arg0); - func_801C89B8(arg1); - func_801C8A30(arg2); -} - -void func_801C8B90(void) { - func_801C8974(); - func_801C89EC(); - func_801C8A64(); -} - -s32 func_801C8BC0(struct_801E0D18* arg0) { - if ((arg0->unk_68 < 0x25) || (arg0->unk_68 >= 0x29)) { - if ((arg0->unk_68 != 0x1F) && (arg0->unk_68 != 0x20)) { - func_801C8940(arg0->unk_68); - func_801C89B8(3); - } - } - LeoClearQueue(); - return 4; -} - -s32 func_801C8C1C(struct_801E0D18* arg0) { - s32 var_s0; - - do { - var_s0 = 0; - Sleep_Msec(60); - func_801C82E0(arg0); - - switch (arg0->unk_68) { - case 0x2A: - func_801C8A64(); - return 0; - case 0x22: - func_801C8A64(); - LeoClearQueue(); - return 3; - case 0: - func_801C8A30(6); - FALLTHROUGH; - case 0x23: - var_s0 = 1; - break; - } - } while (var_s0 != 0); - - func_801C8A64(); - return func_801C8BC0(arg0); -} - -s32 func_801C8CEC(struct_801E0D18* arg0) { - switch (arg0->unk_68) { - case 0x22: - func_801C8B90(); - LeoClearQueue(); - return 3; - case 0x2: - func_801C8940(arg0->unk_68); - func_801C8A30(5); - return 9; - case 0x0: - func_801C8B90(); - return 0; - case 0x2B: - if (arg0->unk_65 == 0) { - func_801C8B90(); - arg0->unk_65 = 2; - return 1; - } - FALLTHROUGH; - default: - func_801C8B90(); - return func_801C8BC0(arg0); - case 0x23: - return 9; - } -} - -s32 func_801C8DC0(struct_801E0D18* arg0) { - s32 temp_v0; - - while (true) { - func_801C8298(arg0); - switch (arg0->unk_68) { - case 0x31: - func_801C8940(arg0->unk_68); - func_801C89B8(2); - return 5; - case 0x2A: - func_801C8B90(); - return 5; - } - temp_v0 = func_801C8CEC(arg0); - if (temp_v0 != 9) { - return temp_v0; - } - Sleep_Msec(60); - } -} - -s32 func_801C8E70(struct_801E0D18* arg0) { - s32 temp_a0; - s32 temp_v0; - - while (true) { - Sleep_Msec(60); - func_801C8298(arg0); - - switch (arg0->unk_68) { - case 0x23: - continue; - case 0x31: - func_801C8940(arg0->unk_68); - func_801C89B8(2); - FALLTHROUGH; - case 0x2A: - func_801C8A30(4); - continue; - } - - temp_v0 = func_801C8CEC(arg0); - if (temp_v0 != 9) { - return temp_v0; - } - } -} - -s32 func_801C8F1C(struct_801E0D18* arg0) { - if (D_801D2E54 != NULL) { - return D_801D2E54(arg0); - } - return 1; -} - -s32 func_801C8F58(struct_801E0D18* arg0) { - s32 temp_v0; - - while (true) { - temp_v0 = func_801C8E70(arg0); - if (temp_v0 == 3 || temp_v0 == 4) { - return temp_v0; - } - - // Fake match? - if ((temp_v0 & 0xFFFFFFFF) == 0) { - if (func_801C8F1C(arg0) != 0) { - return 2; - } - func_801C89B8(1); - temp_v0 = func_801C8C1C(arg0); - if (temp_v0 != 0) { - return temp_v0; - } - func_801C89EC(); - } - } -} - -s32 func_801C9000(struct_801E0D18* arg0) { - s32 phi_s0; - s32 temp_s4; - - while (true) { - phi_s0 = func_801C8E70(arg0); - if (phi_s0 == 3 || phi_s0 == 4) { - return phi_s0; - } - - // Fake match? - if ((phi_s0 & 0xFFFFFFFF) == 0) { - func_801C8B90(); - - temp_s4 = func_801C8F1C(arg0); - if (temp_s4 == 3 || temp_s4 == 4) {} - if (temp_s4 != 0) { - return 2; - } - - func_801C89B8(1); - - phi_s0 = func_801C8C1C(arg0); - if (phi_s0 == 3 || phi_s0 == 4) {} - if (phi_s0 != 0) { - return phi_s0; - } - - func_801C89EC(); - if (temp_s4 != 0) { - return phi_s0; - } - } - } -} - -s32 func_801C90C4(struct_801E0D18* arg0) { - func_801C8940(arg0->unk_68); - func_801C89B8(2); - return func_801C9000(arg0); -} - -s32 func_801C90FC(struct_801E0D18* arg0) { - func_801C8940(arg0->unk_68); - return func_801C9000(arg0); -} - -s32 func_801C912C(struct_801E0D18* arg0) { - s32 i = 0; - s32 temp_v0; - - do { - LeoResetClear(); - - temp_v0 = func_801C8DC0(arg0); - if (temp_v0 == 3 || temp_v0 == 4) { - return temp_v0; - } - if (temp_v0 != 1) { - if (temp_v0 == 0) { - return temp_v0; - } else { - return temp_v0; - } - } - - Sleep_Msec(250); - } while (i++ < 30); - - return func_801C8BC0(arg0); -} - -s32 func_801C91E0(struct_801E0D18* arg0) { - if (arg0->unk_68 == 0x29) { - return func_801C8BC0(arg0); - } - - if (osMemSize < 0x800000) { - // LEO_ERROR_RAMPACK_NOT_CONNECTED? - func_801C8B58(0x2C, 0, 3); - return 4; - } - - if (func_801C912C(arg0) == 0) { - D_801D2E90 = 1; - } - return 0; -} - -s32 func_801C9260(struct_801E0D18* arg0) { - s32 temp_v0; - - switch (arg0->unk_68) { - case 0x17: - func_801C873C(arg0); - temp_v0 = func_801C8C1C(arg0); - if (temp_v0 != 0) { - return temp_v0; - } - func_801C8B90(); - return 2; - - case 0x2: - return func_801C8F58(arg0); - - case 0x22: - LeoClearQueue(); - return 3; - - case 0x31: - return func_801C90C4(arg0); - - case 0x2F: - return func_801C9000(arg0); - - case 0x2A: - return func_801C90FC(arg0); - - case 0x0: - return 0; - - case 0x23: - return 2; - } - - return func_801C8BC0(arg0); -} - -s32 func_801C9334(struct_801E0D18* arg0) { - while (true) { - u32 temp_v0 = func_801C8DC0(arg0); - - if (temp_v0 == 3 || temp_v0 == 4 || temp_v0 == 5) { - return temp_v0; - } - - // Fake match? - if ((temp_v0 & 0xFFFFFFFF) == 0) { - if (func_801C8F1C(arg0) != 0) { - return 0; - } - return 7; - } - - if (1) {} - } -} - -s32 func_801C93C4(struct_801E0D18* arg0) { - s32 temp_v0; - s32 temp_v0_2; - - while (true) { - temp_v0_2 = func_801C9334(arg0); - if (temp_v0_2 != 7) { - return temp_v0_2; - } - func_801C89B8(1); - temp_v0 = func_801C8C1C(arg0); - if (temp_v0 != 0) { - return temp_v0; - } - func_801C89EC(); - } -} diff --git a/src/n64dd/n64dd_801C9440.c b/src/n64dd/n64dd_801C9440.c deleted file mode 100644 index ecab855d4ae..00000000000 --- a/src/n64dd/n64dd_801C9440.c +++ /dev/null @@ -1,263 +0,0 @@ -// Some text-handling functions -#include "n64dd.h" -#include "versions.h" - -void (*D_801D2EC0)(void*, uintptr_t, size_t) = NULL; - -s32 B_801E0F70; - -/** - * Seems to work out if a pair of bytes is a valid EUC-JP character, although there may be additions to the font that - * make the strange first check make more sense. - * - * @param bytes Array 2 bytes to test - * @return boolean - */ -int func_801C9440(u8* bytes) { - // This is every possible first byte. May make more sense what was intended with the font files? - if (((*bytes >= 0x8E) && (*bytes <= 0xFE)) || ((*bytes != 0x8F) && (*bytes != 0xA0))) { - bytes++; - return (*bytes >= 0xA0) && (*bytes <= 0xFE); - } - return false; -} - -/** - * A crude check for a valid 2-byte Shift-JIS character - * - * @param bytes Array containing a pair of bytes to test - * @return boolean - */ -int func_801C9494(u8* bytes) { - // Allowable first bytes. - if (((*bytes >= 0x81) && (*bytes <= 0x9F)) || ((*bytes >= 0xE0) && (*bytes <= 0xFC))) { - bytes++; - // Allowable second bytes. - return (*bytes >= 0x40) && (*bytes <= 0xFC) && *bytes != 0x7F; - } - return false; -} - -// Extracts 2 bytes from a bytepacked big-endian short. -void func_801C94F8(u8* arg0, u16 arg1) { - arg0[0] = arg1 >> 8; - arg0[1] = arg1 & 0xFF; -} - -// Convert EUC-JP to JIS X 0208 -u16 func_801C9514(u16 eucjpCh) { - return eucjpCh - 0x8080; -} - -/** - * Converts a JIS X 0208 codepoint to a Shift-JIS one. - * - * @param jisCodepoint Two bytes, each between 0x21 and 0x7E, packed big-endian into a short. - * @return u16 Shift-JIS character representation (expected to be big-endian) - */ -u16 func_801C9534(u16 jisCodepoint) { - u8 hiByte = (jisCodepoint >> 8) & 0xFF; - u8 loByte = jisCodepoint & 0xFF; - - if (hiByte & 1) { - loByte += 0x1F; - if (loByte >= 0x7F) { - loByte++; - } - } else { - loByte += 0x7E; - } - - hiByte = (hiByte - 0x21) / 2 + 0x81; - if (hiByte >= 0xA0) { - hiByte += 0x40; - } - - return (hiByte << 8) + loByte; -} - -void func_801C95C0(void* arg0, uintptr_t arg1, size_t arg2) { - if (D_801D2EC0 != NULL) { - D_801D2EC0(arg0, arg1, arg2); - } -} - -s32 func_801C95F0(u8* arg0) { - return LeoGetKAdr(func_801C9534(func_801C9514((arg0[0] << 8) | arg0[1]))) + DDROM_FONT_START; -} - -s32 func_801C963C(s32* arg0, int* dx, int* dy, int* cy, u8 arg4) { - s32 temp_v0; - s32 temp_v1; - - u16 temp = arg4 - 0x20; - temp += 0xC0 * B_801E0F70; - - temp_v0 = LeoGetAAdr(temp, dx, dy, cy); - temp_v1 = temp_v0 & 0xF; - *arg0 = (temp_v0 - temp_v1) + DDROM_FONT_START; - return temp_v1; -} - -s32 func_801C969C(void* arg0, int* dx, int* dy, int* cy, u8* arg4) { - s32 sp24; - s32 phi_v1; - - if (func_801C9440(arg4)) { - sp24 = func_801C95F0(arg4); - *dx = 16; - *dy = 16; - *cy = 11; - phi_v1 = 0; - } else { - phi_v1 = func_801C963C(&sp24, dx, dy, cy, *arg4); - } - - func_801C95C0(arg0, sp24, 0x80); - return phi_v1; -} - -// return boolean -s32 func_801C9740(u8* arg0, s32 arg1, u8 arg2) { - if (arg1 == 1) { - *arg0 = arg2 << 4; - return false; - } else { - *arg0 |= arg2; - return true; - } -} - -u8* func_801C9778(u8* arg0, s32* arg1, s32 arg2) { - arg0 += (arg2 >> 1); - - if (((*arg1 == 1) && !(arg2 & 1)) || ((*arg1 == 0) && (arg2 & 1))) { - arg0 += arg2 & 1; - *arg1 = 1; - } else { - *arg1 = 0; - } - return arg0; -} - -s32 func_801C97C4(u8** arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, u8* arg5, s32 dx, s32 dy, s32 cy) { - u8* var_fp; - u8* var_s0; - s32 var_s1; - s32 x; - s32 sp4C; - s32 var_s4; - s32 sp44; - - sp4C = arg2; - sp44 = dx + arg3 + arg4; - var_s4 = 1; - var_fp = func_801C9778(*arg0, &sp4C, arg3); - arg1 >>= 1; - var_fp += ((11 - cy) * arg1); - if (dx & 1) { - dx++; - } - while (dy--) { - var_s0 = var_fp; - var_s1 = sp4C; - for (x = 0; x < dx; x++) { - if (var_s4 == 1) { - if (func_801C9740(var_s0, var_s1, *arg5 >> 4)) { - var_s0++; - } - } else { - if (func_801C9740(var_s0, var_s1, *arg5 & 0xF)) { - var_s0++; - } - arg5++; - } - var_s4 ^= 1; - var_s1 ^= 1; - } - var_fp += arg1; - } - *arg0 = func_801C9778(*arg0, &arg2, sp44); - return arg2; -} - -void func_801C9954(u8* bytes, s32* arg1, s32* arg2) { - u8 prevCh; - u8 nextCh; - - if (func_801C9440(bytes)) { - *arg1 = *arg2 = 0; - return; - } - - *arg1 = *arg2 = 0; - - prevCh = bytes[-1]; - nextCh = bytes[1]; - - switch (bytes[0]) { - case ' ': - *arg1 = *arg2 = 0; - return; - - case 'I': - case 'i': -#if OOT_NTSC - *arg2 = 2; - if (1) {} -#endif - - *arg1 = 2; - *arg2 = 2; - - if (prevCh == ' ') { - *arg1 = 0; - } - if (nextCh == ' ') { - *arg2 = 0; - } - return; - } - -#if OOT_NTSC - *arg2 = 1; - if (1) {} -#endif - - *arg1 = 1; - *arg2 = 1; -} - -void func_801C9A10(u8* arg0, s32 arg1, u8* str) { - u8 sp80[0xA0]; - u8* temp_s1; - int dx; - int dy; - int cy; - s32 var_s2; - s32 sp68; - s32 sp64; - s32 temp_v1; - - temp_s1 = (u8*)((((uintptr_t)&sp80 + 0xF) / 0x10) * 0x10); - var_s2 = 1; - if (str != NULL) { - while (*str != '\0') { - func_801C9954(str, &sp68, &sp64); - temp_v1 = func_801C969C(temp_s1, &dx, &dy, &cy, str); - if (dx & 1) { - dx++; - } - var_s2 = func_801C97C4(&arg0, arg1, var_s2, sp68, sp64, &temp_s1[temp_v1], dx, dy, cy); - if (func_801C9440(str)) { - str++; - } - str++; - } - } -} - -void func_801C9B50(s32 arg0, void (*arg1)(void*, uintptr_t, size_t)) { - B_801E0F70 = arg0; - D_801D2EC0 = arg1; -} diff --git a/src/n64dd/n64dd_801C9B70.c b/src/n64dd/n64dd_801C9B70.c deleted file mode 100644 index 79f205c7771..00000000000 --- a/src/n64dd/n64dd_801C9B70.c +++ /dev/null @@ -1,172 +0,0 @@ -// User-facing error handling -#include "n64dd.h" -#include "z_locale.h" - -u8 B_801E0F80[0x600]; -u8 B_801E1580[0x2800]; -u8 B_801E3D80[0x1400]; - -/** - * Converts a number in decimal to a hexadecimal number with the same digits, e.g. 1234 -> 0x1234. - * - * Will only work on nonnegative numbers. - * - * @param decNumber Number in decimal to convert, e.g. 1234 - * @return s32 Hexadecimal number with the same digits as decNumber, e.g. 0x1234 - */ -s32 func_801C9B70(s32 decNumber) { - s32 currPlaceValue; - s32 currExponent = 0; - s32 accumulatedHexDigits = 0; - s32 remainingDecDigits; - - // Nothing to do if only one digit. - if (decNumber < 10) { - return decNumber; - } - - // Find the place value / exponent of the most significant digit in decNumber. - for (currPlaceValue = 1; 10 * currPlaceValue <= decNumber; currPlaceValue *= 10) { - currExponent++; - } - - remainingDecDigits = decNumber; - - // Transfer the digits to hex one at a time. - while (currExponent--) { - // Place the most significant remaining digit at the end of the hex output. - accumulatedHexDigits |= remainingDecDigits / currPlaceValue; - accumulatedHexDigits *= 0x10; // Shift left one hex digit. - - remainingDecDigits %= currPlaceValue; // Remove most significant of the remaining digits. - - currPlaceValue /= 10; - } - - accumulatedHexDigits += remainingDecDigits; // Only one digit left in the remainingDecDigits. - return accumulatedHexDigits; -} - -// n64ddError_GetLanguage -s32 func_801C9C48(void) { - return (gCurrentRegion == 1) ? 0 : 1; -} - -// n64ddError_Memset -void func_801C9C74(u8* dest, u8 value, u32 count) { - while (count--) { - *dest++ = value; - } -} - -// n64ddError_GetErrorHeader -const char* func_801C9CA4(void) { - return gN64DDLocalizedErrorNumberHeaders[func_801C9C48()]; -} - -// n64ddError_WriteNumberJP -// Writes a 2-digit number to the char buffer provided -// Character indices for numbers in the error code (EUC-JP) -void func_801C9CD4(u8* buf, s32 number) { - s32 temp_v0 = func_801C9B70(number); - u16 character; - - if (number >= 10) { - character = ((temp_v0 >> 4) + 0xA3B0); // '0' - } else { - character = 0xA1A1; // ' ' - } - - func_801C94F8(buf, character); - buf += 2; - func_801C94F8(buf, ((temp_v0 & 0xF) + 0xA3B0)); // '0' -} - -// n64ddError_WriteNumberEN -// Writes a 2-digit number to the char buffer provided -// Character indices for numbers in the error code (ASCII) -void func_801C9D54(u8* buf, s32 number) { - s32 temp_v0 = func_801C9B70(number); - - if (number >= 10) { - *buf = (temp_v0 >> 4) + '0'; - } else { - *buf = ' '; - } - buf++; - *buf = (temp_v0 & 0xF) + '0'; -} - -void func_801C9DB8(u8* arg0, s32 errorNum) { - u8* errorHeader = (u8*)func_801C9CA4(); - - //! @bug: both of these functions will write to the pointer target, but errorHeader points to a string literal, - //! which is meant to be const. - if (gCurrentRegion == 1) { - func_801C9CD4(&errorHeader[12], errorNum); - } else { - func_801C9D54(&errorHeader[13], errorNum); - } - func_801C9A10(arg0, 192, errorHeader); -} - -u8* func_801C9E28(s32 errorNum) { - func_801C9EC0(); - - if (errorNum == 41) { - return (u8*)gN64DDError41Texs[func_801C9C48()]; - } - - // 31,32, 37,38,39,40 - if (((errorNum >= 37) && (errorNum < 41)) || (errorNum == 31) || (errorNum == 32)) { - return B_801E0F80; - } else { - func_801C9DB8(B_801E0F80, errorNum); - return B_801E0F80; - } -} - -// Clear something -u8* func_801C9EC0(void) { - func_801C9C74(B_801E0F80, 0, 0x600); - return B_801E0F80; -} - -// Prints the error message body (?) -void func_801C9EF4(u8* arg0, s32 errorNum, s32 lineCount) { - s32 i; - - for (i = 0; i < lineCount; i++, arg0 += 0xA00) { - u8* line = (u8*)D_801D2EE0[func_801C9C48()][errorNum][i]; - - if (1) {} - func_801C9A10(arg0, 320, line); - } -} - -u8* func_801C9F90(s32 errorNum) { - func_801C9FFC(); - if (errorNum == 3) { - return (u8*)gN64DDPleaseReadManualTexs[func_801C9C48()]; - } - func_801C9EF4(B_801E1580, errorNum, 4); - return B_801E1580; -} - -// Clear something -u8* func_801C9FFC(void) { - func_801C9C74(B_801E1580, 0, 0x2800); - return B_801E1580; -} - -u8* func_801CA030(s32 errorNum) { - func_801CA070(); - func_801C9EF4(B_801E3D80, errorNum, 2); - return B_801E3D80; -} - -// Clear something -u8* func_801CA070(void) { - func_801C9C74(B_801E3D80, 0, 0x1400); - return B_801E3D80; -} diff --git a/src/n64dd/n64dd_801CA0B0.c b/src/n64dd/n64dd_801CA0B0.c deleted file mode 100644 index 8252def9e54..00000000000 --- a/src/n64dd/n64dd_801CA0B0.c +++ /dev/null @@ -1,247 +0,0 @@ -#include "n64dd.h" - -#include "libc64/aprintf.h" -#include "attributes.h" -#include "array_count.h" -#include "color.h" - -// Draws text to framebuffer -typedef struct struct_801CA704 { - /* 0x00 */ PrintCallback callback; - /* 0x04 */ void* charTexBuf; - /* 0x08 */ u16 unk_08; - /* 0x0A */ u16 posX; - /* 0x0C */ u16 posY; - /* 0x10 */ Color_RGBA8_u32 color; - /* 0x14 */ u16 baseX; - /* 0x16 */ u16 baseY; - /* 0x18 */ u16 endX; - /* 0x1A */ u16 endY; - /* 0x1C */ u8 sjisPrevByte; - /* 0x20 */ void* frameBuf; - /* 0x24 */ u16 screenWidth; - /* 0x26 */ u16 screenHeight; -} struct_801CA704; - -// clang-format off -u32 D_801D8BE0[0x5F] = { - 0x00009D14, 0x00232A14, 0x00296314, 0x002F8A14, 0x00457E18, 0x0063CA14, 0x0084AA14, 0x00A03314, - 0x00A45E14, 0x00BB4E14, 0x00CA6514, 0x00D3770E, 0x00E33302, 0x00E78108, 0x00EB2102, 0x00EC6C14, - 0x01008A14, 0x01163A14, 0x01217A14, 0x01377A14, 0x014D8A14, 0x01638A14, 0x01798A14, 0x018F7A14, - 0x01A58A14, 0x01BB8A14, 0x01D1170E, 0x01D5490E, 0x01DF770E, 0x01EF740A, 0x01F9770E, 0x02097A14, - 0x021FDC16, 0x024DBA14, 0x026E7A14, 0x0284BA14, 0x02A59A14, 0x02C16A14, 0x02D26A14, 0x02E3BA14, - 0x03048A14, 0x031A1A14, 0x03206A14, 0x03318A14, 0x03476A14, 0x0358CA14, 0x03799A14, 0x0395CA14, - 0x03B67A14, 0x03CCCA14, 0x03ED8A14, 0x04037A14, 0x04196A14, 0x042A8A14, 0x0440AA14, 0x045CDA14, - 0x04839A14, 0x049F9A14, 0x04BB7A14, 0x04D14D14, 0x04DF5C14, 0x04F33D14, 0x05015216, 0x050681FA, - 0x050A9D14, 0x052D9810, 0x05449A14, 0x05609810, 0x05779A14, 0x05939810, 0x05AA5A14, 0x05BB9C10, - 0x05DC7A14, 0x05F22A14, 0x05F83D14, 0x06067A14, 0x061C2A14, 0x0622D810, 0x06427810, 0x06549810, - 0x066B9B10, 0x06899B10, 0x06A74810, 0x06B06810, 0x06BE5A14, 0x06CF770E, 0x06DF870E, 0x06EFB70E, - 0x0707670E, 0x07138A0E, 0x0729670E, 0x07356D14, 0x074A1F16, 0x07526D14, 0x07675216, -}; -// clang-format on - -// Loads character texture to buffer -s32 func_801CA0B0(s32 charCode, void* charTexBuf, int* dx, int* dy, int* cy) { - s32 offset; - OSPiHandle* handle; - OSMesgQueue queue; - OSMesg msgBuf[1]; - OSIoMesg mesg; - - handle = osDriveRomInit(); - if (charCode >= 0x20 && charCode < 0x7F) { // ASCII - offset = LeoGetAAdr2(D_801D8BE0[charCode - 0x20], dx, dy, cy); - } else if (charCode >= 0x8140) { // Shift-JIS - offset = LeoGetKAdr(charCode); - *dx = 16; - *dy = 16; - *cy = 11; - } else { - return -1; - } - - osCreateMesgQueue(&queue, msgBuf, ARRAY_COUNT(msgBuf)); - - // clang-format off - mesg.hdr.retQueue = &queue; \ - mesg.devAddr = offset + DDROM_FONT_START; \ - mesg.dramAddr = charTexBuf; \ - mesg.size = 0x80; \ - mesg.hdr.pri = 0; - // clang-format on - - handle->transferInfo.cmdType = 2; - osEPiStartDma(handle, &mesg, 0); - osRecvMesg(&queue, NULL, OS_MESG_BLOCK); - - return 0; -} - -const u16 D_801D9390[16] = { - 0x0001, 0x1085, 0x2109, 0x318D, 0x4211, 0x5295, 0x6319, 0x739D, - 0x8C63, 0x9CE7, 0xAD6B, 0xBDEF, 0xCE73, 0xDEF7, 0xEF7B, 0xFFFF, -}; - -// Maps 4-bit intensity to a 16-bit color -u16 func_801CA1D4(u32 arg0) { - return D_801D9390[arg0 % ARRAY_COUNT(D_801D9390)]; -} - -void func_801CA1F0(void* charTexBuf, s32 posX, s32 posY, s32 dx, s32 dy, s32 cy, void* frameBuf, s32 screenWidth) { - s32 intensity; - s32 x; - s32 y; - u8* src = charTexBuf; - u16* dst = frameBuf; - - for (y = 0; y < dy; y++) { - for (x = 0; x < dx; x++) { - if (!(x & 1)) { - intensity = *src >> 4; - } else { - intensity = *src & 0xF; - src++; - } - dst[posX + x + ((posY + (11 - cy) + y) * screenWidth)] = func_801CA1D4(intensity); - } - if (dx & 1) { - src++; - } - } -} - -void func_801CA2F8(struct_801CA704* arg0, u32 r, u32 g, u32 b, u32 a) { - arg0->color.r = r; - arg0->color.g = g; - arg0->color.b = b; - arg0->color.a = a; -} - -void func_801CA314(struct_801CA704* arg0, s32 arg1, s32 arg2) { - arg0->posX = arg0->baseX + arg1; - arg0->posY = arg0->baseY + arg2; -} - -void func_801CA334(struct_801CA704* arg0, s32 baseX, s32 baseY, s32 endX, s32 endY) { - arg0->baseX = baseX; - arg0->baseY = baseY; - arg0->endX = endX; - arg0->endY = endY; -} - -void func_801CA350(struct_801CA704* arg0, void* frameBuf, s32 screenWidth, s32 screenHeight) { - arg0->frameBuf = (u8*)frameBuf + 0x20000000; - arg0->screenWidth = screenWidth; - arg0->screenHeight = screenHeight; - func_801CA334(arg0, 0, 0, screenWidth - 1, screenHeight - 1); -} - -void func_801CA3B4(struct_801CA704* arg0, void* charTexBuf, s32 arg2) { - arg0->charTexBuf = (u8*)charTexBuf + 0x20000000; - arg0->unk_08 = arg2; -} - -void func_801CA3CC(struct_801CA704* arg0, char c) { - s32 charCode; - int dx; - int dy; - int cy; - - if (arg0->sjisPrevByte != 0) { - charCode = (arg0->sjisPrevByte << 8) | c; - } else { - if (c >= 0x80 && c < 0x99) { - arg0->sjisPrevByte = c; - return; - } - charCode = c; - } - - arg0->sjisPrevByte = 0; - if (func_801CA0B0(charCode, arg0->charTexBuf, &dx, &dy, &cy) == 0) { - if (arg0->posX + dx > arg0->endX) { - arg0->posX = arg0->baseX; - if (arg0->posY + 16 > arg0->endY) { - arg0->posY = arg0->baseY; - } else { - arg0->posY += 16; - } - } - func_801CA1F0(arg0->charTexBuf, arg0->posX, arg0->posY, dx, dy, cy, arg0->frameBuf, arg0->screenWidth); - arg0->posX += (dx == 16 ? dx : dx + 2); - } -} - -void func_801CA4F4(struct_801CA704* arg0, char c) { - if (c >= ' ' && c <= 0xFF) { - func_801CA3CC(arg0, c); - } else { - switch (c) { - case '\n': - arg0->posY += 32; - FALLTHROUGH; - case '\r': - arg0->posX = arg0->baseX; - break; - case '\t': - do { - func_801CA3CC(arg0, ' '); - } while ((arg0->posX - arg0->baseX) % 256); - break; - case '\0': - break; - } - } -} - -void func_801CA5BC(struct_801CA704* arg0, const char* str, s32 arg2, size_t count) { - const char* s = str; - s32 n = arg2 * count; - - while (n != 0) { - func_801CA4F4(arg0, *s++); - n--; - } -} - -void func_801CA618(struct_801CA704* arg0, const char* str) { - while (*str != 0) { - func_801CA4F4(arg0, *str++); - } -} - -void* func_801CA670(void* arg, const char* str, size_t count) { - func_801CA5BC(arg, str, 1, count); - return arg; -} - -void func_801CA6A0(struct_801CA704* arg0) { - arg0->callback = &func_801CA670; - arg0->posX = 0; - arg0->posY = 0; - arg0->baseX = 0; - arg0->baseY = 0; - arg0->endX = 0; - arg0->endY = 0; - arg0->color.rgba = 0; - arg0->sjisPrevByte = 0; - arg0->charTexBuf = NULL; -} - -void func_801CA6D8(struct_801CA704* arg0) { -} - -s32 func_801CA6E4(struct_801CA704* arg0, const char* fmt, va_list args) { - return PrintUtils_VPrintf(&arg0->callback, fmt, args); -} - -s32 func_801CA704(struct_801CA704* arg0, const char* fmt, ...) { - s32 ret; - va_list args; - - va_start(args, fmt); - ret = func_801CA6E4(arg0, fmt, args); - va_end(args); - - return ret; -} diff --git a/src/n64dd/n64dd_error_bodies.c b/src/n64dd/n64dd_error_bodies.c deleted file mode 100644 index 9c990d76bf0..00000000000 --- a/src/n64dd/n64dd_error_bodies.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "n64dd.h" - -const char* D_801D2EE0[2][8][4] = { - { - { "  メモリー拡張パックが正しく差し込", "  んでありますか?        ", NULL, NULL }, - { "  間違ったディスクが差し込まれてい", "  る可能性があります。正しいディス", - "  クに交換してください。     ", NULL }, - { "  注意:アクセスランプ点滅中にディ", "  スクを抜かないでください。詳しく", - "  は、取扱説明書をお読みください。", NULL }, - { "  詳しくは、取扱説明書をお読みくだ", "  さい。             ", NULL, NULL }, - { "   ディスクを差し込んでください。", NULL, NULL, NULL }, - { "  ディスクを差し込み直してください。", NULL, NULL, NULL }, - { "   ディスクを取り出してください。", NULL, NULL, NULL }, - { NULL, NULL, NULL, NULL }, - }, - { - { - " Are you sure the Expansion", - " Pak is inserted correctly?", - NULL, - NULL, - }, - { - " Check to see if the proper", - " disk is inserted.", - " Please insert the disk the", - " correct disk.", - }, - { - " Do not remove the disk when", - " the access light is flashing.", - " Please read the instruction", - " manual for details.", - }, - { - " Please read the instruction", - " manual for details.", - NULL, - NULL, - }, - { " Please insert a disk.", NULL, NULL, NULL }, - { " Please insert the disk again.", NULL, NULL, NULL }, - { " Please remove the disk.", NULL, NULL, NULL }, - { NULL, NULL, NULL, NULL }, - }, -}; diff --git a/src/n64dd/n64dd_error_textures.c b/src/n64dd/n64dd_error_textures.c deleted file mode 100644 index 38b42de363e..00000000000 --- a/src/n64dd/n64dd_error_textures.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "ultra64.h" - -u64 gN64DDError41Texs[2][0x600 / sizeof(u64)] = { - { -#include "assets/n64dd/error_textures/gN64DDError41JPNTex.i4.inc.c" - }, - { -#include "assets/n64dd/error_textures/gN64DDError41ENGTex.i4.inc.c" - }, -}; - -u64 gN64DDPleaseReadManualTexs[2][0x2800 / sizeof(u64)] = { - { -#include "assets/n64dd/error_textures/gN64DDPleaseReadManualJPNTex.i4.inc.c" - }, - { -#include "assets/n64dd/error_textures/gN64DDPleaseReadManualENGTex.i4.inc.c" - }, -}; diff --git a/src/n64dd/z_n64dd.c b/src/n64dd/z_n64dd.c deleted file mode 100644 index c05bf3ad8b5..00000000000 --- a/src/n64dd/z_n64dd.c +++ /dev/null @@ -1,591 +0,0 @@ -// Main interface for the 64DD from the rest of the game. Starts background -// threads and provides functions to submit commands to them. - -#include "n64dd.h" - -#include "libc64/sleep.h" -#include "array_count.h" -#include "fault.h" -#include "gfx.h" -#include "irqmgr.h" -#include "line_numbers.h" -#include "stack.h" -#include "stackcheck.h" -#include "sys_freeze.h" -#include "versions.h" -#include "audio.h" -#include "thread.h" - -#pragma increment_block_number "ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" - -typedef struct struct_801D9C30 { - /* 0x000 */ s32 unk_000; // disk start - /* 0x004 */ s32 unk_004; // disk end - /* 0x008 */ uintptr_t unk_008; // ram start - /* 0x00C */ uintptr_t unk_00C; // ram end - /* 0x010 */ UNK_PTR unk_010; - /* 0x014 */ char unk_014[0x104]; -} struct_801D9C30; // size = 0x118 - -typedef struct struct_801D9B90 { - /* 0x00 */ OSMesg unk_00[30]; - /* 0x78 */ OSMesgQueue unk_78; - /* 0x90 */ IrqMgrClient unk_90; - /* 0x98 */ IrqMgr* unk_98; -} struct_801D9B90; // size = 0x9C - -s32 func_801C7A1C(struct_801E0D18* arg0); - -void* D_801D2E50 = &gN64DDDiskReadTemporaryBuffer; -s32 (*D_801D2E54)(struct_801E0D18*) = func_801C7A1C; - -struct_801D9B90 B_801D9B90; -struct_801D9C30 B_801D9C30; -struct_801D9C30* B_801D9D48; -struct_801D9D50 B_801D9D50; -OSMesgQueue B_801D9D80; -OSMesgQueue B_801D9D98; -OSMesg B_801D9DB0[1]; -OSMesg B_801D9DB4[1]; -volatile u8 B_801D9DB8; -volatile OSTime B_801D9DC0; -s32 B_801D9DC8; // 1 if disk gameName is correct, 2 otherwise -void* B_801D9DCC; -void* B_801D9DD0; -void* B_801D9DD4; -OSThread B_801D9DD8; -STACK(B_801D9F88, 0x1000); -StackEntry B_801DAF88; -STACK(B_801DAFA8, 0x1000); -StackEntry B_801DBFA8; -UNK_TYPE B_801DBFC4; // unused? - -u32 func_801C6E80(void) { -#if OOT_NTSC - return LeoDriveExist(); -#else - return 0; -#endif -} - -void func_801C6EA0(Gfx** gfxP) { -} - -void func_801C6EAC(void) { - if (D_80121214 == 0) { - func_800F6BDC(); - D_80121214 = 1; - } -} - -s32 func_801C6EF0(void) { - return D_80121214 != 0; -} - -s32 func_801C6F08(void) { - if (D_80121214 != 0) { - return 1; - } - return 1; -} - -void func_801C6F30(void) { - func_801C6EAC(); - while (func_801C6F08() == 0) { - Sleep_Usec(16666); // 100000 / 6 - } -} - -void func_801C6F78(void) { - if (D_80121214 != 0) { - D_80121214 = 0; - func_800F6B3C(); - } -} - -// boolean -s32 func_801C6FAC(void) { - if (D_80121213 == 0) { - return false; - } else { - D_80121213 = 0; - return true; - } -} - -void func_801C6FD8(void) { - while (!func_801C6FAC()) { - Sleep_Usec(16666); // 100000 / 6 - } -} - -// Adds a HungupAndCrash -void func_801C7018(void) { - if (D_80121213 != 0) { - Fault_AddHungupAndCrash("../z_n64dd.c", LN2(503, 551, 573)); - } - - D_80121213 = 1; -} - -s32 func_801C7064(void) { - B_801D9D50.unk_00 = 5; - return (&func_801C8000)(&B_801D9D50); -} - -s32 func_801C7098(void) { - s32 phi_v1; - -#if OOT_VERSION < PAL_1_0 - if (0) {} -#endif - - B_801D9D50.unk_00 = 10; - phi_v1 = (&func_801C8000)(&B_801D9D50); - if (phi_v1 < 0) { - Freeze_CurrentThread(); - } - return phi_v1; -} - -s32 func_801C70E4(void) { - return B_801D9DC8 == 1; -} - -// Used by EnMag and FileChoose -s32 func_801C70FC(void) { - return func_801C70E4(); -} - -void func_801C711C(void* arg) { - static void* B_801DBFC8; - struct_801D9B90* arg0 = (struct_801D9B90*)arg; - s16* sp58; - s32 var_s0; - void* temp_v0; - - sp58 = NULL; - arg0->unk_98 = &gIrqMgr; - osCreateMesgQueue(&arg0->unk_78, arg0->unk_00, ARRAY_COUNT(arg0->unk_00)); - IrqMgr_AddClient(arg0->unk_98, &arg0->unk_90, &arg0->unk_78); - var_s0 = 0; - do { - osRecvMesg(&arg0->unk_78, (OSMesg*)&sp58, OS_MESG_BLOCK); - switch (*sp58) { - case 1: - temp_v0 = osViGetNextFramebuffer(); - if (B_801DBFC8 != temp_v0) { - B_801DBFC8 = temp_v0; - B_801D9DB8 = 1; - } - func_801C8AA8(); - break; - case 4: - LeoReset(); - break; - case 3: - var_s0 = 1; - break; - } - } while (var_s0 == 0); - IrqMgr_RemoveClient(arg0->unk_98, &arg0->unk_90); -} - -#if OOT_VERSION >= NTSC_1_1 -void func_801C7B28_ne2(void) { - s32 temp; - - if (B_801D9DC0 != 0) { - temp = (osGetTime() - B_801D9DC0) * 64 / 3000; - if (1000000 - temp > 0) { - Sleep_Usec(1000000 - temp); - } - } -} -#endif - -void func_801C7268(void) { - s32 pad; - s32 sp20; - s32 sp1C; - - sp20 = func_801C6EF0(); - if (sp20 == 0) { - func_801C6F30(); - } - B_801D9DB8 = 1; - B_801D9DC0 = 0; - if (func_801C7064() == 1) { - func_801C7098(); - } else if (B_801D9DC8 != 0) { - B_801D9DC8 = 0; - } -#if OOT_VERSION < NTSC_1_1 - if (B_801D9DC0 != 0) { - sp1C = (osGetTime() - B_801D9DC0) * 64 / 3000; - - // Remnants from debug statements? - (void)(osGetTime() - B_801D9DC0); - (void)((osGetTime() - B_801D9DC0) * 64 / 3000); - (void)((osGetTime() - B_801D9DC0) * 64 / 3000); - - if (1000000 - sp1C > 0) { - Sleep_Usec(1000000 - sp1C); - } - } -#else - if (D_801D2EA8 == 1 || B_801E0F60 == 1 || B_801E0F64 == 1) { - B_801D9DC0 = osGetTime(); - } - func_801C7B28_ne2(); -#endif - if (sp20 == 0) { - func_801C6F78(); - } -} - -// Clears framebuffer -void func_801C7438(void* arg0) { - u16* var_v0; - - for (var_v0 = (u16*)arg0; var_v0 < (u16*)arg0 + SCREEN_WIDTH * SCREEN_HEIGHT; var_v0++) { - *var_v0 = 1; - } -} - -void func_801C746C(void* arg0, void* arg1, void* arg2) { - void* sp2C; - - if (arg0 != NULL || arg1 != NULL || arg2 != NULL) { - sp2C = (u8*)osViGetNextFramebuffer() + 0x20000000; - if ((u32)sp2C & 0xFFFFFF) { - if (B_801D9DB8 != 0) { - B_801D9DB8 = 0; - func_801C7438(sp2C); - B_801D9DC0 = osGetTime(); - } - if (arg0 != NULL) { - func_801CA1F0(arg0, 96, 32, 192, 16, 11, sp2C, SCREEN_WIDTH); - } - if (arg1 != NULL) { - func_801CA1F0(arg1, 0, 80, 320, 64, 11, sp2C, SCREEN_WIDTH); - } - if (arg2 != NULL) { - func_801CA1F0(arg2, 0, 176, 320, 32, 11, sp2C, SCREEN_WIDTH); - } -#if OOT_VERSION < PAL_1_0 - osViBlack(0); -#endif - } - } -} - -void func_801C75BC(void* arg0, void* arg1, void* arg2) { - s32 temp; - - if (arg0 == NULL && arg1 == NULL && arg2 == NULL) { - return; - } - - if (B_801D9DB8) {} - - if (arg0 != 0) { - B_801D9DCC = arg0; - } - if (arg1 != 0) { - B_801D9DD0 = arg1; - } - if (arg2 != 0) { - B_801D9DD4 = arg2; - } - func_801C746C(arg0, arg1, arg2); -} - -void func_801C761C(void) { - Sleep_Msec(100); - func_801C746C(B_801D9DCC, B_801D9DD0, B_801D9DD4); -} - -s32 func_801C7658(void) { - if (D_80121212 != 0) { - return 0; - } - -#if OOT_VERSION < PAL_1_0 - StackCheck_Init(&B_801DAF88, B_801D9F88, STACK_TOP(B_801D9F88), 0, 0x100, "ddmsg"); - osCreateThread(&B_801D9DD8, THREAD_ID_DDMSG, &func_801C711C, &B_801D9B90, STACK_TOP(B_801D9F88), THREAD_PRI_DDMSG); - osStartThread(&B_801D9DD8); -#endif - - osCreateMesgQueue(&B_801D9D80, B_801D9DB0, ARRAY_COUNT(B_801D9DB0)); - osCreateMesgQueue(&B_801D9D98, B_801D9DB4, ARRAY_COUNT(B_801D9DB4)); - - StackCheck_Init(&B_801DBFA8, B_801DAFA8, STACK_TOP(B_801DAFA8), 0, 0x100, "n64dd"); - - B_801D9D50.unk_1C = &B_801D9D80; - B_801D9D50.unk_20 = &B_801D9D98; - B_801D9D50.unk_24 = THREAD_ID_N64DD; - B_801D9D50.unk_28 = STACK_TOP(B_801DAFA8); - B_801D9D50.unk_2C = THREAD_PRI_N64DD; - B_801D9D50.unk_00 = 1; - - (&func_801C8000)(&B_801D9D50); - - D_80121213 = 1; - func_801C6FD8(); - - B_801D9D50.unk_00 = 2; - B_801D9D50.unk_10 = 6; - B_801D9D50.unk_14 = &DmaMgr_DmaFromDriveRom; - B_801D9D50.unk_0C = &func_801C75BC; - (&func_801C8000)(&B_801D9D50); - - B_801D9D50.unk_00 = 13; - (&func_801C8000)(&B_801D9D50); - -#if OOT_VERSION >= PAL_1_0 - StackCheck_Init(&B_801DAF88, B_801D9F88, STACK_TOP(B_801D9F88), 0, 0x100, "ddmsg"); - osCreateThread(&B_801D9DD8, THREAD_ID_DDMSG, &func_801C711C, &B_801D9B90, STACK_TOP(B_801D9F88), THREAD_PRI_DDMSG); - osStartThread(&B_801D9DD8); -#endif - - return 0; -} - -s32 func_801C7818(void) { -#if OOT_VERSION >= NTSC_1_1 - B_801D9DB8 = 1; - B_801D9DC0 = 0; -#endif - - B_801D9D50.unk_00 = 12; - (&func_801C8000)(&B_801D9D50); - - while (func_801C81C4() == 0) { - // the number 16666 sounds like it could be 1 frame (at 60 frames per second) - Sleep_Usec(1000000 * 1 / 60); - } - -#if OOT_VERSION >= NTSC_1_1 - if (D_801D2EA8 == 1 || B_801E0F60 == 1 || B_801E0F64 == 1) { - B_801D9DC0 = osGetTime(); - } - func_801C7B28_ne2(); -#endif - - if (func_801C81C4() != 2) { - func_801C761C(); - Freeze_CurrentThread(); - return -3; - } - - func_801C7018(); - D_80121212 = 1; - return 0; -} - -s32 func_801C78B8(void) { - s32 phi_v1 = func_801C7658(); - - if (phi_v1 == 0) { - phi_v1 = func_801C7818(); - } - return phi_v1; -} - -s32 func_801C78F0(void) { - B_801D9D50.unk_00 = 0; - return (&func_801C8000)(&B_801D9D50); -} - -void func_801C7920(s32 arg0, void* arg1, s32 arg2) { - B_801D9D50.unk_18 = arg1; - B_801D9D50.unk_1C = (void*)arg0; - B_801D9D50.unk_20 = (void*)arg2; - B_801D9D50.unk_00 = 3; - (&func_801C8000)(&B_801D9D50); - osGetTime(); - B_801D9D50.unk_00 = 6; - while ((&func_801C8000)(&B_801D9D50) != 0) { - Sleep_Usec(16666); // 100000 / 6 - } - B_801D9D50.unk_00 = 7; - if ((&func_801C8000)(&B_801D9D50) != 0) { - Freeze_CurrentThread(); - } -} - -void func_801C79CC(void* arg0, s32 arg1, s32 arg2) { - B_801D9D50.unk_18 = arg0; - B_801D9D50.unk_1C = (void*)arg1; - B_801D9D50.unk_20 = (void*)arg2; - B_801D9D50.unk_00 = 4; - (&func_801C8000)(&B_801D9D50); -} - -void func_801C7A10(LEODiskID* arg0) { -} - -// Checks diskId, sets B_801D9DC8 and returns true if diskId is correct -s32 func_801C7A1C(struct_801E0D18* arg0) { - static LEODiskID B_801DBFD0; - static s32 B_801DBFF0; // bool - - func_801C7A10(&arg0->diskId); - if (!B_801DBFF0) { -#if OOT_NTSC - if (bcmp(arg0->diskId.gameName, "EZLJ", 4) == 0 || bcmp(arg0->diskId.gameName, "EZLE", 4) == 0) -#else - if (bcmp(arg0->diskId.gameName, "EZLP", 4) == 0) -#endif - { - B_801DBFD0 = arg0->diskId; - B_801DBFF0 = true; - B_801D9DC8 = 1; - } else { - B_801D9DC8 = 2; - } - } else if (bcmp(&B_801DBFD0, &arg0->diskId, sizeof(LEODiskID)) == 0) { - B_801D9DC8 = 1; - } else { - B_801D9DC8 = 2; - } - return B_801D9DC8 == 1; -} - -// Translates byte position to LBA and byte offset -s32 func_801C7B48(s32 arg0, s32* arg1, s32* arg2) { - s32 sp2C; - s32 temp_v0_2; - s32 sp24; - s32 sp20; - s32 temp_v0; - - temp_v0_2 = LeoByteToLBA(1, arg0 + 1, &sp2C); - if (temp_v0_2 != LEO_ERROR_GOOD) { - return temp_v0_2; - } - sp24 = sp2C - 1; - if (sp2C == 1) { - sp20 = 0; - } else { - temp_v0 = LeoLBAToByte(1, sp24, &sp20); - if (temp_v0 != LEO_ERROR_GOOD) { - return temp_v0; - } - } - *arg1 = sp24 + 1; - *arg2 = arg0 - sp20; - return LEO_ERROR_GOOD; -} - -s32 func_801C7BEC(s32 startLBA) { - s32 bytes; - - if (LeoLBAToByte(startLBA, 1, &bytes) == LEO_ERROR_GOOD) { - return bytes; - } - return 0; -} - -// Copies bytes from disk to arg0 -void func_801C7C1C(void* dest, s32 offset, s32 size) { - s32 sp5C; - s32 sp58; - s32 sp54; - s32 sp50; - void* sp4C; - s32 var_s0; - s32 var_s1; - s32 temp_v1_2; - - func_801C6FD8(); - func_801C6F30(); - B_801D9DB8 = 1; - B_801D9DC0 = 0; - func_801C7B48(offset, &sp5C, &sp54); - func_801C7B48(offset + size, &sp58, &sp50); - sp4C = D_801D2E50; - if (sp5C == sp58) { - func_801C7920(sp5C, sp4C, func_801C7BEC(sp5C)); - bcopy((u8*)sp4C + sp54, dest, size); - } else { - var_s1 = 0; - func_801C7920(sp5C, sp4C, func_801C7BEC(sp5C)); - bcopy((u8*)sp4C + sp54, dest, func_801C7BEC(sp5C) - sp54); - if (sp5C + 1 < sp58) { - for (var_s0 = sp5C + 1; var_s0 < sp58; var_s0++) { - var_s1 += func_801C7BEC(var_s0); - } - func_801C7920(sp5C + 1, (u8*)dest + func_801C7BEC(sp5C) - sp54, var_s1); - } - if (sp50 > 0) { - func_801C7920(sp58, sp4C, func_801C7BEC(sp58)); - bcopy((u8*)sp4C, (u8*)dest + func_801C7BEC(sp5C) - sp54 + var_s1, sp50); - } - } -#if OOT_VERSION < NTSC_1_1 - if (B_801D9DC0 != 0) { - temp_v1_2 = (osGetTime() - B_801D9DC0) * 64 / 3000; - if (1000000 - temp_v1_2 > 0) { - Sleep_Usec(1000000 - temp_v1_2); - } - } -#else - func_801C7B28_ne2(); -#endif - func_801C7018(); - func_801C6F78(); -} - -void func_801C7E78(void) { -} - -s32 func_801C7E80(void) { - s32 sp24; - s32 sp20; - s32 sp1C; - uintptr_t sp18; - - if (B_801D9D48 != NULL) { - return -1; - } - B_801D9D48 = &B_801D9C30; - func_801C7C1C(B_801D9D48, 0x1060, 0x118); - sp24 = B_801D9D48->unk_004 - B_801D9D48->unk_000; - sp20 = B_801D9D48->unk_00C - B_801D9D48->unk_008; - sp18 = B_801D9D48->unk_008 + sp24; - func_801C7C1C((void*)B_801D9D48->unk_008, B_801D9D48->unk_000, sp24); - bzero((void*)sp18, sp20 - sp24); - func_800AD4C0(B_801D9D48->unk_010); - return 0; -} - -s32 func_801C7F24(void) { - uintptr_t temp_a0; - struct_801D9C30* temp_v0; - - if (B_801D9D48 == 0) { - return -1; - } - - // Function from code - func_800AD51C(); - - temp_v0 = B_801D9D48; - temp_a0 = temp_v0->unk_008; - bzero((void*)temp_a0, temp_v0->unk_00C - temp_a0); - bzero(B_801D9D48, sizeof(struct_801D9C30)); - B_801D9D48 = 0; - return 0; -} - -void n64dd_SetDiskVersion(s32 arg0) { - if (arg0 != 0) { - if (B_801D9D48 == 0) { - func_801C7E80(); - } - } else if (B_801D9D48 != 0) { - func_801C7F24(); - } -} diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 1b193f8ca25..1338740ad35 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -52,7 +52,7 @@ static ColliderQuadInit sQuadInit = { ACELEM_NONE, OCELEM_NONE, }, - { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, + { 0 }, }; static Vec3f sUnusedVec1 = { 0.0f, 0.5f, 0.0f }; 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 426fe0b2171..1f86328fb33 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 @@ -135,8 +135,8 @@ void BgBdanObjects_SetProperty(BgBdanObjects* this, s32 arg1) { } void BgBdanObjects_Init(Actor* thisx, PlayState* play) { - s32 pad; BgBdanObjects* this = (BgBdanObjects*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -153,7 +153,7 @@ void BgBdanObjects_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gJabuBigOctoPlatformCol, &colHeader); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); - thisx->world.pos.y += -79.0f; + thisx->world.pos.y = (f32)(thisx->world.pos.y + -79.0f); if (Flags_GetClear(play, thisx->room)) { Flags_SetSwitch(play, this->var.switchFlag); this->actionFunc = BgBdanObjects_SinkToFloorHeight; @@ -169,14 +169,14 @@ void BgBdanObjects_Init(Actor* thisx, PlayState* play) { thisx->world.pos.y = thisx->home.pos.y + -70.0f; } else { Flags_SetSwitch(play, this->var.switchFlag); - this->timer = 0; + this->unk_16A = 0; this->actionFunc = BgBdanObjects_OctoPlatform_WaitForRutoToStartCutscene; } } } else { if (thisx->params == JABU_OBJECTS_TYPE_SMALL_AUTO_ELEVATOR) { CollisionHeader_GetVirtual(&gJabuElevatorCol, &colHeader); - this->timer = 512; + this->unk_16A = 0x200; this->var.camChangeTimer = 0; this->actionFunc = BgBdanObjects_ElevatorOscillate; } else { // JABU_OBJECTS_TYPE_FALLING_PLATFORM @@ -211,19 +211,21 @@ void BgBdanObjects_OctoPlatform_WaitForRutoToStartCutscene(BgBdanObjects* this, if (BgBdanObjects_GetProperty(this, JABU_OBJECTS_GET_PROP_CAM_SETTING_NORMAL0)) { if (this->dyna.actor.xzDistToPlayer < 250.0f) { BgBdanObjects_SetProperty(this, JABU_OBJECTS_SET_PROP_CAM_SETTING_NORMAL1); - this->timer = 20; + this->unk_16A = 0x14; OnePointCutscene_Init(play, 3070, -99, &this->dyna.actor, CAM_ID_MAIN); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3300.0f; Rumble_Request(0.0f, 255, 20, 150); } - } else if (this->timer != 0) { - if (this->timer != 0) { - this->timer--; - } - if (this->timer == 0) { - this->actionFunc = BgBdanObjects_OctoPlatform_RaiseToUpperPosition; + } else { + if (this->unk_16A != 0) { + if (this->unk_16A != 0) { + this->unk_16A -= 1; + } + if (this->unk_16A == 0) { + this->actionFunc = BgBdanObjects_OctoPlatform_RaiseToUpperPosition; + } } } @@ -239,16 +241,16 @@ void BgBdanObjects_OctoPlatform_RaiseToUpperPosition(BgBdanObjects* this, PlaySt 0.1f) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A); this->actionFunc = BgBdanObjects_OctoPlatform_WaitForRutoToAdvanceCutscene; - this->timer = 30; + this->unk_16A = 0x1E; BgBdanObjects_SetProperty(this, JABU_OBJECTS_SET_PROP_CAM_SETTING_DUNGEON0); Rumble_Request(0.0f, 255, 20, 150); } else { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - if (this->timer == 0) { + if (this->unk_16A == 0) { Rumble_Request(0.0f, 120, 20, 10); - this->timer = 11; + this->unk_16A = 0xB; } Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_BUYOSTAND_RISING - SFX_FLAG); } @@ -261,9 +263,9 @@ void BgBdanObjects_OctoPlatform_RaiseToUpperPosition(BgBdanObjects* this, PlaySt void BgBdanObjects_OctoPlatform_WaitForRutoToAdvanceCutscene(BgBdanObjects* this, PlayState* play) { s32 quakeIndex; - if (this->timer != 0) { - this->timer--; - if (this->timer == 0) { + if (this->unk_16A != 0) { + this->unk_16A -= 1; + if (this->unk_16A == 0) { quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); Quake_SetSpeed(quakeIndex, 0x3A98); Quake_SetPerturbations(quakeIndex, 0, 1, 250, 1); @@ -276,7 +278,7 @@ void BgBdanObjects_OctoPlatform_WaitForRutoToAdvanceCutscene(BgBdanObjects* this this->dyna.actor.world.pos.y + 140.0f, this->dyna.actor.world.pos.z, 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 0); BgBdanObjects_SetProperty(this, JABU_OBJECTS_SET_PROP_WATCHED_BIGOCTO_INTRO_CUTSCENE); - this->timer = 10; + this->unk_16A = 0xA; this->actionFunc = BgBdanObjects_OctoPlatform_PauseBeforeDescending; Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); } @@ -289,7 +291,7 @@ void BgBdanObjects_OctoPlatform_DescendWithBigOcto(BgBdanObjects* this, PlayStat if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f, this->dyna.actor.velocity.y)) { this->dyna.actor.world.rot.y = 0; - this->timer = 60; + this->unk_16A = 0x3C; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; this->actionFunc = BgBdanObjects_OctoPlatform_WaitForBigOctoToStartBattle; @@ -302,12 +304,12 @@ void BgBdanObjects_OctoPlatform_DescendWithBigOcto(BgBdanObjects* this, PlayStat Rumble_Request(0.0f, 255, 30, 150); } else { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - if (this->timer == 0) { + if (this->unk_16A == 0) { Rumble_Request(0.0f, 120, 20, 10); - this->timer = 11; + this->unk_16A = 0xB; } if (this->dyna.actor.child != NULL) { this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; @@ -316,25 +318,27 @@ void BgBdanObjects_OctoPlatform_DescendWithBigOcto(BgBdanObjects* this, PlayStat } void BgBdanObjects_OctoPlatform_PauseBeforeDescending(BgBdanObjects* this, PlayState* play) { - this->timer--; + this->unk_16A -= 1; - if (this->timer == 0) { + if (this->unk_16A == 0) { Flags_UnsetSwitch(play, this->var.switchFlag); - } else if (this->timer == -40) { - this->timer = 0; + } else if (this->unk_16A == -0x28) { + this->unk_16A = 0; this->actionFunc = BgBdanObjects_OctoPlatform_DescendWithBigOcto; } } void BgBdanObjects_OctoPlatform_WaitForBigOctoToStartBattle(BgBdanObjects* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - if ((this->timer == 0) && (this->dyna.actor.child != NULL)) { - if (this->dyna.actor.child->params == 2) { - this->actionFunc = BgBdanObjects_OctoPlatform_BattleInProgress; - } else if (this->dyna.actor.child->params == 0) { - this->dyna.actor.child->params = 1; + if (this->unk_16A == 0) { + if (this->dyna.actor.child != NULL) { + if (this->dyna.actor.child->params == 2) { + this->actionFunc = BgBdanObjects_OctoPlatform_BattleInProgress; + } else if (this->dyna.actor.child->params == 0) { + this->dyna.actor.child->params = 1; + } } } } @@ -386,8 +390,8 @@ void BgBdanObjects_DoNothing(BgBdanObjects* this, PlayState* play) { } void BgBdanObjects_ElevatorOscillate(BgBdanObjects* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } if (this->var.camChangeTimer == 0) { if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { @@ -400,31 +404,31 @@ void BgBdanObjects_ElevatorOscillate(BgBdanObjects* this, PlayState* play) { Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { if (this->var.camChangeTimer != 0) { - this->var.camChangeTimer--; + this->var.camChangeTimer -= 1; } } if (this->var.camChangeTimer == 0) { if (1) {} - Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], this->cameraSetting); + Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], (s16)this->cameraSetting); Camera_SetStateFlag(play->cameraPtrs[CAM_ID_MAIN], CAM_STATE_CHECK_BG); } } this->dyna.actor.world.pos.y = - this->dyna.actor.home.pos.y - (sinf(this->timer * (M_PI / 256.0f)) * 471.24f); // pi * 150 - if (this->timer == 0) { - this->timer = 512; + this->dyna.actor.home.pos.y - (sinf((f32)this->unk_16A * (M_PI / 256.0f)) * 471.24f); // pi * 150 + if (this->unk_16A == 0) { + this->unk_16A = 0x200; } } void BgBdanObjects_WaitForSwitch(BgBdanObjects* this, PlayState* play) { if (Flags_GetSwitch(play, this->var.switchFlag)) { - this->timer = 100; + this->unk_16A = 0x64; this->actionFunc = BgBdanObjects_ChangeWaterBoxLevel; } } void BgBdanObjects_ChangeWaterBoxLevel(BgBdanObjects* this, PlayState* play) { - if (this->timer == 0) { + if (this->unk_16A == 0) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 0.5f)) { Flags_UnsetSwitch(play, this->var.switchFlag); this->actionFunc = BgBdanObjects_WaitForSwitch; @@ -440,11 +444,11 @@ void BgBdanObjects_ChangeWaterBoxLevel(BgBdanObjects* this, PlayState* play) { } void BgBdanObjects_WaitForTimerExpired(BgBdanObjects* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - Actor_PlaySfx_FlaggedTimer(&this->dyna.actor, this->timer); // play ticking sound effect - if (this->timer == 0) { + Actor_PlaySfx_FlaggedTimer(&this->dyna.actor, this->unk_16A); + if (this->unk_16A == 0) { this->actionFunc = BgBdanObjects_ChangeWaterBoxLevel; } } @@ -452,7 +456,7 @@ void BgBdanObjects_WaitForTimerExpired(BgBdanObjects* this, PlayState* play) { void BgBdanObjects_WaitForPlayerOnTop(BgBdanObjects* this, PlayState* play) { if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { Flags_SetSwitch(play, this->var.switchFlag); - this->timer = 50; + this->unk_16A = 0x32; this->actionFunc = BgBdanObjects_FallToLowerPos; this->dyna.actor.home.pos.y -= 200.0f; OnePointCutscene_Init(play, 3100, 51, &this->dyna.actor, CAM_ID_MAIN); @@ -460,13 +464,11 @@ void BgBdanObjects_WaitForPlayerOnTop(BgBdanObjects* this, PlayState* play) { } void BgBdanObjects_FallToLowerPos(BgBdanObjects* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->timer * (M_PI / 50.0f)) * 200.0f); - - if (this->timer == 0) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->unk_16A * (M_PI / 50.0f)) * 200.0f); + if (this->unk_16A == 0) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->actionFunc = BgBdanObjects_DoNothing; // Using `CAM_ID_NONE` here defaults to the active camera 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 72f2b7103c0..fd90fcc47d8 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 @@ -22,7 +22,7 @@ typedef struct BgBdanObjects { /* 0x0168 */ u8 switchFlag; /* 0x0168 */ u8 camChangeTimer; } var; - /* 0x016A */ s16 timer; + /* 0x016A */ s16 unk_16A; /* 0x016C */ ColliderCylinder collider; /* 0x01B8 */ s32 cameraSetting; } BgBdanObjects; // size = 0x01BC 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 90855881e48..4e0be9d9850 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 @@ -1,6 +1,6 @@ /* * File: z_bg_bdan_switch.c - * Overlay: ovl_Bg_Bdan_Switch + * Overlay: Bg_Bdan_Switch * Description: Switches Inside Lord Jabu-Jabu */ diff --git a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c index e773a20c4c2..569157c7fde 100644 --- a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c +++ b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c @@ -72,7 +72,7 @@ void func_8086E638(BgBomGuard* this, PlayState* play) { while (it != NULL) { if (it->id == ACTOR_EN_BOM_BOWL_MAN) { - if ((((EnBomBowlMan*)it)->minigamePlayStatus != 0) && (fabsf(play->view.eye.x) > -20.0f) && + if ((((EnBomBowlMan*)it)->unk_258 != 0) && (fabsf(play->view.eye.x) > -20.0f) && (fabsf(play->view.eye.y) > 110.0f)) { this->unk_168 = 1; } diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 57a5b0b9e6b..607d97cd3d3 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -5,9 +5,8 @@ */ #include "z_bg_bowl_wall.h" +#include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" #include "overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h" -#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" - #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" @@ -15,12 +14,10 @@ #include "rand.h" #include "sfx.h" #include "sys_matrix.h" -#include "terminal.h" -#include "translation.h" #include "z_lib.h" +#include "bgcheck.h" #include "effect.h" #include "play_state.h" - #include "assets/objects/object_bowl/object_bowl.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -28,13 +25,13 @@ void BgBowlWall_Init(Actor* thisx, PlayState* play); void BgBowlWall_Destroy(Actor* thisx, PlayState* play); void BgBowlWall_Update(Actor* thisx, PlayState* play); -void BgBowlWall_Draw(Actor* thisx, PlayState* play2); +void BgBowlWall_Draw(Actor* thisx, PlayState* play); -void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play); -void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play); -void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play); -void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play); -void BgBowlWall_Reset(BgBowlWall* this, PlayState* play); +void func_8086F260(BgBowlWall* this, PlayState* play); +void func_8086F440(BgBowlWall* this, PlayState* play); +void func_8086F464(BgBowlWall* this, PlayState* play); +void func_8086F718(BgBowlWall* this, PlayState* play); +void func_8086F7F8(BgBowlWall* this, PlayState* play); ActorProfile Bg_Bowl_Wall_Profile = { /**/ ACTOR_BG_BOWL_WALL, @@ -47,156 +44,151 @@ ActorProfile Bg_Bowl_Wall_Profile = { /**/ BgBowlWall_Update, /**/ BgBowlWall_Draw, }; - -static Vec3f sBullseyeOffset[] = { +Vec3f D_8086FA40[4] = { { 0.0f, 210.0f, -20.0f }, { 0.0f, 170.0f, -20.0f }, { -170.0f, 0.0f, -20.0f }, { 170.0f, 0.0f, -20.0f }, }; - -static s16 sTargetRot[] = { 0x0000, 0x0000, 0x3FFF, -0x3FFF }; +s16 D_8086FA70[4] = { 0, 0, 0x3FFF, -0x3FFF }; +Vec3f D_8086FA78 = { 0.0f, 0.1f, 0.0f }; +Vec3f D_8086FA84 = { 0.0f, 0.0f, 0.0f }; void BgBowlWall_Init(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; - s32 pad1; - s32 pad2; - CollisionHeader* colHeader = NULL; + s32 pad1[2]; + CollisionHeader* sp28; + s32 pad2[2]; + sp28 = NULL; DynaPolyActor_Init(&this->dyna, 0); - if (this->dyna.actor.params == 0) { - CollisionHeader_GetVirtual(&gBowlingFirstAndFinalRoundCol, &colHeader); + CollisionHeader_GetVirtual(&gBowlingFirstAndFinalRoundCol, &sp28); } else { - CollisionHeader_GetVirtual(&gBowlingSecondRoundCol, &colHeader); + CollisionHeader_GetVirtual(&gBowlingSecondRoundCol, &sp28); } - - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->initPos = this->dyna.actor.world.pos; + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp28); + this->unk168 = this->dyna.actor.world.pos; PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) - T(" ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n", " ☆☆☆☆☆ Bowling obstacle wall spawns ☆☆☆☆☆ %d\n") VT_RST, - this->dyna.actor.params); - this->actionFunc = BgBowlWall_SpawnBullseyes; - this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = 1.0f; + PRINTF("\x1b[32m ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n\x1b[m", this->dyna.actor.params); + this->actionFunc = func_8086F260; + this->dyna.actor.scale.z = 1.0f; + this->dyna.actor.scale.y = 1.0f; + this->dyna.actor.scale.x = 1.0f; } void BgBowlWall_Destroy(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, (s32)this->dyna.bgId); } -void BgBowlWall_SpawnBullseyes(BgBowlWall* this, PlayState* play) { +void func_8086F260(BgBowlWall* this, PlayState* play) { + Actor* var_v0_2; + EnWallTubo* temp_v0_2; s32 pad; - EnWallTubo* bullseye; - Actor* lookForGirl; - s16 type; - - type = this->dyna.actor.params; - if (type != 0) { - type += (s16)Rand_ZeroFloat(2.99f); - this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z = sTargetRot[type]; + s16 params = this->dyna.actor.params; + + if (params != 0) { + params += (s16)Rand_ZeroFloat(2.99f); + this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z = D_8086FA70[params]; PRINTF("\n\n"); } - this->bullseyeCenter.x = sBullseyeOffset[type].x + this->dyna.actor.world.pos.x; - this->bullseyeCenter.y = sBullseyeOffset[type].y + this->dyna.actor.world.pos.y; - this->bullseyeCenter.z = sBullseyeOffset[type].z + this->dyna.actor.world.pos.z; - if (1) {} - bullseye = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, - this->bullseyeCenter.x, this->bullseyeCenter.y, this->bullseyeCenter.z, - 0, 0, 0, this->dyna.actor.params); - if (bullseye != NULL) { - bullseye->explosionCenter = this->bullseyeCenter; - if (type != 0) { - bullseye->explosionCenter = this->bullseyeCenter = this->dyna.actor.world.pos; + this->unk174.x = D_8086FA40[params].x + this->dyna.actor.world.pos.x; + this->unk174.y = D_8086FA40[params].y + this->dyna.actor.world.pos.y; + this->unk174.z = D_8086FA40[params].z + this->dyna.actor.world.pos.z; + if (0) {} + temp_v0_2 = + (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, this->unk174.x, + this->unk174.y, this->unk174.z, 0, 0, 0, this->dyna.actor.params); + if (temp_v0_2 != NULL) { + temp_v0_2->unk154 = this->unk174; + if (params != 0) { + temp_v0_2->unk154 = this->unk174 = this->dyna.actor.world.pos; } - if (this->chuGirl == NULL) { - lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head; - while (lookForGirl != NULL) { - if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) { - lookForGirl = lookForGirl->next; - } else { - this->chuGirl = (EnBomBowlMan*)lookForGirl; - break; + if (this->unk184 == NULL) { + var_v0_2 = play->actorCtx.actorLists[4].head; + while (var_v0_2 != NULL) { + if (var_v0_2->id != ACTOR_EN_BOM_BOWL_MAN) { + var_v0_2 = var_v0_2->next; + continue; } + this->unk184 = (EnBomBowlMan*)var_v0_2; + break; } } - this->actionFunc = BgBowlWall_WaitForHit; + this->actionFunc = func_8086F440; } } -void BgBowlWall_WaitForHit(BgBowlWall* this, PlayState* play) { - if (this->isHit) { - this->actionFunc = BgBowlWall_FallDoEffects; +void func_8086F440(BgBowlWall* this, PlayState* play) { + if (this->unk180 != 0) { + this->actionFunc = func_8086F464; } } -void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play) { - s16 pad; - Vec3f effectAccel = { 0.0f, 0.1f, 0.0f }; - Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; - Vec3f effectPos; +void func_8086F464(BgBowlWall* this, PlayState* play) { + s32 var_s0; + Vec3f spA0 = D_8086FA78; + Vec3f sp94 = D_8086FA84; + Vec3f sp88; s16 quakeIndex; - s32 wallFallen; - s32 i; - - wallFallen = false; + s32 var_s0_2; - if (this->dyna.actor.params == 0) { // wall collapses backwards - Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 3, 500, 0); + var_s0 = false; + if (this->dyna.actor.params == 0) { + Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 3, 0x1F4, 0); this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x; if (this->dyna.actor.shape.rot.x < -0x3C1E) { - wallFallen = true; + var_s0 = true; } - } else { // wall slides downwards - Math_ApproachF(&this->dyna.actor.world.pos.y, this->initPos.y - 450.0f, 0.3f, 10.0f); - if (this->dyna.actor.world.pos.y < (this->initPos.y - 400.0f)) { - wallFallen = true; + } else { + Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk168.y - 450.0f, 0.3f, 10.0f); + if (this->dyna.actor.world.pos.y < (this->unk168.y - 400.0f)) { + var_s0 = true; } } - - if (wallFallen) { - for (i = 0; i < 15; i++) { - effectPos.x = Rand_CenteredFloat(300.0f) + this->bullseyeCenter.x; - effectPos.y = -100.0f; - effectPos.z = Rand_CenteredFloat(400.0f) + this->bullseyeCenter.z; - EffectSsBomb2_SpawnLayered(play, &effectPos, &effectVelocity, &effectAccel, 100, 30); - effectPos.y = -50.0f; - EffectSsHahen_SpawnBurst(play, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); + if (var_s0) { + for (var_s0_2 = 0; var_s0_2 < 15; var_s0_2++) { + sp88.x = Rand_CenteredFloat(300.0f) + this->unk174.x; + sp88.y = -100.0f; + sp88.z = Rand_CenteredFloat(400.0f) + this->unk174.z; + EffectSsBomb2_SpawnLayered(play, &sp88, &sp94, &spA0, 100, 30); + sp88.y = -50.0f; + EffectSsHahen_SpawnBurst(play, &sp88, 10.0f, 0, 50, 15, 3, -1, 10, NULL); Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetPerturbations(quakeIndex, 300, 0, 0, 0); Quake_SetDuration(quakeIndex, 30); - this->timer = 20; - this->actionFunc = BgBowlWall_FinishFall; + this->unk182 = 0x14; + this->actionFunc = func_8086F718; } } -void BgBowlWall_FinishFall(BgBowlWall* this, PlayState* play) { - if (this->timer >= 2) { +void func_8086F718(BgBowlWall* this, PlayState* play) { + if (this->unk182 >= 2) { if (this->dyna.actor.params == 0) { - Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 200, 0); + Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 0xC8, 0); } else { - Math_ApproachF(&this->dyna.actor.world.pos.y, this->initPos.y - 450.0f, 0.3f, 10.0f); + Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk168.y - 450.0f, 0.3f, 10.0f); } - } else if (this->timer == 1) { + } else if (this->unk182 == 1) { + this->dyna.actor.world.pos.y = this->unk168.y - 450.0f; this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x = 0; - this->dyna.actor.world.pos.y = this->initPos.y - 450.0f; - this->chuGirl->wallStatus[this->dyna.actor.params] = 2; - this->actionFunc = BgBowlWall_Reset; + this->unk184->unk23E_arr[this->dyna.actor.params] = 2; + this->actionFunc = func_8086F7F8; } } -void BgBowlWall_Reset(BgBowlWall* this, PlayState* play) { - if (this->chuGirl->wallStatus[this->dyna.actor.params] != 2) { - Math_ApproachF(&this->dyna.actor.world.pos.y, this->initPos.y, 0.3f, 50.0f); - if (fabsf(this->dyna.actor.world.pos.y - this->initPos.y) <= 10.0f) { - this->dyna.actor.world.pos.y = this->initPos.y; - this->isHit = false; - this->actionFunc = BgBowlWall_SpawnBullseyes; +void func_8086F7F8(BgBowlWall* this, PlayState* play) { + if (this->unk184->unk23E_arr[this->dyna.actor.params] != 2) { + Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk168.y, 0.3f, 50.0f); + if (fabsf(this->dyna.actor.world.pos.y - this->unk168.y) <= 10.0f) { + this->dyna.actor.world.pos.y = this->unk168.y; + this->unk180 = 0; + this->actionFunc = func_8086F260; } } } @@ -204,30 +196,27 @@ void BgBowlWall_Reset(BgBowlWall* this, PlayState* play) { void BgBowlWall_Update(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; - if (this->timer != 0) { - this->timer--; + if (this->unk182 != 0) { + this->unk182--; } - this->actionFunc(this, play); } -void BgBowlWall_Draw(Actor* thisx, PlayState* play2) { - PlayState* play = play2; +void BgBowlWall_Draw(Actor* thisx, PlayState* play) { + u32 new_var2; BgBowlWall* this = (BgBowlWall*)thisx; - u32 frames; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_bg_bowl_wall.c", 441); - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x8, Gfx_TexScroll(play->state.gfxCtx, 0, -2 * (frames = play->state.frames), 16, 16)); + gSPSegment(POLY_OPA_DISP++, 0x8, + Gfx_TexScroll(play->state.gfxCtx, 0, (new_var2 = play->state.frames) * -2, 16, 16)); gDPPipeSync(POLY_OPA_DISP++); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_bowl_wall.c", 453); - if (this->dyna.actor.params == 0) { gSPDisplayList(POLY_OPA_DISP++, gBowlingRound1WallDL); } else { gSPDisplayList(POLY_OPA_DISP++, gBowlingRound2WallDL); } - CLOSE_DISPS(play->state.gfxCtx, "../z_bg_bowl_wall.c", 464); } diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h index c1084475755..2a2568f95d2 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h @@ -3,20 +3,19 @@ #include "ultra64.h" #include "actor.h" -#include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" struct BgBowlWall; typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, struct PlayState*); typedef struct BgBowlWall { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ BgBowlWallActionFunc actionFunc; - /* 0x0168 */ Vec3f initPos; - /* 0x0174 */ Vec3f bullseyeCenter; - /* 0x0180 */ s16 isHit; - /* 0x0182 */ s16 timer; - /* 0x0184 */ EnBomBowlMan* chuGirl; -} BgBowlWall; // size = 0x0188 + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ BgBowlWallActionFunc actionFunc; + /* 0x168 */ Vec3f unk168; + /* 0x174 */ Vec3f unk174; + /* 0x180 */ s16 unk180; + /* 0x182 */ s16 unk182; + /* 0x184 */ struct EnBomBowlMan* unk184; +} BgBowlWall; // size = 0x188 #endif 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 71f37f61a5a..262c7f101b6 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 @@ -42,10 +42,10 @@ static InitChainEntry sInitChain[] = { }; typedef enum BgDdanJdState { - /* 0 */ STATE_GO_BOTTOM, - /* 1 */ STATE_GO_MIDDLE_FROM_BOTTOM, - /* 2 */ STATE_GO_MIDDLE_FROM_TOP, - /* 3 */ STATE_GO_TOP + STATE_GO_BOTTOM, + STATE_GO_MIDDLE_FROM_BOTTOM, + STATE_GO_MIDDLE_FROM_TOP, + STATE_GO_TOP, } BgDdanJdState; #define MOVE_HEIGHT_MIDDLE 140.0f @@ -59,14 +59,14 @@ typedef enum BgDdanJdState { #define SHORTCUT_Y_SPEED 5 void BgDdanJd_Init(Actor* thisx, PlayState* play) { - s32 pad; BgDdanJd* this = (BgDdanJd*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&gDodongoRisingPlatformCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->idleTimer = IDLE_FRAMES; this->state = STATE_GO_BOTTOM; diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 1f37e0fcd48..fd7f59d997e 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -131,8 +131,9 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, PlayState* play) { } void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) { - static Vec3f velocity = { 0.0f, 5.0f, 0.0f }; - static Vec3f accel = { 0.0f, -0.45f, 0.0f }; + static Vec3f D_808718FC = { 0.0f, 5.0f, 0.0f }; + static Vec3f D_80871908 = { 0.0f, -0.45f, 0.0f }; + static Vec3f D_80871914 = { 0.0f, 0.0f, 0.0f }; Vec3f pos1; Vec3f pos2; f32 effectStrength; @@ -165,11 +166,11 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) { func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); func_80033480(play, &pos2, 20.0f, 1, effectStrength * 135.0f, 60, 1); - velocity.x = Rand_CenteredFloat(3.0f); - velocity.z = Rand_CenteredFloat(3.0f); + D_808718FC.x = Rand_CenteredFloat(3.0f); + D_808718FC.z = Rand_CenteredFloat(3.0f); - func_8003555C(play, &pos1, &velocity, &accel); - func_8003555C(play, &pos2, &velocity, &accel); + func_8003555C(play, &pos1, &D_808718FC, &D_80871908); + func_8003555C(play, &pos2, &D_808718FC, &D_80871908); pos1 = this->dyna.actor.world.pos; pos1.z += 560.0f + Rand_ZeroOne() * 5.0f; @@ -177,7 +178,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) { pos1.y = Rand_ZeroOne() * 3.0f + (this->dyna.actor.floorHeight + 20.0f); func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1); - func_8003555C(play, &pos1, &velocity, &accel); + func_8003555C(play, &pos1, &D_808718FC, &D_80871908); } Camera_RequestQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3); SFX_PLAY_AT_POS(&this->dyna.actor.projectedPos, NA_SE_EV_PILLAR_SINK - SFX_FLAG); 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 44dc02ca0d6..307a2bc8a2d 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 @@ -5,9 +5,9 @@ */ #include "z_bg_dy_yoseizo.h" -#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" +#include "overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h" +#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" -#include "libc64/qrand.h" #include "gfx.h" #include "gfx_setupdl.h" #include "one_point_cutscene.h" @@ -17,8 +17,6 @@ #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" -#include "terminal.h" -#include "translation.h" #include "versions.h" #include "z_lib.h" #include "ocarina.h" @@ -36,47 +34,32 @@ #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) #endif -typedef enum BgDyYoseizoRewardType { - /* 0 */ FAIRY_UPGRADE_MAGIC, - /* 1 */ FAIRY_UPGRADE_DOUBLE_MAGIC, - /* 2 */ FAIRY_UPGRADE_DOUBLE_DEFENSE -} BgDyYoseizoRewardType; - -typedef enum BgDyYoseizoSpellType { - /* 0 */ FAIRY_SPELL_FARORES_WIND, - /* 1 */ FAIRY_SPELL_DINS_FIRE, - /* 2 */ FAIRY_SPELL_NAYRUS_LOVE -} BgDyYoseizoSpellType; - void BgDyYoseizo_Init(Actor* thisx, PlayState* play2); void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play); void BgDyYoseizo_Update(Actor* thisx, PlayState* play2); -void BgDyYoseizo_Draw(Actor* thisx, PlayState* play); -void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play); -void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play); - -void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel, - Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type); +void func_80872D20(BgDyYoseizo* this, PlayState* play); +void func_80872DE4(BgDyYoseizo* this, PlayState* play); +void func_8087328C(BgDyYoseizo* this, PlayState* play); +void func_80873380(BgDyYoseizo* this, PlayState* play); +void func_808734DC(BgDyYoseizo* this, PlayState* play); +void func_8087358C(BgDyYoseizo* this, PlayState* play); +void func_808736A4(BgDyYoseizo* this, PlayState* play); +void func_80873780(BgDyYoseizo* this, PlayState* play); +void func_80873868(BgDyYoseizo* this, PlayState* play); +void func_80873B3C(BgDyYoseizo* this, PlayState* play); +void func_80873C14(BgDyYoseizo* this, PlayState* play); +void func_80873D14(BgDyYoseizo* this, PlayState* play); +void func_80873E04(BgDyYoseizo* this, PlayState* play); +void func_80873EA4(BgDyYoseizo* this, PlayState* play); +void func_80873FD8(BgDyYoseizo* this, PlayState* play); +void func_80874304(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Draw(Actor* thisx, PlayState* play); +void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f*, Vec3f*, Vec3f*, Color_RGB8*, Color_RGB8*, f32, s16, s16); void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play); void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play); -static s32 sUnusedGetItemIds[] = { GI_FARORES_WIND, GI_NAYRUS_LOVE, GI_DINS_FIRE }; - +static s32 D_80875440[3] = { 0x5D, 0x5E, 0x5C }; ActorProfile Bg_Dy_Yoseizo_Profile = { /**/ ACTOR_BG_DY_YOSEIZO, /**/ ACTORCAT_PROP, @@ -88,37 +71,57 @@ ActorProfile Bg_Dy_Yoseizo_Profile = { /**/ BgDyYoseizo_Update, /**/ NULL, }; +static Color_RGB8 D_8087546C[9] = { + { 0xFF, 0xFF, 0xFF }, { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0xFF, 0xFF, 0xAA }, + { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0xFF, 0xFF, 0xAA }, +}; +static Color_RGB8 D_80875488[9] = { + { 0x9B, 0xFF, 0xFF }, { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0xFF, 0x64, 0xFF }, + { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0x64, 0xFF, 0xFF }, +}; +static Vec3f D_808754A4 = { 0.0f, 0.0f, 0.0f }; +static s16 D_808754B0[4] = { 2, 0, 1, 0 }; +static s16 D_808754B8[4] = { 0x11, 0x10, 0x12, 0 }; +static s16 D_808754C0[] = { ITEMGETINF_MASK(ITEMGETINF_18), ITEMGETINF_MASK(ITEMGETINF_19), + ITEMGETINF_MASK(ITEMGETINF_1A) }; +static u8 D_808754C8[4] = { 0xD, 5, 0x13, 0 }; + +static void* D_808754CC[] = { + gGreatFairyEyeOpenTex, + gGreatFairyEyeHalfTex, + gGreatFairyEyeClosedTex, +}; + +static void* D_808754D8[] = { + gGreatFairyMouthClosedTex, + gGreatFairyMouthOpenTex, +}; void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { - PlayState* play = play2; BgDyYoseizo* this = (BgDyYoseizo*)thisx; + PlayState* play = play2; - this->fountainType = play->spawn; - - if (this->fountainType < 0) { - this->fountainType = 0; + this->unk2EC = (s16)play->spawn; + if (this->unk2EC < 0) { + this->unk2EC = 0; } - - this->vanishHeight = this->actor.world.pos.y; - this->grownHeight = this->vanishHeight + 40.0f; + this->unk310 = this->actor.world.pos.y; + this->unk30C = this->actor.world.pos.y + 40.0f; this->actor.focus.pos = this->actor.world.pos; - if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Great Fairy Fountain ☆☆☆☆☆ %d\n") VT_RST, - play->spawn); - SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, - this->jointTable, this->morphTable, 28); + PRINTF("\x1b[32m☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n\x1b[m", play->spawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, this->unk194, + this->unk23C, 28); #if OOT_VERSION < NTSC_1_1 - if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->fountainType != FAIRY_UPGRADE_MAGIC)) { + if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->unk2EC != 0)) { Actor_Kill(&this->actor); return; } #endif } else { - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Stone Fairy Fountain ☆☆☆☆☆ %d\n") VT_RST, - play->spawn); - SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, - this->jointTable, this->morphTable, 28); + PRINTF("\x1b[32m☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n\x1b[m", play->spawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, this->unk194, + this->unk23C, 28); #if OOT_VERSION < NTSC_1_1 if (!gSaveContext.save.info.playerData.isMagicAcquired) { Actor_Kill(&this->actor); @@ -126,103 +129,86 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { } #endif } - #if OOT_VERSION < NTSC_1_1 - this->actionFunc = BgDyYoseizo_ChooseType; + this->actionFunc = func_80872DE4; #else - this->actionFunc = BgDyYoseizo_CheckMagicAcquired; + this->actionFunc = func_80872D20; #endif } void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play) { } -static Color_RGB8 sEffectPrimColors[] = { - { 255, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 }, - { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 }, -}; - -static Color_RGB8 sEffectEnvColors[] = { - { 155, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 100, 255 }, - { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 100, 255, 255 }, -}; - -void BgDyYoseizo_SpawnEffects(BgDyYoseizo* this, PlayState* play, s16 type) { - Vec3f vel = { 0.0f, 0.0f, 0.0f }; - Vec3f accel; - Vec3f pos; - Color_RGB8 primColor; - Color_RGB8 envColor; - f32 spawnPosVariation; - s32 effectType; - f32 scale; - s32 i; - s16 life; - - if (!(this->scale < 0.01f)) { - spawnPosVariation = this->scale * 3500.0f; - accel.x = Rand_ZeroOne() - 0.5f; - accel.y = Rand_ZeroOne() - 0.5f; - accel.z = Rand_ZeroOne() - 0.5f; - for (i = 0; i < 2; i++) { - if (type == 0) { - effectType = 0; - scale = 0.4f; - life = 90; - pos.x = this->actor.world.pos.x; - pos.y = this->actor.world.pos.y + spawnPosVariation + - ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.5f)); - pos.z = this->actor.world.pos.z + 30.0f; +void func_80872960(BgDyYoseizo* this, PlayState* play, s16 arg2) { + Vec3f spC4; + Vec3f spB8; + Vec3f spAC; + Color_RGB8 spA8; + Color_RGB8 spA4; + f32 temp_fs0; + f32 var_fs2; + s32 var_s1; + s32 var_s2; + s32 var_s3; + + spC4 = D_808754A4; + if (!(this->unk308 < 0.01f)) { + temp_fs0 = this->unk308 * 3500.0f; + spB8.x = Rand_ZeroOne() - 0.5f; + spB8.y = Rand_ZeroOne() - 0.5f; + spB8.z = Rand_ZeroOne() - 0.5f; + for (var_s3 = 0; var_s3 < 2; var_s3++) { + if (arg2 == 0) { + var_s1 = 0; + var_fs2 = 0.4f; + var_s2 = 0x5A; + spAC.x = this->actor.world.pos.x; + spAC.y = this->actor.world.pos.y + temp_fs0 + (temp_fs0 * 0.5f * (Rand_ZeroOne() - 0.5f)); + spAC.z = this->actor.world.pos.z + 30.0f; } else { - life = 50; - effectType = type; - scale = 0.2f; - pos.x = this->actor.world.pos.x + Rand_CenteredFloat(10.0f); - + var_fs2 = 0.2f; + var_s2 = 0x32; + var_s1 = arg2; + spAC.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - pos.y = this->actor.world.pos.y + spawnPosVariation + 50.0f + - ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f)); - pos.z = this->actor.world.pos.z + 30.0f; + spAC.y = this->actor.world.pos.y + temp_fs0 + 50.0f + (temp_fs0 * 0.1f * (Rand_ZeroOne() - 0.5f)); + spAC.z = this->actor.world.pos.z + 30.0f; } else { - pos.y = this->actor.world.pos.y + spawnPosVariation - 30.0f + - ((Rand_ZeroOne() - 0.5f) * (spawnPosVariation * 0.1f)); - pos.z = this->actor.world.pos.z + 60.0f; + spAC.y = this->actor.world.pos.y + temp_fs0 - 30.0f + (temp_fs0 * 0.1f * (Rand_ZeroOne() - 0.5f)); + spAC.z = this->actor.world.pos.z + 60.0f; } - if (LINK_IS_ADULT) { - pos.y += 20.0f; + spAC.y += 20.0f; } } - - primColor.r = sEffectPrimColors[effectType].r; - primColor.g = sEffectPrimColors[effectType].g; - primColor.b = sEffectPrimColors[effectType].b; - envColor.r = sEffectEnvColors[effectType].r; - envColor.g = sEffectEnvColors[effectType].g; - envColor.b = sEffectEnvColors[effectType].b; - BgDyYoseizo_SpawnEffect(this, &pos, &vel, &accel, &primColor, &envColor, scale, life, effectType); + spA8.r = D_8087546C[var_s1].r; + spA8.g = D_8087546C[var_s1].g; + spA8.b = D_8087546C[var_s1].b; + spA4.r = D_80875488[var_s1].r; + spA4.g = D_80875488[var_s1].g; + spA4.b = D_80875488[var_s1].b; + BgDyYoseizo_SpawnEffect(this, &spAC, &spC4, &spB8, &spA8, &spA4, var_fs2, var_s2, var_s1); } } } -void BgDyYoseizo_Bob(BgDyYoseizo* this, PlayState* play) { - this->targetHeight = this->grownHeight + this->bobOffset; - Math_ApproachF(&this->actor.world.pos.y, this->targetHeight, 0.1f, 10.0f); - Math_ApproachF(&this->bobOffset, 10.0f, 0.1f, 0.5f); - +void func_80872C58(BgDyYoseizo* this, PlayState* play) { + this->unk31C = this->unk30C + this->unk320; + Math_ApproachF(&this->actor.world.pos.y, this->unk31C, 0.1f, 10.0f); + Math_ApproachF(&this->unk320, 10.0f, 0.1f, 0.5f); if (play->csCtx.state == CS_STATE_IDLE) { - this->actor.velocity.y = Math_SinS(this->bobTimer); + this->actor.velocity.y = Math_SinS((s16)(s32)this->unk324); } else { - this->actor.velocity.y = Math_SinS(this->bobTimer) * 0.4f; + this->actor.velocity.y = Math_SinS((s16)(s32)this->unk324) * 0.4f; } } #if OOT_VERSION >= NTSC_1_1 -void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) { +void func_80872D20(BgDyYoseizo* this, PlayState* play) { if (Flags_GetSwitch(play, 0x38)) { play->msgCtx.ocarinaMode = OCARINA_MODE_04; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->fountainType != FAIRY_UPGRADE_MAGIC)) { + if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->unk2EC != 0)) { Actor_Kill(&this->actor); return; } @@ -233,13 +219,13 @@ void BgDyYoseizo_CheckMagicAcquired(BgDyYoseizo* this, PlayState* play) { } } Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - this->actionFunc = BgDyYoseizo_ChooseType; + this->actionFunc = func_80872DE4; } } #endif -void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { - s32 givingReward; +void func_80872DE4(BgDyYoseizo* this, PlayState* play) { + s32 var_v1; #if OOT_VERSION < NTSC_1_1 if (!Flags_GetSwitch(play, 0x38)) { @@ -253,848 +239,777 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, PlayState* play) { #endif Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Mode ☆☆☆☆☆ %d\n") VT_RST, play->msgCtx.ocarinaMode); - givingReward = false; - + PRINTF("\x1b[33m☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n\x1b[m", play->msgCtx.ocarinaMode); + var_v1 = 0; if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - switch (this->fountainType) { - case FAIRY_SPELL_FARORES_WIND: + switch (this->unk2EC) { + case 0: if (!GET_ITEMGETINF(ITEMGETINF_18)) { - givingReward = true; + var_v1 = 1; } break; - case FAIRY_SPELL_DINS_FIRE: + + case 1: if (!GET_ITEMGETINF(ITEMGETINF_19)) { - givingReward = true; + var_v1 = 1; } break; - case FAIRY_SPELL_NAYRUS_LOVE: + + case 2: if (!GET_ITEMGETINF(ITEMGETINF_1A)) { - givingReward = true; + var_v1 = 1; } break; } } else { - switch (this->fountainType) { - case FAIRY_UPGRADE_MAGIC: - if (!gSaveContext.save.info.playerData.isMagicAcquired || BREG(2)) { - PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n", " ☆☆☆☆☆ Turning speed UP ☆☆☆☆☆ \n") - VT_RST); - this->givingSpell = true; - givingReward = true; + switch (this->unk2EC) { + case 0: + if (!gSaveContext.save.info.playerData.isMagicAcquired || (gRegEditor->data[0x962] != 0)) { + PRINTF("\x1b[32m ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n\x1b[m"); + var_v1 = 1; + this->unk2EA = 1; } break; - case FAIRY_UPGRADE_DOUBLE_MAGIC: + + case 1: if (!gSaveContext.save.info.playerData.isDoubleMagicAcquired) { - PRINTF(VT_FGCOL(YELLOW) T(" ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n", - " ☆☆☆☆☆ Magic Gauge Meter Doubled ☆☆☆☆☆ \n") VT_RST); - this->givingSpell = true; - givingReward = true; + PRINTF("\x1b[33m ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n\x1b[m"); + this->unk2EA = 1; + var_v1 = 1; } break; - case FAIRY_UPGRADE_DOUBLE_DEFENSE: + + case 2: if (!gSaveContext.save.info.playerData.isDoubleDefenseAcquired) { - PRINTF(VT_FGCOL(MAGENTA) T(" ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n", " ☆☆☆☆☆ Damage halved ☆☆☆☆☆ \n") VT_RST); - this->givingSpell = true; - givingReward = true; + PRINTF("\x1b[35m ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n\x1b[m"); + this->unk2EA = 1; + var_v1 = 1; } break; } } - - if (givingReward) { + if (var_v1 != 0) { if (!IS_CUTSCENE_LAYER || !DEBUG_FEATURES) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - switch (this->fountainType) { - case FAIRY_SPELL_FARORES_WIND: + switch (this->unk2EC) { + case 0: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs); gSaveContext.cutsceneTrigger = 1; break; - case FAIRY_SPELL_DINS_FIRE: + + case 1: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs); gSaveContext.cutsceneTrigger = 1; break; - case FAIRY_SPELL_NAYRUS_LOVE: + + case 2: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs); gSaveContext.cutsceneTrigger = 1; break; } } else { - switch (this->fountainType) { - case FAIRY_UPGRADE_MAGIC: + switch (this->unk2EC) { + case 0: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs); gSaveContext.cutsceneTrigger = 1; break; - case FAIRY_UPGRADE_DOUBLE_MAGIC: + + case 1: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs); gSaveContext.cutsceneTrigger = 1; break; - case FAIRY_UPGRADE_DOUBLE_DEFENSE: + + case 2: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenseCs); gSaveContext.cutsceneTrigger = 1; break; } } } - this->actionFunc = BgDyYoseizo_SetupSpinGrow_Reward; - return; - } - - play->envCtx.lightSettingOverride = 2; - - if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - OnePointCutscene_Init(play, 8603, -99, NULL, CAM_ID_MAIN); + this->actionFunc = func_80873EA4; } else { - OnePointCutscene_Init(play, 8604, -99, NULL, CAM_ID_MAIN); - }; - - Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); - this->actor.draw = BgDyYoseizo_Draw; - this->actionFunc = BgDyYoseizo_SetupSpinGrow_NoReward; + play->envCtx.lightSettingOverride = 2; + if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { + OnePointCutscene_Init(play, 8603, -99, NULL, CAM_ID_MAIN); + } else { + OnePointCutscene_Init(play, 8604, -99, NULL, CAM_ID_MAIN); + } + Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); + this->actor.draw = BgDyYoseizo_Draw; + this->actionFunc = func_8087328C; + } } -// Sets animations for spingrow -void BgDyYoseizo_SetupSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { +void func_8087328C(BgDyYoseizo* this, PlayState* play) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount, - ANIMMODE_ONCE, -10.0f); + this->unk32C = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, + -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->frameCount, + this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } - Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - this->actionFunc = BgDyYoseizo_SpinGrow_NoReward; + this->actionFunc = func_80873380; } -void BgDyYoseizo_SpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { +void func_80873380(BgDyYoseizo* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - Math_ApproachF(&this->actor.world.pos.y, this->grownHeight, this->heightFraction, 100.0f); - Math_ApproachF(&this->scale, 0.035f, this->scaleFraction, 0.005f); - Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f); - Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f); - // Finished growing - if (this->scale >= 0.034f) { - if ((this->actor.shape.rot.y > -8000) && (this->actor.shape.rot.y < 1000)) { + Math_ApproachF(&this->actor.world.pos.y, this->unk30C, this->unk314, 100.0f); + Math_ApproachF(&this->unk308, 0.035f, this->unk318, 0.005f); + Math_ApproachF(&this->unk314, 0.8f, 0.1f, 0.02f); + Math_ApproachF(&this->unk318, 0.2f, 0.03f, 0.05f); + if (this->unk308 >= 0.034f) { + if ((this->actor.shape.rot.y >= -0x1F3F) && (this->actor.shape.rot.y < 0x3E8)) { SkelAnime_Update(&this->skelAnime); - // Turn to front - Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 5, 1000, 0); + Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 5, 0x3E8, 0); if (fabsf(this->actor.shape.rot.y) < 50.0f) { - this->actionFunc = BgDyYoseizo_CompleteSpinGrow_NoReward; + this->actionFunc = func_808734DC; } } else { - this->actor.shape.rot.y += 3000; + this->actor.shape.rot.y += 0xBB8; } } else { - this->actor.shape.rot.y += 3000; + this->actor.shape.rot.y += 0xBB8; } - BgDyYoseizo_SpawnEffects(this, play, 0); + func_80872960(this, play, 0); } -void BgDyYoseizo_CompleteSpinGrow_NoReward(BgDyYoseizo* this, PlayState* play) { - f32 curFrame = this->skelAnime.curFrame; +void func_808734DC(BgDyYoseizo* this, PlayState* play) { + f32 sp1C; + sp1C = this->skelAnime.curFrame; #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - - if ((this->frameCount * 1273.0f) <= this->bobTimer) { - this->bobTimer = 0.0f; + if ((this->unk32C * 1273.0f) <= this->unk324) { + this->unk324 = 0.0f; } - SkelAnime_Update(&this->skelAnime); - - if ((this->frameCount <= curFrame) && !this->animationChanged) { - this->actionFunc = BgDyYoseizo_SetupGreetPlayer_NoReward; + if ((this->unk32C <= sp1C) && (this->unk2FC == 0)) { + this->actionFunc = func_8087358C; } } -void BgDyYoseizo_SetupGreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { +void func_8087358C(BgDyYoseizo* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, - -10.0f); + this->unk32C = Animation_GetLastFrame(&gGreatFairySittingAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, + this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); } - this->actor.textId = 0xDB; - this->dialogState = TEXT_STATE_EVENT; + this->unk2EE = TEXT_STATE_EVENT; Message_StartTextbox(play, this->actor.textId, NULL); - BgDyYoseizo_SpawnEffects(this, play, 0); - this->actionFunc = BgDyYoseizo_GreetPlayer_NoReward; + func_80872960(this, play, 0); + this->actionFunc = func_808736A4; } -void BgDyYoseizo_GreetPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { +void func_808736A4(BgDyYoseizo* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - this->bobTimer = this->skelAnime.curFrame * 1273.0f; - - if ((this->frameCount * 1273.0f) <= this->bobTimer) { - this->bobTimer = 0.0f; + this->unk324 = this->skelAnime.curFrame * 1273.0f; + if (this->unk324 >= (this->unk32C * 1273.0f)) { + this->unk324 = 0.0f; } - SkelAnime_Update(&this->skelAnime); - - if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->unk2EE == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE); - this->actionFunc = BgDyYoseizo_SetupHealPlayer_NoReward; + this->actionFunc = func_80873780; } - - BgDyYoseizo_Bob(this, play); - BgDyYoseizo_SpawnEffects(this, play, 0); + func_80872C58(this, play); + func_80872960(this, play, 0); } -void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { +void func_80873780(BgDyYoseizo* this, PlayState* play) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, + this->unk32C = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyAnim_005810); - Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, - -10.0f); + this->unk32C = Animation_GetLastFrame(&gGreatFairyAnim_005810); + Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } - Actor_PlaySfx(&this->actor, NA_SE_VO_FR_SMILE_0); - this->mouthState = 1; - this->actionFunc = BgDyYoseizo_HealPlayer_NoReward; + this->unk2F6 = 1; + this->actionFunc = func_80873868; } -void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, PlayState* play) { - Player* player = GET_PLAYER(play); - f32 curFrame = this->skelAnime.curFrame; - Vec3f beamPos; - s16 beamParams; +void func_80873868(BgDyYoseizo* this, PlayState* play) { + Player* player; + f32 temp_fv1; + s16 var_v0; + Vec3f vec; - if (this->animationChanged) { - this->bobTimer = this->skelAnime.curFrame * 1300.0f; - if ((this->frameCount * 1300.0f) <= this->bobTimer) { - this->bobTimer = 0.0f; + player = GET_PLAYER(play); + temp_fv1 = this->skelAnime.curFrame; + if (this->unk2FC != 0) { + this->unk324 = this->skelAnime.curFrame * 1300.0f; + if ((this->unk32C * 1300.0f) <= this->unk324) { + this->unk324 = 0.0f; } } - SkelAnime_Update(&this->skelAnime); - if ((this->frameCount <= curFrame) && !(this->animationChanged)) { + if ((this->unk32C <= temp_fv1) && (this->unk2FC == 0)) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount, - ANIMMODE_LOOP, -10.0f); + this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, + -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, + this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); } - this->healingTimer = 150; - this->animationChanged = true; - if (!this->givingSpell) { - beamPos.x = player->actor.world.pos.x; - beamPos.y = player->actor.world.pos.y + 200.0f; - beamPos.z = player->actor.world.pos.z; - - beamParams = ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) ? 0 : 1); - - this->beam = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA, - beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamParams); + this->unk302 = 0x96; + this->unk2FC = 1; + if (this->unk2EA == 0) { + vec.x = player->actor.world.pos.x; + vec.y = player->actor.world.pos.y + 200.0f; + vec.z = player->actor.world.pos.z; + if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { + var_v0 = 0; + } else { + var_v0 = 1; + } + this->unk340 = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA, vec.x, + vec.y, vec.z, 0, 0, 0, var_v0); } } - if (this->refillTimer > 1) { - this->refillTimer--; + if (this->unk306 >= 2) { + this->unk306--; } - - if (this->healingTimer >= 110) { - this->healingTimer--; + if (this->unk302 >= 0x6E) { + this->unk302--; } - - if (this->healingTimer == 110) { + if (this->unk302 == 0x6E) { gSaveContext.healthAccumulator = 0x140; Magic_Fill(play); - this->refillTimer = 200; + this->unk306 = 0xC8; } - if (((gSaveContext.save.info.playerData.healthCapacity == gSaveContext.save.info.playerData.health) && (gSaveContext.save.info.playerData.magic == gSaveContext.magicCapacity)) || - (this->refillTimer == 1)) { - this->healingTimer--; - if (this->healingTimer == 90) { - if (!this->givingSpell) { - this->beam->trigger = 1; + (this->unk306 == 1)) { + this->unk302--; + if (this->unk302 == 0x5A) { + if (this->unk2EA == 0) { + this->unk340->unk_152 = 1; } - this->givingSpell = false; + this->unk2EA = 0; } } - - if (this->healingTimer == 1) { + if (this->unk302 == 1) { this->actor.textId = 0xDA; - this->dialogState = TEXT_STATE_EVENT; + this->unk2EE = TEXT_STATE_EVENT; Message_ContinueTextbox(play, this->actor.textId); - this->actionFunc = BgDyYoseizo_SayFarewell_NoReward; - return; + this->actionFunc = func_80873B3C; + } else { + func_80872C58(this, play); } - BgDyYoseizo_Bob(this, play); } -void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, PlayState* play) { - this->bobTimer = this->skelAnime.curFrame * 1400.0f; - - if (this->bobTimer >= (this->frameCount * 1400.0f)) { - this->bobTimer = 0.0f; +void func_80873B3C(BgDyYoseizo* this, PlayState* play) { + this->unk324 = this->skelAnime.curFrame * 1400.0f; + if (this->unk324 >= (this->unk32C * 1400.0f)) { + this->unk324 = 0.0f; } - SkelAnime_Update(&this->skelAnime); - - if ((this->dialogState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->unk2EE == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->mouthState = 0; - this->actionFunc = BgDyYoseizo_SetupSpinShrink; - Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); + this->unk2F6 = 0; + this->actionFunc = func_80873C14; + Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); } - - BgDyYoseizo_Bob(this, play); - BgDyYoseizo_SpawnEffects(this, play, 0); + func_80872C58(this, play); + func_80872960(this, play, 0); } -void BgDyYoseizo_SetupSpinShrink(BgDyYoseizo* this, PlayState* play) { +void func_80873C14(BgDyYoseizo* this, PlayState* play) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim); - Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->frameCount, + this->unk32C = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim); + Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairySpellFountainSpinShrinkAnim); - Animation_Change(&this->skelAnime, &gGreatFairySpellFountainSpinShrinkAnim, 1.0f, 0.0f, this->frameCount, + this->unk32C = Animation_GetLastFrame(&gGreatFairySpellFountainSpinShrinkAnim); + Animation_Change(&this->skelAnime, &gGreatFairySpellFountainSpinShrinkAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } - - this->vanishTimer = 5; - this->scaleFraction = 0.0f; - this->heightFraction = 0.0f; + this->unk2E8 = 5; + this->unk318 = 0.0f; + this->unk314 = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_VANISH); - this->actionFunc = BgDyYoseizo_SpinShrink; + this->actionFunc = func_80873D14; } -void BgDyYoseizo_SpinShrink(BgDyYoseizo* this, PlayState* play) { +void func_80873D14(BgDyYoseizo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->vanishTimer == 0) { - if (this->scale < 0.003f) { - this->vanishTimer = 30; - this->actionFunc = BgDyYoseizo_Vanish; + if (this->unk2E8 == 0) { + if (this->unk308 < 0.003f) { + this->unk2E8 = 0x1E; + this->actionFunc = func_80873E04; } else { - Math_ApproachF(&this->actor.world.pos.y, this->vanishHeight, this->heightFraction, 100.0f); - Math_ApproachZeroF(&this->scale, this->scaleFraction, 0.005f); - Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f); - Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f); - this->actor.shape.rot.y += 3000; - BgDyYoseizo_SpawnEffects(this, play, 0); + Math_ApproachF(&this->actor.world.pos.y, this->unk310, this->unk314, 100.0f); + Math_ApproachZeroF(&this->unk308, this->unk318, 0.005f); + Math_ApproachF(&this->unk314, 0.8f, 0.1f, 0.02f); + Math_ApproachF(&this->unk318, 0.2f, 0.03f, 0.05f); + this->actor.shape.rot.y += 0xBB8; + func_80872960(this, play, 0); } } } -void BgDyYoseizo_Vanish(BgDyYoseizo* this, PlayState* play) { - Actor* findOcarinaSpot; +void func_80873E04(BgDyYoseizo* this, PlayState* play) { + Actor* var_a0; - if (this->vanishTimer == 0) { + if (this->unk2E8 == 0) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); play->envCtx.lightSettingOverride = 0; - findOcarinaSpot = play->actorCtx.actorLists[ACTORCAT_PROP].head; - - while (findOcarinaSpot != NULL) { - if (findOcarinaSpot->id != ACTOR_EN_OKARINA_TAG) { - findOcarinaSpot = findOcarinaSpot->next; - continue; + var_a0 = play->actorCtx.actorLists[ACTORCAT_PROP].head; + while (var_a0 != NULL) { + if (var_a0->id != ACTOR_EN_OKARINA_TAG) { + var_a0 = var_a0->next; + } else { + Actor_Kill(var_a0); + break; } - Actor_Kill(findOcarinaSpot); - break; } - Flags_UnsetSwitch(play, 0x38); Actor_Kill(&this->actor); } } -void BgDyYoseizo_SetupSpinGrow_Reward(BgDyYoseizo* this, PlayState* play) { - if (play->csCtx.state != CS_STATE_IDLE) { - if ((play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 2)) { - this->actor.draw = BgDyYoseizo_Draw; - Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - this->finishedSpinGrow = false; - - if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->frameCount, - ANIMMODE_ONCE, -10.0f); - } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->frameCount, - ANIMMODE_ONCE, -10.0f); - } - - Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); - this->actionFunc = BgDyYoseizo_SpinGrowSetupGive_Reward; +void func_80873EA4(BgDyYoseizo* this, PlayState* play) { + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[0] != NULL) && + (play->csCtx.actorCues[0]->id == 2)) { + this->actor.draw = BgDyYoseizo_Draw; + Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); + this->unk2FE = 0; + if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { + this->unk32C = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->unk32C, + ANIMMODE_ONCE, -10.0f); + } else { + this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->unk32C, + ANIMMODE_ONCE, -10.0f); } + Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); + this->actionFunc = func_80873FD8; } } -void BgDyYoseizo_SpinGrowSetupGive_Reward(BgDyYoseizo* this, PlayState* play) { - f32 curFrame = this->skelAnime.curFrame; - - if (!this->finishedSpinGrow) { - Math_ApproachF(&this->actor.world.pos.y, this->grownHeight, this->heightFraction, 100.0f); - Math_ApproachF(&this->scale, 0.035f, this->scaleFraction, 0.005f); - Math_ApproachF(&this->heightFraction, 0.8f, 0.1f, 0.02f); - Math_ApproachF(&this->scaleFraction, 0.2f, 0.03f, 0.05f); - // Finished growing - if (this->scale >= 0.034f) { - if ((this->actor.shape.rot.y > -8000) && (this->actor.shape.rot.y < 1000)) { +void func_80873FD8(BgDyYoseizo* this, PlayState* play) { + f32 temp_fv0; + + temp_fv0 = this->skelAnime.curFrame; + if (this->unk2FE == 0) { + Math_ApproachF(&this->actor.world.pos.y, this->unk30C, this->unk314, 100.0f); + Math_ApproachF(&this->unk308, 0.035f, this->unk318, 0.005f); + Math_ApproachF(&this->unk314, 0.8f, 0.1f, 0.02f); + Math_ApproachF(&this->unk318, 0.2f, 0.03f, 0.05f); + if (this->unk308 >= 0.034f) { + if ((this->actor.shape.rot.y >= -0x1F3F) && (this->actor.shape.rot.y < 0x3E8)) { SkelAnime_Update(&this->skelAnime); - // Spin until facing front - Math_ApproachS(&this->actor.shape.rot.y, 0, 5, 1000); + Math_ApproachS(&this->actor.shape.rot.y, 0, 5, 0x3E8); if (fabsf(this->actor.shape.rot.y) < 50.0f) { - this->finishedSpinGrow = true; + this->unk2FE = 1; } } else { - this->actor.shape.rot.y += 3000; + this->actor.shape.rot.y += 0xBB8; } } else { - this->actor.shape.rot.y += 3000; + this->actor.shape.rot.y += 0xBB8; } } else { SkelAnime_Update(&this->skelAnime); - - if ((this->frameCount <= curFrame) && !this->animationChanged) { + if ((this->unk32C <= temp_fv0) && (this->unk2FC == 0)) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairySittingAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, + this->unk32C = Animation_GetLastFrame(&gGreatFairySittingAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->frameCount, + this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); } - this->animationChanged = true; + this->unk2FC = 1; } - - if ((play->csCtx.state != CS_STATE_IDLE) && - ((play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 3))) { - this->finishedSpinGrow = this->animationChanged = false; + if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[0] != NULL) && + (play->csCtx.actorCues[0]->id == 3)) { + this->unk2FE = this->unk2FC = 0; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->frameCount, + this->unk32C = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyAnim_005810); - Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, + this->unk32C = Animation_GetLastFrame(&gGreatFairyAnim_005810); + Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); } - this->mouthState = 1; - this->actionFunc = BgDyYoseizo_Give_Reward; + this->unk2F6 = 1; + this->actionFunc = func_80874304; } } - BgDyYoseizo_SpawnEffects(this, play, 0); + func_80872960(this, play, 0); } -static s16 sDemoEffectLightColors[] = { DEMO_EFFECT_LIGHT_GREEN, DEMO_EFFECT_LIGHT_RED, DEMO_EFFECT_LIGHT_BLUE }; - -static s16 sExItemTypes[] = { EXITEM_MAGIC_WIND, EXITEM_MAGIC_FIRE, EXITEM_MAGIC_DARK }; - -static s16 sItemGetFlagMasks[] = { ITEMGETINF_MASK(ITEMGETINF_18), ITEMGETINF_MASK(ITEMGETINF_19), - ITEMGETINF_MASK(ITEMGETINF_1A) }; - -static u8 sItemIds[] = { ITEM_FARORES_WIND, ITEM_DINS_FIRE, ITEM_NAYRUS_LOVE }; +void func_80874304(BgDyYoseizo* this, PlayState* play) { + f32 temp_fv1_sp5C; + Player* player; + s16 var_v1; + s16 sp56; + Vec3f var_fv1; -void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) { - f32 curFrame = this->skelAnime.curFrame; - Player* player = GET_PLAYER(play); - s16 cueIdTemp; - s16 demoEffectParams; - Vec3f itemPos; - - if (this->animationChanged) { - this->bobTimer = this->skelAnime.curFrame * 1400.0f; - if ((this->frameCount * 1400.0f) <= this->bobTimer) { - this->bobTimer = 0.0f; + temp_fv1_sp5C = this->skelAnime.curFrame; + player = GET_PLAYER(play); + if (this->unk2FC != 0) { + this->unk324 = this->skelAnime.curFrame * 1400.0f; + if (this->unk324 >= (this->unk32C * 1400.0f)) { + this->unk324 = 0.0f; } } SkelAnime_Update(&this->skelAnime); - - if ((this->frameCount <= curFrame) && !this->animationChanged) { + if ((this->unk32C <= temp_fv1_sp5C) && (this->unk2FC == 0)) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->frameCount, - ANIMMODE_LOOP, -10.0f); + this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, + -10.0f); } else { - this->frameCount = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, + this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); } - this->animationChanged = true; + this->unk2FC = 1; } - - if (play->csCtx.actorCues[0]->id == 13) { - this->actionFunc = BgDyYoseizo_SetupSpinShrink; + if (play->csCtx.actorCues[0]->id == 0xD) { + this->actionFunc = func_80873C14; return; } - if ((play->csCtx.actorCues[0]->id >= 4) && (play->csCtx.actorCues[0]->id < 7)) { - cueIdTemp = play->csCtx.actorCues[0]->id - 4; - + var_v1 = play->csCtx.actorCues[0]->id - 4; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - cueIdTemp++; - BgDyYoseizo_SpawnEffects(this, play, cueIdTemp); - - } else if (!this->lightBallSpawned) { - demoEffectParams = ((s16)(sDemoEffectLightColors[cueIdTemp] << 0xC) | DEMO_EFFECT_LIGHT); + var_v1 += 1; + func_80872960(this, play, var_v1); + } else if (this->unk2E4 == 0) { + sp56 = D_808754B0[var_v1] << 0xC; + sp56 |= 0x12; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, (s32)demoEffectParams); - this->lightBallSpawned = true; + this->actor.world.pos.z, 0, 0, 0, sp56); + this->unk2E4 = 1; } } else { - BgDyYoseizo_SpawnEffects(this, play, 0); + func_80872960(this, play, 0); } - - if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id >= 10) && - (play->csCtx.actorCues[0]->id < 13)) { - cueIdTemp = play->csCtx.actorCues[0]->id - 10; - - switch (cueIdTemp) { - case FAIRY_UPGRADE_MAGIC: - gSaveContext.save.info.playerData.isMagicAcquired = true; - gSaveContext.magicFillTarget = MAGIC_NORMAL_METER; - // magicLevel is already 0, setting isMagicAcquired to true triggers magicCapacity to grow - Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); - break; - case FAIRY_UPGRADE_DOUBLE_MAGIC: - if (!gSaveContext.save.info.playerData.isMagicAcquired) { - gSaveContext.save.info.playerData.isMagicAcquired = true; + if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { + if ((play->csCtx.actorCues[0]->id >= 0xA) && (play->csCtx.actorCues[0]->id < 0xD)) { + var_v1 = play->csCtx.actorCues[0]->id - 0xA; + switch (var_v1) { + case 0: + gSaveContext.save.info.playerData.isMagicAcquired = 1; + gSaveContext.magicFillTarget = 0x30; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); + break; + + case 1: + if (gSaveContext.save.info.playerData.isMagicAcquired == 0) { + gSaveContext.save.info.playerData.isMagicAcquired = 1; + } + gSaveContext.save.info.playerData.isDoubleMagicAcquired = 1; + gSaveContext.magicFillTarget = 0x60; + gSaveContext.save.info.playerData.magicLevel = 0; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); + break; + + case 2: + gSaveContext.save.info.playerData.isDoubleDefenseAcquired = 1; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); + break; + } + if (this->unk2E6 == 0) { + gSaveContext.healthAccumulator = 0x140; + this->unk2E6 = 1; + if (var_v1 == 2) { + Magic_Fill(play); } - gSaveContext.save.info.playerData.isDoubleMagicAcquired = true; - gSaveContext.magicFillTarget = MAGIC_DOUBLE_METER; - // Setting magicLevel to 0 triggers magicCapacity to grow - gSaveContext.save.info.playerData.magicLevel = 0; - Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); - break; - case FAIRY_UPGRADE_DOUBLE_DEFENSE: - gSaveContext.save.info.playerData.isDoubleDefenseAcquired = true; - Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); - break; - } - - if (!this->healing) { - gSaveContext.healthAccumulator = 0x140; - this->healing = true; - if (cueIdTemp == 2) { - Magic_Fill(play); } } } - - if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id >= 14) && - (play->csCtx.actorCues[0]->id < 17)) { - cueIdTemp = play->csCtx.actorCues[0]->id - 14; - - if (!this->itemSpawned) { - itemPos.x = player->actor.world.pos.x; - itemPos.y = (LINK_IS_ADULT ? player->actor.world.pos.y + 73.0f : player->actor.world.pos.y + 53.0f); - itemPos.z = player->actor.world.pos.z; - - this->item = (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemPos.x, - itemPos.y, itemPos.z, 0, 0, 0, sExItemTypes[cueIdTemp]); - - if (this->item != NULL) { - if (!gSaveContext.save.info.playerData.isMagicAcquired) { - gSaveContext.save.info.playerData.isMagicAcquired = true; + if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { + if ((play->csCtx.actorCues[0]->id >= 0xE) && (play->csCtx.actorCues[0]->id < 0x11)) { + var_v1 = play->csCtx.actorCues[0]->id - 0xE; + if (this->unk300 == 0) { + var_fv1.x = player->actor.world.pos.x; + if (LINK_IS_ADULT) { + var_fv1.y = player->actor.world.pos.y + 73.0f; } else { - Magic_Fill(play); + var_fv1.y = player->actor.world.pos.y + 53.0f; } - - this->itemSpawned = true; - gSaveContext.healthAccumulator = 0x140; - Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); - gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_18_19_1A] |= sItemGetFlagMasks[cueIdTemp]; - Item_Give(play, sItemIds[cueIdTemp]); + var_fv1.z = player->actor.world.pos.z; + this->unk344 = + (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, var_fv1.x, + var_fv1.y, var_fv1.z, 0, 0, 0, D_808754B8[var_v1]); + if (this->unk344 != NULL) { + if (!gSaveContext.save.info.playerData.isMagicAcquired) { + gSaveContext.save.info.playerData.isMagicAcquired = true; + } else { + Magic_Fill(play); + } + this->unk300 = 1; + gSaveContext.healthAccumulator = 0x140; + Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); + gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_18_19_1A] |= D_808754C0[var_v1]; + Item_Give(play, D_808754C8[var_v1]); + } + } else { + this->unk344->actor.world.pos.x = player->actor.world.pos.x; + if (LINK_IS_ADULT) { + this->unk344->actor.world.pos.y = player->actor.world.pos.y + 73.0f; + } else { + this->unk344->actor.world.pos.y = player->actor.world.pos.y + 53.0f; + } + this->unk344->actor.world.pos.z = player->actor.world.pos.z; + this->unk344->scale = 0.3f; } - } else { - this->item->actor.world.pos.x = player->actor.world.pos.x; - this->item->actor.world.pos.y = - (LINK_IS_ADULT ? player->actor.world.pos.y + 73.0f : player->actor.world.pos.y + 53.0f); - this->item->actor.world.pos.z = player->actor.world.pos.z; - this->item->scale = 0.3f; } } - - if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 17) && - (this->item != NULL)) { - Actor_Kill(&this->item->actor); - this->item = NULL; + if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 0x11)) { + if (this->unk344 != NULL) { + Actor_Kill(&this->unk344->actor); + this->unk344 = NULL; + } } - - if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 18)) { - this->giveDefenseHearts = true; + if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 0x12)) { + this->unk2E5 = 1; } - - if (this->giveDefenseHearts) { + if (this->unk2E5 != 0) { if (gSaveContext.save.info.inventory.defenseHearts < 20) { - gSaveContext.save.info.inventory.defenseHearts++; + gSaveContext.save.info.inventory.defenseHearts += 1; } } - - if ((play->csCtx.actorCues[0]->id >= 19) && (play->csCtx.actorCues[0]->id < 22) && !this->warpEffectSpawned) { - cueIdTemp = play->csCtx.actorCues[0]->id - 11; + if ((play->csCtx.actorCues[0]->id >= 0x13) && (play->csCtx.actorCues[0]->id < 0x16) && (this->unk304 == 0)) { + var_v1 = play->csCtx.actorCues[0]->id - 0xB; Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, player->actor.world.pos.x, player->actor.world.pos.y, - player->actor.world.pos.z, 0, 0, 0, cueIdTemp); - this->warpEffectSpawned = true; + player->actor.world.pos.z, 0, 0, 0, var_v1); + this->unk304 = 1; } - BgDyYoseizo_Bob(this, play); + func_80872C58(this, play); } void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) { - PlayState* play = play2; BgDyYoseizo* this = (BgDyYoseizo*)thisx; - s32 sfx; - - this->absoluteTimer++; + PlayState* play = play2; + s32 var_v1; - if (this->vanishTimer != 0) { - this->vanishTimer--; + this->unk2F0 += 1; + if (this->unk2E8 != 0) { + this->unk2E8--; } - if (this->blinkTimer != 0) { - this->blinkTimer--; + if (this->unk2F8 != 0) { + this->unk2F8--; } - if (this->unusedTimer != 0) { - this->unusedTimer--; + if (this->unk2FA != 0) { + this->unk2FA--; } - this->actionFunc(this, play); - if (play->csCtx.state != CS_STATE_IDLE) { - sfx = 0; + var_v1 = 0; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { if ((play->csCtx.curFrame == 32) || (play->csCtx.curFrame == 291) || (play->csCtx.curFrame == 426) || (play->csCtx.curFrame == 851)) { - sfx = 1; + var_v1 = 1; } if (play->csCtx.curFrame == 101) { - sfx = 2; + var_v1 = 2; } } else { if ((play->csCtx.curFrame == 35) || (play->csCtx.curFrame == 181) || (play->csCtx.curFrame == 462) || (play->csCtx.curFrame == 795)) { - sfx = 1; + var_v1 = 1; } if (play->csCtx.curFrame == 90) { - sfx = 2; + var_v1 = 2; } } - - if (sfx == 1) { + if (var_v1 == 1) { Actor_PlaySfx(&this->actor, NA_SE_VO_FR_SMILE_0); } - if (sfx == 2) { + if (var_v1 == 2) { Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); } } - - if ((this->blinkTimer == 0) && (this->actionFunc != BgDyYoseizo_HealPlayer_NoReward)) { - this->eyeState++; - this->eyeState2++; - if (this->eyeState >= 3) { - this->eyeState = this->eyeState2 = 0; - this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; + if ((this->unk2F8 == 0) && (this->actionFunc != func_80873868)) { + this->unk2F2 += 1; + this->unk2F4 += 1; + if (this->unk2F2 >= 3) { + this->unk2F4 = 0; + this->unk2F2 = this->unk2F4; + this->unk2F8 = (s16)Rand_ZeroFloat(60.0f) + 0x14; } } - Actor_MoveXZGravity(&this->actor); - this->heightOffset = this->scale * 7500.0f; - Actor_SetFocus(&this->actor, this->heightOffset); - this->actor.focus.pos.y = this->heightOffset; - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); + this->unk328 = this->unk308 * 7500.0f; + Actor_SetFocus(&this->actor, this->unk328); + this->actor.focus.pos.y = this->unk328; + Actor_TrackPlayer(play, &this->actor, &this->unk334, &this->unk33A, this->actor.focus.pos); BgDyYoseizo_UpdateEffects(this, play); - Actor_SetScale(&this->actor, this->scale); + Actor_SetScale(&this->actor, this->unk308); } -s32 BgDyYoseizo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - BgDyYoseizo* this = (BgDyYoseizo*)thisx; +s32 func_80874B7C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { + BgDyYoseizo* this = thisx; - if (limbIndex == 8) { // Torso - rot->x += this->torsoRot.y; + if (limbIndex == 8) { + rot->x += this->unk33A.y; } - if (limbIndex == 15) { // Head - rot->x += this->headRot.y; - rot->z += this->headRot.z; + if (limbIndex == 15) { + rot->x += this->unk334.y; + rot->z += this->unk334.z; } return 0; } -static void* sEyeTextures[] = { - gGreatFairyEyeOpenTex, // Open - gGreatFairyEyeHalfTex, // Half - gGreatFairyEyeClosedTex, // Closed -}; - -static void* sMouthTextures[] = { - gGreatFairyMouthClosedTex, // Closed - gGreatFairyMouthOpenTex, // Open -}; - void BgDyYoseizo_Draw(Actor* thisx, PlayState* play) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1609); - if (this->actionFunc != BgDyYoseizo_Vanish) { + if (this->actionFunc != func_80873E04) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState])); - - // This was probably intended to allow this actor to wink, but segment 09 is not used in the dList for the head, - // so it can only blink - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeState2])); - - gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthState])); - + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_808754CC[this->unk2F2])); + gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(D_808754CC[this->unk2F4])); + gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(D_808754D8[this->unk2F6])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - BgDyYoseizo_OverrideLimbDraw, NULL, this); + func_80874B7C, NULL, this); } CLOSE_DISPS(play->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1629); BgDyYoseizo_DrawEffects(this, play); } -void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelocity, Vec3f* accel, - Color_RGB8* primColor, Color_RGB8* envColor, f32 scale, s16 life, s16 type) { +void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, Color_RGB8* arg4, + Color_RGB8* arg5, f32 arg6, s16 arg7, s16 arg8) { BgDyYoseizoEffect* effect; - s16 i; + s16 var_v1; effect = this->effects; - - for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { - if (effect->alive == 0) { - effect->alive = 1; - effect->pos = *initPos; - effect->velocity = *initVelocity; - effect->accel = *accel; - effect->primColor = *primColor; - effect->alpha = 0; - effect->envColor = *envColor; - effect->scale = scale; - effect->timer = life; - effect->type = type; - effect->pitch = 0.0f; - effect->yaw = Rand_CenteredFloat(30000.0f); - effect->roll = 0.0f; - return; + for (var_v1 = 0; var_v1 < BG_DY_YOSEIZO_EFFECT_COUNT; var_v1++, effect++) { + if (effect->unk0 == 0) { + effect->unk0 = 1; + effect->unk4 = *arg1; + effect->unk10 = *arg2; + effect->unk1C = *arg3; + effect->unk28 = *arg4; + effect->unk2E = 0; + effect->unk2B = *arg5; + effect->unk30 = arg6; + effect->unk34 = arg7; + effect->unk36 = arg8; + effect->unk38 = 0.0f; + effect->unk3C = Rand_CenteredFloat(30000.0f); + effect->unk40 = 0.0f; + break; } } } void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) { - BgDyYoseizoEffect* effect = this->effects; - Player* player = GET_PLAYER(play); + s16 var_s5; + Player* player; Vec3f sp94; Vec3f sp88; - f32 goalPitch; - f32 goalYaw; - s16 i = 0; - - for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { - if (effect->alive != 0) { - effect->roll += 3000.0f; + BgDyYoseizoEffect* effect; + f32 temp_fs0; + f32 temp_fs1; - if (effect->type == 0) { - effect->pos.x += effect->velocity.x; - effect->pos.y += effect->velocity.y; - effect->pos.z += effect->velocity.z; - effect->velocity.x += effect->accel.x; - effect->velocity.y += effect->accel.y; - effect->velocity.z += effect->accel.z; + effect = this->effects; + player = GET_PLAYER(play); + for (var_s5 = 0; var_s5 < BG_DY_YOSEIZO_EFFECT_COUNT; var_s5++, effect++) { + if (effect->unk0 != 0) { + effect->unk40 += 3000.0f; + if (effect->unk36 == 0) { + effect->unk4.x += effect->unk10.x; + effect->unk4.y += effect->unk10.y; + effect->unk4.z += effect->unk10.z; + effect->unk10.x += effect->unk1C.x; + effect->unk10.y += effect->unk1C.y; + effect->unk10.z += effect->unk1C.z; } else { Actor_PlaySfx(&this->actor, NA_SE_EV_HEALING - SFX_FLAG); - sp94 = player->actor.world.pos; sp94.y = player->actor.world.pos.y - 150.0f; sp94.z = player->actor.world.pos.z - 50.0f; - - goalPitch = Math_Vec3f_Pitch(&effect->pos, &sp94); - goalYaw = Math_Vec3f_Yaw(&effect->pos, &sp94); - - Math_ApproachF(&effect->pitch, goalPitch, 0.9f, 5000.0f); - Math_ApproachF(&effect->yaw, goalYaw, 0.9f, 5000.0f); + temp_fs0 = Math_Vec3f_Pitch(&effect->unk4, &sp94); + temp_fs1 = Math_Vec3f_Yaw(&effect->unk4, &sp94); + Math_ApproachF(&effect->unk38, temp_fs0, 0.9f, 5000.0f); + Math_ApproachF(&effect->unk3C, temp_fs1, 0.9f, 5000.0f); Matrix_Push(); - Matrix_RotateY(BINANG_TO_RAD_ALT(effect->yaw), MTXMODE_NEW); - Matrix_RotateX(BINANG_TO_RAD_ALT(effect->pitch), MTXMODE_APPLY); - - sp94.x = sp94.y = sp94.z = 3.0f; - + Matrix_RotateY(BINANG_TO_RAD_ALT(effect->unk3C), MTXMODE_NEW); + Matrix_RotateX(BINANG_TO_RAD_ALT(effect->unk38), MTXMODE_APPLY); + sp94.z = 3.0f; + sp94.y = 3.0f; + sp94.x = 3.0f; Matrix_MultVec3f(&sp94, &sp88); Matrix_Pop(); - effect->pos.x += sp88.x; - effect->pos.y += sp88.y; - effect->pos.z += sp88.z; + effect->unk4.x += sp88.x; + effect->unk4.y += sp88.y; + effect->unk4.z += sp88.z; } } - - // fade up, fade down, vanish and reset - if (effect->timer != 0) { - effect->timer--; - effect->alpha += 30; - - if (effect->alpha > 255) { - effect->alpha = 255; + if (effect->unk34 != 0) { + effect->unk34 -= 1; + effect->unk2E += 0x1E; + if (effect->unk2E >= 0x100) { + effect->unk2E = 0xFF; } } else { - effect->alpha -= 30; - - if (effect->alpha <= 0) { - effect->alpha = effect->alive = 0; + effect->unk2E -= 0x1E; + if (effect->unk2E <= 0) { + effect->unk0 = 0; + effect->unk2E = effect->unk0; } } } } void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play) { - GraphicsContext* gfxCtx = play->state.gfxCtx; - u8 materialFlag = 0; - BgDyYoseizoEffect* effect = this->effects; - s16 i; + GraphicsContext* gfxCtx; + s16 var_s4; + BgDyYoseizoEffect* effect; + u8 materialFlag; + gfxCtx = play->state.gfxCtx; + materialFlag = 0; + effect = this->effects; OPEN_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1767); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - - for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { - if (effect->alive == 1) { + for (var_s4 = 0; var_s4 < BG_DY_YOSEIZO_EFFECT_COUNT; var_s4++, effect++) { + if (effect->unk0 == 1) { if (materialFlag == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleMaterialDL)); gDPPipeSync(POLY_XLU_DISP++); - materialFlag++; } - - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, effect->primColor.r, effect->primColor.g, effect->primColor.b, - effect->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, effect->envColor.r, effect->envColor.g, effect->envColor.b, 0); - - Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, effect->unk28.r, effect->unk28.g, effect->unk28.b, + effect->unk2E); + gDPSetEnvColor(POLY_XLU_DISP++, effect->unk2B.r, effect->unk2B.g, effect->unk2B.b, 0); + Matrix_Translate(effect->unk4.x, effect->unk4.y, effect->unk4.z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ(effect->roll, MTXMODE_APPLY); - + Matrix_Scale(effect->unk30, effect->unk30, 1.0f, MTXMODE_APPLY); + Matrix_RotateZ(effect->unk40, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_bg_dy_yoseizo.c", 1810); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleModelDL)); } } - CLOSE_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1819); } 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 f3cca1b6c21..616c208d0b9 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 @@ -3,72 +3,72 @@ #include "ultra64.h" #include "actor.h" -#include "overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h" -#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" - -struct BgDyYoseizo; - -typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, struct PlayState*); #define BG_DY_YOSEIZO_EFFECT_COUNT 200 typedef struct BgDyYoseizoEffect { - /* 0x00 */ u8 alive; // drawn if 1, respawn if 0 - /* 0x04 */ Vec3f pos; - /* 0x10 */ Vec3f velocity; - /* 0x1C */ Vec3f accel; - /* 0x28 */ Color_RGB8 primColor; - /* 0x2B */ Color_RGB8 envColor; - /* 0x2E */ s16 alpha; - /* 0x30 */ f32 scale; - /* 0x34 */ s16 timer; // lifetime - /* 0x36 */ s16 type; // 0 is general radiance, else is directed towards Player - /* 0x38 */ f32 pitch; - /* 0x3C */ f32 yaw; - /* 0x40 */ f32 roll; + /* 0x00 */ u8 unk0; + /* 0x01 */ char pad1[3]; /* maybe part of unk0[4]? */ + /* 0x04 */ Vec3f unk4; + /* 0x10 */ Vec3f unk10; + /* 0x1C */ Vec3f unk1C; + /* 0x28 */ Color_RGB8 unk28; + /* 0x2B */ Color_RGB8 unk2B; + /* 0x2E */ s16 unk2E; + /* 0x30 */ f32 unk30; + /* 0x34 */ s16 unk34; + /* 0x36 */ s16 unk36; + /* 0x38 */ f32 unk38; + /* 0x3C */ f32 unk3C; + /* 0x40 */ f32 unk40; } BgDyYoseizoEffect; // size = 0x44 +struct BgDyYoseizo; + +typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, struct PlayState*); + typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; - /* 0x014C */ BgDyYoseizoActionFunc actionFunc; + /* 0x014C */ void (*actionFunc)(struct BgDyYoseizo*, struct PlayState*); /* 0x0150 */ SkelAnime skelAnime; - /* 0x0194 */ Vec3s jointTable[28]; - /* 0x023C */ Vec3s morphTable[28]; - /* 0x02E4 */ u8 lightBallSpawned; - /* 0x02E5 */ u8 giveDefenseHearts; - /* 0x02E6 */ u8 healing; - /* 0x02E8 */ s16 vanishTimer; - /* 0x02EA */ s16 givingSpell; - /* 0x02EC */ s16 fountainType; - /* 0x02EE */ s16 dialogState; - /* 0x02F0 */ s16 absoluteTimer; - /* 0x02F2 */ s16 eyeState; - /* 0x02F4 */ s16 eyeState2; // Used, but does not actually change the actor's eyes - /* 0x02F6 */ s16 mouthState; - /* 0x02F8 */ s16 blinkTimer; - /* 0x02FA */ s16 unusedTimer; - /* 0x02FC */ s16 animationChanged; - /* 0x02FE */ s16 finishedSpinGrow; - /* 0x0300 */ s16 itemSpawned; - /* 0x0302 */ s16 healingTimer; - /* 0x0304 */ s16 warpEffectSpawned; - /* 0x0306 */ s16 refillTimer; - /* 0x0308 */ f32 scale; - /* 0x030C */ f32 grownHeight; - /* 0x0310 */ f32 vanishHeight; - /* 0x0314 */ f32 heightFraction; - /* 0x0318 */ f32 scaleFraction; - /* 0x031C */ f32 targetHeight; - /* 0x0320 */ f32 bobOffset; - /* 0x0324 */ f32 bobTimer; - /* 0x0328 */ f32 heightOffset; - /* 0x032C */ f32 frameCount; - /* 0x0330 */ char unk_330[4]; - /* 0x0334 */ Vec3s headRot; - /* 0x033A */ Vec3s torsoRot; - /* 0x0340 */ EnDyExtra* beam; - /* 0x0344 */ EnExItem* item; - /* 0x0348 */ char unk_348[0x4C]; + /* 0x0194 */ Vec3s unk194[28]; + /* 0x023C */ Vec3s unk23C[28]; + /* 0x02E4 */ u8 unk2E4; + /* 0x02E5 */ u8 unk2E5; + /* 0x02E6 */ u8 unk2E6; + /* 0x02E7 */ char pad2E7[1]; + /* 0x02E8 */ s16 unk2E8; + /* 0x02EA */ s16 unk2EA; + /* 0x02EC */ s16 unk2EC; + /* 0x02EE */ s16 unk2EE; + /* 0x02F0 */ s16 unk2F0; + /* 0x02F2 */ s16 unk2F2; + /* 0x02F4 */ s16 unk2F4; + /* 0x02F6 */ s16 unk2F6; + /* 0x02F8 */ s16 unk2F8; + /* 0x02FA */ s16 unk2FA; + /* 0x02FC */ s16 unk2FC; + /* 0x02FE */ s16 unk2FE; + /* 0x0300 */ s16 unk300; + /* 0x0302 */ s16 unk302; + /* 0x0304 */ s16 unk304; + /* 0x0306 */ s16 unk306; + /* 0x0308 */ f32 unk308; + /* 0x030C */ f32 unk30C; + /* 0x0310 */ f32 unk310; + /* 0x0314 */ f32 unk314; + /* 0x0318 */ f32 unk318; + /* 0x031C */ f32 unk31C; + /* 0x0320 */ f32 unk320; + /* 0x0324 */ f32 unk324; + /* 0x0328 */ f32 unk328; + /* 0x032C */ f32 unk32C; + /* 0x0330 */ char pad330[4]; + /* 0x0334 */ Vec3s unk334; + /* 0x033A */ Vec3s unk33A; + /* 0x0340 */ struct EnDyExtra* unk340; + /* 0x0344 */ struct EnExItem* unk344; + /* 0x0348 */ char pad348[0x4C]; /* 0x0394 */ BgDyYoseizoEffect effects[BG_DY_YOSEIZO_EFFECT_COUNT]; } BgDyYoseizo; // size = 0x38B4 diff --git a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c index 441870154f6..1b7a23c8fd3 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c @@ -18,14 +18,12 @@ #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) -void BgGndFiremeiro_Init(Actor* thisx, PlayState* play); +void BgGndFiremeiro_Init(Actor* thisx, PlayState* play2); void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2); void BgGndFiremeiro_Update(Actor* thisx, PlayState* play); void BgGndFiremeiro_Draw(Actor* thisx, PlayState* play); -void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play); -void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play); -void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play); +void BgGndFiremeiro_RiseWaitAtTop(BgGndFiremeiro* this, PlayState* play); ActorProfile Bg_Gnd_Firemeiro_Profile = { /**/ ACTOR_BG_GND_FIREMEIRO, @@ -39,20 +37,19 @@ ActorProfile Bg_Gnd_Firemeiro_Profile = { /**/ BgGndFiremeiro_Draw, }; -void BgGndFiremeiro_Init(Actor* thisx, PlayState* play) { - s32 pad; +void BgGndFiremeiro_Init(Actor* thisx, PlayState* play2) { + PlayState* play = play2; BgGndFiremeiro* this = (BgGndFiremeiro*)thisx; CollisionHeader* colHeader = NULL; ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); Actor_SetScale(&this->dyna.actor, 0.1f); - this->initPos = this->dyna.actor.world.pos; - + this->homePos = this->dyna.actor.world.pos; if (this->dyna.actor.params == 0) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gFireTrialPlatformCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->actionFunc = BgGndFiremeiro_Rise; + this->actionFunc = BgGndFiremeiro_RiseWaitAtTop; } } @@ -63,80 +60,77 @@ void BgGndFiremeiro_Destroy(Actor* thisx, PlayState* play2) { if (this->dyna.actor.params != 0) { return; } - DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgGndFiremeiro_Sink(BgGndFiremeiro* this, PlayState* play) { - f32 sunkHeight = this->initPos.y - 150.0f; +void BgGndFIremeiro_Sink(BgGndFiremeiro* this, PlayState* play) { + f32 sinkTarget = this->homePos.y - 150.0f; - if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna) != 0) { this->timer = 10; } - - if (sunkHeight < this->dyna.actor.world.pos.y) { + if (sinkTarget < this->dyna.actor.world.pos.y) { this->dyna.actor.world.pos.y -= 0.5f; - - if (this->dyna.actor.world.pos.y < sunkHeight) { - this->dyna.actor.world.pos.y = sunkHeight; + // I was not able to get this to be true in fire trial. + if (this->dyna.actor.world.pos.y < sinkTarget) { + this->dyna.actor.world.pos.y = sinkTarget; } - Actor_PlaySfx_FlaggedCentered2(&this->dyna.actor, NA_SE_EV_ROLL_STAND_2 - SFX_FLAG); } - if (this->timer > 0) { this->timer--; } else { - this->actionFunc = BgGndFiremeiro_Rise; + this->actionFunc = BgGndFiremeiro_RiseWaitAtTop; } } void BgGndFiremeiro_Shake(BgGndFiremeiro* this, PlayState* play) { s32 pad; - f32 randSign; + f32 shakeOffset; - if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { + if (DynaPolyActor_IsPlayerOnTop(&this->dyna) != 0) { if (this->timer > 0) { this->timer--; - - randSign = ((this->timer & 1) ? 2.0f : -2.0f); - - this->dyna.actor.world.pos = this->initPos; - this->dyna.actor.world.pos.x += randSign * Math_SinS(this->timer * 0x2FFF); - this->dyna.actor.world.pos.z += randSign * Math_CosS(this->timer * 0x2FFF); + if ((this->timer % 2) != 0) { + shakeOffset = 2.0f; + } else { + shakeOffset = -2.0f; + } + this->dyna.actor.world.pos = this->homePos; + this->dyna.actor.world.pos.x += shakeOffset * Math_SinS(this->timer * 0x2FFF); + this->dyna.actor.world.pos.z += shakeOffset * Math_CosS(this->timer * 0x2FFF); this->dyna.actor.world.pos.y += Math_CosS(this->timer * 0x7FFF); - if (!(this->timer % 4)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_SHAKE); } } else { this->timer = 10; - this->dyna.actor.world.pos = this->initPos; - this->actionFunc = BgGndFiremeiro_Sink; + this->dyna.actor.world.pos = this->homePos; + this->actionFunc = BgGndFIremeiro_Sink; } } else { - this->dyna.actor.world.pos = this->initPos; - this->actionFunc = BgGndFiremeiro_Rise; + this->dyna.actor.world.pos = this->homePos; + this->actionFunc = BgGndFiremeiro_RiseWaitAtTop; } } -void BgGndFiremeiro_Rise(BgGndFiremeiro* this, PlayState* play) { +void BgGndFiremeiro_RiseWaitAtTop(BgGndFiremeiro* this, PlayState* play) { Player* player = GET_PLAYER(play); Actor* thisx = &this->dyna.actor; - if ((player->currentBoots != PLAYER_BOOTS_HOVER) && DynaPolyActor_IsPlayerOnTop(&this->dyna)) { - if (thisx->world.pos.y < this->initPos.y) { - this->actionFunc = BgGndFiremeiro_Sink; + if ((player->currentBoots != 2) && (DynaPolyActor_IsPlayerOnTop(&this->dyna) != 0)) { + if (thisx->world.pos.y < this->homePos.y) { + this->actionFunc = BgGndFIremeiro_Sink; this->timer = 20; } else { this->actionFunc = BgGndFiremeiro_Shake; this->timer = 20; } } else { - if (thisx->world.pos.y < this->initPos.y) { + if (thisx->world.pos.y < this->homePos.y) { thisx->world.pos.y += 2.0f; - if (this->initPos.y < thisx->world.pos.y) { - thisx->world.pos.y = this->initPos.y; + if (this->homePos.y < thisx->world.pos.y) { + thisx->world.pos.y = this->homePos.y; } } } @@ -150,8 +144,8 @@ void BgGndFiremeiro_Update(Actor* thisx, PlayState* play) { void BgGndFiremeiro_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 280); - Gfx_SetupDL_37Opa(play->state.gfxCtx); + Gfx_SetupDL_37Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_gnd_firemeiro.c", 282); gSPDisplayList(POLY_OPA_DISP++, gFireTrialPlatformDL); diff --git a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h index a6092c9364c..9bb3196c4c2 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h +++ b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.h @@ -10,7 +10,7 @@ typedef void (*BgGndFiremeiroActionFunc)(struct BgGndFiremeiro*, struct PlayStat typedef struct BgGndFiremeiro { /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ Vec3f initPos; + /* 0x0164 */ Vec3f homePos; /* 0x0170 */ u16 timer; /* 0x0174 */ BgGndFiremeiroActionFunc actionFunc; } BgGndFiremeiro; // size = 0x0178 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 4e6d67df949..be84c272a0b 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_haka_huta.c - * Overlay: ovl_Bg_Haka_Huta - * Description: Coffin Lid - */ - #include "z_bg_haka_huta.h" #include "overlays/actors/ovl_En_Rd/z_en_rd.h" @@ -27,11 +21,10 @@ void BgHakaHuta_Destroy(Actor* thisx, PlayState* play); void BgHakaHuta_Update(Actor* thisx, PlayState* play); void BgHakaHuta_Draw(Actor* thisx, PlayState* play); -void BgHakaHuta_SpawnDust(BgHakaHuta* this, PlayState* play); -void BgHakaHuta_PlaySfx(BgHakaHuta* this, PlayState* play, u16 sfx); -void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, PlayState* play); -void BgHakaHuta_Open(BgHakaHuta* this, PlayState* play); -void BgHakaHuta_SlideOpen(BgHakaHuta* this, PlayState* play); +void func_8087D0AC(BgHakaHuta* this, PlayState* play); +void func_8087D2F0(BgHakaHuta* this, PlayState* play); +void func_8087D5B8(BgHakaHuta* this, PlayState* play); +void func_8087D66C(BgHakaHuta* this, PlayState* play); void func_8087D720(BgHakaHuta* this, PlayState* play); void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play); @@ -46,137 +39,153 @@ ActorProfile Bg_Haka_Huta_Profile = { /**/ BgHakaHuta_Update, /**/ BgHakaHuta_Draw, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_8087D940[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; +static Vec3f D_8087D944 = { 0.0f, 0.0f, 0.0f }; +static Color_RGBA8 D_8087D950 = { 30, 20, 50, 255 }; +static Color_RGBA8 D_8087D954 = { 0, 0, 0, 255 }; void BgHakaHuta_Init(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; - s16 pad; - CollisionHeader* colHeader = NULL; + s32 pad; + CollisionHeader* sp24; - Actor_ProcessInitChain(thisx, sInitChain); + sp24 = NULL; + Actor_ProcessInitChain(&this->dyna.actor, D_8087D940); 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 = PARAMS_GET_U(thisx->params, 8, 8); + CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &sp24); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp24); + this->unk16A = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; - if (Flags_GetSwitch(play, thisx->params)) { - this->counter = -1; + if (Flags_GetSwitch(play, this->dyna.actor.params)) { + this->unk168 = -1; this->actionFunc = func_8087D720; } else { - this->actionFunc = BgHakaHuta_SpawnEnemies; + this->actionFunc = func_8087D2F0; } } void BgHakaHuta_Destroy(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgHakaHuta_SpawnDust(BgHakaHuta* this, PlayState* play) { - static Vec3f sEffectAccel[] = { 0.0f, 0.0f, 0.0f }; - static Color_RGBA8 primColor = { 30, 20, 50, 255 }; - static Color_RGBA8 envColor = { 0, 0, 0, 255 }; - f32 scale; - f32 phi_f20; - Vec3f effectPos; - Vec3f effectVel; - s32 i; - f32 new_Xpos; - f32 xPosOffset; - - phi_f20 = (this->dyna.actor.world.rot.y == 0) ? 1.0f : -1.0f; - effectVel.y = 0.0f; - effectVel.z = 0.0f; - effectVel.x = -0.5f * phi_f20; - effectPos.y = this->dyna.actor.world.pos.y; - effectPos.z = this->dyna.actor.world.pos.z; - new_Xpos = 50 - ((this->dyna.actor.world.pos.x - this->dyna.actor.home.pos.x) * phi_f20); - xPosOffset = new_Xpos * phi_f20; - - for (i = 0; i < 4; i++) { - if (i == 2) { - effectPos.z += 120.0f * phi_f20; +void func_8087D0AC(BgHakaHuta* this, PlayState* play) { + s32 var_s0; + f32 temp_fs1; + Vec3f sp94; + Vec3f sp88; + f32 var_fs0; + f32 v; + + if (this->dyna.actor.world.rot.y == 0) { + var_fs0 = 1.0f; + } else { + var_fs0 = -1.0f; + } + sp88.x = -0.5f * var_fs0; + sp88.y = 0.0f; + sp88.z = 0.0f; + sp94.y = this->dyna.actor.world.pos.y; + sp94.z = this->dyna.actor.world.pos.z; + v = (50 - ((this->dyna.actor.world.pos.x - this->dyna.actor.home.pos.x) * var_fs0)); + temp_fs1 = v * var_fs0; + for (var_s0 = 0; var_s0 < 4; var_s0++) { + if (var_s0 == 2) { + sp94.z += 120.0f * var_fs0; } - effectPos.x = this->dyna.actor.home.pos.x - (Rand_ZeroOne() * xPosOffset); - scale = ((Rand_ZeroOne() * 10.0f) + 50.0f); - func_8002829C(play, &effectPos, &effectVel, sEffectAccel, &primColor, &envColor, scale, 0xA); + sp94.x = this->dyna.actor.home.pos.x - (Rand_ZeroOne() * temp_fs1); + func_8002829C(play, &sp94, &sp88, &D_8087D944, &D_8087D950, &D_8087D954, (Rand_ZeroOne() * 10.0f) + 50.0f, 10); } } -void BgHakaHuta_PlaySfx(BgHakaHuta* this, PlayState* play, u16 sfx) { - Vec3f pos; +void BgHakaHuta_PlaySound(BgHakaHuta* this, PlayState* play, u16 arg2) { + Vec3f sp24; - pos.z = (this->dyna.actor.shape.rot.y == 0) ? this->dyna.actor.world.pos.z + 120.0f - : this->dyna.actor.world.pos.z - 120.0f; - pos.x = this->dyna.actor.world.pos.x; - pos.y = this->dyna.actor.world.pos.y; - SfxSource_PlaySfxAtFixedWorldPos(play, &pos, 30, sfx); + if (this->dyna.actor.shape.rot.y == 0) { + sp24.z = this->dyna.actor.world.pos.z + 120.0f; + } else { + sp24.z = this->dyna.actor.world.pos.z - 120.0f; + } + sp24.x = this->dyna.actor.world.pos.x; + sp24.y = this->dyna.actor.world.pos.y; + SfxSource_PlaySfxAtFixedWorldPos(play, &sp24, 30, arg2); } -void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, PlayState* play) { +void func_8087D2F0(BgHakaHuta* this, PlayState* play) { if (Flags_GetSwitch(play, this->dyna.actor.params) && !Player_InCsMode(play)) { - this->counter = 25; - this->actionFunc = BgHakaHuta_Open; + this->unk168 = 0x19; + this->actionFunc = func_8087D5B8; OnePointCutscene_Init(play, 6001, 999, &this->dyna.actor, CAM_ID_MAIN); - if (this->unk_16A == 2) { + if (this->unk16A == 2) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, - (this->dyna.actor.world.pos.x + (-25.0f) * Math_CosS(this->dyna.actor.shape.rot.y) + - 40.0f * Math_SinS(this->dyna.actor.shape.rot.y)), + this->dyna.actor.world.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + + (40.0f * Math_SinS(this->dyna.actor.shape.rot.y)), this->dyna.actor.world.pos.y - 10.0f, - (this->dyna.actor.world.pos.z - (-25.0f) * Math_SinS(this->dyna.actor.shape.rot.y) + - Math_CosS(this->dyna.actor.shape.rot.y) * 40.0f), - 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 2); + this->dyna.actor.world.pos.z - (-25.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + + (40.0f * Math_CosS(this->dyna.actor.shape.rot.y)), + 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 2); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, - (this->dyna.actor.world.pos.x + (-25.0f) * (Math_CosS(this->dyna.actor.shape.rot.y)) + - Math_SinS(this->dyna.actor.shape.rot.y) * 80.0f), + this->dyna.actor.world.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + + (80.0f * Math_SinS(this->dyna.actor.shape.rot.y)), this->dyna.actor.world.pos.y - 10.0f, - (this->dyna.actor.world.pos.z - (-25.0f) * (Math_SinS(this->dyna.actor.shape.rot.y)) + - Math_CosS(this->dyna.actor.shape.rot.y) * 80.0f), + this->dyna.actor.world.pos.z - (-25.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + + (80.0f * Math_CosS(this->dyna.actor.shape.rot.y)), 0, this->dyna.actor.shape.rot.y, 0, 2); - - } else if (this->unk_16A == 1) { + } else if (this->unk16A == 1) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RD, - (this->dyna.actor.home.pos.x + (-25.0f) * (Math_CosS(this->dyna.actor.shape.rot.y)) + - Math_SinS(this->dyna.actor.shape.rot.y) * 100.0f), + this->dyna.actor.home.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + + (100.0f * Math_SinS(this->dyna.actor.shape.rot.y)), this->dyna.actor.home.pos.y - 40.0f, - (this->dyna.actor.home.pos.z - (-25.0f) * (Math_SinS(this->dyna.actor.shape.rot.y)) + - Math_CosS(this->dyna.actor.shape.rot.y) * 100.0f), + this->dyna.actor.home.pos.z - (-25.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + + (100.0f * Math_CosS(this->dyna.actor.shape.rot.y)), 0, this->dyna.actor.shape.rot.y, 0, (u8)REDEAD_TYPE_GIBDO_RISING_OUT_OF_COFFIN); } } } -void BgHakaHuta_Open(BgHakaHuta* this, PlayState* play) { - f32 posOffset; +void func_8087D5B8(BgHakaHuta* this, PlayState* play) { + f32 var_fv0; + s16 temp_v0; - if (this->counter != 0) { - this->counter--; + temp_v0 = this->unk168; + if (temp_v0 != 0) { + this->unk168 = temp_v0 - 1; } - posOffset = (this->dyna.actor.world.rot.y == 0) ? 4.0f : -4.0f; - Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + posOffset, 2.0f); - if (this->counter == 0) { - this->counter = 37; - BgHakaHuta_PlaySfx(this, play, NA_SE_EV_COFFIN_CAP_OPEN); - this->actionFunc = BgHakaHuta_SlideOpen; + if (this->dyna.actor.world.rot.y == 0) { + var_fv0 = 4.0f; + } else { + var_fv0 = -4.0f; + } + Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + var_fv0, 2.0f); + if (this->unk168 == 0) { + this->unk168 = 0x25; + BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_OPEN); + this->actionFunc = func_8087D66C; } } -void BgHakaHuta_SlideOpen(BgHakaHuta* this, PlayState* play) { - f32 posOffset; +void func_8087D66C(BgHakaHuta* this, PlayState* play) { + f32 var_fv0; + s16 temp_v0; - if (this->counter != 0) { - this->counter--; + temp_v0 = this->unk168; + if (temp_v0 != 0) { + this->unk168 = temp_v0 - 1; } - posOffset = (this->dyna.actor.world.rot.y == 0) ? 24.0f : -24.0f; - if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + posOffset, 0.5f)) { - BgHakaHuta_SpawnDust(this, play); + if (this->dyna.actor.world.rot.y == 0) { + var_fv0 = 24.0f; + } else { + var_fv0 = -24.0f; } - if (this->counter == 0) { - BgHakaHuta_PlaySfx(this, play, NA_SE_EV_COFFIN_CAP_BOUND); + if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + var_fv0, 0.5f)) { + func_8087D0AC(this, play); + } + if (this->unk168 == 0) { + BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_BOUND); this->actionFunc = func_8087D720; } } @@ -184,34 +193,33 @@ void BgHakaHuta_SlideOpen(BgHakaHuta* this, PlayState* play) { void func_8087D720(BgHakaHuta* this, PlayState* play) { static Vec3f D_8087D958 = { 30.0f, 0.0f, 0.0f }; static Vec3f D_8087D964 = { 0.03258f, 0.3258f, -0.9449f }; - MtxF mtx; - Vec3f vec; - s32 quakeIndex; + MtxF sp40; + Vec3f sp34; + s32 temp_v0; - this->counter++; - if (this->counter == 6) { + this->unk168 += 1; + if (this->unk168 == 6) { this->actionFunc = BgHakaHuta_DoNothing; - quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); - Quake_SetSpeed(quakeIndex, 0x7530); - Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0); - Quake_SetDuration(quakeIndex, 2); - } else if (this->counter == 0) { - this->counter = 6; + temp_v0 = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_3); + Quake_SetSpeed(temp_v0, 0x7530); + Quake_SetPerturbations(temp_v0, 4, 0, 0, 0); + Quake_SetDuration(temp_v0, 2); + } else if (this->unk168 == 0) { + this->unk168 = 6; this->actionFunc = BgHakaHuta_DoNothing; } - - D_8087D958.x = this->counter + 24.0f; + D_8087D958.x = this->unk168 + 24.0f; if (D_8087D958.x > 30.0f) { D_8087D958.x = 30.0f; } Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.world.rot.y), MTXMODE_NEW); - Matrix_RotateAxis(this->counter * (191 * M_PI / 3750), &D_8087D964, MTXMODE_APPLY); - Matrix_MultVec3f(&D_8087D958, &vec); - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + vec.x; - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + vec.y; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + vec.z; - Matrix_Get(&mtx); - Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0); + Matrix_RotateAxis(this->unk168 * 0.16001178f, &D_8087D964, MTXMODE_APPLY); + Matrix_MultVec3f(&D_8087D958, &sp34); + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + sp34.x; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + sp34.y; + this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + sp34.z; + Matrix_Get(&sp40); + Matrix_MtxFToYXZRotS(&sp40, &this->dyna.actor.shape.rot, 0); } void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play) { @@ -224,5 +232,7 @@ void BgHakaHuta_Update(Actor* thisx, PlayState* play) { } void BgHakaHuta_Draw(Actor* thisx, PlayState* play) { + BgHakaHuta* this = (BgHakaHuta*)thisx; + Gfx_DrawDListOpa(play, gBotwCoffinLidDL); } diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h index 3d691f3fad0..6cfea299dd9 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h @@ -11,8 +11,8 @@ typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, struct PlayState*); typedef struct BgHakaHuta { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHakaHutaActionFunc actionFunc; - /* 0x0168 */ s16 counter; - /* 0x016A */ s16 unk_16A; + /* 0x0168 */ s16 unk168; + /* 0x016A */ s16 unk16A; } BgHakaHuta; // size = 0x016C #endif diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index a91df648c10..d653d810a06 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -3,23 +3,23 @@ * Overlay: ovl_Bg_Haka_Trap * Description: Shadow Temple traps * - * HAKA_TRAP_GUILLOTINE: + * BG_HAKA_TRAP_GUILLOTINE: * A guillotine blade attached to a chain, drops from the ceiling. * - * HAKA_TRAP_GUILLOTINE_FAST: (spawn only param) + * BG_HAKA_TRAP_GUILLOTINE_FAST: (spawn only param) * Enables a flag making the guillotine move faster. * - * HAKA_TRAP_SPIKED_CRUSHER: + * BG_HAKA_TRAP_SPIKED_CRUSHER: * A square shaped platform suspended by a chain with spikes underneath, intended to crush the player. A pushblock can * be used to prevent it from decending completely. Rotating this actor may prevent correct hit detection of the block. * - * HAKA_TRAP_SPIKED_WALL_EAST: - * HAKA_TRAP_SPIKED_WALL_WEST: + * BG_HAKA_TRAP_SPIKED_WALL_EAST: + * BG_HAKA_TRAP_SPIKED_WALL_WEST: * * Two wooden spike walls that come together to crush the player. The one to the east has extra holes to reveal the * chest behind it. * - * HAKA_TRAP_FAN_BLADE: + * BG_HAKA_TRAP_FAN_BLADE: * A small fan blade that pushes the player away when turned on. `world.rot.z` is used to store the angular * velocity of the fan */ @@ -46,7 +46,6 @@ void BgHakaTrap_Destroy(Actor* thisx, PlayState* play); void BgHakaTrap_Update(Actor* thisx, PlayState* play); void BgHakaTrap_Draw(Actor* thisx, PlayState* play); -void BgHakaTrap_UpdateBodyColliderPos(BgHakaTrap* this, PlayState* play); void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play); void BgHakaTrap_SpikedWall_Burn(BgHakaTrap* this, PlayState* play); void BgHakaTrap_Guillotine_Fall(BgHakaTrap* this, PlayState* play); @@ -57,9 +56,8 @@ void BgHakaTrap_FanBlade_Idle(BgHakaTrap* this, PlayState* play); void BgHakaTrap_PushPlayer(BgHakaTrap* this, PlayState* play, s16 angularVelocity); void BgHakaTrap_FanBlade_ToggleFanGust(BgHakaTrap* this, PlayState* play); void BgHakaTrap_FanBlade_FullGust(BgHakaTrap* this, PlayState* play); -void BgHakaTrap_SpikedWall_UpdateCollider(BgHakaTrap* this); -static s32 sIsSpikeWallBurning = false; +s32 sIsSpikeWallBurning = false; ActorProfile Bg_Haka_Trap_Profile = { /**/ ACTOR_BG_HAKA_TRAP, @@ -73,203 +71,154 @@ ActorProfile Bg_Haka_Trap_Profile = { /**/ BgHakaTrap_Draw, }; -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_METAL, - AT_ON | AT_TYPE_ENEMY, - AC_ON | AC_HARD | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_PLAYER, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x04 }, - { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NORMAL, - ACELEM_ON, - OCELEM_ON, - }, - { 30, 90, 0, { 0, 0, 0 } }, +ColliderCylinderInit D_80880F54 = { + { 9, 0x11, 0xD, 9, 0x20, 1 }, + { 0, { 0xFFCFFFFF, 0, 4 }, { 0xFFCFFFFF, 0, 0 }, 1, 1, 1 }, + { 0x1E, 0x5A, 0, { 0, 0, 0 } }, }; -static ColliderTrisElementInit sSpikedWallTrisElementsInit[] = { - { - { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x00020000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_NONE, - }, - { { { 1800.0f, 1200.0f, 0.0f }, { -1800.0f, 1200.0f, 0.0f }, { -1800.0f, 0.0f, 0.0f } } }, - }, +static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { { + { 0, { 0, 0, 0 }, { 0x20000, 0, 0 }, 0, 1, 0 }, { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x00020000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_NONE, + { + { 1800.0f, 1200.0f, 0.0f }, + { -1800.0f, 1200.0f, 0.0f }, + { -1800.0f, 0.0f, 0.0f }, + }, }, - { { { 1800.0f, 1200.0f, 0.0f }, { -1800.0f, 0.0f, 0.0f }, { 1800.0f, 0.0f, 0.0f } } }, }, -}; - -static ColliderTrisInit sSpikedWallTrisInit = { { - COL_MATERIAL_NONE, - AT_NONE, - AC_ON | AC_TYPE_PLAYER, - OC1_NONE, - OC2_TYPE_2, - COLSHAPE_TRIS, + { 0, { 0, 0, 0 }, { 0x20000, 0, 0 }, 0, 1, 0 }, + { { + { 1800.0f, 1200.0f, 0.0f }, + { -1800.0f, 0.0f, 0.0f }, + { 1800.0f, 0.0f, 0.0f }, + } }, }, - ARRAY_COUNT(sSpikedWallTrisElementsInit), - sSpikedWallTrisElementsInit, }; -static CollisionCheckInfoInit sColChkInfoInit = { 0, 80, 100, MASS_IMMOVABLE }; +static ColliderTrisInit sSpikedWallTrisInit = { { 0xA, 0, 9, 0, 0x20, 2 }, 2, sSpikedWallTrisElementsInit }; +CollisionCheckInfoInit D_80881008 = { 0, 0x50, 0x64, 0xFF }; -static InitChainEntry sInitChain[] = { +InitChainEntry D_80881010[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; void BgHakaTrap_Init(Actor* thisx, PlayState* play) { static s32 sSpikedCrusherFlip = false; - BgHakaTrap* this = (BgHakaTrap*)thisx; - s32 pad; - CollisionHeader* colHeader = NULL; - Actor_ProcessInitChain(thisx, sInitChain); - thisx->params &= 0xFF; - - if (thisx->params != HAKA_TRAP_FAN_BLADE) { - Collider_InitCylinder(play, &this->colliderCylinder); - Collider_SetCylinder(play, &this->colliderCylinder, thisx, &sCylinderInit); - - if ((thisx->params == HAKA_TRAP_GUILLOTINE) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { - this->timer = 20; - this->colliderCylinder.dim.yShift = 10; - thisx->velocity.y = 0.1f; - - if (thisx->params == HAKA_TRAP_GUILLOTINE_FAST) { - thisx->params = HAKA_TRAP_GUILLOTINE; + s32* spikedCrusherFlipPtr; + BgHakaTrap* this = (BgHakaTrap*)thisx; + CollisionHeader* sp2C; + + sp2C = NULL; + Actor_ProcessInitChain(&this->dyna.actor, D_80881010); + this->dyna.actor.params &= 0xFF; + spikedCrusherFlipPtr = &sSpikedCrusherFlip; + if (this->dyna.actor.params != BG_HAKA_TRAP_FAN_BLADE) { + Collider_InitCylinder(play, &this->unk178); + Collider_SetCylinder(play, &this->unk178, &this->dyna.actor, &D_80880F54); + if ((this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE) || + (this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE_FAST)) { + this->unk168 = 0x14; + do { + } while (0); + this->unk178.dim.yShift = 0xA; + this->dyna.actor.velocity.y = 0.1f; + if (this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE_FAST) { + this->dyna.actor.params = BG_HAKA_TRAP_GUILLOTINE; this->isGuillotineFast = true; } - - this->actionFunc = BgHakaTrap_Guillotine_Fall; + this->actionFunc = &BgHakaTrap_Guillotine_Fall; } else { - DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - thisx->flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - - if (thisx->params == HAKA_TRAP_SPIKED_CRUSHER) { - CollisionHeader_GetVirtual(&gShadowTempleSpikedCrusherCol, &colHeader); - this->timer = 30; - - // Instances alternate between starting off in the up or down position. - if (sSpikedCrusherFlip) { - this->actionFunc = BgHakaTrap_SpikedCrusher_Lift; + DynaPolyActor_Init((DynaPolyActor*)this, DYNA_TRANSFORM_POS); + this->dyna.actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; + if (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_CRUSHER) { + CollisionHeader_GetVirtual(&gShadowTempleSpikedCrusherCol, &sp2C); + this->unk168 = 0x1E; + if (*spikedCrusherFlipPtr) { + this->actionFunc = &BgHakaTrap_SpikedCrusher_Lift; sSpikedCrusherFlip = false; } else { sSpikedCrusherFlip = true; - this->actionFunc = BgHakaTrap_SpikedCrusher_Fall; - thisx->velocity.y = 0.5f; + this->actionFunc = &BgHakaTrap_SpikedCrusher_Fall; + this->dyna.actor.velocity.y = 0.5f; } - // Assign the minimum height of the crusher. The crusher intentionally clips through the floor by 25 // units to allow the spikes to pierce the floor - thisx->floorHeight = thisx->home.pos.y - (200 + 25); - + this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y - (200 + 25); // Assigns the height the crusher rises on first "tug". The final -25 offset is missing in other // calculations of this variable. - this->spikedCrusherStepY = (thisx->floorHeight + 50.0f) - 25.0f; - - this->colliderCylinder.dim.radius = 10; - this->colliderCylinder.dim.height = 40; + this->spikedCrusherStepY = this->dyna.actor.floorHeight + 50.0f - 25.0f; + this->unk178.dim.radius = 0xA; + this->unk178.dim.height = 0x28; } else { - if (thisx->params == HAKA_TRAP_SPIKED_WALL_EAST) { - CollisionHeader_GetVirtual(&gShadowTempleSpikedWallEastCol, &colHeader); + if (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) { + CollisionHeader_GetVirtual(&gShadowTempleSpikedWallEastCol, &sp2C); // Shift the home position toward the center of the room. This will become the target position that // triggers the crush. - thisx->home.pos.x -= 200.0f; + this->dyna.actor.home.pos.x -= 200.0f; } else /* HAKA_TRAP_SPIKED_WALL_WEST */ { // Shift the home position toward the center of the room. This will become the target position that // triggers the crush. - thisx->home.pos.x += 200.0f; - CollisionHeader_GetVirtual(&gShadowTempleSpikedWallWestCol, &colHeader); + this->dyna.actor.home.pos.x += 200.0f; + CollisionHeader_GetVirtual(&gShadowTempleSpikedWallWestCol, &sp2C); } - - Collider_InitTris(play, &this->spikesCollider); - Collider_SetTris(play, &this->spikesCollider, thisx, &sSpikedWallTrisInit, - this->spikesColliderElements); - - this->colliderCylinder.dim.radius = 18; - this->colliderCylinder.dim.height = 115; - - this->colliderCylinder.elem.atElemFlags &= ~ATELEM_SFX_NORMAL; - this->colliderCylinder.elem.atElemFlags |= ATELEM_SFX_WOOD; - - this->actionFunc = BgHakaTrap_SpikedWall_CloseIn; + Collider_InitTris(play, &this->unk1C4); + Collider_SetTris(play, &this->unk1C4, &this->dyna.actor, &sSpikedWallTrisInit, this->unk1E4); + this->unk178.dim.radius = 0x12; + this->unk178.dim.height = 0x73; + this->unk178.elem.atElemFlags &= ~ATELEM_SFX_NORMAL; + this->unk178.elem.atElemFlags |= 0x10; + this->actionFunc = &BgHakaTrap_SpikedWall_CloseIn; } - - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp2C); } } else { // Initialize HAKA_TRAP_FAN_BLADE - this->timer = 40; - this->actionFunc = BgHakaTrap_FanBlade_Idle; - thisx->cullingVolumeScale = 500.0f; + this->unk168 = 0x28; + this->actionFunc = &BgHakaTrap_FanBlade_Idle; + this->dyna.actor.cullingVolumeScale = 500.0f; } - - CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); + CollisionCheck_SetInfo(&this->dyna.actor.colChkInfo, NULL, &D_80881008); } void BgHakaTrap_Destroy(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; - if (this->dyna.actor.params != HAKA_TRAP_FAN_BLADE) { - if (this->dyna.actor.params != HAKA_TRAP_GUILLOTINE) { + if (this->dyna.actor.params != BG_HAKA_TRAP_FAN_BLADE) { + if (this->dyna.actor.params != BG_HAKA_TRAP_GUILLOTINE) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - if ((this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_EAST) || - (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_WEST)) { - Collider_DestroyTris(play, &this->spikesCollider); + if ((this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) || + (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_WEST)) { + Collider_DestroyTris(play, &this->unk1C4); } } - - Collider_DestroyCylinder(play, &this->colliderCylinder); + Collider_DestroyCylinder(play, &this->unk178); } - Audio_StopSfxByPos(&this->chainLiftSfxPos); } -// Updates body collider for HAKA_TRAP_GUILLOTINE, HAKA_TRAP_SPIKED_WALL_EAST, HAKA_TRAP_SPIKED_WALL_WEST +// Updates body collider for BG_HAKA_TRAP_GUILLOTINE, BG_HAKA_TRAP_SPIKED_WALL_EAST, BG_HAKA_TRAP_SPIKED_WALL_WEST void BgHakaTrap_UpdateBodyColliderPos(BgHakaTrap* this, PlayState* play) { f32 cos; Vec3f colOff; f32 sin; - f32 zSign; Player* player = GET_PLAYER(play); Actor_WorldToActorCoords(&this->dyna.actor, &colOff, &player->actor.world.pos); - sin = Math_SinS(this->dyna.actor.shape.rot.y); cos = Math_CosS(this->dyna.actor.shape.rot.y); - - if (this->dyna.actor.params == HAKA_TRAP_GUILLOTINE) { + if (this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE) { colOff.x = CLAMP(colOff.x, -50.0f, 50.0f); - zSign = (colOff.z >= 0.0f) ? 1.0f : -1.0f; - colOff.z = zSign * -15.0f; + colOff.z = ((colOff.z >= 0.0f) ? 1.0f : -1.0f) * -15.0f; } else { colOff.x = -CLAMP(colOff.x, -162.0f, 162.0f); - zSign = (colOff.z >= 0.0f) ? 1.0f : -1.0f; - colOff.z = zSign * 15.0f; + colOff.z = ((colOff.z >= 0.0f) ? 1.0f : -1.0f) * 15.0f; } - - this->colliderCylinder.dim.pos.x = this->dyna.actor.world.pos.x + colOff.x * cos + colOff.z * sin; - this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + colOff.x * sin + colOff.z * cos; + this->unk178.dim.pos.x = this->dyna.actor.world.pos.x + (colOff.x * cos) + (colOff.z * sin); + this->unk178.dim.pos.z = this->dyna.actor.world.pos.z + (colOff.x * sin) + (colOff.z * cos); } #define BGHAKATRAP_SPIKEDWALL_HITEAST (1 << 0) @@ -278,23 +227,23 @@ void BgHakaTrap_UpdateBodyColliderPos(BgHakaTrap* this, PlayState* play) { void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) { static s32 sSpikedWallFlags = 0; + Player* player = GET_PLAYER(play); - if (!sIsSpikeWallBurning && !Player_InCsMode(play)) { - // Step towards the home position. If we haven't reached it, play the sliding sfx - if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f)) { + if (!sIsSpikeWallBurning && (Player_InCsMode(play) == 0)) { + if (Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f) == 0) { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG); - } else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_EAST) { - sSpikedWallFlags |= BGHAKATRAP_SPIKEDWALL_HITEAST; - } else if (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_WEST) { - sSpikedWallFlags |= BGHAKATRAP_SPIKEDWALL_HITWEST; + } else { + if (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) { + sSpikedWallFlags |= BGHAKATRAP_SPIKEDWALL_HITEAST; + } else if (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_WEST) { + sSpikedWallFlags |= BGHAKATRAP_SPIKEDWALL_HITWEST; + } } } - BgHakaTrap_UpdateBodyColliderPos(this, play); - - if (this->spikesCollider.base.acFlags & AC_HIT) { - this->timer = 20; + if (this->unk1C4.base.acFlags & AC_HIT) { + this->unk168 = 0x14; sIsSpikeWallBurning = true; this->actionFunc = BgHakaTrap_SpikedWall_Burn; } else if (sSpikedWallFlags == (BGHAKATRAP_SPIKEDWALL_HITEAST | BGHAKATRAP_SPIKEDWALL_HITWEST)) { @@ -303,31 +252,25 @@ void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) { } } +Vec3f D_8088101C = { 0.0f, 0.0f, 0.0f }; + void BgHakaTrap_SpikedWall_Burn(BgHakaTrap* this, PlayState* play) { - static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - Vec3f vector; - f32 xScale; - s32 i; + Vec3f sp94; + s32 var_s0; - if (this->timer != 0) { - this->timer--; + if (this->unk168 != 0) { + this->unk168--; } - Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_BURN_OUT - SFX_FLAG); - - for (i = 0; i < 2; i++) { - f32 rand = Rand_ZeroOne(); - - xScale = (this->dyna.actor.params == HAKA_TRAP_SPIKED_WALL_EAST) ? -30.0f : 30.0f; - - vector.x = xScale * rand + this->dyna.actor.world.pos.x; - vector.y = Rand_ZeroOne() * 10.0f + this->dyna.actor.world.pos.y + 30.0f; - vector.z = Rand_CenteredFloat(320.0f) + this->dyna.actor.world.pos.z; - - EffectSsDeadDb_Spawn(play, &vector, &zeroVec, &zeroVec, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, false); - } - - if (this->timer == 0) { + for (var_s0 = 0; var_s0 < 2; var_s0++) { + sp94.x = (Rand_ZeroOne() * ((this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) ? -30.0f : 30.0f)) + + this->dyna.actor.world.pos.x; + sp94.y = (Rand_ZeroOne() * 10.0f) + this->dyna.actor.world.pos.y + 30.0f; + sp94.z = Rand_CenteredFloat(320.0f) + this->dyna.actor.world.pos.z; + EffectSsDeadDb_Spawn(play, &sp94, &D_8088101C, &D_8088101C, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, + false); + } + if (this->unk168 == 0) { sIsSpikeWallBurning = false; Actor_Kill(&this->dyna.actor); } @@ -335,142 +278,123 @@ void BgHakaTrap_SpikedWall_Burn(BgHakaTrap* this, PlayState* play) { void BgHakaTrap_Guillotine_Fall(BgHakaTrap* this, PlayState* play) { s32 isDoneFalling; - s32 timer; + s32 unk168; if (this->isGuillotineFast) { this->dyna.actor.velocity.y *= 3.0f; } else { this->dyna.actor.velocity.y *= 2.0f; } - - if (this->timer != 0) { - this->timer -= 1; + if (this->unk168 != 0) { + this->unk168 -= 1; } - isDoneFalling = Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 185.0f, this->dyna.actor.velocity.y); - timer = this->timer; - - if ((timer == 10 && !this->isGuillotineFast) || (timer == 13 && this->isGuillotineFast)) { + unk168 = this->unk168; + if (((unk168 == 0xA) && !this->isGuillotineFast) || ((unk168 == 0xD) && this->isGuillotineFast)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GUILLOTINE_BOUND); } - - if (this->timer == 0) { + if (this->unk168 == 0) { this->dyna.actor.velocity.y = 0.0f; - this->timer = (this->isGuillotineFast) ? 10 : 40; + if (this->isGuillotineFast) { + this->unk168 = 0xA; + } else { + this->unk168 = 0x28; + } Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GUILLOTINE_UP); this->actionFunc = BgHakaTrap_Guillotine_Lift; } - BgHakaTrap_UpdateBodyColliderPos(this, play); - if (!isDoneFalling) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk178.base); } } void BgHakaTrap_Guillotine_Lift(BgHakaTrap* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk168 != 0) { + this->unk168 -= 1; } - if (this->isGuillotineFast) { - Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 27.0f); } else { - if (this->timer > 20) { + if (this->unk168 >= 0x15) { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 90.0f, 9.0f); } else { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 4.5f); } - - if (this->timer == 20) { + if (this->unk168 == 0x14) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GUILLOTINE_UP); } } - - if (this->timer == 0) { - this->timer = 20; + if (this->unk168 == 0) { + this->unk168 = 0x14; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; this->dyna.actor.velocity.y = 0.1f; this->actionFunc = BgHakaTrap_Guillotine_Fall; } - BgHakaTrap_UpdateBodyColliderPos(this, play); } void BgHakaTrap_SpikedCrusher_Fall(BgHakaTrap* this, PlayState* play) { - Vec3f vector; - f32 floorHeight; + Vec3f sp74; f32 yIntersect; - s32 i; + f32 floorHeight; + s32 var_s0; s32 bgId; this->dyna.actor.velocity.y *= 1.6f; - - if (this->timer != 0) { - this->timer--; + if (this->unk168 != 0) { + this->unk168 -= 1; } - // Perform a collision check for the "stone umbrella" block // Because of the shape of the room and the size of the block we only need to check three positions, // the center of the east edge, the centerpoint, and the center of the west edge of the crusher. // // The y coordinate is offset by 25 units, as the crusher is allowed to clip into the floor for visual effect. - - vector.x = this->dyna.actor.world.pos.x + 90.0f; - vector.y = (this->dyna.actor.world.pos.y + 1.0f) + 25.0f; - vector.z = this->dyna.actor.world.pos.z; - + sp74.x = this->dyna.actor.world.pos.x + 90.0f; + sp74.y = this->dyna.actor.world.pos.y + 1.0f + 25.0f; + sp74.z = this->dyna.actor.world.pos.z; // actor.floorHeight is storing the minimum y position of the crusher floorHeight = this->dyna.actor.floorHeight; - - for (i = 0; i < 3; i++) { + for (var_s0 = 0; var_s0 < 3; var_s0++) { yIntersect = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &vector) - + BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &sp74) - 25.0f; if (floorHeight < yIntersect) { floorHeight = yIntersect; } - - vector.x -= 90.0f; + sp74.x -= 90.0f; } - - if (Math_StepToF(&this->dyna.actor.world.pos.y, floorHeight, this->dyna.actor.velocity.y)) { + if (Math_StepToF(&this->dyna.actor.world.pos.y, floorHeight, this->dyna.actor.velocity.y) != 0) { if (this->dyna.actor.velocity.y > 0.01f) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_TRAP_BOUND); } this->dyna.actor.velocity.y = 0.0f; } - if (this->dyna.actor.velocity.y >= 0.01f) { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_CHINETRAP_DOWN - SFX_FLAG); } - - if (this->timer == 0) { + if (this->unk168 == 0) { this->dyna.actor.velocity.y = 0.0f; - this->timer = 30; + this->unk168 = 0x1E; this->spikedCrusherStepY = (s16)this->dyna.actor.world.pos.y + 50.0f; - this->spikedCrusherStepY = CLAMP_MAX(this->spikedCrusherStepY, this->dyna.actor.home.pos.y); - + this->spikedCrusherStepY = MIN(this->dyna.actor.home.pos.y, this->spikedCrusherStepY); this->actionFunc = BgHakaTrap_SpikedCrusher_Lift; } } void BgHakaTrap_SpikedCrusher_Lift(BgHakaTrap* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk168 != 0) { + this->unk168--; } - - if (this->timer > 20) { + if (this->unk168 >= 0x15) { this->isSpikedCrusherStationary = Math_StepToF(&this->dyna.actor.world.pos.y, this->spikedCrusherStepY, 15.0f); } else { this->isSpikedCrusherStationary = Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 20.0f); } - - if (this->timer == 0) { - this->timer = 30; + if (this->unk168 == 0) { + this->unk168 = 0x1E; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; this->dyna.actor.velocity.y = 0.5f; this->actionFunc = BgHakaTrap_SpikedCrusher_Fall; @@ -478,12 +402,11 @@ void BgHakaTrap_SpikedCrusher_Lift(BgHakaTrap* this, PlayState* play) { } void BgHakaTrap_FanBlade_Idle(BgHakaTrap* this, PlayState* play) { - if (this->timer != 0) { - this->timer -= 1; + if (this->unk168 != 0) { + this->unk168 -= 1; } - - if (this->timer == 0) { - // this->timer = 0, which signals the fan to turn on and speed up + if (this->unk168 == 0) { + // this->unk168 = 0, which signals the fan to turn on and speed up this->actionFunc = BgHakaTrap_FanBlade_ToggleFanGust; } } @@ -493,55 +416,50 @@ void BgHakaTrap_PushPlayer(BgHakaTrap* this, PlayState* play, s16 angularVelocit Vec3f playerRelOff; Actor_WorldToActorCoords(&this->dyna.actor, &playerRelOff, &player->actor.world.pos); - if ((fabsf(playerRelOff.x) < 70.0f) && (fabsf(playerRelOff.y) < 100.0f) && (playerRelOff.z < 500.0f) && - (GET_PLAYER(play)->currentBoots != PLAYER_BOOTS_IRON)) { + (GET_PLAYER(play)->currentBoots != 1)) { player->pushedSpeed = - ((500.0f - playerRelOff.z) * 0.06f + 5.0f) * angularVelocity * (1.0f / 0x3A00) * (2.0f / 3.0f); + (((500.0f - playerRelOff.z) * 0.06f) + 5.0f) * angularVelocity * (1.0f / 14848.0f) * (2.0f / 3.0f); player->pushedYaw = this->dyna.actor.shape.rot.y; } } void BgHakaTrap_FanBlade_ToggleFanGust(BgHakaTrap* this, PlayState* play) { - // this->timer stores the current fan behavior. + // this->unk168 stores the current fan behavior. // if 1, the fan is on and is ramping down to the off state. // if 0, the fan is off and is ramping up to the full on state. // world.rot.z is the current angular velocity of the fan - if (this->timer != 0) { + if (this->unk168 != 0) { // Fan winds down - if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0, this->dyna.actor.world.rot.z * 0.03f + 5.0f)) { - this->timer = 40; + if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0, (this->dyna.actor.world.rot.z * 0.03f) + 5.0f) != 0) { + this->unk168 = 0x28; this->actionFunc = BgHakaTrap_FanBlade_Idle; } } else { // Fan speeds up - if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0x3A00, this->dyna.actor.world.rot.z * 0.03f + 5.0f)) { - this->timer = 100; + if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0x3A00, (this->dyna.actor.world.rot.z * 0.03f) + 5.0f) != + 0) { + this->unk168 = 0x64; this->actionFunc = BgHakaTrap_FanBlade_FullGust; } } - this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z; if (this->dyna.actor.world.rot.z > 0x1800) { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_WIND_TRAP - SFX_FLAG); } - BgHakaTrap_PushPlayer(this, play, this->dyna.actor.world.rot.z); } void BgHakaTrap_FanBlade_FullGust(BgHakaTrap* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk168 != 0) { + this->unk168--; } - Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_WIND_TRAP - SFX_FLAG); - - if (this->timer == 0) { - this->timer = 1; // setting this signals the fan to turn off and slow down + if (this->unk168 == 0) { + this->unk168 = 1; // setting this signals the fan to turn off and slow down this->actionFunc = BgHakaTrap_FanBlade_ToggleFanGust; } - // world.rot.z is the current angular velocity of the fan this->dyna.actor.shape.rot.z += this->dyna.actor.world.rot.z; BgHakaTrap_PushPlayer(this, play, this->dyna.actor.world.rot.z); @@ -549,22 +467,20 @@ void BgHakaTrap_FanBlade_FullGust(BgHakaTrap* this, PlayState* play) { void BgHakaTrap_Update(Actor* thisx, PlayState* play) { BgHakaTrap* this = (BgHakaTrap*)thisx; - Vec3f* actorPos = &this->dyna.actor.world.pos; + s32 pad; this->actionFunc(this, play); - if ((this->dyna.actor.params != HAKA_TRAP_FAN_BLADE) && (thisx->params != HAKA_TRAP_SPIKED_CRUSHER)) { - this->colliderCylinder.dim.pos.y = actorPos->y; - - if ((thisx->params == HAKA_TRAP_GUILLOTINE) || (thisx->params == HAKA_TRAP_GUILLOTINE_FAST)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); + if ((thisx->params != BG_HAKA_TRAP_FAN_BLADE) && (thisx->params != BG_HAKA_TRAP_SPIKED_CRUSHER)) { + this->unk178.dim.pos.y = this->dyna.actor.world.pos.y; + if ((thisx->params == BG_HAKA_TRAP_GUILLOTINE) || (thisx->params == BG_HAKA_TRAP_GUILLOTINE_FAST)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk178.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk178.base); } else { if (this->actionFunc == BgHakaTrap_SpikedWall_CloseIn) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->spikesCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C4.base); } - - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk178.base); } } } @@ -575,42 +491,37 @@ void BgHakaTrap_SpikedWall_UpdateCollider(BgHakaTrap* this) { Matrix_MultVec3f(&sSpikedWallTrisElementsInit[0].dim.vtx[0], &vtx[0]); Matrix_MultVec3f(&sSpikedWallTrisElementsInit[0].dim.vtx[1], &vtx[1]); Matrix_MultVec3f(&sSpikedWallTrisElementsInit[0].dim.vtx[2], &vtx[2]); - Collider_SetTrisVertices(&this->spikesCollider, 0, &vtx[0], &vtx[1], &vtx[2]); - + Collider_SetTrisVertices(&this->unk1C4, 0, &vtx[0], &vtx[1], &vtx[2]); Matrix_MultVec3f(&sSpikedWallTrisElementsInit[1].dim.vtx[2], &vtx[1]); - Collider_SetTrisVertices(&this->spikesCollider, 1, &vtx[0], &vtx[2], &vtx[1]); + Collider_SetTrisVertices(&this->unk1C4, 1, &vtx[0], &vtx[2], &vtx[1]); } +Gfx* D_80881028[5] = { + gShadowTempleGuillotineDL, gShadowTempleSpikedCrusherDL, gShadowTempleSpikedWallEastDL, + gShadowTempleSpikedWallWestDL, gShadowTempleFanBladeDL, +}; +static Color_RGBA8 sFogBlack = { 0, 0, 0, 0 }; + void BgHakaTrap_Draw(Actor* thisx, PlayState* play) { - static Gfx* sDLists[5] = { - gShadowTempleGuillotineDL, gShadowTempleSpikedCrusherDL, gShadowTempleSpikedWallEastDL, - gShadowTempleSpikedWallWestDL, gShadowTempleFanBladeDL, - }; - static Color_RGBA8 sFogBlack = { 0, 0, 0, 0 }; BgHakaTrap* this = (BgHakaTrap*)thisx; s32 pad; if (this->actionFunc == BgHakaTrap_SpikedWall_Burn) { - func_80026230(play, &sFogBlack, this->timer + 20, 40); + func_80026230(play, &sFogBlack, this->unk168 + 0x14, 40); } - - Gfx_DrawDListOpa(play, sDLists[this->dyna.actor.params]); - + Gfx_DrawDListOpa(play, D_80881028[this->dyna.actor.params]); if (this->actionFunc == BgHakaTrap_SpikedWall_CloseIn) { BgHakaTrap_SpikedWall_UpdateCollider(this); } - if (this->actionFunc == BgHakaTrap_SpikedWall_Burn) { func_80026608(play); } - - if ((this->actionFunc == BgHakaTrap_SpikedCrusher_Lift) && !this->isSpikedCrusherStationary) { + if ((this->actionFunc == BgHakaTrap_SpikedCrusher_Lift) && ((u8)this->isSpikedCrusherStationary == 0)) { Vec3f sfxPos; sfxPos.x = this->dyna.actor.world.pos.x; sfxPos.z = this->dyna.actor.world.pos.z; sfxPos.y = this->dyna.actor.world.pos.y + 110.0f; - SkinMatrix_Vec3fMtxFMultXYZ(&play->viewProjectionMtxF, &sfxPos, &this->chainLiftSfxPos); Sfx_PlaySfxAtPos(&this->chainLiftSfxPos, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); } 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 14c7c7a1a34..ee212c5a7a8 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,33 +4,33 @@ #include "ultra64.h" #include "actor.h" -typedef enum HakaTrapType { - /* 0x00 */ HAKA_TRAP_GUILLOTINE, - /* 0x01 */ HAKA_TRAP_SPIKED_CRUSHER, - /* 0x02 */ HAKA_TRAP_SPIKED_WALL_EAST, - /* 0x03 */ HAKA_TRAP_SPIKED_WALL_WEST, - /* 0x04 */ HAKA_TRAP_FAN_BLADE, - /* 0x05 */ HAKA_TRAP_GUILLOTINE_FAST -} HakaTrapType; +typedef enum BgHakaTrapType { + /* 0 */ BG_HAKA_TRAP_GUILLOTINE, + /* 1 */ BG_HAKA_TRAP_SPIKED_CRUSHER, + /* 2 */ BG_HAKA_TRAP_SPIKED_WALL_EAST, + /* 3 */ BG_HAKA_TRAP_SPIKED_WALL_WEST, + /* 4 */ BG_HAKA_TRAP_FAN_BLADE, + /* 5 */ BG_HAKA_TRAP_GUILLOTINE_FAST +} BgHakaTrapType; struct BgHakaTrap; typedef void (*BgHakaTrapActionFunc)(struct BgHakaTrap*, struct PlayState*); typedef struct BgHakaTrap { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ BgHakaTrapActionFunc actionFunc; - /* 0x0168 */ u8 timer; - /* 0x0169 */ u8 isSpikedCrusherStationary; + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ BgHakaTrapActionFunc actionFunc; + /* 0x168 */ u8 unk168; + /* 0x169 */ s8 isSpikedCrusherStationary; /* 0x016A */ union { s16 isGuillotineFast; // 0 slow, 1 fast s16 spikedCrusherStepY; // when lifting the crusher, it will pause briefly at this height before being // lifted to its maximum height }; - /* 0x016C */ Vec3f chainLiftSfxPos; - /* 0x0178 */ ColliderCylinder colliderCylinder; - /* 0x01C4 */ ColliderTris spikesCollider; - /* 0x01E4 */ ColliderTrisElement spikesColliderElements[2]; -} BgHakaTrap; // size = 0x029C + /* 0x16C */ Vec3f chainLiftSfxPos; + /* 0x178 */ ColliderCylinder unk178; + /* 0x1C4 */ ColliderTris unk1C4; + /* 0x1E4 */ ColliderTrisElement unk1E4[2]; +} BgHakaTrap; // size = 0x29C #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c index b8d10809f83..28258a50a17 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c @@ -1,6 +1,6 @@ /* * File: z_bg_hidan_fslift.c - * Overlay: ovl_Bg_Hidan_Fslift + * Overlay: Bg_Hidan_Fslift * Description: Hookshot Elevator */ @@ -44,32 +44,33 @@ static InitChainEntry sInitChain[] = { }; void BgHidanFslift_Init(Actor* thisx, PlayState* play) { - s32 pad1; BgHidanFslift* this = (BgHidanFslift*)thisx; + s32 pad1; CollisionHeader* colHeader = NULL; s32 pad2; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&gFireTempleHookshotElevatorCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); - if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_HSBLOCK, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y + 40.0f, this->dyna.actor.world.pos.z + -28.0f, 0, 0, 0, - 2) == NULL) { - Actor_Kill(&this->dyna.actor); + if (Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_HSBLOCK, thisx->world.pos.x, + thisx->world.pos.y + 40.0f, thisx->world.pos.z + -28.0f, 0, 0, 0, 2) == NULL) { + Actor_Kill(thisx); return; } this->actionFunc = BgHidanFslift_Idle; } void BgHidanFslift_SetHookshotTargetPos(BgHidanFslift* this) { - if (this->dyna.actor.child != NULL && this->dyna.actor.child->update != NULL) { - this->dyna.actor.child->world.pos.x = this->dyna.actor.world.pos.x; - this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 40.0f; - this->dyna.actor.child->world.pos.z = this->dyna.actor.world.pos.z + -28.0f; - } else { - this->dyna.actor.child = NULL; + Actor* thisx = &this->dyna.actor; + + if (thisx->child != NULL && thisx->child->update != NULL) { + thisx->child->world.pos.x = thisx->world.pos.x; + thisx->child->world.pos.y = thisx->world.pos.y + 40.0f; + thisx->child->world.pos.z = thisx->world.pos.z + -28.0f; + return; } + thisx->child = NULL; } void BgHidanFslift_Destroy(Actor* thisx, PlayState* play) { @@ -79,47 +80,54 @@ void BgHidanFslift_Destroy(Actor* thisx, PlayState* play) { } void BgHidanFslift_SetupIdle(BgHidanFslift* this) { - this->timer = 40; + this->unk_168 = 0x28; this->actionFunc = BgHidanFslift_Idle; } void BgHidanFslift_Idle(BgHidanFslift* this, PlayState* play) { s32 nearHomePos; + Actor* thisx = &this->dyna.actor; - if (this->timer) { - this->timer--; - } + DECR(this->unk_168); - if (this->timer == 0) { + if (this->unk_168 == 0) { nearHomePos = false; - if ((this->dyna.actor.world.pos.y - this->dyna.actor.home.pos.y) < 0.5f) { + if ((thisx->world.pos.y - thisx->home.pos.y) < 0.5f) { nearHomePos = true; } - if (DynaPolyActor_IsPlayerAbove(&this->dyna) && nearHomePos) { - this->actionFunc = BgHidanFslift_Ascend; - } else if (!nearHomePos) { + if (DynaPolyActor_IsPlayerAbove(&this->dyna)) { + if (nearHomePos) { + this->actionFunc = BgHidanFslift_Ascend; + return; + } + } + if (!nearHomePos) { this->actionFunc = BgHidanFslift_Descend; } } } void BgHidanFslift_Descend(BgHidanFslift* this, PlayState* play) { - if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 4.0f)) { - Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + Actor* thisx = &this->dyna.actor; + + if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y, 4.0f)) { + Actor_PlaySfx(thisx, NA_SE_EV_BLOCK_BOUND); BgHidanFslift_SetupIdle(this); } else { - Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); } BgHidanFslift_SetHookshotTargetPos(this); } void BgHidanFslift_Ascend(BgHidanFslift* this, PlayState* play) { + Actor* thisx = &this->dyna.actor; + if (DynaPolyActor_IsPlayerAbove(&this->dyna)) { - if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 790.0f, 4.0f)) { - Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); + if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y + 790.0f, 4.0f)) { + Actor_PlaySfx(thisx, NA_SE_EV_BLOCK_BOUND); BgHidanFslift_SetupIdle(this); } else { - Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); } } else { BgHidanFslift_SetupIdle(this); @@ -136,10 +144,8 @@ void BgHidanFslift_Update(Actor* thisx, PlayState* play) { this->cameraSetting = CAM_SET_DUNGEON0; } Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_ELEVATOR_PLATFORM); - } else if (!DynaPolyActor_IsPlayerOnTop(&this->dyna)) { + } else if (DynaPolyActor_IsPlayerOnTop(&this->dyna) == 0) { if (this->cameraSetting != CAM_SET_NONE) { - // Given the values that get set to `cameraSetting`, it seems likely that it was intended to be - // passed to the function call below. But instead `CAM_SET_DUNGEON0` is used directly. Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->cameraSetting = CAM_SET_NONE; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h index 1f810b1c04e..9b4bf034298 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.h @@ -11,7 +11,7 @@ typedef void (*BgHidanFsliftActionFunc)(struct BgHidanFslift*, struct PlayState* typedef struct BgHidanFslift { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHidanFsliftActionFunc actionFunc; - /* 0x0168 */ s16 timer; + /* 0x0168 */ s16 unk_168; /* 0x016A */ s16 cameraSetting; } BgHidanFslift; // size = 0x016C 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 3559b572fb7..ead2b5649bc 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 @@ -114,9 +114,10 @@ void func_80889ACC(BgHidanKousi* this) { Vec3s* rot = &this->dyna.actor.world.rot; 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); + Vec3f* initPos = &this->dyna.actor.home.pos; - 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; + this->dyna.actor.world.pos.x = initPos->x + temp1; + this->dyna.actor.world.pos.z = initPos->z + temp2; } void func_80889B5C(BgHidanKousi* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 8bf82f42fef..62553babe41 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -37,89 +37,34 @@ ActorProfile Bg_Hidan_Rsekizou_Profile = { /**/ BgHidanRsekizou_Draw, }; -static ColliderJntSphElementInit sJntSphElementsInit[] = { +static ColliderJntSphElementInit D_8088CC80[6] = { { - { - ELEM_MATERIAL_UNK0, - { 0x20000000, HIT_SPECIAL_EFFECT_FIRE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NONE, - ACELEM_NONE, - OCELEM_NONE, - }, - { 1, { { 0, 30, 40 }, 25 }, 100 }, + { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, + { 1, { { 0, 0x1E, 0x28 }, 0x19 }, 0x64 }, }, { - { - ELEM_MATERIAL_UNK0, - { 0x20000000, HIT_SPECIAL_EFFECT_FIRE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NONE, - ACELEM_NONE, - OCELEM_NONE, - }, - { 1, { { -35, 32, 77 }, 32 }, 100 }, + { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, + { 1, { { -0x23, 0x20, 0x4D }, 0x20 }, 0x64 }, }, { - { - ELEM_MATERIAL_UNK0, - { 0x20000000, HIT_SPECIAL_EFFECT_FIRE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NONE, - ACELEM_NONE, - OCELEM_NONE, - }, - { 1, { { -80, 35, 130 }, 42 }, 100 }, + { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, + { 1, { { -0x50, 0x23, 0x82 }, 0x2A }, 0x64 }, }, { - { - ELEM_MATERIAL_UNK0, - { 0x20000000, HIT_SPECIAL_EFFECT_FIRE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NONE, - ACELEM_NONE, - OCELEM_NONE, - }, - { 1, { { 0, 30, -40 }, 25 }, 100 }, + { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, + { 1, { { 0, 0x1E, -0x28 }, 0x19 }, 0x64 }, }, { - { - ELEM_MATERIAL_UNK0, - { 0x20000000, HIT_SPECIAL_EFFECT_FIRE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NONE, - ACELEM_NONE, - OCELEM_NONE, - }, - { 1, { { 35, 32, -77 }, 32 }, 100 }, + { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, + { 1, { { 0x23, 0x20, -0x4D }, 0x20 }, 0x64 }, }, { - { - ELEM_MATERIAL_UNK0, - { 0x20000000, HIT_SPECIAL_EFFECT_FIRE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NONE, - ACELEM_NONE, - OCELEM_NONE, - }, - { 1, { { 80, 35, -130 }, 42 }, 100 }, + { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, + { 1, { { 0x50, 0x23, -0x82 }, 0x2A }, 0x64 }, }, }; - -static ColliderJntSphInit sJntSphInit = { - { - COL_MATERIAL_NONE, - AT_ON | AT_TYPE_ENEMY, - AC_NONE, - OC1_NONE, - OC2_TYPE_2, - COLSHAPE_JNTSPH, - }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, -}; - -static InitChainEntry sInitChain[] = { +ColliderJntSphInit D_8088CD58 = { { 0xA, 0x11, 0, 0, 0x20, 0 }, 6, D_8088CC80 }; +InitChainEntry D_8088CD68[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 400, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1500, ICHAIN_STOP), @@ -134,140 +79,124 @@ void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; s32 i; s32 pad; - CollisionHeader* colHeader; + CollisionHeader* sp30; - colHeader = NULL; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + sp30 = NULL; + Actor_ProcessInitChain(&this->dyna.actor, D_8088CD68); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); - for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; + CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &sp30); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); + Collider_InitJntSph(play, &this->unk168); + Collider_SetJntSph(play, &this->unk168, &this->dyna.actor, &D_8088CD58, this->unk188); + for (i = 0; i < 6; i++) { + this->unk168.elements[i].dim.worldSphere.radius = this->unk168.elements[i].dim.modelSphere.radius; } - this->burnFrame = 0; - this->bendFrame = 0; + this->unk166 = 0; + this->unk164 = 0; } void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(play, &this->collider); + Collider_DestroyJntSph(play, &this->unk168); } void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { - BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; + s32 pad[4]; + f32 sp24; s32 i; - ColliderJntSphElement* element; - s32 pad; - f32 yawSine; - f32 yawCosine; - - this->burnFrame = (this->burnFrame + 1) % 8; + ColliderJntSphElement* temp_v0_2; + f32 temp_fv0; + BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; - if (this->bendFrame != 0) { - this->bendFrame--; + this->unk166 = (this->unk166 + 1) % 8; + if (this->unk164 != 0) { + this->unk164--; } - - if (this->bendFrame == 0) { - this->bendFrame = 3; + if (this->unk164 == 0) { + this->unk164 = 3; } - - this->dyna.actor.shape.rot.y += 0x180; // Approximately 2 Degrees per Frame - yawSine = Math_SinS(this->dyna.actor.shape.rot.y); - yawCosine = Math_CosS(this->dyna.actor.shape.rot.y); - - for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) { - element = &this->collider.elements[i]; - element->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + - (yawCosine * element->dim.modelSphere.center.x) + - (yawSine * element->dim.modelSphere.center.z); - element->dim.worldSphere.center.y = (s16)this->dyna.actor.home.pos.y + element->dim.modelSphere.center.y; - element->dim.worldSphere.center.z = this->dyna.actor.home.pos.z - - (yawSine * element->dim.modelSphere.center.x) + - (yawCosine * element->dim.modelSphere.center.z); + this->dyna.actor.shape.rot.y += 0x180; + sp24 = Math_SinS(this->dyna.actor.shape.rot.y); + temp_fv0 = Math_CosS(this->dyna.actor.shape.rot.y); + for (i = 0; i < 6; i++) { + temp_v0_2 = &this->unk168.elements[i]; + temp_v0_2->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + + (temp_fv0 * temp_v0_2->dim.modelSphere.center.x) + + (sp24 * temp_v0_2->dim.modelSphere.center.z); + temp_v0_2->dim.worldSphere.center.y = (s16)this->dyna.actor.home.pos.y + temp_v0_2->dim.modelSphere.center.y; + temp_v0_2->dim.worldSphere.center.z = this->dyna.actor.home.pos.z - + (sp24 * temp_v0_2->dim.modelSphere.center.x) + + (temp_fv0 * temp_v0_2->dim.modelSphere.center.z); } - - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); - Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_FIRE_PILLAR - SFX_FLAG); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk168.base); + Actor_PlaySfx_Flagged(&this->dyna.actor, 0x2033U); } -Gfx* BgHidanRsekizou_DrawFireball(PlayState* play, BgHidanRsekizou* this, s16 frame, MtxF* mf, s32 a, - Gfx* displayList) { - f32 coss; - f32 sins; - s32 temp; - f32 fVar6; - f32 tmpf7; - - temp = (((this->burnFrame + frame) % 8) * 7) * (1.0f / 7.0f); - gSPSegment(displayList++, 0x09, SEGMENTED_TO_VIRTUAL(sFireballsTexs[temp])); - - frame++; - fVar6 = (frame != 4) ? frame + ((3 - this->bendFrame) * (1.0f / 3.0f)) : frame; - - gDPSetPrimColor(displayList++, 0, 1, 255, 255, 0, 150); - gDPSetEnvColor(displayList++, 255, 0, 0, 255); - - if (a == 0) { - sins = -Math_SinS(this->dyna.actor.shape.rot.y - (frame * 1500)); - coss = -Math_CosS(this->dyna.actor.shape.rot.y - (frame * 1500)); +Gfx* func_8088C70C(GraphicsContext** arg0, BgHidanRsekizou* arg1, s16 arg2, MtxF* arg3, s32 arg4, Gfx* arg5) { + s32 i; + f32 sp58; + f32 temp_fv1; + f32 var_fa1; + f32 var_fa0; + + i = (s32)(((arg1->unk166 + arg2) % 8) * 7 * 0.14285715f); + gSPSegment(arg5++, 9, SEGMENTED_TO_VIRTUAL(sFireballsTexs[i])); + arg2 = arg2 + 1; + if (arg2 != 4) { + var_fa1 = arg2 + ((3 - arg1->unk164) * 0.33333334f); } else { - sins = Math_SinS(this->dyna.actor.shape.rot.y - (frame * 1500)); - coss = Math_CosS(this->dyna.actor.shape.rot.y - (frame * 1500)); + var_fa1 = arg2; } - - mf->xx = mf->yy = mf->zz = (0.7f * fVar6) + 0.5f; - tmpf7 = (((((0.7f * fVar6) + 0.5f) * 10.0f) * fVar6) + 20.0f); - - mf->xw = (tmpf7 * sins) + this->dyna.actor.world.pos.x; - mf->yw = (this->dyna.actor.world.pos.y + 30.0f) + ((7.0f / 10.0f) * fVar6); - mf->zw = (tmpf7 * coss) + this->dyna.actor.world.pos.z; - - gSPMatrix(displayList++, - Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(mf, "../z_bg_hidan_rsekizou.c", 543), - GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx))), + gDPSetPrimColor(arg5++, 0x00, 0x01, 255, 255, 0, 150); + gDPSetEnvColor(arg5++, 255, 0, 0, 255); + if (arg4 == 0) { + sp58 = -Math_SinS((s16)(arg1->dyna.actor.shape.rot.y - (arg2 * 0x5DC))); + var_fa0 = -Math_CosS((s16)(arg1->dyna.actor.shape.rot.y - (arg2 * 0x5DC))); + } else { + sp58 = Math_SinS((s16)(arg1->dyna.actor.shape.rot.y - (arg2 * 0x5DC))); + var_fa0 = Math_CosS((s16)(arg1->dyna.actor.shape.rot.y - (arg2 * 0x5DC))); + } + arg3->mf[0][0] = arg3->mf[1][1] = arg3->mf[2][2] = (0.7f * var_fa1) + 0.5f; + temp_fv1 = (((0.7f * var_fa1) + 0.5f) * 10.0f * var_fa1) + 20.0f; + arg3->mf[3][0] = (temp_fv1 * sp58) + arg1->dyna.actor.world.pos.x; + arg3->mf[3][1] = arg1->dyna.actor.world.pos.y + 30.0f + (0.70f * var_fa1); + arg3->mf[3][2] = (temp_fv1 * var_fa0) + arg1->dyna.actor.world.pos.z; + gSPMatrix(arg5++, + Matrix_MtxFToMtx(MATRIX_CHECK_FLOATS(arg3, "../z_bg_hidan_rsekizou.c", 543), GRAPH_ALLOC(*arg0, 0x40U)), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - gSPDisplayList(displayList++, gFireTempleFireballDL); - - return displayList; + gSPDisplayList(arg5++, gFireTempleFireballDL); + return arg5; } void BgHidanRsekizou_Draw(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; - s32 i; s32 pad; - MtxF mf; + s32 var_s0; + MtxF sp5C; OPEN_DISPS(play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 564); - Gfx_SetupDL_25Opa(play->state.gfxCtx); - MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 568); gSPDisplayList(POLY_OPA_DISP++, gFireTempleSpinningFlamethrowerDL); - Matrix_MtxFCopy(&mf, &gIdentityMtxF); - + Matrix_MtxFCopy(&sp5C, &gIdentityMtxF); POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_20); - - if ((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0) { - for (i = 3; i >= 0; i--) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 0, POLY_XLU_DISP); + if ((s16)((Camera_GetCamDirYaw(play->cameraPtrs[play->activeCamId]) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= + 0) { + for (var_s0 = 3; var_s0 >= 0; var_s0--) { + POLY_XLU_DISP = func_8088C70C(&play->state.gfxCtx, this, var_s0, &sp5C, 0, POLY_XLU_DISP); } - - for (i = 0; i < 4; i++) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 1, POLY_XLU_DISP); + for (var_s0 = 0; var_s0 < 4; var_s0++) { + POLY_XLU_DISP = func_8088C70C(&play->state.gfxCtx, this, var_s0, &sp5C, 1, POLY_XLU_DISP); } } else { - for (i = 3; i >= 0; i--) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 1, POLY_XLU_DISP); + for (var_s0 = 3; var_s0 >= 0; var_s0--) { + POLY_XLU_DISP = func_8088C70C(&play->state.gfxCtx, this, var_s0, &sp5C, 1, POLY_XLU_DISP); } - - for (i = 0; i < 4; i++) { - POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(play, this, i, &mf, 0, POLY_XLU_DISP); + for (var_s0 = 0; var_s0 < 4; var_s0++) { + POLY_XLU_DISP = func_8088C70C(&play->state.gfxCtx, this, var_s0, &sp5C, 0, POLY_XLU_DISP); } } - CLOSE_DISPS(play->state.gfxCtx, "../z_bg_hidan_rsekizou.c", 600); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h index 7810d0f4111..a4cf85b08b3 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h @@ -7,11 +7,11 @@ struct BgHidanRsekizou; typedef struct BgHidanRsekizou { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ s16 bendFrame; - /* 0x0166 */ s16 burnFrame; - /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderElements[6]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ s16 unk164; + /* 0x166 */ s16 unk166; + /* 0x168 */ ColliderJntSph unk168; + /* 0x188 */ ColliderJntSphElement unk188[6]; } BgHidanRsekizou; // size = 0x0308 #endif diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c index a540872b96e..7c65d2c0845 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c @@ -1,6 +1,6 @@ /* * File: z_bg_hidan_syoku.c - * Overlay: ovl_Bg_Hidan_Syoku + * Overlay: Bg_Hidan_Syoku * Description: Stone Elevator in the Fire Temple */ @@ -40,8 +40,8 @@ static InitChainEntry sInitChain[] = { }; void BgHidanSyoku_Init(Actor* thisx, PlayState* play) { - s32 pad; BgHidanSyoku* this = (BgHidanSyoku*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -59,24 +59,24 @@ void BgHidanSyoku_Destroy(Actor* thisx, PlayState* play) { } void func_8088F47C(BgHidanSyoku* this) { - this->timer = 60; + this->unk_16A = 0x3C; Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); this->actionFunc = func_8088F62C; } void func_8088F4B8(BgHidanSyoku* this, PlayState* play) { if (Flags_GetClear(play, this->dyna.actor.room) && DynaPolyActor_IsPlayerOnTop(&this->dyna)) { - this->timer = 140; + this->unk_16A = 0x8C; this->actionFunc = func_8088F514; } } void func_8088F514(BgHidanSyoku* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - this->dyna.actor.world.pos.y = (cosf(this->timer * (M_PI / 140)) * 540.0f) + this->dyna.actor.home.pos.y; - if (this->timer == 0) { + this->dyna.actor.world.pos.y = (cosf(this->unk_16A * (M_PI / 140)) * 540.0f) + this->dyna.actor.home.pos.y; + if (this->unk_16A == 0) { func_8088F47C(this); } else { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); @@ -84,11 +84,11 @@ void func_8088F514(BgHidanSyoku* this, PlayState* play) { } void func_8088F5A0(BgHidanSyoku* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->timer * (M_PI / 140)) * 540.0f); - if (this->timer == 0) { + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - (cosf(this->unk_16A * (M_PI / 140)) * 540.0f); + if (this->unk_16A == 0) { func_8088F47C(this); } else { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_ELEVATOR_MOVE3 - SFX_FLAG); @@ -96,11 +96,11 @@ void func_8088F5A0(BgHidanSyoku* this, PlayState* play) { } void func_8088F62C(BgHidanSyoku* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; + if (this->unk_16A != 0) { + this->unk_16A -= 1; } - if (this->timer == 0) { - this->timer = 140; + if (this->unk_16A == 0) { + this->unk_16A = 0x8c; if (this->dyna.actor.world.pos.y < this->dyna.actor.home.pos.y) { this->actionFunc = func_8088F514; } else { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h index 6b169810c86..19411b379ee 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h @@ -12,7 +12,7 @@ typedef struct BgHidanSyoku { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHidanSyokuActionFunc actionFunc; /* 0x0168 */ s16 unk_168; - /* 0x016A */ s16 timer; + /* 0x016A */ s16 unk_16A; } BgHidanSyoku; // size = 0x016C -#endif +#endif; diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index 5ba57a0a375..b9d15620588 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -23,32 +23,17 @@ void BgIceTurara_Destroy(Actor* thisx, PlayState* play); void BgIceTurara_Update(Actor* thisx, PlayState* play); void BgIceTurara_Draw(Actor* thisx, PlayState* play); -void BgIceTurara_Stalagmite(BgIceTurara* this, PlayState* play); -void BgIceTurara_Wait(BgIceTurara* this, PlayState* play); -void BgIceTurara_Shiver(BgIceTurara* this, PlayState* play); -void BgIceTurara_Fall(BgIceTurara* this, PlayState* play); -void BgIceTurara_Regrow(BgIceTurara* this, PlayState* play); - -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_NONE, - AT_ON | AT_TYPE_ENEMY, - AC_ON | AC_TYPE_PLAYER, - OC1_NONE, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x04 }, - { 0x4FC007CA, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NORMAL, - ACELEM_ON, - OCELEM_NONE, - }, - { 13, 120, 0, { 0, 0, 0 } }, +void func_80892220(BgIceTurara*, PlayState*); +void func_80892280(BgIceTurara*, PlayState*); +void func_808922B8(BgIceTurara*, PlayState*); +void func_80892424(BgIceTurara*, PlayState*); +void func_80892574(BgIceTurara*, PlayState*); + +static ColliderCylinderInit D_80892620 = { + { 0xA, 0x11, 9, 0, 0x20, 1 }, + { 0, { 0xFFCFFFFF, 0, 4 }, { 0x4FC007CA, 0, 0 }, 1, 1, 0 }, + { 0xD, 0x78, 0, { 0, 0, 0 } }, }; - ActorProfile Bg_Ice_Turara_Profile = { /**/ ACTOR_BG_ICE_TURARA, /**/ ACTORCAT_PROP, @@ -60,32 +45,35 @@ ActorProfile Bg_Ice_Turara_Profile = { /**/ BgIceTurara_Update, /**/ BgIceTurara_Draw, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_8089266C[] = { ICHAIN_F32(cullingVolumeScale, 600, ICHAIN_CONTINUE), ICHAIN_F32(gravity, -3, ICHAIN_CONTINUE), ICHAIN_F32(minVelocityY, -30, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; +static Vec3f D_8089267C = { 0.0f, -1.0f, 0.0f }; +static Color_RGBA8 D_80892688 = { 0xAA, 0xFF, 0xFF, 0xFF }; +static Color_RGBA8 D_8089268C = { 0, 0x32, 0x64, 0xFF }; void BgIceTurara_Init(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; s32 pad; - CollisionHeader* colHeader = NULL; + CollisionHeader* sp24; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + sp24 = NULL; + Actor_ProcessInitChain(&this->dyna.actor, D_8089266C); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &colHeader); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); - Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - if (this->dyna.actor.params == TURARA_STALAGMITE) { - this->actionFunc = BgIceTurara_Stalagmite; + CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &sp24); + Collider_InitCylinder(play, &this->unk16C); + Collider_SetCylinder(play, &this->unk16C, &this->dyna.actor, &D_80892620); + Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp24); + if (this->dyna.actor.params == 0) { + this->unk164 = func_80892220; } else { this->dyna.actor.shape.rot.x = -0x8000; this->dyna.actor.shape.yOffset = 1200.0f; - this->actionFunc = BgIceTurara_Wait; + this->unk164 = func_80892280; } } @@ -93,107 +81,111 @@ void BgIceTurara_Destroy(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk16C); } -void BgIceTurara_Break(BgIceTurara* this, PlayState* play, f32 arg2) { - static Vec3f accel = { 0.0f, -1.0f, 0.0f }; - static Color_RGBA8 primColor = { 170, 255, 255, 255 }; - static Color_RGBA8 envColor = { 0, 50, 100, 255 }; - Vec3f vel; - Vec3f pos; - s32 j; - s32 i; +void func_80892040(BgIceTurara* this, PlayState* play, f32 arg2) { + Vec3f sp9C; + Vec3f sp90; + s32 var_s0; + s32 sp88; SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_ICE_BROKEN); - for (i = 0; i < 2; i++) { - for (j = 0; j < 10; j++) { - pos.x = this->dyna.actor.world.pos.x + Rand_CenteredFloat(8.0f); - pos.y = this->dyna.actor.world.pos.y + (Rand_ZeroOne() * arg2) + (i * arg2); - pos.z = this->dyna.actor.world.pos.z + Rand_CenteredFloat(8.0f); - - vel.x = Rand_CenteredFloat(7.0f); - vel.z = Rand_CenteredFloat(7.0f); - vel.y = (Rand_ZeroOne() * 4.0f) + 8.0f; - - EffectSsEnIce_Spawn(play, &pos, (Rand_ZeroOne() * 0.2f) + 0.1f, &vel, &accel, &primColor, &envColor, 30); + sp88 = 0; + do { + for (var_s0 = 0; var_s0 < 10; var_s0++) { + sp90.x = Rand_CenteredFloat(8.0f) + this->dyna.actor.world.pos.x; + sp90.y = (Rand_ZeroOne() * arg2) + this->dyna.actor.world.pos.y + (sp88 * arg2); + sp90.z = Rand_CenteredFloat(8.0f) + this->dyna.actor.world.pos.z; + sp9C.x = Rand_CenteredFloat(7.0f); + sp9C.z = Rand_CenteredFloat(7.0f); + sp9C.y = (Rand_ZeroOne() * 4.0f) + 8.0f; + EffectSsEnIce_Spawn(play, &sp90, (Rand_ZeroOne() * 0.2f) + 0.1f, &sp9C, &D_8089267C, &D_80892688, + &D_8089268C, 30); } - } + sp88 = sp88 + 1; + } while (sp88 != 2); } -void BgIceTurara_Stalagmite(BgIceTurara* this, PlayState* play) { - if (this->collider.base.acFlags & AC_HIT) { - BgIceTurara_Break(this, play, 50.0f); +void func_80892220(BgIceTurara* this, PlayState* play) { + if (this->unk16C.base.acFlags & AC_HIT) { + func_80892040(this, play, 50.0f); Actor_Kill(&this->dyna.actor); - return; + } else { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk16C.base); } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void BgIceTurara_Wait(BgIceTurara* this, PlayState* play) { +void func_80892280(BgIceTurara* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 60.0f) { - this->shiverTimer = 10; - this->actionFunc = BgIceTurara_Shiver; + this->unk168 = 0xA; + this->unk164 = func_808922B8; } } -void BgIceTurara_Shiver(BgIceTurara* this, PlayState* play) { - s16 phi_v0_3; - s16 phi_v0_2; +void func_808922B8(BgIceTurara* this, PlayState* play) { + s32 var_v0_2; f32 sp28; - if (this->shiverTimer != 0) { - this->shiverTimer--; + if (this->unk168 != 0) { + this->unk168 -= 1; } - if (!(this->shiverTimer % 4)) { + if (!(this->unk168 % 4)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_ICE_SWING); } - if (this->shiverTimer == 0) { + if (this->unk168 == 0) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; - Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk16C.base); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); - this->actionFunc = BgIceTurara_Fall; + this->unk164 = func_80892424; } else { sp28 = Rand_ZeroOne(); - phi_v0_2 = (Rand_ZeroOne() < 0.5f ? -1 : 1); - this->dyna.actor.world.pos.x = (phi_v0_2 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.home.pos.x; + if (Rand_ZeroOne() < 0.5f) { + var_v0_2 = -1; + } else { + var_v0_2 = 1; + } + this->dyna.actor.world.pos.x = (var_v0_2 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.home.pos.x; sp28 = Rand_ZeroOne(); - phi_v0_3 = (Rand_ZeroOne() < 0.5f ? -1 : 1); - this->dyna.actor.world.pos.z = (phi_v0_3 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.home.pos.z; + if (Rand_ZeroOne() < 0.5f) { + var_v0_2 = -1; + } else { + var_v0_2 = 1; + } + this->dyna.actor.world.pos.z = (var_v0_2 * ((0.5f * sp28) + 0.5f)) + this->dyna.actor.home.pos.z; } } -void BgIceTurara_Fall(BgIceTurara* this, PlayState* play) { - if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->collider.base.atFlags &= ~AT_HIT; +void func_80892424(BgIceTurara* this, PlayState* play) { + if ((this->unk16C.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + this->unk16C.base.atFlags &= ~AT_HIT; this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; if (this->dyna.actor.world.pos.y < this->dyna.actor.floorHeight) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } - BgIceTurara_Break(this, play, 40.0f); - if (this->dyna.actor.params == TURARA_STALACTITE_REGROW) { + func_80892040(this, play, 40.0f); + if (this->dyna.actor.params == 2) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 120.0f; DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); - this->actionFunc = BgIceTurara_Regrow; + this->unk164 = func_80892574; } else { Actor_Kill(&this->dyna.actor); - return; } } else { Actor_MoveXZGravity(&this->dyna.actor); this->dyna.actor.world.pos.y += 40.0f; Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->dyna.actor.world.pos.y -= 40.0f; - Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk16C.base); } } -void BgIceTurara_Regrow(BgIceTurara* this, PlayState* play) { +void func_80892574(BgIceTurara* this, PlayState* play) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f)) { - this->actionFunc = BgIceTurara_Wait; + this->unk164 = func_80892280; this->dyna.actor.velocity.y = 0.0f; } } @@ -201,9 +193,11 @@ void BgIceTurara_Regrow(BgIceTurara* this, PlayState* play) { void BgIceTurara_Update(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; - this->actionFunc(this, play); + this->unk164(this, play); } void BgIceTurara_Draw(Actor* thisx, PlayState* play) { + BgIceTurara* this = (BgIceTurara*)thisx; + Gfx_DrawDListOpa(play, object_ice_objects_DL_0023D0); } 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 c8779247cbc..218d4a8ed1e 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,17 +8,12 @@ struct BgIceTurara; typedef void (*BgIceTuraraActionFunc)(struct BgIceTurara*, struct PlayState*); -typedef enum BgIceTuraraType { - /* 0 */ TURARA_STALAGMITE, - /* 1 */ TURARA_STALACTITE, - /* 2 */ TURARA_STALACTITE_REGROW -} BgIceTuraraType; - typedef struct BgIceTurara { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ BgIceTuraraActionFunc actionFunc; - /* 0x0168 */ s16 shiverTimer; - /* 0x016C */ ColliderCylinder collider; + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ BgIceTuraraActionFunc unk164; + /* 0x168 */ s16 unk168; + /* 0x16A */ char pad16A[2]; + /* 0x16C */ ColliderCylinder unk16C; } BgIceTurara; // size = 0x01B8 #endif 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 a7427fcab34..e666fc9e7ce 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 @@ -32,7 +32,7 @@ void BgJya1flift_SetupDoNothing(BgJya1flift* this); void BgJya1flift_ResetMoveDelay(BgJya1flift* this); void BgJya1flift_DelayMove(BgJya1flift* this, PlayState* play); -static u8 sIsSpawned = false; +static u8 sHasSpawned = false; ActorProfile Bg_Jya_1flift_Profile = { /**/ ACTOR_BG_JYA_1FLIFT, @@ -104,10 +104,10 @@ void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; - PRINTF(T("(1Fリフト)(flag %d)(room %d)\n", "(1F lift)(flag %d)(room %d)\n"), sIsSpawned, - play->roomCtx.curRoom.num); + + PRINTF(T("(1Fリフト)(flag %d)(room %d)\n", "(1F lift)(flag %d)(room %d)\n"), sHasSpawned, play->roomCtx.curRoom.num); this->hasInitialized = false; - if (sIsSpawned) { + if (sHasSpawned) { Actor_Kill(thisx); return; } @@ -120,7 +120,7 @@ void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift_SetupWaitForSwitch(this); } thisx->room = -1; - sIsSpawned = true; + sHasSpawned = true; this->hasInitialized = true; } @@ -128,7 +128,7 @@ void BgJya1flift_Destroy(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; if (this->hasInitialized) { - sIsSpawned = false; + sHasSpawned = false; Collider_DestroyCylinder(play, &this->collider); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } 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 feb7cba7b72..1740a3bad9d 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_jya_bigmirror.c - * Overlay: ovl_Bg_Jya_Bigmirror - * Description: Ceiling mirror and puzzle in Spirit Temple top rooms - */ - #include "z_bg_jya_bigmirror.h" #include "overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h" @@ -23,7 +17,13 @@ void BgJyaBigmirror_Destroy(Actor* thisx, PlayState* play); void BgJyaBigmirror_Update(Actor* thisx, PlayState* play); void BgJyaBigmirror_Draw(Actor* thisx, PlayState* play); -static u8 sIsSpawned = false; +void func_808936E0(BgJyaBigmirror* this, PlayState* play); +void func_80893750(BgJyaBigmirror* this2, PlayState* play); +void func_8089394C(BgJyaBigmirror* this, PlayState* play); +void func_8089399C(BgJyaBigmirror* this2, PlayState* play); +void func_80893C68(BgJyaBigmirror* this, PlayState* play); + +static u8 D_80893ED0 = 0; ActorProfile Bg_Jya_Bigmirror_Profile = { /**/ ACTOR_BG_JYA_BIGMIRROR, @@ -37,142 +37,131 @@ ActorProfile Bg_Jya_Bigmirror_Profile = { /**/ BgJyaBigmirror_Draw, }; -typedef struct BigMirrorDataEntry { - /* 0x00 */ Vec3f pos; - /* 0x0C */ s16 params; - /* 0x0E */ s16 solvedRotY; - /* 0x10 */ s16 initRotY; -} BigMirrorDataEntry; // size = 0x14 - -static BigMirrorDataEntry sCobraSpawnData[] = { - { { -560.0f, 1743.0f, -310.0f }, 0xFF01, 0x4000, 0x8000 }, - { { 60.0f, 1743.0f, -310.0f }, 0xFF02, 0x8000, 0xA000 }, +typedef struct struct_80893EF4 { + /* 0x00 */ Vec3f unk0; + /* 0x0C */ s16 unkC; + /* 0x0E */ s16 unkE; + /* 0x10 */ s16 unk10; + /* 0x12 */ char pad12[2]; +} struct_80893EF4; +static struct_80893EF4 D_80893EF4[2] = { + { { -560.0f, 1743.0f, -310.0f }, -0xFF, 0x4000, 0x8000 }, + { { 60.0f, 1743.0f, -310.0f }, -0xFE, 0x8000, 0xA000 }, }; +static u8 D_80893F1C[4] = { 1, 2, 0, 0 }; +static s16 D_80893F20[4] = { 5, 7, 8, 0 }; +static Vec3f D_80893F28[3] = { + { 60.0f, 1802.0f, -1102.0f }, + { -560.0f, 1800.0f, -310.0f }, + { 60.0f, 1800.0f, -310.0f }, +}; +static Vec3s D_80893F4C = { 0, 0, 0 }; -void BgJyaBigmirror_SetRoomFlag(Actor* thisx, PlayState* play) { - BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - - this->puzzleFlags &= - ~(BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); +void func_808936E0(BgJyaBigmirror* this, PlayState* play) { + this->unk15C &= ~0x38; if (play->roomCtx.curRoom.num == 5) { - this->puzzleFlags |= BIGMIR_PUZZLE_IN_STATUE_ROOM; + this->unk15C |= 8; } else if (play->roomCtx.curRoom.num == 0x19) { - this->puzzleFlags |= BIGMIR_PUZZLE_IN_1ST_TOP_ROOM; + this->unk15C |= 0x10; } else if (play->roomCtx.curRoom.num == 0x1A) { - this->puzzleFlags |= BIGMIR_PUZZLE_IN_2ND_TOP_ROOM; + this->unk15C |= 0x20; } } -void BgJyaBigmirror_HandleCobra(Actor* thisx, PlayState* play) { - static u8 cobraPuzzleFlags[] = { BIGMIR_PUZZLE_COBRA1_SOLVED, BIGMIR_PUZZLE_COBRA2_SOLVED }; - BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - BigMirrorDataEntry* curSpawnData; - BigmirrorCobra* curCobraInfo; +void func_80893750(BgJyaBigmirror* this2, PlayState* play) { s32 i; + BgJyaBigmirror_sub14C* new_var; + struct_80893EF4* new_var2; + BgJyaBigmirror* this = this2; - if (this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM)) { + if (this->unk15C & 0x30) { for (i = 0; i < 2; i++) { - curSpawnData = &sCobraSpawnData[i]; - curCobraInfo = &this->cobraInfo[i]; - if (curCobraInfo->cobra != NULL) { - curCobraInfo->rotY = curCobraInfo->cobra->dyna.actor.shape.rot.y; - - if (curCobraInfo->rotY == curSpawnData->solvedRotY) { - this->puzzleFlags |= cobraPuzzleFlags[i]; + new_var2 = &D_80893EF4[i]; + new_var = &this->unk14C[i]; + if (new_var->unk0 != NULL) { + new_var->unk4 = new_var->unk0->shape.rot.y; + if (new_var->unk4 == new_var2->unkE) { + this->unk15C |= D_80893F1C[i]; } else { - this->puzzleFlags &= ~cobraPuzzleFlags[i]; + this->unk15C &= ~D_80893F1C[i]; } - #if DEBUG_FEATURES - if (curCobraInfo->cobra->dyna.actor.update == NULL) { - PRINTF(T("Error : コブラ削除された (%s %d)\n", "Error : Cobra deleted (%s %d)\n"), - "../z_bg_jya_bigmirror.c", 203); + if (new_var->unk0->update == NULL) { + PRINTF("Error : コブラ削除された (%s %d)\n", "../z_bg_jya_bigmirror.c", 203); } #endif } else { - curCobraInfo->cobra = (BgJyaCobra*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, curSpawnData->pos.x, curSpawnData->pos.y, - curSpawnData->pos.z, 0, curCobraInfo->rotY, 0, curSpawnData->params); + new_var->unk0 = + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_BG_JYA_COBRA, new_var2->unk0.x, + new_var2->unk0.y, new_var2->unk0.z, 0, new_var->unk4, 0, new_var2->unkC); this->actor.child = NULL; - - if (curCobraInfo->cobra == NULL) { - PRINTF(T("Error : コブラ発生失敗 (%s %d)\n", "Error : Cobra failed to spawn (%s %d)\n"), - "../z_bg_jya_bigmirror.c", 221); + if (new_var->unk0 == NULL) { + PRINTF("Error : コブラ発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 221); } } } } else { - for (i = 0; i < 2; i++) { - curCobraInfo = &this->cobraInfo[i]; - if (curCobraInfo->cobra != NULL) { - if (curCobraInfo->cobra->dyna.actor.child != NULL) { - Actor_Kill(curCobraInfo->cobra->dyna.actor.child); - curCobraInfo->cobra->dyna.actor.child = NULL; + new_var = &this->unk14C[i]; + if (new_var->unk0 != NULL) { + if (new_var->unk0->child != NULL) { + Actor_Kill(new_var->unk0->child); + new_var->unk0->child = NULL; } - Actor_Kill(&curCobraInfo->cobra->dyna.actor); - curCobraInfo->cobra = NULL; + Actor_Kill(new_var->unk0); + new_var->unk0 = NULL; } } } } -void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, PlayState* play) { - BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - +void func_8089394C(BgJyaBigmirror* this, PlayState* play) { if (Flags_GetSwitch(play, 0x29)) { - this->puzzleFlags |= BIGMIR_PUZZLE_BOMBIWA_DESTROYED; + this->unk15C |= 4; } else { - this->puzzleFlags &= ~(BIGMIR_PUZZLE_BOMBIWA_DESTROYED); + this->unk15C &= ~4; } } -void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { - static s16 sMirRayParamsVals[] = { 0x0005, 0x0007, 0x0008 }; - static Vec3f sMirRayPositions[] = { - { 60.0f, 1802.0f, -1102.0f }, - { -560.0f, 1800.0f, -310.0f }, - { 60.0f, 1800.0f, -310.0f }, - }; - BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - s32 puzzleSolved; - s32 lightBeamToggles[3]; - s32 i; +void func_8089399C(BgJyaBigmirror* this2, PlayState* play) { + s32 var_s1; + s32 var_v0; + s32 sp74[3]; + BgJyaBigmirror* this = this2; s32 mirRayObjectSlot; mirRayObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MIR_RAY); - - if ((mirRayObjectSlot < 0) || (mirRayObjectSlot != this->mirRayObjectSlot)) { - this->lightBeams[2] = NULL; - this->lightBeams[1] = NULL; - this->lightBeams[0] = NULL; + if ((mirRayObjectSlot < 0) || ((mirRayObjectSlot != this->mirRayObjectSlot))) { + this->unk160[2] = NULL; + this->unk160[1] = NULL; + this->unk160[0] = NULL; } else { - // Only spawn if puzzle solved - lightBeamToggles[0] = (this->puzzleFlags & (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM)) && - (this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) && - (this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED); - lightBeamToggles[1] = lightBeamToggles[2] = - this->puzzleFlags & (BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM); - - for (i = 0; i < 3; i++) { - if (lightBeamToggles[i]) { - if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, mirRayObjectSlot)) { - - this->lightBeams[i] = - Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y, - sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]); - + var_v0 = (this->unk15C & 0x18) != 0; + if (var_v0 != 0) { + var_v0 = (this->unk15C & 2) != 0; + if (var_v0 != 0) { + var_v0 = (this->unk15C & 1) != 0; + } + } + sp74[0] = var_v0; + sp74[1] = sp74[2] = var_v0 = this->unk15C & 0x30; + + for (var_s1 = 0; var_s1 < 3; var_s1++) { + if (sp74[var_s1] != 0) { + if ((this->unk160[var_s1] == NULL) && (Object_IsLoaded(&play->objectCtx, mirRayObjectSlot) != 0)) { + this->unk160[var_s1] = + Actor_Spawn(&play->actorCtx, play, 0xB7, D_80893F28[var_s1].x, D_80893F28[var_s1].y, + D_80893F28[var_s1].z, 0, 0, 0, D_80893F20[var_s1]); #if DEBUG_FEATURES - if (this->lightBeams[i] == NULL) { - PRINTF(T("Error : Mir Ray 発生失敗 (%s %d)\n", "Error : Mir Ray failed to spawn (%s %d)\n"), - "../z_bg_jya_bigmirror.c", 310); + if (this->unk160[var_s1] == NULL) { + PRINTF("Error : Mir Ray 発生失敗 (%s %d)\n", "../z_bg_jya_bigmirror.c", 310); } #endif } } else { - if (this->lightBeams[i] != NULL) { - Actor_Kill(this->lightBeams[i]); - this->lightBeams[i] = NULL; + if (this->unk160[var_s1] != NULL) { + Actor_Kill(this->unk160[var_s1]); + this->unk160[var_s1] = NULL; } } } @@ -183,75 +172,69 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) { void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - if (sIsSpawned) { + if (D_80893ED0 != 0) { Actor_Kill(&this->actor); return; } - Actor_SetScale(&this->actor, 0.1f); - this->cobraInfo[0].rotY = sCobraSpawnData[0].initRotY; - this->cobraInfo[1].rotY = sCobraSpawnData[1].initRotY; + this->unk14C[0].unk4 = D_80893EF4[0].unk10; + this->unk14C[1].unk4 = D_80893EF4[1].unk10; this->actor.room = -1; - sIsSpawned = true; - this->spawned = true; + D_80893ED0 = 1; + this->unk15D = 1; this->mirRayObjectSlot = -1; - - PRINTF(T("(jya 大鏡)(arg_data 0x%04x)\n", "(jya Big mirror)(arg_data 0x%04x)\n"), this->actor.params); + PRINTF("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params); } void BgJyaBigmirror_Destroy(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - if (this->spawned) { - sIsSpawned = false; + if (this->unk15D != 0) { + D_80893ED0 = 0; } } void BgJyaBigmirror_Update(Actor* thisx, PlayState* play) { - BgJyaBigmirror_SetRoomFlag(thisx, play); - BgJyaBigmirror_HandleCobra(thisx, play); - BgJyaBigmirror_SetBombiwaFlag(thisx, play); - BgJyaBigmirror_HandleMirRay(thisx, play); + BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; + + func_808936E0(this, play); + func_80893750(this, play); + func_8089394C(this, play); + func_8089399C(this, play); } -void BgJyaBigmirror_DrawLightBeam(Actor* thisx, PlayState* play) { - static Vec3s D_80893F4C = { 0, 0, 0 }; - BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - Actor* lift; +void func_80893C68(BgJyaBigmirror* this, PlayState* play) { + s32 pad; + Actor* temp_v0; OPEN_DISPS(play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 435); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - lift = Actor_Find(&play->actorCtx, ACTOR_BG_JYA_LIFT, ACTORCAT_BG); - if (lift != NULL) { - this->liftHeight = lift->world.pos.y; + temp_v0 = Actor_Find(&play->actorCtx, ACTOR_BG_JYA_LIFT, ACTORCAT_BG); + if (temp_v0 != NULL) { + this->unk170 = temp_v0->world.pos.y; } Matrix_SetTranslateRotateYXZ(this->actor.world.pos.x, this->actor.world.pos.y + 40.0f, this->actor.world.pos.z, &this->actor.shape.rot); - Matrix_Scale(0.1f, (this->liftHeight * -(1.0f / 1280.0f)) + (1779.4f / 1280.0f), 0.1f, MTXMODE_APPLY); + Matrix_Scale(0.1f, (this->unk170 * -0.00078125f) + 1.3901563f, 0.1f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 457); gSPDisplayList(POLY_XLU_DISP++, gBigMirror1DL); - - if (lift != NULL) { - Matrix_SetTranslateRotateYXZ(lift->world.pos.x, lift->world.pos.y, lift->world.pos.z, &D_80893F4C); + if (temp_v0 != NULL) { + Matrix_SetTranslateRotateYXZ(temp_v0->world.pos.x, temp_v0->world.pos.y, temp_v0->world.pos.z, &D_80893F4C); Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 467); gSPDisplayList(POLY_XLU_DISP++, gBigMirror2DL); } - CLOSE_DISPS(play->state.gfxCtx, "../z_bg_jya_bigmirror.c", 476); } void BgJyaBigmirror_Draw(Actor* thisx, PlayState* play) { BgJyaBigmirror* this = (BgJyaBigmirror*)thisx; - if (this->puzzleFlags & BIGMIR_PUZZLE_IN_1ST_TOP_ROOM) { + if (this->unk15C & 0x10) { Gfx_DrawDListOpa(play, gBigMirror3DL); Gfx_DrawDListXlu(play, gBigMirror4DL); } - - if ((this->puzzleFlags & - (BIGMIR_PUZZLE_IN_STATUE_ROOM | BIGMIR_PUZZLE_IN_1ST_TOP_ROOM | BIGMIR_PUZZLE_IN_2ND_TOP_ROOM)) && - (this->puzzleFlags & BIGMIR_PUZZLE_COBRA2_SOLVED) && (this->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED)) { - BgJyaBigmirror_DrawLightBeam(&this->actor, play); + if ((this->unk15C & 0x38) && (this->unk15C & 2) && (this->unk15C & 1)) { + func_80893C68(this, play); } } 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 15bc7f83e4c..437c627980d 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 @@ -4,28 +4,22 @@ #include "ultra64.h" #include "actor.h" -#define BIGMIR_PUZZLE_COBRA1_SOLVED (1 << 0) -#define BIGMIR_PUZZLE_COBRA2_SOLVED (1 << 1) -#define BIGMIR_PUZZLE_BOMBIWA_DESTROYED (1 << 2) -#define BIGMIR_PUZZLE_IN_STATUE_ROOM (1 << 3) -#define BIGMIR_PUZZLE_IN_1ST_TOP_ROOM (1 << 4) -#define BIGMIR_PUZZLE_IN_2ND_TOP_ROOM (1 << 5) - struct BgJyaBigmirror; -typedef struct BigmirrorCobra { - /* 0x00 */ struct BgJyaCobra* cobra; - /* 0x04 */ s16 rotY; -} BigmirrorCobra; // size = 0x08 +typedef struct BgJyaBigmirror_sub14C { + Actor* unk0; + s16 unk4; +} BgJyaBigmirror_sub14C; typedef struct BgJyaBigmirror { - /* 0x0000 */ Actor actor; - /* 0x014C */ BigmirrorCobra cobraInfo[2]; - /* 0x015C */ u8 puzzleFlags; - /* 0x015D */ u8 spawned; - /* 0x0160 */ Actor* lightBeams[3]; - /* 0x016C */ s32 mirRayObjectSlot; - /* 0x0170 */ f32 liftHeight; -} BgJyaBigmirror; // size = 0x0174 + /* 0x000 */ Actor actor; + /* 0x14C */ BgJyaBigmirror_sub14C unk14C[2]; + /* 0x15C */ u8 unk15C; + /* 0x15D */ u8 unk15D; + /* 0x15E */ char pad15E[2]; /* maybe part of unk15D[3]? */ + /* 0x160 */ Actor* unk160[3]; + /* 0x16C */ s32 mirRayObjectSlot; + /* 0x170 */ f32 unk170; +} BgJyaBigmirror; // size = 0x174 #endif 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 32fe055262f..39b74a70558 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 @@ -91,14 +91,14 @@ void BgJyaBombchuiwa_SetDrawFlags(BgJyaBombchuiwa* this, u8 drawFlags) { void BgJyaBombchuiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombchuiwa* this = (BgJyaBombchuiwa*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); BgJyaBombchuiwa_SetupCollider(this, play); - if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 0, 6))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { BgJyaBombchuiwa_SpawnLightRay(this, play); } else { BgJyaBombchuiwa_SetupWaitForExplosion(this, play); } - Actor_SetFocus(&this->actor, 0.0f); + Actor_SetFocus(thisx, 0.0f); } void BgJyaBombchuiwa_Destroy(Actor* thisx, PlayState* play2) { 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 2f40d2a17a9..2846d6f1b05 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_jya_bombiwa.c - * Overlay: ovl_Bg_Jya_Bombiwa - * Description: Spirit Temple top room bombable wall - */ - #include "z_bg_jya_bombiwa.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" @@ -92,31 +86,31 @@ void BgJyaBombiwa_SetupDynaPoly(BgJyaBombiwa* this, PlayState* play, CollisionHe } void BgJyaBombiwa_InitCollider(BgJyaBombiwa* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->dyna.actor; Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); + Collider_SetJntSph(play, &this->collider, thisx, &sJntSphInit, &this->colliderElements); } void BgJyaBombiwa_Init(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - if (PARAMS_GET_U(this->dyna.actor.params, 0, 6) != 0x29) { + if (PARAMS_GET_U(thisx->params, 0, 6) != 0x29) { PRINTF_COLOR_WARNING(); PRINTF(T("Warning : Switch Number が変更された(%s %d)(SW %d)\n", "Warning : Switch Number has been changed (%s %d)(SW %d)\n"), - "../z_bg_jya_bombiwa.c", 218, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); + "../z_bg_jya_bombiwa.c", 218, PARAMS_GET_U(thisx->params, 0, 6)); PRINTF_RST(); } BgJyaBombiwa_SetupDynaPoly(this, play, &gBombiwaCol, 0); BgJyaBombiwa_InitCollider(this, play); - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { - Actor_Kill(&this->dyna.actor); + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { + Actor_Kill(thisx); } else { - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); PRINTF(T("(jya 爆弾で破壊岩)(arg_data 0x%04x)\n", "(jya bomb destroys rocks)(arg_data 0x%04x)\n"), - this->dyna.actor.params); + thisx->params); } } diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h index 8888d372d66..c1d564eea90 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h +++ b/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.h @@ -10,7 +10,7 @@ typedef struct BgJyaBombiwa { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ s32 unk_164; /* 0x0168 */ ColliderJntSph collider; - /* 0x0188 */ ColliderJntSphElement colliderElements[1]; + /* 0x0188 */ ColliderJntSphElement colliderElements; } BgJyaBombiwa; // size = 0x01C8 #endif 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 81fe1e598f6..a2cd32632ae 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 @@ -183,13 +183,13 @@ void func_80895A70(BgJyaCobra* this) { } break; case 1: - mirRay = (MirRay*)mirror->lightBeams[1]; + mirRay = (MirRay*)mirror->unk160[1]; if (mirRay == NULL) { return; } break; case 2: - mirRay = (MirRay*)mirror->lightBeams[2]; + mirRay = (MirRay*)mirror->unk160[2]; if (mirRay == NULL) { return; } @@ -197,19 +197,19 @@ void func_80895A70(BgJyaCobra* this) { } if (this->unk_18C <= 0.0f) { - mirRay->unLit = 1; + mirRay->unk2AE = 1; } else { Vec3f sp28; - mirRay->unLit = 0; - Math_Vec3f_Copy(&mirRay->sourcePt, &this->unk_180); + mirRay->unk2AE = 0; + Math_Vec3f_Copy(&mirRay->coneFrustumCenterTop, &this->unk_180); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_NEW); 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; - Matrix_MultVec3f(&sp28, &mirRay->poolPt); - Math_Vec3f_Sum(&mirRay->sourcePt, &mirRay->poolPt, &mirRay->poolPt); + Matrix_MultVec3f(&sp28, &mirRay->coneFrustumCenterBase); + Math_Vec3f_Sum(&mirRay->coneFrustumCenterTop, &mirRay->coneFrustumCenterBase, &mirRay->coneFrustumCenterBase); } } @@ -230,9 +230,7 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) { BgJyaBigmirror* mirror = (BgJyaBigmirror*)this->dyna.actor.parent; f32 phi_f0; - if (PARAMS_GET_U(params, 0, 2) == 2 && mirror != NULL && - (!(mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED) || - !(mirror->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED))) { + if (PARAMS_GET_U(params, 0, 2) == 2 && mirror != NULL && (!(mirror->unk15C & 4) || !(mirror->unk15C & 1))) { Math_StepToF(&this->unk_18C, 0.0f, 0.05f); } else { this->unk_18C = 1.0f; @@ -261,8 +259,7 @@ void func_80895C74(BgJyaCobra* this, PlayState* play) { phi_f0 = 0.34f; } else { phi_v0 = this->dyna.actor.shape.rot.y - 0x4000; - if (phi_v0 < 0x500 && phi_v0 > -0x500 && mirror != NULL && - (mirror->puzzleFlags & BIGMIR_PUZZLE_BOMBIWA_DESTROYED)) { + if (phi_v0 < 0x500 && phi_v0 > -0x500 && mirror != NULL && (mirror->unk15C & 4)) { phi_f0 = 0.34f; } } @@ -289,7 +286,7 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { Vec3f spD4; Vec3f spC8; Vec3f spBC; - u8* shadowTex; + u8* temp_s2; s32 temp_x; s32 temp_z; s32 x; @@ -300,8 +297,8 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { s32 l; s16 rotY; - shadowTex = COBRA_SHADOW_TEX_PTR(this); - Lib_MemSet(shadowTex, COBRA_SHADOW_TEX_SIZE, 0); + temp_s2 = (u8*)ALIGN16((s32)(&this->shadowTexture)); + Lib_MemSet(temp_s2, 0x1000, 0); Matrix_RotateX((M_PI / 4), MTXMODE_NEW); rotY = !PARAMS_GET_U(this->dyna.actor.params, 0, 2) ? (this->dyna.actor.shape.rot.y + 0x4000) @@ -332,7 +329,7 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { if (temp_x & ~0x3F) { continue; } - shadowTex[temp_z + temp_x] |= D_8089731C[k][l]; + temp_s2[temp_z + temp_x] |= D_8089731C[k][l]; } } } @@ -361,20 +358,20 @@ void BgJyaCobra_UpdateShadowFromSide(BgJyaCobra* this) { if (temp_x & ~0x3F) { continue; } - shadowTex[temp_z + temp_x] |= D_80897398[k][l]; + temp_s2[temp_z + temp_x] |= D_80897398[k][l]; } } } } for (i = 0; i < 0x40; i++) { - shadowTex[0 * 0x40 + i] = 0; - shadowTex[0x3F * 0x40 + i] = 0; + temp_s2[0 * 0x40 + i] = 0; + temp_s2[0x3F * 0x40 + i] = 0; } for (j = 1; j < 0x3F; j++) { - shadowTex[j * 0x40 + 0] = 0; - shadowTex[j * 0x40 + 0x3F] = 0; + temp_s2[j * 0x40 + 0] = 0; + temp_s2[j * 0x40 + 0x3F] = 0; } } @@ -387,15 +384,15 @@ void BgJyaCobra_UpdateShadowFromTop(BgJyaCobra* this) { s32 j; s32 i_copy; s32 counter; - u8* shadowTex; + u8* temp_s0; u8* sp40; for (i = 0; i < 0x40; i++) { sp58[i] = SQ(i - 31.5f); } - sp40 = shadowTex = COBRA_SHADOW_TEX_PTR(this); - Lib_MemSet(shadowTex, COBRA_SHADOW_TEX_SIZE, 0); + sp40 = temp_s0 = (u8*)ALIGN16((u32)(&this->shadowTexture)); + Lib_MemSet(temp_s0, 0x1000, 0); for (i = 0; i != 0x40; i++) { f32 temp_f12 = sp58[i]; @@ -412,12 +409,12 @@ void BgJyaCobra_UpdateShadowFromTop(BgJyaCobra* this) { for (i_copy = 0x780, counter = 0; counter < 4; counter++, i_copy += 0x40) { i = i_copy; for (j = 4; j < 0x3C; j++) { - if (shadowTex[i_copy + j] < D_80897518[counter]) { - shadowTex[i_copy + j] = D_80897518[counter]; + if (temp_s0[i_copy + j] < D_80897518[counter]) { + temp_s0[i_copy + j] = D_80897518[counter]; } } - shadowTex[i + 0x3C] = 0x20; - shadowTex[i + 0x3] = 0x20; + temp_s0[i + 0x3C] = 0x20; + temp_s0[i + 0x3] = 0x20; } } @@ -447,7 +444,7 @@ void BgJyaCobra_Init(Actor* thisx, PlayState* play) { PRINTF(T("(jya コブラ)(arg_data 0x%04x)(act %x)(txt %x)(txt16 %x)\n", "(jya cobra)(arg_data 0x%04x)(act %x)(txt %x)(txt16 %x)\n"), - this->dyna.actor.params, this, &this->shadowTextureBuffer, COBRA_SHADOW_TEX_PTR(this)); + this->dyna.actor.params, this, &this->shadowTexture, ALIGN16((s32)(&this->shadowTexture))); } void BgJyaCobra_Destroy(Actor* thisx, PlayState* play) { @@ -615,9 +612,9 @@ void BgJyaCobra_DrawShadow(BgJyaCobra* this, PlayState* play) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 120); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_jya_cobra.c", 994); - gDPLoadTextureBlock(POLY_XLU_DISP++, COBRA_SHADOW_TEX_PTR(this), G_IM_FMT_I, G_IM_SIZ_8b, COBRA_SHADOW_TEX_WIDTH, - COBRA_SHADOW_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, - G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(POLY_XLU_DISP++, ALIGN16((s32)(&this->shadowTexture)), G_IM_FMT_I, G_IM_SIZ_8b, 0x40, 0x40, 0, + G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, + G_TX_NOLOD); gSPDisplayList(POLY_XLU_DISP++, sShadowDL); @@ -637,8 +634,7 @@ void BgJyaCobra_Draw(Actor* thisx, PlayState* play) { 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) && - (mirror->puzzleFlags & BIGMIR_PUZZLE_COBRA1_SOLVED)) { + if (mirror != NULL && (mirror->unk15C & 4) && (mirror->unk15C & 1)) { BgJyaCobra_DrawShadow(this, play); } } else { diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h index 9f2a9d9f362..a050987240f 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.h @@ -8,11 +8,6 @@ struct BgJyaCobra; typedef void (*BgJyaCobraActionFunc)(struct BgJyaCobra*, struct PlayState*); -#define COBRA_SHADOW_TEX_WIDTH 64 -#define COBRA_SHADOW_TEX_HEIGHT 64 -#define COBRA_SHADOW_TEX_SIZE (COBRA_SHADOW_TEX_WIDTH * COBRA_SHADOW_TEX_HEIGHT * G_IM_SIZ_8b_BYTES) -#define COBRA_SHADOW_TEX_PTR(this) (u8*)ALIGN16((uintptr_t)&(this)->shadowTextureBuffer) - typedef struct BgJyaCobra { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgJyaCobraActionFunc actionFunc; @@ -26,7 +21,7 @@ typedef struct BgJyaCobra { /* 0x0180 */ Vec3f unk_180; /* 0x018C */ f32 unk_18C; /* 0x0190 */ f32 unk_190; - /* 0x0194 */ u8 shadowTextureBuffer[COBRA_SHADOW_TEX_SIZE / sizeof(u8) + 0xF]; // Extra space to allow aligning actual texture to 0x10 + /* 0x0194 */ u8 shadowTexture[0x1010]; } BgJyaCobra; // size = 0x11A4 #endif diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 3c91cb71a64..0df864b40fb 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -156,7 +156,7 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play) { this->collider.base.atFlags &= ~(AT_ON | AT_HIT); relYawTowardsPlayer = thisx->yawTowardsPlayer - thisx->world.rot.y; - if ((relYawTowardsPlayer > -0x4000) && (relYawTowardsPlayer < 0x4000)) { + if ((relYawTowardsPlayer >= -0x3FFF) && (relYawTowardsPlayer < 0x4000)) { thisx->world.rot.y += 0x8000; } @@ -202,10 +202,10 @@ void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, PlayState* play) { } void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { + Player* player = GET_PLAYER(play); s32 pad; BgJyaGoroiwa* this = (BgJyaGoroiwa*)thisx; - Player* player = GET_PLAYER(play); - s32 bgId; + s32 sp38; Vec3f checkPos; if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { @@ -215,7 +215,7 @@ void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { checkPos.y = this->actor.world.pos.y + 59.5f; checkPos.z = this->actor.world.pos.z; this->actor.floorHeight = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &checkPos); + BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &sp38, &this->actor, &checkPos); BgJyaGoroiwa_UpdateCollider(this); if (this->collider.base.atFlags & AT_ON) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index 665635d16dd..9b33e10d702 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -5,7 +5,6 @@ */ #include "z_bg_jya_haheniron.h" -#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" #include "array_count.h" @@ -24,12 +23,14 @@ void BgJyaHaheniron_Destroy(Actor* thisx, PlayState* play); void BgJyaHaheniron_Update(Actor* thisx, PlayState* play); void BgJyaHaheniron_Draw(Actor* thisx, PlayState* play); -void BgJyaHaheniron_SetupChairCrumble(BgJyaHaheniron* this); -void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, PlayState* play); -void BgJyaHaheniron_SetupPillarCrumble(BgJyaHaheniron* this); -void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, PlayState* play); -void BgJyaHaheniron_SetupRubbleCollide(BgJyaHaheniron* this); -void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, PlayState* play); +void func_808980C0(BgJyaHaheniron* this, PlayState* play); +void func_80898114(PlayState* play, Vec3f* arg1, Vec3f* arg2); +void func_8089843C(BgJyaHaheniron* this); +void func_8089844C(BgJyaHaheniron* this, PlayState* play); +void func_80898588(BgJyaHaheniron* this); +void func_80898598(BgJyaHaheniron* this, PlayState* play); +void func_8089861C(BgJyaHaheniron* this); +void func_8089862C(BgJyaHaheniron* this, PlayState* play); ActorProfile Bg_Jya_Haheniron_Profile = { /**/ ACTOR_BG_JYA_HAHENIRON, @@ -42,187 +43,154 @@ ActorProfile Bg_Jya_Haheniron_Profile = { /**/ BgJyaHaheniron_Update, /**/ BgJyaHaheniron_Draw, }; - -static ColliderJntSphElementInit sJntSphElementsInit[] = { - { - { - ELEM_MATERIAL_UNK0, - { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x04 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NORMAL, - ACELEM_NONE, - OCELEM_NONE, - }, - { 0, { { 0, 0, 0 }, 10 }, 100 }, - }, -}; - -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphElementInit D_80898740[1] = { { - COL_MATERIAL_NONE, - AT_ON | AT_TYPE_ENEMY, - AC_ON, - OC1_NONE, - OC2_NONE, - COLSHAPE_JNTSPH, + { 0, { 0xFFCFFFFF, 0, 4 }, { 0, 0, 0 }, 1, 0, 0 }, + { 0, { { 0, 0, 0 }, 0xA }, 0x64 }, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, }; - -static s16 sKakeraScales[] = { 5, 8, 11, 14, 17 }; - -static InitChainEntry sInitChain[] = { +static ColliderJntSphInit D_80898764 = { { 0xA, 0x11, 1, 0, 0, 0 }, 1, D_80898740 }; +static s16 D_80898774[5] = { 5, 8, 0xB, 0xE, 0x11 }; +static InitChainEntry D_80898780[5] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -15000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 500, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 1000, ICHAIN_STOP), }; +static f32 D_80898794[3] = { 0.13f, 0.1f, 0.1f }; +static Vec3f D_808987A0 = { 0.0f, 14.0f, 0.0f }; +static Vec3f D_808987AC = { 0.0f, 8.0f, 0.0f }; +static Gfx* D_808987B8[] = { + gObjectJyaIronDL_000880, + gObjectJyaIronDL_000AE0, + gObjectJyaIronDL_000600, +}; -static f32 D_80898794[] = { 0.13f, 0.1f, 0.1f }; - -static Vec3f D_808987A0[] = { 0.0f, 14.0f, 0.0f }; - -static Vec3f D_808987AC[] = { 0.0f, 8.0f, 0.0f }; - -void BgJyaHaheniron_ColliderInit(BgJyaHaheniron* this, PlayState* play) { +void func_808980C0(BgJyaHaheniron* this, PlayState* play) { s32 pad; - Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->unk150); + Collider_SetJntSph(play, &this->unk150, &this->actor, &D_80898764, this->unk170); } -void BgJyaHaheniron_SpawnFragments(PlayState* play, Vec3f* vec1, Vec3f* vec2) { - Vec3f vel; - Vec3f pos; - s16 arg5; - s32 angle; - s32 i; - f32 rand1; - - for (angle = 0, i = 0; i < ARRAY_COUNT(sKakeraScales); i++) { - rand1 = Rand_ZeroOne() * 10.0f; - vel.x = (Math_SinS(angle) * rand1) + vec2->x; - vel.y = (Rand_ZeroOne() * 10.0f) + vec2->y; - vel.z = (Math_CosS(angle) * rand1) + vec2->z; - - rand1 = Rand_ZeroOne(); - if (rand1 < 0.2f) { - arg5 = 96; - } else if (rand1 < 0.8f) { - arg5 = 64; +void func_80898114(PlayState* play, Vec3f* arg1, Vec3f* arg2) { + Vec3f spB4; + Vec3f spA8; + f32 temp_fv0; + s32 var_s1; + s32 var_v0; + + for (var_s1 = 0; var_s1 < ARRAY_COUNT(D_80898774); var_s1++) { + temp_fv0 = Rand_ZeroOne() * 10.0f; + spB4.x = (Math_SinS(var_s1 * 0x3333) * temp_fv0) + arg2->x; + spB4.y = (Rand_ZeroOne() * 10.0f) + arg2->y; + spB4.z = (Math_CosS(var_s1 * 0x3333) * temp_fv0) + arg2->z; + temp_fv0 = Rand_ZeroOne(); + if (temp_fv0 < 0.2f) { + var_v0 = 0x60; + } else if (temp_fv0 < 0.8f) { + var_v0 = 0x40; } else { - arg5 = 32; + var_v0 = 0x20; } - - EffectSsKakera_Spawn(play, vec1, &vel, vec1, -350, arg5, 40, 4, 0, sKakeraScales[i], 0, 20, 40, - KAKERA_COLOR_NONE, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); - angle += 0x3333; + EffectSsKakera_Spawn(play, arg1, &spB4, arg1, -350, (s16)var_v0, 0x28, 4, 0, D_80898774[var_s1], 0, 0x14, 40, + -1, OBJECT_JYA_IRON, gObjectJyaIronDL_000880); } - pos.x = vec1->x + (vec2->x * 5.0f); - pos.y = vec1->y + (vec2->y * 5.0f); - pos.z = vec1->z + (vec2->z * 5.0f); - func_80033480(play, &pos, 100.0f, 4, 100, 160, 1); + spA8.x = arg1->x + (arg2->x * 5.0f); + spA8.y = arg1->y + (arg2->y * 5.0f); + spA8.z = arg1->z + (arg2->z * 5.0f); + func_80033480(play, &spA8, 100.0f, 4, 0x64, 0xA0, 1U); } void BgJyaHaheniron_Init(Actor* thisx, PlayState* play) { - s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->actor, D_80898780); Actor_SetScale(&this->actor, D_80898794[this->actor.params]); if (this->actor.params == 0) { - BgJyaHaheniron_ColliderInit(this, play); - this->actor.shape.rot.z = (Rand_ZeroOne() * 65535.0f); - BgJyaHaheniron_SetupChairCrumble(this); + func_808980C0(this, play); + this->actor.shape.rot.z = (s16)(s32)(Rand_ZeroOne() * 65535.0f); + func_8089843C(this); } else if (this->actor.params == 1) { - BgJyaHaheniron_SetupPillarCrumble(this); + func_80898588(this); } else if (this->actor.params == 2) { - BgJyaHaheniron_SetupRubbleCollide(this); + func_8089861C(this); } } void BgJyaHaheniron_Destroy(Actor* thisx, PlayState* play) { - s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; if (this->actor.params == 0) { - Collider_DestroyJntSph(play, &this->collider); + Collider_DestroyJntSph(play, &this->unk150); } } -void BgJyaHaheniron_SetupChairCrumble(BgJyaHaheniron* this) { - this->actionFunc = BgJyaHaheniron_ChairCrumble; +void func_8089843C(BgJyaHaheniron* this) { + this->unk14C = func_8089844C; } -void BgJyaHaheniron_ChairCrumble(BgJyaHaheniron* this, PlayState* play) { - Vec3f vec; +void func_8089844C(BgJyaHaheniron* this, PlayState* play) { + Vec3f sp2C; Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 8.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || - ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.at != NULL) && - (this->collider.base.at->category == ACTORCAT_PLAYER))) { - vec.x = -Rand_ZeroOne() * this->actor.velocity.x; - vec.y = -Rand_ZeroOne() * this->actor.velocity.y; - vec.z = -Rand_ZeroOne() * this->actor.velocity.z; - BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, &vec); + ((this->unk150.base.atFlags & AT_HIT) && (this->unk150.base.at != NULL) && + (this->unk150.base.at->category == 2))) { + sp2C.x = -Rand_ZeroOne() * this->actor.velocity.x; + sp2C.y = -Rand_ZeroOne() * this->actor.velocity.y; + sp2C.z = -Rand_ZeroOne() * this->actor.velocity.z; + func_80898114(play, &this->actor.world.pos, &sp2C); Actor_Kill(&this->actor); - } else if (this->timer > 60) { + } else if (this->unk1B0 >= 0x3D) { Actor_Kill(&this->actor); } else { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk150.base); } this->actor.shape.rot.y += 0x4B0; this->actor.shape.rot.x += 0xFA0; } -void BgJyaHaheniron_SetupPillarCrumble(BgJyaHaheniron* this) { - this->actionFunc = BgJyaHaheniron_PillarCrumble; +void func_80898588(BgJyaHaheniron* this) { + this->unk14C = func_80898598; } -void BgJyaHaheniron_PillarCrumble(BgJyaHaheniron* this, PlayState* play) { - if (this->timer >= 8) { +void func_80898598(BgJyaHaheniron* this, PlayState* play) { + if (this->unk1B0 >= 8) { Actor_MoveXZGravity(&this->actor); - } else if (this->timer >= 17) { - BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, D_808987A0); + } else if (this->unk1B0 >= 0x11) { + func_80898114(play, &this->actor.world.pos, &D_808987A0); Actor_Kill(&this->actor); } this->actor.shape.rot.y += 0x258; this->actor.shape.rot.x += 0x3E8; } -void BgJyaHaheniron_SetupRubbleCollide(BgJyaHaheniron* this) { - this->actionFunc = BgJyaHaheniron_RubbleCollide; +void func_8089861C(BgJyaHaheniron* this) { + this->unk14C = func_8089862C; } -void BgJyaHaheniron_RubbleCollide(BgJyaHaheniron* this, PlayState* play) { - if (this->timer >= 17) { - BgJyaHaheniron_SpawnFragments(play, &this->actor.world.pos, D_808987AC); +void func_8089862C(BgJyaHaheniron* this, PlayState* play) { + if (this->unk1B0 >= 0x11) { + func_80898114(play, &this->actor.world.pos, &D_808987AC); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 80, NA_SE_EN_IRONNACK_BREAK_PILLAR2); Actor_Kill(&this->actor); } } void BgJyaHaheniron_Update(Actor* thisx, PlayState* play) { - s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; - this->timer++; - this->actionFunc(this, play); + this->unk1B0 += 1; + this->unk14C(this, play); } void BgJyaHaheniron_Draw(Actor* thisx, PlayState* play) { - static Gfx* dLists[] = { - gObjectJyaIronDL_000880, - gObjectJyaIronDL_000AE0, - gObjectJyaIronDL_000600, - }; - s32 pad; BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; if (this->actor.params == 0) { - Collider_UpdateSpheres(0, &this->collider); + Collider_UpdateSpheres(0, &this->unk150); } - Gfx_DrawDListOpa(play, dLists[this->actor.params]); + Gfx_DrawDListOpa(play, D_808987B8[this->actor.params]); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h index ba4af700bf8..1046d76ef78 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h @@ -9,11 +9,12 @@ struct BgJyaHaheniron; typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, struct PlayState*); typedef struct BgJyaHaheniron { - /* 0x0000 */ Actor actor; - /* 0x014C */ BgJyaHahenironActionFunc actionFunc; - /* 0x0150 */ ColliderJntSph collider; - /* 0x0170 */ ColliderJntSphElement colliderElements[1]; - /* 0x01B0 */ s16 timer; + /* 0x000 */ Actor actor; + /* 0x14C */ BgJyaHahenironActionFunc unk14C; + /* 0x150 */ ColliderJntSph unk150; + /* 0x170 */ ColliderJntSphElement unk170[1]; + /* 0x1B0 */ s16 unk1B0; + /* 0x1B2 */ char pad1B2[2]; } BgJyaHaheniron; // size = 0x01B4 #endif 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 652ec8e8e6e..2c23ad0aa32 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 @@ -1,7 +1,7 @@ /* * File: z_bg_jya_kanaami.c - * Overlay: ovl_Bg_Jya_Kanaami - * Description: Climbable grating/bridge (Spirit Temple) + * Overlay: Bg_Jya_Kanaami + * Description: Climbable Metal Grating (Fire Temple) */ #include "z_bg_jya_kanaami.h" 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 83e58b79b83..44b7964cf39 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 @@ -29,7 +29,7 @@ void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play); void BgJyaLift_SetupMove(BgJyaLift* this); void BgJyaLift_Move(BgJyaLift* this, PlayState* play); -static s16 sIsSpawned = false; +static s16 D_8089A020 = 0; ActorProfile Bg_Jya_Lift_Profile = { /**/ ACTOR_BG_JYA_LIFT, @@ -63,7 +63,7 @@ void BgJyaLift_Init(Actor* thisx, PlayState* play) { BgJyaLift* this = (BgJyaLift*)thisx; this->isSpawned = false; - if (sIsSpawned) { + if (D_8089A020) { Actor_Kill(thisx); return; } @@ -77,7 +77,7 @@ void BgJyaLift_Init(Actor* thisx, PlayState* play) { BgJyaLift_SetInitPosY(this); } thisx->room = -1; - sIsSpawned = true; + D_8089A020 = 1; this->isSpawned = true; } @@ -87,7 +87,7 @@ void BgJyaLift_Destroy(Actor* thisx, PlayState* play) { if (this->isSpawned) { PRINTF(T("女神リフト DT\n", "Goddess lift DT\n")); - sIsSpawned = false; + D_8089A020 = 0; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -144,7 +144,7 @@ void BgJyaLift_Update(Actor* thisx, PlayState* play2) { } if ((this->dyna.interactFlags & DYNA_INTERACT_PLAYER_ABOVE) && !(this->unk_16B & DYNA_INTERACT_PLAYER_ABOVE)) { Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DIRECTED_YAW); - } else if (!(this->dyna.interactFlags & DYNA_INTERACT_PLAYER_ABOVE) && + } else if (((this->dyna.interactFlags) & DYNA_INTERACT_PLAYER_ABOVE) == 0 && (this->unk_16B & DYNA_INTERACT_PLAYER_ABOVE) && (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_DIRECTED_YAW)) { Camera_RequestSetting(play->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); 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 7f5b2731623..cd25f48330d 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_jya_megami.c - * Overlay: ovl_Bg_Jya_Megami - * Description: Face of Spirit Temple Goddess Statue - */ - #include "z_bg_jya_megami.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" 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 c8c325298cf..55007489b16 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 @@ -14,6 +14,9 @@ #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED +#define SIZE_PARAM PARAMS_GET_U((u16)this->dyna.actor.params, 12, 4) +#define TIMER_PARAM PARAMS_GET_U((u16)this->dyna.actor.params, 6, 6) + void BgMizuShutter_Init(Actor* thisx, PlayState* play); void BgMizuShutter_Destroy(Actor* thisx, PlayState* play); void BgMizuShutter_Update(Actor* thisx, PlayState* play); @@ -59,34 +62,30 @@ void BgMizuShutter_Init(Actor* thisx, PlayState* play) { s32 pad; BgMizuShutter* this = (BgMizuShutter*)thisx; s32 pad2; - CollisionHeader* colHeader = NULL; + CollisionHeader* sp30 = NULL; s32 pad3; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - this->displayList = sDisplayLists[BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor)]; + this->displayList = sDisplayLists[SIZE_PARAM]; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - 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_GET_SIZE(&this->dyna.actor) == BGMIZUSHUTTER_SMALL) || - (BGMIZUSHUTTER_GET_SIZE(&this->dyna.actor) == BGMIZUSHUTTER_LARGE)) { + CollisionHeader_GetVirtual(sCollisionHeaders[SIZE_PARAM], &sp30); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); + if ((SIZE_PARAM == BGMIZUSHUTTER_SMALL) || (SIZE_PARAM == BGMIZUSHUTTER_LARGE)) { this->closedPos = this->dyna.actor.world.pos; this->timer = 0; - this->timerMax = BGMIZUSHUTTER_GET_TIMER(&this->dyna.actor) * 20; - + this->timerMax = TIMER_PARAM * 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_GET_SIZE(&this->dyna.actor)], &this->openPos); + Matrix_MultVec3f(&sDisplacements[SIZE_PARAM], &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_GET_SWITCH(&this->dyna.actor)); + Flags_UnsetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6)); this->dyna.actor.world.pos = this->closedPos; } - if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6))) { this->dyna.actor.world.pos = this->openPos; this->actionFunc = BgMizuShutter_WaitForTimer; } else { @@ -103,7 +102,7 @@ void BgMizuShutter_Destroy(Actor* thisx, PlayState* play) { } void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, PlayState* play) { - if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6))) { if (ABS(this->dyna.actor.world.rot.x) > 0x2C60) { OnePointCutscene_Init(play, 4510, -99, &this->dyna.actor, CAM_ID_MAIN); } else { @@ -122,7 +121,7 @@ void BgMizuShutter_WaitForCutscene(BgMizuShutter* this, PlayState* play) { } void BgMizuShutter_Move(BgMizuShutter* this, PlayState* play) { - if (Flags_GetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor))) { + if (Flags_GetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6))) { 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); @@ -152,7 +151,7 @@ void BgMizuShutter_WaitForTimer(BgMizuShutter* this, PlayState* play) { Actor_PlaySfx_FlaggedTimer(&this->dyna.actor, this->timer); if (this->timer == 0) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALDOOR_CLOSE); - Flags_UnsetSwitch(play, BGMIZUSHUTTER_GET_SWITCH(&this->dyna.actor)); + Flags_UnsetSwitch(play, PARAMS_GET_U((u16)this->dyna.actor.params, 0, 6)); 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 a3f172393a3..86c8a725b0c 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,11 +4,7 @@ #include "ultra64.h" #include "actor.h" -#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)) +#define BGMIZUSHUTTER_PARAM(size, timer, switchFlag) (size << 0xC) | (timer << 0x6) | switchFlag struct BgMizuShutter; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c index 03d4ac56286..8019e58b4b2 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c @@ -20,8 +20,6 @@ void BgMizuUzu_Destroy(Actor* thisx, PlayState* play); void BgMizuUzu_Update(Actor* thisx, PlayState* play); void BgMizuUzu_Draw(Actor* thisx, PlayState* play); -void func_8089F788(BgMizuUzu* this, PlayState* play); - ActorProfile Bg_Mizu_Uzu_Profile = { /**/ ACTOR_BG_MIZU_UZU, /**/ ACTORCAT_PROP, @@ -40,16 +38,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; +void func_8089F788(BgMizuUzu* this, PlayState* play); + void BgMizuUzu_Init(Actor* thisx, PlayState* play) { - s32 pad; BgMizuUzu* this = (BgMizuUzu*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gObjectMizuObjectsUzuCol_0074EC, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); this->actionFunc = func_8089F788; } 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 8532ce180b2..ba608b4e164 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 @@ -30,7 +30,7 @@ void func_808A2008(BgMoriElevator* this, PlayState* play); void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, PlayState* play); void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, PlayState* play); -static s16 sIsSpawned = false; +static s16 sIsSpawned = 0; ActorProfile Bg_Mori_Elevator_Profile = { /**/ ACTOR_BG_MORI_ELEVATOR, @@ -113,9 +113,9 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { #endif switch (sIsSpawned) { - case false: + case 0: PRINTF(T("森の神殿 elevator CT\n", "Forest Temple elevator CT\n")); - sIsSpawned = true; + sIsSpawned = 1; this->dyna.actor.room = -1; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); @@ -123,7 +123,7 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) { this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); BgMoriElevator_SetupWaitAfterInit(this); break; - case true: + case 1: Actor_Kill(thisx); break; } @@ -135,7 +135,7 @@ void BgMoriElevator_Destroy(Actor* thisx, PlayState* play) { if (this->unk_172 == 0) { PRINTF(T("森の神殿 elevator DT\n", "Forest Temple elevator DT\n")); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - sIsSpawned = false; + sIsSpawned = 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 613a1bf2ca1..b49ee52544c 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 @@ -14,7 +14,6 @@ #include "sys_matrix.h" #include "versions.h" #include "z_lib.h" -#include "curve.h" #include "play_state.h" #include "player.h" 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 2cd35ab1ee5..0d2340ed684 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 @@ -30,7 +30,7 @@ void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play); void BgMoriIdomizu_SetupMain(BgMoriIdomizu* this); void BgMoriIdomizu_Main(BgMoriIdomizu* this, PlayState* play); -static s16 sIsSpawned = false; +static s16 sAlreadyLoaded = false; ActorProfile Bg_Mori_Idomizu_Profile = { /**/ ACTOR_BG_MORI_IDOMIZU, @@ -60,7 +60,7 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { s32 pad; BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; - if (sIsSpawned) { + if (sAlreadyLoaded) { Actor_Kill(&this->actor); return; } @@ -85,7 +85,7 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) { return; } BgMoriIdomizu_SetupWaitForMoriTex(this); - sIsSpawned = true; + sAlreadyLoaded = true; this->isLoaded = true; this->actor.room = -1; PRINTF(T("(森の神殿 井戸水)(arg_data 0x%04x)\n", "(Forest Temple well water)(arg_data 0x%04x)\n"), @@ -97,7 +97,7 @@ void BgMoriIdomizu_Destroy(Actor* thisx, PlayState* play) { BgMoriIdomizu* this = (BgMoriIdomizu*)thisx; if (this->isLoaded) { - sIsSpawned = false; + sAlreadyLoaded = false; } } 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 ed0094b8b03..df39cc4d60f 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_po_syokudai.c - * Overlay: ovl_Bg_Po_Syokudai - * Description: Golden Torch Stand (Poe Sisters) - */ - #include "z_bg_po_syokudai.h" #include "libc64/qrand.h" @@ -20,52 +14,27 @@ #define FLAGS 0 -typedef enum PoeFlameColor { - POE_FLAME_PURPLE, // Meg - POE_FLAME_RED, // Joelle - POE_FLAME_BLUE, // Beth - POE_FLAME_GREEN // Amy -} PoeFlameColor; - -#define POE_TORCH_FLAG 0x1C - void BgPoSyokudai_Init(Actor* thisx, PlayState* play); void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play); void BgPoSyokudai_Update(Actor* thisx, PlayState* play); void BgPoSyokudai_Draw(Actor* thisx, PlayState* play); -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_METAL, - AT_NONE, - AC_ON | AC_HARD | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_ON, - }, - { 12, 60, 0, { 0, 0, 0 } }, +static ColliderCylinderInit D_808A8960 = { + { 9, 0, 0xD, 0x39, 0x20, 1 }, + { 0, { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0 }, 0, 1, 1 }, + { 0xC, 0x3C, 0, { 0, 0, 0 } }, }; - -static Color_RGBA8 sPrimColors[] = { - { 255, 170, 255, 255 }, - { 255, 200, 0, 255 }, - { 0, 170, 255, 255 }, - { 170, 255, 0, 255 }, +static Color_RGBA8 D_808A898C[4] = { + { 0xFF, 0xAA, 0xFF, 0xFF }, + { 0xFF, 0xC8, 0x00, 0xFF }, + { 0x00, 0xAA, 0xFF, 0xFF }, + { 0xAA, 0xFF, 0x00, 0xFF }, }; - -static Color_RGBA8 sEnvColors[] = { - { 100, 0, 255, 255 }, - { 255, 0, 0, 255 }, - { 0, 0, 255, 255 }, - { 0, 150, 0, 255 }, +static Color_RGBA8 D_808A899C[4] = { + { 0x64, 0x00, 0xFF, 0xFF }, + { 0xFF, 0x00, 0x00, 0xFF }, + { 0x00, 0x00, 0xFF, 0xFF }, + { 0x00, 0x96, 0x00, 0xFF }, }; ActorProfile Bg_Po_Syokudai_Profile = { @@ -80,7 +49,7 @@ ActorProfile Bg_Po_Syokudai_Profile = { /**/ BgPoSyokudai_Draw, }; -static InitChainEntry sInitChain[] = { +static InitChainEntry D_808A89CC[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; @@ -88,51 +57,38 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; - Actor_ProcessInitChain(thisx, sInitChain); - - this->flameColor = PARAMS_GET_U(thisx->params, 8, 8); - thisx->params &= 0x3F; - - thisx->colChkInfo.mass = MASS_IMMOVABLE; - - this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - Lights_PointGlowSetInfo(&this->lightInfo, thisx->world.pos.x, (s16)thisx->world.pos.y + 65, thisx->world.pos.z, 0, - 0, 0, 0); - - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); - - this->collider.dim.pos.x = thisx->world.pos.x; - this->collider.dim.pos.y = thisx->world.pos.y; - this->collider.dim.pos.z = thisx->world.pos.z; - - if (this->flameColor == POE_FLAME_PURPLE && Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_GREEN) && - Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_BLUE) && - Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_RED) && !Flags_GetSwitch(play, thisx->params)) { - - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, thisx->params); + Actor_ProcessInitChain(&this->actor, D_808A89CC); + this->unk14C = PARAMS_GET_U(thisx->params, 8, 8); + this->actor.params &= 0x3F; + this->actor.colChkInfo.mass = 0xFF; + this->unk150 = LightContext_InsertLight(play, &play->lightCtx, &this->unk154); + Lights_PointGlowSetInfo(&this->unk154, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 65, + this->actor.world.pos.z, 0, 0, 0, 0); + Collider_InitCylinder(play, &this->unk164); + Collider_SetCylinder(play, &this->unk164, &this->actor, &D_808A8960); + this->unk164.dim.pos.x = this->actor.world.pos.x; + this->unk164.dim.pos.y = this->actor.world.pos.y; + this->unk164.dim.pos.z = this->actor.world.pos.z; + if ((this->unk14C == 0) && Flags_GetSwitch(play, 0x1F) && Flags_GetSwitch(play, 0x1E) && + Flags_GetSwitch(play, 0x1D) && !Flags_GetSwitch(play, this->actor.params)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, this->actor.params); + play->envCtx.lightSettingOverride = 4; + } else if (!Flags_GetSwitch(play, 0x1C) && !Flags_GetSwitch(play, 0x1B)) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, this->actor.world.pos.x, + this->actor.world.pos.y + 52.0f, this->actor.world.pos.z, 0, 0, 0, + (this->unk14C << 8) + this->actor.params + 0x1000); + } else if (!Flags_GetSwitch(play, this->actor.params) && + (play->envCtx.lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE)) { play->envCtx.lightSettingOverride = 4; - - } else if (!Flags_GetSwitch(play, POE_TORCH_FLAG + POE_FLAME_PURPLE) && !Flags_GetSwitch(play, 0x1B)) { - - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y + 52.0f, - thisx->world.pos.z, 0, 0, 0, (this->flameColor << 8) + thisx->params + 0x1000); - - } else if (!Flags_GetSwitch(play, thisx->params)) { - if (play->envCtx.lightSettingOverride == LIGHT_SETTING_OVERRIDE_NONE) { - play->envCtx.lightSettingOverride = 4; - } } - - this->flameTextureScroll = (s16)(Rand_ZeroOne() * 20.0f); + this->unk14E = Rand_ZeroOne() * 20.0f; } void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; - LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); - Collider_DestroyCylinder(play, &this->collider); - + LightContext_RemoveLight(play, &play->lightCtx, this->unk150); + Collider_DestroyCylinder(play, &this->unk164); if (play->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) { play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } @@ -142,53 +98,42 @@ void BgPoSyokudai_Update(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk164.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk164.base); if (Flags_GetSwitch(play, this->actor.params)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } - this->flameTextureScroll++; + this->unk14E += 1; } void BgPoSyokudai_Draw(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; - f32 lightBrightness; - u8 red; - u8 green; - u8 blue; + f32 temp_fv1; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_bg_po_syokudai.c", 315); - Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_po_syokudai.c", 319); gSPDisplayList(POLY_OPA_DISP++, gGoldenTorchDL); - if (Flags_GetSwitch(play, this->actor.params)) { - Color_RGBA8* primColor = &sPrimColors[this->flameColor]; - Color_RGBA8* envColor = &sEnvColors[this->flameColor]; - - lightBrightness = (0.3f * Rand_ZeroOne()) + 0.7f; - - red = (u8)(primColor->r * lightBrightness); - green = (u8)(primColor->g * lightBrightness); - blue = (u8)(primColor->b * lightBrightness); - - Lights_PointSetColorAndRadius(&this->lightInfo, red, green, blue, 200); + Color_RGBA8* sp64; + Color_RGBA8* sp60; + sp64 = &D_808A898C[this->unk14C]; + sp60 = &D_808A899C[this->unk14C]; + temp_fv1 = (Rand_ZeroOne() * 0.3f) + 0.7f; + Lights_PointSetColorAndRadius(&this->unk154, sp64->r * temp_fv1, sp64->g * temp_fv1, sp64->b * temp_fv1, 200); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 64, 1, 0, - (this->flameTextureScroll * -20) & 0x1FF, 32, 128)); - - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, primColor->r, primColor->g, primColor->b, 255); - gDPSetEnvColor(POLY_XLU_DISP++, envColor->r, envColor->g, envColor->b, 255); - + (this->unk14E * -0x14) & 0x1FF, 32, 128)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sp64->r, sp64->g, sp64->b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, sp60->r, sp60->g, sp60->b, 255); Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); Matrix_RotateY( - BINANG_TO_RAD((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000)), + BINANG_TO_RAD((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000)), MTXMODE_APPLY); Matrix_Scale(0.0027f, 0.0027f, 0.0027f, MTXMODE_APPLY); - MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_po_syokudai.c", 368); gSPDisplayList(POLY_XLU_DISP++, gEffFire1DL); } diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h index 3c50d66794f..b9aa8bacfc8 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h @@ -8,12 +8,12 @@ struct BgPoSyokudai; typedef struct BgPoSyokudai { - /* 0x0000 */ Actor actor; - /* 0x014C */ u8 flameColor; - /* 0x014E */ s16 flameTextureScroll; - /* 0x0150 */ LightNode* lightNode; - /* 0x0154 */ LightInfo lightInfo; - /* 0x0164 */ ColliderCylinder collider; + /* 0x000 */ Actor actor; + /* 0x14C */ u8 unk14C; + /* 0x14E */ s16 unk14E; + /* 0x150 */ LightNode* unk150; + /* 0x154 */ LightInfo unk154; + /* 0x164 */ ColliderCylinder unk164; } BgPoSyokudai; // size = 0x01B0 #endif diff --git a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c index 49f017a0f96..ba6f821adda 100644 --- a/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c +++ b/src/overlays/actors/ovl_Bg_Pushbox/z_bg_pushbox.c @@ -46,16 +46,16 @@ void BgPushbox_SetupAction(BgPushbox* this, BgPushboxActionFunc actionFunc) { } void BgPushbox_Init(Actor* thisx, PlayState* play) { - s32 pad; BgPushbox* this = (BgPushbox*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gBlockSmallCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); BgPushbox_SetupAction(this, BgPushbox_UpdateImpl); } @@ -66,12 +66,14 @@ void BgPushbox_Destroy(Actor* thisx, PlayState* play) { } void BgPushbox_UpdateImpl(BgPushbox* this, PlayState* play) { - this->dyna.actor.speed += this->dyna.unk_150 * 0.2f; - this->dyna.actor.speed = CLAMP(this->dyna.actor.speed, -1.0f, 1.0f); - Math_StepToF(&this->dyna.actor.speed, 0.0f, 0.2f); - this->dyna.actor.world.rot.y = this->dyna.unk_158; - Actor_MoveXZGravity(&this->dyna.actor); - Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 20.0f, 40.0f, 40.0f, + Actor* thisx = &this->dyna.actor; + + thisx->speed += this->dyna.unk_150 * 0.2f; + thisx->speed = (thisx->speed < -1.0f) ? -1.0f : ((thisx->speed > 1.0f) ? 1.0f : thisx->speed); + Math_StepToF(&thisx->speed, 0.0f, 0.2f); + thisx->world.rot.y = this->dyna.unk_158; + Actor_MoveXZGravity(thisx); + Actor_UpdateBgCheckInfo(play, thisx, 20.0f, 40.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } 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 d3f827b6969..8016f9b36c9 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 @@ -35,8 +35,8 @@ void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play); void BgSpot00Hanebasi_Update(Actor* thisx, PlayState* play); void BgSpot00Hanebasi_Draw(Actor* thisx, PlayState* play); -void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play); -void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play); +void BgSpot00Hanebasi_DrawBridgeWait(BgSpot00Hanebasi* this, PlayState* play); +void BgSpot00Hanebasi_DrawBridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play); void BgSpot00Hanebasi_SetTorchLightInfo(BgSpot00Hanebasi* this, PlayState* play); ActorProfile Bg_Spot00_Hanebasi_Profile = { @@ -114,7 +114,7 @@ void BgSpot00Hanebasi_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); } - this->actionFunc = BgSpot00Hanebasi_DrawbridgeWait; + this->actionFunc = BgSpot00Hanebasi_DrawBridgeWait; this->destAngle = 40; } else if (this->dyna.actor.params == DT_CHAIN_1) { if (Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT00_HANEBASI, @@ -148,20 +148,19 @@ void BgSpot00Hanebasi_Destroy(Actor* thisx, PlayState* play) { } } -void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { +void BgSpot00Hanebasi_DrawBridgeWait(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child = (BgSpot00Hanebasi*)this->dyna.actor.child; if (!IS_CUTSCENE_LAYER && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !GET_EVENTCHKINF(EVENTCHKINF_80)) { return; } - if ((this->dyna.actor.shape.rot.x != 0) && (CutsceneFlags_Get(play, 0) || (!IS_CUTSCENE_LAYER && IS_DAY))) { - this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; + this->actionFunc = BgSpot00Hanebasi_DrawBridgeRiseAndFall; this->destAngle = 0; child->destAngle = 0; } else if ((this->dyna.actor.shape.rot.x == 0) && !IS_CUTSCENE_LAYER && !LINK_IS_ADULT && !IS_DAY) { - this->actionFunc = BgSpot00Hanebasi_DrawbridgeRiseAndFall; + this->actionFunc = BgSpot00Hanebasi_DrawBridgeRiseAndFall; this->destAngle = -0x4000; child->destAngle = -0xFE0; } @@ -170,13 +169,13 @@ void BgSpot00Hanebasi_DrawbridgeWait(BgSpot00Hanebasi* this, PlayState* play) { void BgSpot00Hanebasi_DoNothing(BgSpot00Hanebasi* this, PlayState* play) { } -void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play) { +void BgSpot00Hanebasi_DrawBridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* play) { BgSpot00Hanebasi* child; Actor* childsChild; s16 angle = 80; if (Math_ScaledStepToS(&this->dyna.actor.shape.rot.x, this->destAngle, 80)) { - this->actionFunc = BgSpot00Hanebasi_DrawbridgeWait; + this->actionFunc = BgSpot00Hanebasi_DrawBridgeWait; } if (this->dyna.actor.shape.rot.x >= -0x27D8) { @@ -188,13 +187,13 @@ void BgSpot00Hanebasi_DrawbridgeRiseAndFall(BgSpot00Hanebasi* this, PlayState* p } if (this->destAngle < 0) { - if (this->actionFunc == BgSpot00Hanebasi_DrawbridgeWait) { + if (this->actionFunc == BgSpot00Hanebasi_DrawBridgeWait) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE_STOP); } else { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_BRIDGE_CLOSE - SFX_FLAG); } } else { - if (this->actionFunc == BgSpot00Hanebasi_DrawbridgeWait) { + if (this->actionFunc == BgSpot00Hanebasi_DrawBridgeWait) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); } else { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN - SFX_FLAG); diff --git a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c index b68a23208f9..b7a47e0d113 100644 --- a/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c +++ b/src/overlays/actors/ovl_Bg_Spot01_Idosoko/z_bg_spot01_idosoko.c @@ -1,6 +1,6 @@ /* * File: z_bg_spot01_idosoko.c - * Overlay: ovl_Bg_Spot01_Idosoko + * Overlay: Bg_Spot01_Idosoko * Description: Stone that blocks the entrance to Bottom of the Well */ @@ -45,17 +45,17 @@ void BgSpot01Idosoko_SetupAction(BgSpot01Idosoko* this, BgSpot01IdosokoActionFun } void BgSpot01Idosoko_Init(Actor* thisx, PlayState* play) { - s32 pad; BgSpot01Idosoko* this = (BgSpot01Idosoko*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; s32 pad2; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); CollisionHeader_GetVirtual(&gKakarikoBOTWStoneCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if (!LINK_IS_ADULT) { - Actor_Kill(&this->dyna.actor); + Actor_Kill(thisx); } else { BgSpot01Idosoko_SetupAction(this, func_808ABF54); } 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 3fd0960883c..4dfbb4efbfe 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 @@ -9,7 +9,7 @@ typedef enum BgSpot03TakiState { WATERFALL_OPENING_IDLE, WATERFALL_OPENING_ANIMATED, WATERFALL_OPENED, - WATERFALL_CLOSING + WATERFALL_CLOSING, } BgSpot03TakiState; struct BgSpot03Taki; 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 1303fad7354..9b9eeb2c8ac 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 @@ -47,11 +47,12 @@ static Gfx* sDLists[] = { }; void BgSpot05Soko_Init(Actor* thisx, PlayState* play) { - s32 pad1; BgSpot05Soko* this = (BgSpot05Soko*)thisx; - CollisionHeader* colHeader = NULL; - s32 pad2; + u32 pad1; + CollisionHeader* colHeader; + u32 pad2; + colHeader = NULL; Actor_ProcessInitChain(thisx, sInitChain); this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); thisx->params &= 0xFF; @@ -85,20 +86,23 @@ void func_808AE5A8(BgSpot05Soko* this, PlayState* play) { } void func_808AE5B4(BgSpot05Soko* this, PlayState* play) { + Actor* thisx = &this->dyna.actor; + if (Flags_GetSwitch(play, this->switchFlag)) { - SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); - Actor_SetFocus(&this->dyna.actor, 50.0f); + SfxSource_PlaySfxAtFixedWorldPos(play, &thisx->world.pos, 30, NA_SE_EV_METALDOOR_CLOSE); + Actor_SetFocus(thisx, 50.0f); OnePointCutscene_Attention(play, &this->dyna.actor); this->actionFunc = func_808AE630; - this->dyna.actor.speed = 0.5f; + thisx->speed = 0.5f; } } void func_808AE630(BgSpot05Soko* this, PlayState* play) { - this->dyna.actor.speed *= 1.5f; - if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 120.0f, this->dyna.actor.speed) != - 0) { - Actor_Kill(&this->dyna.actor); + Actor* thisx = &this->dyna.actor; + + thisx->speed *= 1.5f; + if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y - 120.0f, thisx->speed) != 0) { + Actor_Kill(thisx); } } 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 ee7036a4912..d81922c0314 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_spot08_iceblock.c - * Overlay: ovl_Bg_Spot08_Iceblock - * Description: Floating ice platforms - */ - #include "z_bg_spot08_iceblock.h" #include "libc64/math64.h" @@ -27,13 +21,13 @@ void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play); void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play); void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play); -void BgSpot08Iceblock_SetupFloatNonrotating(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, PlayState* play); -void BgSpot08Iceblock_SetupFloatRotating(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play); -void BgSpot08Iceblock_SetupFloatOrbitingTwins(BgSpot08Iceblock* this); -void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play); -void BgSpot08Iceblock_SetupNoAction(BgSpot08Iceblock* this); +void func_808B1388(BgSpot08Iceblock* this); +void func_808B13AC(BgSpot08Iceblock* this, PlayState* play); +void func_808B13FC(BgSpot08Iceblock* this); +void func_808B1420(BgSpot08Iceblock* this, PlayState* play); +void func_808B147C(BgSpot08Iceblock* this); +void func_808B14A0(BgSpot08Iceblock* this, PlayState* play); +void func_808B1574(BgSpot08Iceblock* this); ActorProfile Bg_Spot08_Iceblock_Profile = { /**/ ACTOR_BG_SPOT08_ICEBLOCK, @@ -47,43 +41,49 @@ ActorProfile Bg_Spot08_Iceblock_Profile = { /**/ BgSpot08Iceblock_Draw, }; -void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, BgSpot08IceblockActionFunc actionFunc) { - this->actionFunc = actionFunc; +static Vec3f D_808B16B0 = { 0.0f, 1.0f, 0.0f }; +static Vec3f D_808B16BC = { 0.0f, 0.0f, 0.0f }; +static f32 D_808B16C8[3] = { 1.4285714e-8f, 5.714286e-9f, 1.4285715e-9f }; +static f32 D_808B16D4[3] = { 0.96f, 0.96f, 0.98f }; +static f32 D_808B16E0[3] = { 0.22495104f, 0.22495104f, 0.03489947f }; +static f32 D_808B16EC[3] = { 0.97437006f, 0.97437006f, 0.99939084f }; +static InitChainEntry D_808B16F8[] = { + ICHAIN_F32(cullingVolumeDistance, 3000, ICHAIN_CONTINUE), + ICHAIN_F32(cullingVolumeScale, 1000, ICHAIN_CONTINUE), + ICHAIN_F32(cullingVolumeDownward, 2200, ICHAIN_STOP), +}; + +void func_808B0960(BgSpot08Iceblock* this, void (*arg1)(BgSpot08Iceblock*, PlayState*)) { + this->unk164 = arg1; } -void BgSpot08Iceblock_InitDynaPoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* collision, s32 flags) { +void func_808B0968(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* arg2, s32 arg3) { s32 pad; - CollisionHeader* colHeader = NULL; + CollisionHeader* sp30; - DynaPolyActor_Init(&this->dyna, flags); - CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + sp30 = NULL; + DynaPolyActor_Init(&this->dyna, arg3); + CollisionHeader_GetVirtual(arg2, &sp30); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); #if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { s32 pad2; - PRINTF(T("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", - "Warning : move BG registration failed (%s %d)(name %d)(arg_data 0x%04x)\n"), - "../z_bg_spot08_iceblock.c", 0xD9, this->dyna.actor.id, this->dyna.actor.params); + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 217, + this->dyna.actor.id, this->dyna.actor.params); } #endif } -// Sets params to 0x10 (medium, nonrotating) if not in the cases listed. -void BgSpot08Iceblock_CheckParams(BgSpot08Iceblock* this) { +void func_808B09F0(BgSpot08Iceblock* this) { switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case 0xFF: this->dyna.actor.params = 0x10; break; - default: - PRINTF(T("Error : arg_data 設定ミスです。(%s %d)(arg_data 0x%04x)\n", - "Error : arg_data setting error. (%s %d)(arg_data 0x%04x)\n"), - "../z_bg_spot08_iceblock.c", 0xF6, this->dyna.actor.params); - this->dyna.actor.params = 0x10; - break; - case 1: - case 4: + + case 0x1: + case 0x4: case 0x10: case 0x11: case 0x12: @@ -92,273 +92,236 @@ void BgSpot08Iceblock_CheckParams(BgSpot08Iceblock* this) { case 0x23: case 0x24: break; + + default: + PRINTF("Error : arg_data 設定ミスです。(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot08_iceblock.c", 0xF6, + this->dyna.actor.params); + this->dyna.actor.params = 0x10; + break; } } -void BgSpot08Iceblock_Bobbing(BgSpot08Iceblock* this) { - this->bobOffset = (Math_SinS(this->bobPhaseSlow) * 4.0f) + (Math_SinS(this->bobPhaseFast) * 3.0f); +void func_808B0A84(BgSpot08Iceblock* this) { + this->unk198 = (Math_SinS(this->unk18C) * 4.0f) + (Math_SinS(this->unk18E) * 3.0f); } -void BgSpot08Iceblock_SinkUnderPlayer(BgSpot08Iceblock* this) { - f32 target; - f32 step; +void func_808B0AE0(BgSpot08Iceblock* this) { + f32 var_fv0; + f32 sp18; switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) { case 0: - step = 0.15f; + sp18 = 0.15f; break; + case 0x10: - step = 0.2f; + sp18 = 0.2f; break; + case 0x20: - step = 0.4f; + sp18 = 0.4f; break; } - - // Sink under an actor's weight if standing on it - target = (DynaPolyActor_IsActorOnTop(&this->dyna) ? -4.0f : 0.0f); - - Math_StepToF(&this->sinkOffset, target, step); + if (DynaPolyActor_IsActorOnTop(&this->dyna) != 0) { + var_fv0 = -4.0f; + } else { + var_fv0 = 0.0f; + } + Math_StepToF(&this->unk194, var_fv0, sp18); } -void BgSpot08Iceblock_SetWaterline(BgSpot08Iceblock* this) { - this->dyna.actor.world.pos.y = this->sinkOffset + this->bobOffset + this->dyna.actor.home.pos.y; +void func_808B0B8C(BgSpot08Iceblock* this) { + this->dyna.actor.world.pos.y = this->unk194 + this->unk198 + this->dyna.actor.home.pos.y; } -void BgSpot08Iceblock_MultVectorScalar(Vec3f* dest, Vec3f* v, f32 scale) { - dest->x = v->x * scale; - dest->y = v->y * scale; - dest->z = v->z * scale; +void func_808B0BA8(Vec3f* arg0, Vec3f* arg1, f32 arg2) { + arg0->x = arg1->x * arg2; + arg0->y = arg1->y * arg2; + arg0->z = arg1->z * arg2; } -void BgSpot08Iceblock_CrossProduct(Vec3f* dest, Vec3f* v1, Vec3f* v2) { - dest->x = (v1->y * v2->z) - (v1->z * v2->y); - dest->y = (v1->z * v2->x) - (v1->x * v2->z); - dest->z = (v1->x * v2->y) - (v1->y * v2->x); +void func_808B0BD4(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2) { + arg0->x = (arg1->y * arg2->z) - (arg1->z * arg2->y); + arg0->y = (arg1->z * arg2->x) - (arg1->x * arg2->z); + arg0->z = (arg1->x * arg2->y) - (arg1->y * arg2->x); } -s32 BgSpot08Iceblock_NormalizeVector(Vec3f* dest, Vec3f* v) { - f32 magnitude; +s32 func_808B0C44(Vec3f* arg0, Vec3f* arg1) { + f32 temp_fv0; + f32 temp_fv1; - magnitude = Math3D_Vec3fMagnitude(v); - if (magnitude < 0.001f) { - dest->x = dest->y = 0.0f; - dest->z = 1.0f; + temp_fv0 = Math3D_Vec3fMagnitude(arg1); + if (temp_fv0 < 0.001f) { + arg0->y = 0.0f; + arg0->x = 0.0f; + arg0->z = 1.0f; return false; } else { - dest->x = v->x * (1.0f / magnitude); - dest->y = v->y * (1.0f / magnitude); - dest->z = v->z * (1.0f / magnitude); + temp_fv1 = 1.0f / temp_fv0; + arg0->x = arg1->x * temp_fv1; + arg0->y = arg1->y * temp_fv1; + arg0->z = arg1->z * temp_fv1; return true; } } -static Vec3f sVerticalVector = { 0.0f, 1.0f, 0.0f }; -static Vec3f sZeroVector = { 0.0f, 0.0f, 0.0f }; -static f32 sInertias[] = { 1.0f / 70000000, 1.0f / 175000000, 1.0f / 700000000 }; -static f32 sDampingFactors[] = { 0.96f, 0.96f, 0.98f }; - -static f32 sRollSins[] = { - 0.22495104f, // sin(13 degrees) - 0.22495104f, // sin(13 degrees) - 0.03489947f, // sin(2 degrees) -}; - -static f32 sRollCoss[] = { - 0.97437006f, // cos(13 degrees) - 0.97437006f, // cos(13 degrees) - 0.99939084f, // cos(2 degrees) -}; - -/** - * Handles all the factors that influence rolling: inertia, random oscillations, and most significantly, player weight, - * and combines them to produce a matrix that rotates the actor to match the surface normal - */ -void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, PlayState* play) { - f32 deviationFromVertSq; - f32 stabilityCorrection; - Vec3f surfaceNormalHorizontal; - Vec3f playerCentroidDiff; - Vec3f playerMoment; - Vec3f surfaceNormalHorizontalScaled; - Vec3f randomNutation; - Vec3f tempVec; // reused with different meanings - Vec3f torqueDirection; - f32 playerCentroidDist; - s32 rollDataIndex; - MtxF mtx; - s32 pad; +void func_808B0CE0(BgSpot08Iceblock* this, PlayState* play) { Player* player = GET_PLAYER(play); + s32 pad; + Vec3f spD4; + Vec3f spC8; + Vec3f spBC; + Vec3f spB0; + Vec3f spA4; + Vec3f sp98; + Vec3f sp8C; + f32 sp88; + s32 sp84; + MtxF sp44; + f32 temp_fv0_2; + f32 temp_fv1; switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { - case 0x11: // Medium nonrotating - rollDataIndex = 0; + case 0x11: + sp84 = 0; break; + case 1: - rollDataIndex = 1; // Large nonrotating + sp84 = 1; break; + default: - rollDataIndex = 2; + sp84 = 2; break; } - - Math_Vec3f_Diff(&player->actor.world.pos, &this->dyna.actor.world.pos, &playerCentroidDiff); - playerCentroidDiff.y -= (150.0f * this->dyna.actor.scale.y); - playerCentroidDist = Math3D_Vec3fMagnitude(&playerCentroidDiff); - - randomNutation.x = (Rand_ZeroOne() - 0.5f) * (1.0f / 625); - randomNutation.y = 0.0f; - randomNutation.z = (Rand_ZeroOne() - 0.5f) * (1.0f / 625); - - surfaceNormalHorizontal.x = this->surfaceNormal.x; - surfaceNormalHorizontal.y = 0.0f; - surfaceNormalHorizontal.z = this->surfaceNormal.z; - - // If player is standing on it or holding the edge - if (DynaPolyActor_IsPlayerOnTop(&this->dyna) && (playerCentroidDist > 3.0f)) { - Math_Vec3f_Diff(&playerCentroidDiff, &surfaceNormalHorizontal, &playerMoment); - BgSpot08Iceblock_MultVectorScalar(&playerMoment, &playerMoment, - (sInertias[rollDataIndex] * playerCentroidDist) / this->dyna.actor.scale.x); + Math_Vec3f_Diff(&player->actor.world.pos, &this->dyna.actor.world.pos, &spC8); + spC8.y -= 150.0f * this->dyna.actor.scale.y; + sp88 = Math3D_Vec3fMagnitude(&spC8); + spA4.x = (Rand_ZeroOne() - 0.5f) * 0.0016f; + spA4.y = 0.0f; + spA4.z = (Rand_ZeroOne() - 0.5f) * 0.0016f; + spD4.x = this->unk168.x; + spD4.y = 0.0f; + spD4.z = this->unk168.z; + if ((DynaPolyActor_IsPlayerOnTop(&this->dyna) != 0) && (sp88 > 3.0f)) { + Math_Vec3f_Diff(&spC8, &spD4, &spBC); + func_808B0BA8(&spBC, &spBC, (D_808B16C8[sp84] * sp88) / this->dyna.actor.scale.x); } else { - playerMoment = sZeroVector; + spBC = D_808B16BC; } - - BgSpot08Iceblock_MultVectorScalar(&surfaceNormalHorizontalScaled, &surfaceNormalHorizontal, -0.01f); - - // Add all three deviations - Math_Vec3f_Sum(&this->normalDelta, &playerMoment, &this->normalDelta); - Math_Vec3f_Sum(&this->normalDelta, &surfaceNormalHorizontalScaled, &this->normalDelta); - Math_Vec3f_Sum(&this->normalDelta, &randomNutation, &this->normalDelta); - - this->normalDelta.y = 0.0f; - - Math_Vec3f_Sum(&this->surfaceNormal, &this->normalDelta, &tempVec); - - tempVec.x *= sDampingFactors[rollDataIndex]; - tempVec.z *= sDampingFactors[rollDataIndex]; - - // Set up roll axis and final new angle - if (BgSpot08Iceblock_NormalizeVector(&this->surfaceNormal, &tempVec)) { - deviationFromVertSq = Math3D_Dist1DSq(this->surfaceNormal.z, this->surfaceNormal.x); - - // Prevent overrolling - if (sRollSins[rollDataIndex] < deviationFromVertSq) { - stabilityCorrection = sRollSins[rollDataIndex] / deviationFromVertSq; - - this->surfaceNormal.x *= stabilityCorrection; - this->surfaceNormal.y = sRollCoss[rollDataIndex]; - this->surfaceNormal.z *= stabilityCorrection; + func_808B0BA8(&spB0, &spD4, -0.01f); + Math_Vec3f_Sum(&this->unk174, &spBC, &this->unk174); + Math_Vec3f_Sum(&this->unk174, &spB0, &this->unk174); + Math_Vec3f_Sum(&this->unk174, &spA4, &this->unk174); + this->unk174.y = 0.0f; + Math_Vec3f_Sum(&this->unk168, &this->unk174, &sp98); + sp98.x *= D_808B16D4[sp84]; + sp98.z *= D_808B16D4[sp84]; + if (func_808B0C44(&this->unk168, &sp98)) { + temp_fv0_2 = Math3D_Dist1DSq(this->unk168.z, this->unk168.x); + if (D_808B16E0[sp84] < temp_fv0_2) { + temp_fv1 = D_808B16E0[sp84] / temp_fv0_2; + this->unk168.x *= temp_fv1; + this->unk168.y = D_808B16EC[sp84]; + this->unk168.z *= temp_fv1; } - - BgSpot08Iceblock_CrossProduct(&tempVec, &sVerticalVector, &this->surfaceNormal); - - if (BgSpot08Iceblock_NormalizeVector(&torqueDirection, &tempVec)) { - this->rotationAxis = torqueDirection; + func_808B0BD4(&sp98, &D_808B16B0, &this->unk168); + if (func_808B0C44(&sp8C, &sp98)) { + this->unk180 = sp8C; } } else { - this->surfaceNormal = sVerticalVector; + this->unk168 = D_808B16B0; } - - // Rotation by the angle between surfaceNormal and the vertical about rotationAxis - Matrix_RotateAxis(Math_FAcosF(Math3D_Cos(&sVerticalVector, &this->surfaceNormal)), &this->rotationAxis, - MTXMODE_NEW); + Matrix_RotateAxis(Math_FAcosF(Math3D_Cos(&D_808B16B0, &this->unk168)), &this->unk180, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_APPLY); - Matrix_Get(&mtx); - Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0); + Matrix_Get(&sp44); + Matrix_MtxFToYXZRotS(&sp44, &this->dyna.actor.shape.rot, 0); } -void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, PlayState* play) { +void func_808B1054(BgSpot08Iceblock* this, PlayState* play) { s32 pad[2]; - f32 sin; - f32 cos; - - sin = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; - cos = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; + f32 sp44; + f32 temp_fv1; + sp44 = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; + temp_fv1 = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; 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, 0x123); - - this->dyna.actor.world.pos.x += sin; - this->dyna.actor.world.pos.z += cos; + this->dyna.actor.world.pos.x += sp44; + this->dyna.actor.world.pos.z += temp_fv1; } else { - this->dyna.actor.world.pos.x -= sin; - this->dyna.actor.world.pos.z -= cos; + this->dyna.actor.world.pos.x -= sp44; + this->dyna.actor.world.pos.z -= temp_fv1; } - BgSpot08Iceblock_SetupFloatOrbitingTwins(this); + func_808B147C(this); } -static InitChainEntry sInitChain[] = { - ICHAIN_F32(cullingVolumeDistance, 3000, ICHAIN_CONTINUE), - ICHAIN_F32(cullingVolumeScale, 1000, ICHAIN_CONTINUE), - ICHAIN_F32(cullingVolumeDownward, 2200, ICHAIN_STOP), -}; - void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { + s32 pad; + CollisionHeader* var_a2; + s32 temp_v0_2; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; - CollisionHeader* colHeader; - - PRINTF(T("(spot08 流氷)(arg_data 0x%04x)\n", "(spot08 ice floe)(arg_data 0x%04x)\n"), this->dyna.actor.params); - BgSpot08Iceblock_CheckParams(this); + PRINTF("(spot08 流氷)(arg_data 0x%04x)\n", this->dyna.actor.params); + func_808B09F0(this); switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { case 0: - colHeader = &gZorasFountainIcebergCol; + var_a2 = &gZorasFountainIcebergCol; break; + case 0x200: - colHeader = &gZorasFountainIceRampCol; + var_a2 = &gZorasFountainIceRampCol; break; } - - 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); - break; - default: - BgSpot08Iceblock_InitDynaPoly(this, play, colHeader, 0); - break; + temp_v0_2 = PARAMS_GET_U(this->dyna.actor.params, 0, 4); + if ((temp_v0_2 == 2) || (temp_v0_2 == 3)) { + func_808B0968(this, play, var_a2, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); + } else { + func_808B0968(this, play, var_a2, 0); } - if (LINK_AGE_IN_YEARS == YEARS_CHILD) { Actor_Kill(&this->dyna.actor); return; } - - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - + Actor_ProcessInitChain(&this->dyna.actor, D_808B16F8); switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) { case 0: Actor_SetScale(&this->dyna.actor, 0.2f); break; + case 0x10: Actor_SetScale(&this->dyna.actor, 0.1f); break; + case 0x20: Actor_SetScale(&this->dyna.actor, 0.05f); break; } - - this->bobPhaseSlow = (s32)(Rand_ZeroOne() * (0xFFFF + 0.5f)); - this->bobPhaseFast = (s32)(Rand_ZeroOne() * (0xFFFF + 0.5f)); - this->surfaceNormal.y = 1.0f; - this->rotationAxis.x = 1.0f; - + this->unk18C = (s16)(s32)(Rand_ZeroOne() * 65535.5f); + this->unk18E = (s16)(s32)(Rand_ZeroOne() * 65535.5f); + this->unk168.y = 1.0f; + this->unk180.x = 1.0f; switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case 0: case 1: - BgSpot08Iceblock_SetupFloatNonrotating(this); + func_808B1388(this); break; + case 2: - BgSpot08Iceblock_SetupFloatRotating(this); + func_808B13FC(this); break; + case 3: - BgSpot08Iceblock_SpawnTwinFloe(this, play); + func_808B1054(this, play); break; case 4: - BgSpot08Iceblock_SetupNoAction(this); + func_808B1574(this); + break; + + default: break; } } @@ -369,93 +332,87 @@ void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void BgSpot08Iceblock_SetupFloatNonrotating(BgSpot08Iceblock* this) { - BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatNonrotating); +void func_808B1388(BgSpot08Iceblock* this) { + func_808B0960(this, func_808B13AC); } -void BgSpot08Iceblock_FloatNonrotating(BgSpot08Iceblock* this, PlayState* play) { - BgSpot08Iceblock_Bobbing(this); - BgSpot08Iceblock_SinkUnderPlayer(this); - BgSpot08Iceblock_SetWaterline(this); +void func_808B13AC(BgSpot08Iceblock* this, PlayState* play) { + func_808B0A84(this); + func_808B0AE0(this); + func_808B0B8C(this); this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - BgSpot08Iceblock_Roll(this, play); + func_808B0CE0(this, play); } -void BgSpot08Iceblock_SetupFloatRotating(BgSpot08Iceblock* this) { - BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatRotating); +void func_808B13FC(BgSpot08Iceblock* this) { + func_808B0960(this, func_808B1420); } -void BgSpot08Iceblock_FloatRotating(BgSpot08Iceblock* this, PlayState* play) { - BgSpot08Iceblock_Bobbing(this); - BgSpot08Iceblock_SinkUnderPlayer(this); - BgSpot08Iceblock_SetWaterline(this); +void func_808B1420(BgSpot08Iceblock* this, PlayState* play) { + func_808B0A84(this); + func_808B0AE0(this); + func_808B0B8C(this); this->dyna.actor.world.rot.y += 0x190; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; - BgSpot08Iceblock_Roll(this, play); + func_808B0CE0(this, play); } -void BgSpot08Iceblock_SetupFloatOrbitingTwins(BgSpot08Iceblock* this) { - BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_FloatOrbitingTwins); +void func_808B147C(BgSpot08Iceblock* this) { + func_808B0960(this, func_808B14A0); } -void BgSpot08Iceblock_FloatOrbitingTwins(BgSpot08Iceblock* this, PlayState* play) { - f32 cos; - f32 sin; - - BgSpot08Iceblock_Bobbing(this); - BgSpot08Iceblock_SinkUnderPlayer(this); - BgSpot08Iceblock_SetWaterline(this); +void func_808B14A0(BgSpot08Iceblock* this, PlayState* play) { + f32 temp_fa0; + f32 temp_fv1; - // parent handles rotations of both + func_808B0A84(this); + func_808B0AE0(this); + func_808B0B8C(this); 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; - - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + sin; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + cos; - + temp_fv1 = Math_SinS(this->dyna.actor.world.rot.y) * 100.0f; + temp_fa0 = Math_CosS(this->dyna.actor.world.rot.y) * 100.0f; + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + temp_fv1; + this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp_fa0; if (this->dyna.actor.child != NULL) { - this->dyna.actor.child->world.pos.x = this->dyna.actor.home.pos.x - sin; - this->dyna.actor.child->world.pos.z = this->dyna.actor.home.pos.z - cos; + this->dyna.actor.child->world.pos.x = this->dyna.actor.home.pos.x - temp_fv1; + this->dyna.actor.child->world.pos.z = this->dyna.actor.home.pos.z - temp_fa0; } } - this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - BgSpot08Iceblock_Roll(this, play); + func_808B0CE0(this, play); } -void BgSpot08Iceblock_SetupNoAction(BgSpot08Iceblock* this) { - BgSpot08Iceblock_SetupAction(this, NULL); +void func_808B1574(BgSpot08Iceblock* this) { + func_808B0960(this, NULL); } void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; if (Rand_ZeroOne() < 0.05f) { - this->bobIncrSlow = Rand_S16Offset(300, 100); - this->bobIncrFast = Rand_S16Offset(800, 400); + this->unk190 = Rand_S16Offset(0x12C, 0x64); + this->unk192 = Rand_S16Offset(0x320, 0x190); } - - this->bobPhaseSlow += this->bobIncrSlow; - this->bobPhaseFast += this->bobIncrFast; - if (this->actionFunc != NULL) { - this->actionFunc(this, play); + this->unk18C += this->unk190; + this->unk18E += this->unk192; + if (this->unk164 != NULL) { + this->unk164(this, play); } } void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play) { - Gfx* dList; + Gfx* sp1C; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { - case 0: - dList = gZorasFountainIcebergDL; + case 0x0: + sp1C = gZorasFountainIcebergDL; break; + case 0x200: - dList = gZorasFountainIceRampDL; + sp1C = gZorasFountainIceRampDL; break; } - - Gfx_DrawDListOpa(play, dList); + Gfx_DrawDListOpa(play, sp1C); } diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h index 45c5976f37a..fc7e0f7061d 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h @@ -6,47 +6,18 @@ struct BgSpot08Iceblock; -typedef void (*BgSpot08IceblockActionFunc)(struct BgSpot08Iceblock*, struct PlayState*); - typedef struct BgSpot08Iceblock { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ BgSpot08IceblockActionFunc actionFunc; - /* 0x0168 */ Vec3f surfaceNormal; - /* 0x0170 */ Vec3f normalDelta; // y always 0 - /* 0x0180 */ Vec3f rotationAxis; - /* 0x018C */ s16 bobPhaseSlow; - /* 0x018E */ s16 bobPhaseFast; - /* 0x0190 */ s16 bobIncrSlow; - /* 0x0192 */ s16 bobIncrFast; - /* 0x0194 */ f32 sinkOffset; - /* 0x0198 */ f32 bobOffset; -} BgSpot08Iceblock; // size = 0x019C - -// Params -/** - * 0x200: Shape - * 0x200 is the ice ramp where Jabu is as child - */ - -/** - * 0x100: Twins - * 0x100 is the spawned twin platform - */ - -/** - * 0xF0: Size - * 0x00 is large - * 0x10 is medium - * 0x20 is small - */ - -/** - * 0xF: Action - * 0 Floating, nonrotating - * 1 same as 0, but does not roll as much (?) - * 2 Floating, rotating - * 3 Floating orbiting twins - * 4 Completely static, does nothing - */ + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ void (*unk164)(struct BgSpot08Iceblock*, struct PlayState*); + /* 0x168 */ Vec3f unk168; + /* 0x174 */ Vec3f unk174; + /* 0x180 */ Vec3f unk180; + /* 0x18C */ s16 unk18C; + /* 0x18E */ s16 unk18E; + /* 0x190 */ s16 unk190; + /* 0x192 */ s16 unk192; + /* 0x194 */ f32 unk194; + /* 0x198 */ f32 unk198; +} BgSpot08Iceblock; // size = 0x19C #endif diff --git a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c index 2d467c253bc..679e966a7eb 100644 --- a/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot09_Obj/z_bg_spot09_obj.c @@ -69,15 +69,16 @@ static Gfx* sDLists[] = { s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) { s32 carpentersRescued; + Actor* thisx = &this->dyna.actor; if (IS_CUTSCENE_LAYER) { - return this->dyna.actor.params == BG_SPOT09_OBJ_BRIDGE_SIDES; + return thisx->params == BG_SPOT09_OBJ_BRIDGE_SIDES; } carpentersRescued = GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED(); if (LINK_AGE_IN_YEARS == YEARS_ADULT) { - switch (this->dyna.actor.params) { + switch (thisx->params) { case BG_SPOT09_OBJ_BRIDGE_SIDES: return false; case BG_SPOT09_OBJ_BRIDGE_BROKEN: @@ -88,32 +89,34 @@ s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) { return true; } } else { - return this->dyna.actor.params == BG_SPOT09_OBJ_BRIDGE_CHILD; + return thisx->params == BG_SPOT09_OBJ_BRIDGE_CHILD; } return false; } s32 func_808B1BA0(BgSpot09Obj* this, PlayState* play) { - if (this->dyna.actor.params == BG_SPOT09_OBJ_TENT) { - Actor_SetScale(&this->dyna.actor, 0.1f); + Actor* thisx = &this->dyna.actor; + + if (thisx->params == BG_SPOT09_OBJ_TENT) { + Actor_SetScale(thisx, 0.1f); } else { - Actor_SetScale(&this->dyna.actor, 1.0f); + Actor_SetScale(thisx, 1.0f); } return 1; } s32 func_808B1BEC(BgSpot09Obj* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->dyna.actor; CollisionHeader* colHeader = NULL; - s32 pad2[2]; + s32 pad[2]; - if (D_808B1F90[this->dyna.actor.params] != NULL) { + if (D_808B1F90[thisx->params] != NULL) { DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(D_808B1F90[this->dyna.actor.params], &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + CollisionHeader_GetVirtual(D_808B1F90[thisx->params], &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); } - return true; + return 1; } s32 func_808B1C70(BgSpot09Obj* this, PlayState* play) { @@ -121,20 +124,20 @@ s32 func_808B1C70(BgSpot09Obj* this, PlayState* play) { for (i = 0; i < ARRAY_COUNT(D_808B1FA4); i++) { if (!D_808B1FA4[i](this, play)) { - return false; + return 0; } } - return true; + return 1; } s32 func_808B1CEC(BgSpot09Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain1); - return true; + return 1; } s32 func_808B1D18(BgSpot09Obj* this, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain2); - return true; + return 1; } s32 func_808B1D44(BgSpot09Obj* this, PlayState* play) { @@ -148,20 +151,18 @@ s32 func_808B1D44(BgSpot09Obj* this, PlayState* play) { void BgSpot09Obj_Init(Actor* thisx, PlayState* play) { BgSpot09Obj* this = (BgSpot09Obj*)thisx; - PRINTF(T("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", - "Spot09 Object [arg_data : 0x%04x](Carpenter Rescue Flag 0x%x)\n"), - this->dyna.actor.params, GET_EVENTCHKINF_CARPENTERS_RESCUED_FLAGS()); - this->dyna.actor.params &= 0xFF; - if ((this->dyna.actor.params < 0) || (this->dyna.actor.params >= BG_SPOT09_OBJ_MAX)) { - PRINTF(T("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", - "Error : Spot 09 object arg_data cannot be determined (%s %d)(arg_data 0x%04x)\n"), - "../z_bg_spot09_obj.c", 322, this->dyna.actor.params); + PRINTF("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", thisx->params, + GET_EVENTCHKINF_CARPENTERS_RESCUED_FLAGS()); + thisx->params &= 0xFF; + if ((thisx->params < 0) || (thisx->params >= BG_SPOT09_OBJ_MAX)) { + PRINTF("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot09_obj.c", + 322, thisx->params); } if (!func_808B1C70(this, play)) { - Actor_Kill(&this->dyna.actor); + Actor_Kill(thisx); } else if (!func_808B1D44(this, play)) { - Actor_Kill(&this->dyna.actor); + Actor_Kill(thisx); } } @@ -169,7 +170,7 @@ void BgSpot09Obj_Destroy(Actor* thisx, PlayState* play) { DynaCollisionContext* dynaColCtx = &play->colCtx.dyna; BgSpot09Obj* this = (BgSpot09Obj*)thisx; - if (this->dyna.actor.params != BG_SPOT09_OBJ_BRIDGE_SIDES) { + if (thisx->params != BG_SPOT09_OBJ_BRIDGE_SIDES) { DynaPoly_DeleteBgActor(play, dynaColCtx, this->dyna.bgId); } } 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 f6eae417334..87b1571bc1a 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 @@ -1,6 +1,6 @@ /* * File: z_bg_spot12_gate.c - * Overlay: ovl_Bg_Spot12_Gate + * Overlay: Bg_Spot12_Gate * Description: Haunted Wasteland Gate */ @@ -52,21 +52,20 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDownward, 1200, ICHAIN_STOP), }; -void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) { - s32 pad; +void func_808B2F90(BgSpot12Gate* this, PlayState* play, CollisionHeader* collision, s32 flags) { + Actor* thisx = &this->dyna.actor; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); #if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { - s32 pad2; + s32 pad[2]; - PRINTF(T("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", - "Warning : move BG registration failed (%s %d)(name %d)(arg_data 0x%04x)\n"), - "../z_bg_spot12_gate.c", 145, this->dyna.actor.id, this->dyna.actor.params); + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_gate.c", 145, thisx->id, + thisx->params); } #endif } @@ -74,10 +73,10 @@ void BgSpot12Gate_InitDynaPoly(BgSpot12Gate* this, PlayState* play, CollisionHea void BgSpot12Gate_Init(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; - BgSpot12Gate_InitDynaPoly(this, play, &gGerudoFortressWastelandGateCol, 0); - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + func_808B2F90(this, play, &gGerudoFortressWastelandGateCol, 0); + Actor_ProcessInitChain(thisx, sInitChain); - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { func_808B3274(this); } else { func_808B30C0(this); @@ -91,20 +90,24 @@ void BgSpot12Gate_Destroy(Actor* thisx, PlayState* play) { } void func_808B30C0(BgSpot12Gate* this) { + Actor* thisx = &this->dyna.actor; + this->actionFunc = func_808B30D8; - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; + thisx->world.pos.y = thisx->home.pos.y; } void func_808B30D8(BgSpot12Gate* this, PlayState* play) { - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { + Actor* thisx = &this->dyna.actor; + + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { func_808B3134(this); - OnePointCutscene_Init(play, 4160, -99, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(play, 4160, -99, thisx, CAM_ID_MAIN); } } void func_808B3134(BgSpot12Gate* this) { this->actionFunc = func_808B314C; - this->unk_168 = 40; + this->unk_168 = 0x28; } void func_808B314C(BgSpot12Gate* this, PlayState* play) { @@ -118,11 +121,10 @@ void func_808B317C(BgSpot12Gate* this) { } void func_808B318C(BgSpot12Gate* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->dyna.actor; - Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f); - if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, - this->dyna.actor.velocity.y)) { + Math_StepToF(&thisx->velocity.y, 1.6f, 0.03f); + if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y + 200.0f, thisx->velocity.y)) { func_808B3274(this); { @@ -133,15 +135,17 @@ void func_808B318C(BgSpot12Gate* this, PlayState* play) { Quake_SetDuration(quakeIndex, 12); } - Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); + Actor_PlaySfx(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); } else { - Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); + Actor_PlaySfx_Flagged(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); } } void func_808B3274(BgSpot12Gate* this) { + Actor* thisx = &this->dyna.actor; + this->actionFunc = func_808B3298; - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 200.0f; + thisx->world.pos.y = thisx->home.pos.y + 200.0f; } void func_808B3298(BgSpot12Gate* this, PlayState* play) { @@ -151,7 +155,7 @@ void BgSpot12Gate_Update(Actor* thisx, PlayState* play) { BgSpot12Gate* this = (BgSpot12Gate*)thisx; if (this->unk_168 > 0) { - this->unk_168--; + this->unk_168 -= 1; } this->actionFunc(this, play); } 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 71674bc12b3..2fc27c7fbf7 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 @@ -1,6 +1,6 @@ /* * File: z_bg_spot12_saku.c - * Overlay: ovl_Bg_Spot12_Saku + * Overlay: Bg_Spot12_Saku * Description: */ @@ -50,20 +50,19 @@ static InitChainEntry sInitChain[] = { }; void func_808B3420(BgSpot12Saku* this, PlayState* play, CollisionHeader* collision, s32 flags) { - s32 pad; + Actor* thisx = &this->dyna.actor; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, flags); CollisionHeader_GetVirtual(collision, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); #if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { - s32 pad2; + s32 pad[2]; - PRINTF(T("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", - "Warning : move BG registration failed (%s %d)(name %d)(arg_data 0x%04x)\n"), - "../z_bg_spot12_saku.c", 140, this->dyna.actor.id, this->dyna.actor.params); + PRINTF("Warning : move BG 登録失敗(%s %d)(name %d)(arg_data 0x%04x)\n", "../z_bg_spot12_saku.c", 140, thisx->id, + thisx->params); } #endif } @@ -72,8 +71,8 @@ void BgSpot12Saku_Init(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; func_808B3420(this, play, &gGerudoFortressGTGShutterCol, 0); - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { + Actor_ProcessInitChain(thisx, sInitChain); + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { func_808B3714(this); } else { func_808B3550(this); @@ -87,22 +86,26 @@ void BgSpot12Saku_Destroy(Actor* thisx, PlayState* play) { } void func_808B3550(BgSpot12Saku* this) { + Actor* thisx = &this->dyna.actor; + this->actionFunc = func_808B357C; - this->dyna.actor.scale.x = 0.1f; - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; + thisx->scale.x = 0.1f; + thisx->world.pos.x = thisx->home.pos.x; + thisx->world.pos.z = thisx->home.pos.z; } void func_808B357C(BgSpot12Saku* this, PlayState* play) { - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { + Actor* thisx = &this->dyna.actor; + + if (Flags_GetSwitch(play, PARAMS_GET_U(thisx->params, 0, 6))) { func_808B35E4(this); - this->timer = 20; - OnePointCutscene_Init(play, 4170, -99, &this->dyna.actor, CAM_ID_MAIN); + this->unk_168 = 0x14; + OnePointCutscene_Init(play, 4170, -99, thisx, CAM_ID_MAIN); } } void func_808B35E4(BgSpot12Saku* this) { - if (this->timer == 0) { + if (this->unk_168 == 0) { this->actionFunc = func_808B3604; } } @@ -124,12 +127,12 @@ void func_808B3604(BgSpot12Saku* this, PlayState* play) { } void func_808B3714(BgSpot12Saku* this) { + Actor* thisx = &this->dyna.actor; + this->actionFunc = func_808B37AC; - this->dyna.actor.scale.x = 0.001f / 0.14f; - this->dyna.actor.world.pos.x = - this->dyna.actor.home.pos.x - (Math_SinS(this->dyna.actor.shape.rot.y + 0x4000) * 78.0f); - this->dyna.actor.world.pos.z = - this->dyna.actor.home.pos.z - (Math_CosS(this->dyna.actor.shape.rot.y + 0x4000) * 78.0f); + thisx->scale.x = 0.001f / 0.14f; + thisx->world.pos.x = thisx->home.pos.x - (Math_SinS(thisx->shape.rot.y + 0x4000) * 78.0f); + thisx->world.pos.z = thisx->home.pos.z - (Math_CosS(thisx->shape.rot.y + 0x4000) * 78.0f); } void func_808B37AC(BgSpot12Saku* this, PlayState* play) { @@ -138,8 +141,8 @@ void func_808B37AC(BgSpot12Saku* this, PlayState* play) { void BgSpot12Saku_Update(Actor* thisx, PlayState* play) { BgSpot12Saku* this = (BgSpot12Saku*)thisx; - if (this->timer > 0) { - this->timer--; + if (this->unk_168 > 0) { + this->unk_168 -= 1; } this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h index 6c37ec6d977..3f42607a596 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.h @@ -11,7 +11,7 @@ typedef void (*BgSpot12SakuActionFunc)(struct BgSpot12Saku*, struct PlayState*); typedef struct BgSpot12Saku { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgSpot12SakuActionFunc actionFunc; - /* 0x0168 */ s16 timer; + /* 0x0168 */ s16 unk_168; } BgSpot12Saku; // size = 0x016C #endif 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 650cc50723d..fbfbeead090 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_spot15_rrbox.c - * Overlay: ovl_Bg_Spot15_Rrbox - * Description: Milk Crate - */ - #include "z_bg_spot15_rrbox.h" #include "array_count.h" @@ -99,9 +93,8 @@ void func_808B3A34(BgSpot15Rrbox* this) { s32 func_808B3A40(BgSpot15Rrbox* this, PlayState* play) { DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->bgId); - if ((dynaPolyActor != NULL) && - Math3D_Dist2DSq(dynaPolyActor->actor.world.pos.x, dynaPolyActor->actor.world.pos.z, - this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z) < 0.01f) { + if (dynaPolyActor != NULL && Math3D_Dist2DSq(dynaPolyActor->actor.world.pos.x, dynaPolyActor->actor.world.pos.z, + this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z) < 0.01f) { return true; } return false; @@ -333,10 +326,9 @@ void func_808B43D0(BgSpot15Rrbox* this, PlayState* play) { Actor_MoveXZGravity(actor); - if (actor->world.pos.y <= BGCHECK_Y_MIN + 10.0f) { - PRINTF(T("Warning : ロンロン木箱落ちすぎた(%s %d)(arg_data 0x%04x)\n", - "Warning : Lon Lon Wooden Box fell too far (%s %d)(arg_data 0x%04x)\n"), - "../z_bg_spot15_rrbox.c", 599, actor->params); + if (actor->world.pos.y <= -31990.0f) { + PRINTF("Warning : ロンロン木箱落ちすぎた(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot15_rrbox.c", 599, + actor->params); Actor_Kill(actor); diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c index a95f92eba94..ce528e7320b 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.c @@ -39,22 +39,21 @@ ActorProfile Bg_Spot15_Saku_Profile = { }; void BgSpot15Saku_Init(Actor* thisx, PlayState* play) { - s32 pad; BgSpot15Saku* this = (BgSpot15Saku*)thisx; - s32 pad2; + s32 pad[2]; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gLonLonCorralFenceCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->dyna.actor.scale.x = 0.1f; - this->dyna.actor.scale.y = 0.1f; - this->dyna.actor.scale.z = 0.1f; - this->unk_170.x = this->dyna.actor.world.pos.x; - this->unk_170.y = this->dyna.actor.world.pos.y; - this->unk_170.z = this->dyna.actor.world.pos.z; + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + thisx->scale.x = 0.1f; + thisx->scale.y = 0.1f; + thisx->scale.z = 0.1f; + this->unk_170 = thisx->world.pos.x; + this->unk_174 = thisx->world.pos.y; + this->unk_178 = thisx->world.pos.z; if (GET_INFTABLE(INFTABLE_71)) { - this->dyna.actor.world.pos.z = 2659.0f; + thisx->world.pos.z = 2659.0f; } this->actionFunc = func_808B4930; } @@ -67,25 +66,26 @@ void BgSpot15Saku_Destroy(Actor* thisx, PlayState* play) { void func_808B4930(BgSpot15Saku* this, PlayState* play) { if (this->unk_168 && !GET_INFTABLE(INFTABLE_71)) { - this->timer = 2; + this->unk_17C = 2; this->actionFunc = func_808B4978; } } void func_808B4978(BgSpot15Saku* this, PlayState* play) { - if (this->timer == 0) { - Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); - this->dyna.actor.world.pos.z -= 2.0f; - if (this->dyna.actor.world.pos.z < 2660.0f) { - Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP); - this->timer = 30; + Actor* thisx = &this->dyna.actor; + if (!this->unk_17C) { + Actor_PlaySfx(thisx, NA_SE_EV_METALGATE_OPEN - SFX_FLAG); + thisx->world.pos.z -= 2.0f; + if (thisx->world.pos.z < 2660.0f) { + Actor_PlaySfx(thisx, NA_SE_EV_BRIDGE_OPEN_STOP); + this->unk_17C = 0x1E; this->actionFunc = func_808B4A04; } } } void func_808B4A04(BgSpot15Saku* this, PlayState* play) { - if (this->timer == 0) { + if (!this->unk_17C) { this->unk_168 = 0; this->actionFunc = func_808B4930; } @@ -94,10 +94,7 @@ void func_808B4A04(BgSpot15Saku* this, PlayState* play) { void BgSpot15Saku_Update(Actor* thisx, PlayState* play) { BgSpot15Saku* this = (BgSpot15Saku*)thisx; - if (this->timer != 0) { - this->timer--; - } - + DECR(this->unk_17C); this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h index 61118043184..a51214e393c 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h +++ b/src/overlays/actors/ovl_Bg_Spot15_Saku/z_bg_spot15_saku.h @@ -12,8 +12,10 @@ typedef struct BgSpot15Saku { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgSpot15SakuActionFunc actionFunc; /* 0x0168 */ u64 unk_168; - /* 0x0170 */ Vec3f unk_170; - /* 0x017C */ s16 timer; + /* 0x0170 */ f32 unk_170; + /* 0x0174 */ f32 unk_174; + /* 0x0174 */ f32 unk_178; + /* 0x017C */ s16 unk_17C; } BgSpot15Saku; // size = 0x0180 #endif 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 e30db9ba20d..e5a6cc8c2c7 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 @@ -322,7 +322,7 @@ void func_808B5240(BgSpot16Bombstone* this, PlayState* play) { if (1) {} while (true) { - if ((u32)this->unk_158 >= ARRAY_COUNTU(D_808B5EB0) || this->unk_154 < D_808B5EB0[this->unk_158][0]) { + if (this->unk_158 >= ARRAY_COUNTU(D_808B5EB0) || this->unk_154 < D_808B5EB0[this->unk_158][0]) { break; } 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 0fb4bc98429..778e4ff3ec6 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 @@ -150,37 +150,36 @@ static InitChainEntry sInitChain[] = { }; void BgSpot18Basket_Init(Actor* thisx, PlayState* play) { - s32 pad; BgSpot18Basket* this = (BgSpot18Basket*)thisx; + Actor* actor = &this->dyna.actor; CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); BgSpot18Basket_InitColliderJntSph(&this->dyna.actor, play); CollisionHeader_GetVirtual(&gGoronCityVaseCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, actor, colHeader); - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); - ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); - this->dyna.actor.home.pos.y += 0.01f; - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; + Actor_ProcessInitChain(actor, sInitChain); + ActorShape_Init(&actor->shape, 0.0f, ActorShadow_DrawCircle, 15.0f); + actor->home.pos.y += 0.01f; + actor->world.pos.y = actor->home.pos.y; - if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 8, 6))) { + if (Flags_GetSwitch(play, PARAMS_GET_U(actor->params, 8, 6))) { BgSpot18Basket_SetupSpinning(this); return; } BgSpot18Basket_SetupInactive(this); - Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_BG_SPOT18_FUTA, this->dyna.actor.world.pos.x, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, - this->dyna.actor.shape.rot.y + 0x1555, this->dyna.actor.shape.rot.z, -1); + Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_BG_SPOT18_FUTA, actor->world.pos.x, actor->world.pos.y, + actor->world.pos.z, actor->shape.rot.x, actor->shape.rot.y + 0x1555, actor->shape.rot.z, -1); - if (this->dyna.actor.child == NULL) { + if (actor->child == NULL) { PRINTF_COLOR_RED(); PRINTF(T("Error : 変化壷蓋発生失敗(%s %d)\n", "Error : Failed to spawn the change pot cover (%s %d)\n"), "../z_bg_spot18_basket.c", 351); PRINTF_RST(); - Actor_Kill(&this->dyna.actor); + Actor_Kill(actor); } } @@ -448,13 +447,13 @@ void BgSpot18Basket_GivingPrize(BgSpot18Basket* this, PlayState* play) { } void BgSpot18Basket_Update(Actor* thisx, PlayState* play) { - s32 pad; BgSpot18Basket* this = (BgSpot18Basket*)thisx; - s32 bgId; + s32 pad; + s32 temp; this->timer++; this->actionFunc(this, play); - this->dyna.actor.floorHeight = BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, + this->dyna.actor.floorHeight = BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &temp, &this->dyna.actor, &this->dyna.actor.world.pos); if (this->actionFunc != BgSpot18Basket_Inactive) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); diff --git a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h index a24b60f0939..376eb48f862 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h +++ b/src/overlays/actors/ovl_Bg_Spot18_Futa/z_bg_spot18_futa.h @@ -9,4 +9,5 @@ struct BgSpot18Futa; typedef struct BgSpot18Futa { /* 0x0000 */ DynaPolyActor dyna; } BgSpot18Futa; // size = 0x0164 + #endif 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 e5ebde92cf9..6d9bd99d114 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 @@ -1,7 +1,7 @@ /* * File: z_bg_spot18_obj.c - * Overlay: ovl_Bg_Spot18_Obj + * Overlay: Bg_Spot18_Obj * Description: */ 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 f11e24ef523..0b6dadc4392 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 @@ -1,9 +1,3 @@ -/* - * File: z_bg_toki_hikari.c - * Overlay: ovl_Toki_Hikari - * Description: Temple of Time Windows - */ - #include "z_bg_toki_hikari.h" #include "gfx.h" @@ -22,7 +16,7 @@ void BgTokiHikari_Destroy(Actor* thisx, PlayState* play); void BgTokiHikari_Update(Actor* thisx, PlayState* play); void BgTokiHikari_Draw(Actor* thisx, PlayState* play); -void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play); +void func_808B9F98(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); @@ -41,144 +35,136 @@ ActorProfile Bg_Toki_Hikari_Profile = { /**/ BgTokiHikari_Draw, }; -static InitChainEntry sInitChain[] = { +static InitChainEntry D_808BAC70[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; void BgTokiHikari_Init(Actor* thisx, PlayState* play) { + s16 temp_v0; BgTokiHikari* this = (BgTokiHikari*)thisx; - switch (this->actor.params) { + temp_v0 = this->actor.params; + switch (temp_v0) { /* irregular */ case 0: - Actor_ProcessInitChain(&this->actor, sInitChain); - this->actionFunc = BgTokiHikari_DoNothing; - break; + Actor_ProcessInitChain(&this->actor, D_808BAC70); + this->unk150 = func_808B9F98; + return; case 1: if (!GET_EVENTCHKINF(EVENTCHKINF_OPENED_DOOR_OF_TIME)) { - this->actionFunc = func_808BA204; - this->unk_14C = 0.0f; - } else { - Actor_Kill(&this->actor); + this->unk150 = func_808BA204; + this->unk14C = 0.0f; + return; } - break; + Actor_Kill(&this->actor); + return; } } void BgTokiHikari_Destroy(Actor* thisx, PlayState* play) { + BgTokiHikari* this = (BgTokiHikari*)thisx; } -void BgTokiHikari_DoNothing(BgTokiHikari* this, PlayState* play) { +void func_808B9F98(BgTokiHikari* this, PlayState* play) { } void BgTokiHikari_Update(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; - this->actionFunc(this, play); + this->unk150(this, play); } void BgTokiHikari_Draw(Actor* thisx, PlayState* play) { switch (thisx->params) { case 0: func_808BA018(thisx, play); - break; + return; case 1: func_808BA2CC(thisx, play); - break; + return; } } void func_808BA018(Actor* thisx, PlayState* play) { PlayState* play2 = (PlayState*)play; - OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 246); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0xF6); Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 252); - - if (LINK_IS_ADULT) { + if (gSaveContext.save.linkAge == 0) { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_008190); } 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, play2->gameplayFrames % 128, 64, 32)); - - gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, play2->gameplayFrames % 128, 64, 32)); - + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, 0U, play2->gameplayFrames & 0x7F, 0x40, 0x20)); + gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0U, play2->gameplayFrames & 0x7F, 0x40, 0x20)); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 278); - gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_007EE0); } - CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 284); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0x11C); } void func_808BA204(BgTokiHikari* this, PlayState* play) { if (play->roomCtx.drawParams[1] != 0) { - this->actionFunc = func_808BA22C; + this->unk150 = func_808BA22C; } } void func_808BA22C(BgTokiHikari* this, PlayState* play) { - if (this->unk_14C < 1.0f) { - this->unk_14C += 0.05f; - } else { - this->unk_14C = 1.0f; - this->actionFunc = func_808BA274; + f32 temp_fv0; + + temp_fv0 = this->unk14C; + if (temp_fv0 < 1.0f) { + this->unk14C = temp_fv0 + 0.05f; + return; } + this->unk14C = 1.0f; + this->unk150 = func_808BA274; } void func_808BA274(BgTokiHikari* this, PlayState* play) { - if (this->unk_14C > 0.2f) { - this->unk_14C -= 0.025f; - } else { - this->unk_14C = 0.0f; - Actor_Kill(&this->actor); + if (this->unk14C > 0.2f) { + this->unk14C -= 0.025f; + return; } + this->unk14C = 0.0f; + Actor_Kill(&this->actor); } 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); - Matrix_Scale(0.32f, 0.32f, this->unk_14C * 7.0f, MTXMODE_APPLY); - Matrix_RotateZ(M_PI, MTXMODE_APPLY); + OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0x15E); + Matrix_Translate(0.0f, 276.0f, 1122.0f, 0U); + Matrix_Scale(0.32f, 0.32f, this->unk14C * 7.0f, 1U); + Matrix_RotateZ(3.1415927f, 1U); Gfx_SetupDL_25Opa(play->state.gfxCtx); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, this->unk_14C * 255.0f, (u8)(155.0f * this->unk_14C) + 100, - this->unk_14C * 255.0f, this->unk_14C * 255.0f); - - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 155.0f) + 100, (u8)(255.0f * this->unk_14C), 0, 128); - + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, (u8)(this->unk14C * 255.0f), (u8)(155.0f * this->unk14C) + 100, + (u8)(this->unk14C * 255.0f), (u8)(this->unk14C * 255.0f)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk14C * 155.0f) + 100, (u8)(255.0f * this->unk14C), 0, 128); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 382); - - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, -2 * (play->gameplayFrames & 0x7F), 0, 0x20, 0x40, - 1, (play->gameplayFrames & 0x7F) * 4, 0, 0x20, 0x40)); - + gSPSegment(POLY_XLU_DISP++, 8, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (play->gameplayFrames & 0x7F) * -2, 0U, 0x20, 0x40, + 1, (play->gameplayFrames & 0x7F) * 4, 0U, 0x20, 0x40)); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_000880); Matrix_Pop(); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(this->unk_14C * 200.0f)); - - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 255.0f), (u8)(this->unk_14C * 255.0f), - (u8)(this->unk_14C * 255.0f), (u8)(200.0f * this->unk_14C)); - + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, (u8)(this->unk14C * 200.0f)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk14C * 255.0f), (u8)(this->unk14C * 255.0f), + (u8)(this->unk14C * 255.0f), (u8)(200.0f * this->unk14C)); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 415); - gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_0009C0); Matrix_Pop(); Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (u8)(this->unk_14C * 200.0f)); - - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk_14C * 255.0f), (u8)(this->unk_14C * 255.0f), - (u8)(this->unk_14C * 255.0f), (u8)(200.0f * this->unk_14C)); - + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, (u8)(this->unk14C * 200.0f)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk14C * 255.0f), (u8)(this->unk14C * 255.0f), + (u8)(this->unk14C * 255.0f), (u8)(200.0f * this->unk14C)); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 437); - gSPDisplayList(POLY_XLU_DISP++, &object_toki_objects_DL_0009C0[10]); Matrix_Pop(); - CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 443); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0x1BB); } diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h index 62f668f842d..250e891629c 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h @@ -6,12 +6,10 @@ struct BgTokiHikari; -typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, struct PlayState*); - typedef struct BgTokiHikari { - /* 0x0000 */ Actor actor; - /* 0x014C */ f32 unk_14C; - /* 0x0150 */ BgTokiHikariActionFunc actionFunc; -} BgTokiHikari; // size = 0x0154 + /* 0x000 */ Actor actor; + /* 0x14C */ f32 unk14C; + /* 0x150 */ void (*unk150)(struct BgTokiHikari*, struct PlayState*); +} BgTokiHikari; // size = 0x154 #endif diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 5a2fe183ed2..9527be9cc26 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -47,30 +47,28 @@ ActorProfile Bg_Toki_Swd_Profile = { /**/ BgTokiSwd_Draw, }; -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1 | OC2_UNK1, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_NONE, - OCELEM_ON, - }, - { 10, 70, 0, { 0, 0, 0 } }, -}; +static ColliderCylinderInit sCylinderInit = { { + COL_MATERIAL_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1 | OC2_UNK1, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0xFFCFFFFF, 0x00, 0x00 }, + { 0xFFCFFFFF, 0x00, 0x00 }, + ATELEM_NONE, + ACELEM_NONE, + OCELEM_ON, + }, + { 10, 70, 0, { 0 } } }; static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_IMMOVABLE }; static InitChainEntry sInitChain[] = { - ICHAIN_VEC3F_DIV1000(scale, 25, ICHAIN_STOP), + ICHAIN_VEC3F_DIV1000(scale, 0x19, ICHAIN_STOP), }; void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) { @@ -78,15 +76,15 @@ void BgTokiSwd_SetupAction(BgTokiSwd* this, BgTokiSwdActionFunc actionFunc) { } void BgTokiSwd_Init(Actor* thisx, PlayState* play) { - s32 pad; BgTokiSwd* this = (BgTokiSwd*)thisx; + s32 pad; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); this->actor.shape.yOffset = 800.0f; BgTokiSwd_SetupAction(this, func_808BAF40); if (LINK_IS_ADULT) { - this->actor.draw = NULL; + thisx->draw = NULL; } if (gSaveContext.sceneLayer == 5) { @@ -95,8 +93,8 @@ void BgTokiSwd_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + Collider_UpdateCylinder(thisx, &this->collider); + CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); } void BgTokiSwd_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c index ce538ce9b4e..515482e5469 100644 --- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c +++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c @@ -37,8 +37,8 @@ static InitChainEntry sInitChain[] = { }; void BgUmaJump_Init(Actor* thisx, PlayState* play) { - s32 pad; BgUmaJump* this = (BgUmaJump*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); 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 1d563eda760..cbe76e9a89d 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 @@ -3,7 +3,6 @@ * Overlay: ovl_Bg_Ydan_Hasi * Description: Deku Tree Puzzle elements. Water plane and floating block in B1, and 3 blocks on 2F */ - #include "z_bg_ydan_hasi.h" #include "gfx.h" 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 71aa22cd03f..2a49546e377 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 @@ -138,7 +138,7 @@ void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play) { BgYdanMaruta* this = (BgYdanMaruta*)thisx; Collider_DestroyTris(play, &this->collider); - if (this->dyna.actor.params == 1) { + if (thisx->params == 1) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } } @@ -207,9 +207,7 @@ void BgYdanMaruta_Update(Actor* thisx, PlayState* play) { } void BgYdanMaruta_Draw(Actor* thisx, PlayState* play) { - BgYdanMaruta* this = (BgYdanMaruta*)thisx; - - if (this->dyna.actor.params == 0) { + if (thisx->params == 0) { Gfx_DrawDListOpa(play, gDTRollingSpikeTrapDL); } else { Gfx_DrawDListOpa(play, gDTFallingLadderDL); 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 6bb61d1d019..8bedcd5f0a9 100644 --- a/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c +++ b/src/overlays/actors/ovl_Bg_Zg/z_bg_zg.c @@ -69,7 +69,8 @@ void func_808C0C50(BgZg* this) { } s32 func_808C0C98(BgZg* this, PlayState* play) { - s32 flag = PARAMS_GET_U(this->dyna.actor.params, 8, 8); + Actor* thisx = &this->dyna.actor; + s32 flag = PARAMS_GET_U(thisx->params, 8, 8); return Flags_GetSwitch(play, flag); } @@ -98,9 +99,11 @@ void func_808C0CD4(BgZg* this, PlayState* play) { } void func_808C0D08(BgZg* this, PlayState* play) { - this->dyna.actor.world.pos.y += (kREG(16) + 20.0f) * 1.2f; - if ((((kREG(17) + 200.0f) * 1.2f) + this->dyna.actor.home.pos.y) <= this->dyna.actor.world.pos.y) { - Actor_Kill(&this->dyna.actor); + Actor* thisx = &this->dyna.actor; + + thisx->world.pos.y += (kREG(16) + 20.0f) * 1.2f; + if ((((kREG(17) + 200.0f) * 1.2f) + thisx->home.pos.y) <= thisx->world.pos.y) { + Actor_Kill(thisx); } } @@ -117,25 +120,25 @@ void BgZg_Update(Actor* thisx, PlayState* play) { } void BgZg_Init(Actor* thisx, PlayState* play) { - s32 pad[2]; BgZg* this = (BgZg*)thisx; + s32 pad[2]; CollisionHeader* colHeader; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); DynaPolyActor_Init(&this->dyna, 0); colHeader = NULL; CollisionHeader_GetVirtual(&gTowerCollapseBarsCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); if ((func_808C0CC8(this) == 8) || (func_808C0CC8(this) == 9)) { - this->dyna.actor.scale.x *= 1.3f; - this->dyna.actor.scale.z *= 1.3f; - this->dyna.actor.scale.y *= 1.2f; + thisx->scale.x *= 1.3f; + thisx->scale.z *= 1.3f; + thisx->scale.y *= 1.2f; } this->action = 0; this->drawConfig = 0; - if (func_808C0C98(this, play)) { - Actor_Kill(&this->dyna.actor); + if (func_808C0C98(this, play) != 0) { + Actor_Kill(thisx); } } diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 56db81767b5..29362150a53 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -1127,7 +1127,7 @@ s32 BossDodongo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(play->state.gfxCtx, "../z_boss_dodongo.c", 3826); } - return true; + return 1; } void BossDodongo_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { 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 2e9f2cf6ab2..39006946af5 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -125,15 +125,15 @@ static ColliderCylinderInit sLightBallCylinderInit = { static u8 D_808E4C58[] = { 0, 12, 10, 12, 14, 16, 12, 14, 16, 12, 14, 16, 12, 14, 16, 10, 16, 14 }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" static EnGanonMant* sCape; // 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" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:192 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 sSeed1; static s32 sSeed2; @@ -3955,7 +3955,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { switch (this->unk_1C2) { case 0: - if ((player->stateFlags1 & PLAYER_STATE1_SWINGING_BOTTLE) && + if ((player->stateFlags1 & PLAYER_STATE1_1) && (ABS((s16)(player->actor.shape.rot.y - (s16)(ganondorf->actor.yawTowardsPlayer + 0x8000))) < 0x2000) && (sqrtf(SQ(xDistFromLink) + SQ(yDistFromLink) + SQ(zDistFromLink)) <= 25.0f)) { 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 5d5b4b5d8f8..3fb7dae61ac 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -32,7 +32,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:0 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" + "ique-cn:128 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index f4cb18d3036..a4462299253 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -33,7 +33,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep_0x173D0.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" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:0 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 5401b389d25..c46fc51e422 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -26,8 +26,8 @@ #include "assets/objects/gameplay_keep/shadow_circle.h" #include "assets/objects/object_tw/object_tw.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:0 pal-1.1:0" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ 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 ed7821156e2..494b183409b 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -29,8 +29,8 @@ #include "assets/objects/gameplay_keep/gameplay_keep_0x55DB0.h" #include "assets/objects/object_bv/object_bv.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.0:0" \ - "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 817234eea72..105d4b3aa8b 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -724,7 +724,7 @@ void DemoEc_DrawCarpenter(DemoEc* this, PlayState* play) { void DemoEc_InitGerudo(DemoEc* this, PlayState* play) { DemoEc_UseDrawObject(this, play); - DemoEc_InitSkelAnime(this, play, &gGerudoWhiteSkel); + DemoEc_InitSkelAnime(this, play, &object_ge1_000330_Skel); DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcGerudoAnim, 0, 0.0f, false); func_8096D5D4(this, play); @@ -743,11 +743,11 @@ void DemoEc_UpdateGerudo(DemoEc* this, PlayState* play) { Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { switch (this->actor.params) { case 16: - return gGerudoWhiteHairstyleBobDL; + return object_ge1_009198_DL; case 17: - return gGerudoWhiteHairstyleStraightFringeDL; + return object_ge1_009430_DL; case 18: - return gGerudoWhiteHairstyleSpikyDL; + return object_ge1_009690_DL; default: PRINTF(VT_FGCOL(RED) T("かつらが無い!!!!!!!!!!!!!!!!\n", "No wig!!!!!!!!!!!!!!!!\n") VT_RST); return NULL; @@ -766,9 +766,9 @@ void DemoEc_GerudoPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 void DemoEc_DrawGerudo(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { - gGerudoWhiteEyeOpenTex, - gGerudoWhiteEyeHalfTex, - gGerudoWhiteEyeClosedTex, + (UNK_PTR)0x06000708, + (UNK_PTR)0x06000F08, + (UNK_PTR)0x06001708, }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; 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 cea51edbf5d..ebf4e1d1d7d 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -17,13 +17,14 @@ #include "versions.h" #include "z_lib.h" #include "audio.h" -#include "curve.h" #include "draw.h" #include "cutscene_flags.h" #include "effect.h" #include "play_state.h" #include "save.h" +#include "functions.h" + #include "assets/objects/gameplay_keep/eff_flash.h" #include "assets/objects/object_efc_crystal_light/object_efc_crystal_light.h" #include "assets/objects/object_efc_fire_ball/object_efc_fire_ball.h" @@ -86,6 +87,9 @@ void DemoEffect_SetStartPosFromCue(DemoEffect* this, PlayState* play, s32 cueCha void DemoEffect_SetPosRotFromCue(DemoEffect* this, PlayState* play, s32 cueChannel, s32 shouldUpdateFacing); void DemoEffect_MoveTowardCuePos(DemoEffect* this, PlayState* play, s32 cueChannel, f32 speed); +extern TransformUpdateIndex D_06000050; // timewarpTransformUpdateIndex +extern SkelCurveLimbList D_060012E8; // timewarpLimbList + ActorProfile Demo_Effect_Profile = { /**/ ACTOR_DEMO_EFFECT, /**/ ACTORCAT_BG, @@ -103,32 +107,32 @@ static s16 sSfxJewelId[] = { 0 }; // The object used by the effectType static s16 sEffectTypeObjects[] = { - /* 0x00 */ OBJECT_EFC_CRYSTAL_LIGHT, - /* 0x01 */ OBJECT_EFC_FIRE_BALL, - /* 0x02 */ OBJECT_GAMEPLAY_KEEP, - /* 0x03 */ OBJECT_EFC_LGT_SHOWER, - /* 0x04 */ OBJECT_GOD_LGT, - /* 0x05 */ OBJECT_GOD_LGT, - /* 0x06 */ OBJECT_GOD_LGT, - /* 0x07 */ OBJECT_LIGHT_RING, - /* 0x08 */ OBJECT_TRIFORCE_SPOT, - /* 0x09 */ OBJECT_GI_MEDAL, - /* 0x0A */ OBJECT_GI_MEDAL, - /* 0x0B */ OBJECT_GI_MEDAL, - /* 0x0C */ OBJECT_GI_MEDAL, - /* 0x0D */ OBJECT_GI_MEDAL, - /* 0x0E */ OBJECT_GI_MEDAL, - /* 0x0F */ OBJECT_EFC_TW, - /* 0x10 */ OBJECT_LIGHT_RING, - /* 0x11 */ OBJECT_LIGHT_RING, - /* 0x12 */ OBJECT_GAMEPLAY_KEEP, - /* 0x13 */ OBJECT_GI_JEWEL, - /* 0x14 */ OBJECT_GI_JEWEL, - /* 0x15 */ OBJECT_GI_JEWEL, - /* 0x16 */ OBJECT_GI_JEWEL, - /* 0x17 */ OBJECT_GI_M_ARROW, - /* 0x18 */ OBJECT_EFC_TW, - /* 0x19 */ OBJECT_EFC_TW, + OBJECT_EFC_CRYSTAL_LIGHT, // DEMO_EFFECT_CRYSTAL_LIGHT + OBJECT_EFC_FIRE_BALL, // DEMO_EFFECT_FIRE_BALL + OBJECT_GAMEPLAY_KEEP, // DEMO_EFFECT_BLUE_ORB + OBJECT_EFC_LGT_SHOWER, // DEMO_EFFECT_LGT_SHOWER + OBJECT_GOD_LGT, // DEMO_EFFECT_GOD_LGT_DIN + OBJECT_GOD_LGT, // DEMO_EFFECT_GOD_LGT_NAYRU + OBJECT_GOD_LGT, // DEMO_EFFECT_GOD_LGT_FARORE + OBJECT_LIGHT_RING, // DEMO_EFFECT_LIGHTRING_EXPANDING + OBJECT_TRIFORCE_SPOT, // DEMO_EFFECT_TRIFORCE_SPOT + OBJECT_GI_MEDAL, // DEMO_EFFECT_MEDAL_FIRE + OBJECT_GI_MEDAL, // DEMO_EFFECT_MEDAL_WATER + OBJECT_GI_MEDAL, // DEMO_EFFECT_MEDAL_FOREST + OBJECT_GI_MEDAL, // DEMO_EFFECT_MEDAL_SPIRIT + OBJECT_GI_MEDAL, // DEMO_EFFECT_MEDAL_SHADOW + OBJECT_GI_MEDAL, // DEMO_EFFECT_MEDAL_LIGHT + OBJECT_EFC_TW, // DEMO_EFFECT_TIMEWARP_MASTERSWORD + OBJECT_LIGHT_RING, // DEMO_EFFECT_LIGHTRING_SHRINKING + OBJECT_LIGHT_RING, // DEMO_EFFECT_LIGHTRING_TRIFORCE + OBJECT_GAMEPLAY_KEEP, // DEMO_EFFECT_LIGHT + OBJECT_GI_JEWEL, // DEMO_EFFECT_JEWEL_KOKIRI + OBJECT_GI_JEWEL, // DEMO_EFFECT_JEWEL_GORON + OBJECT_GI_JEWEL, // DEMO_EFFECT_JEWEL_ZORA + OBJECT_GI_JEWEL, // DEMO_EFFECT_DUST + OBJECT_GI_M_ARROW, // DEMO_EFFECT_LIGHTARROW + OBJECT_EFC_TW, // DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE + OBJECT_EFC_TW, // DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL }; static u8 sTimewarpVertexSizeIndices[] = { 1, 1, 2, 0, 1, 1, 2, 0, 1, 2, 0, 2, 1, 0, 1, 0, 2, 0, 2, 2, 0 }; @@ -482,24 +486,24 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { break; case DEMO_EFFECT_JEWEL_KOKIRI: - this->jewelDisplayList = gGiKokiriEmeraldGemDL; - this->jewelHolderDisplayList = gGiKokiriEmeraldSettingDL; + this->jewelDisplayList = gGiKokiriEmeraldGem; + this->jewelHolderDisplayList = gGiKokiriEmeraldSetting; this->jewel.type = DEMO_EFFECT_JEWEL_KOKIRI; this->jewel.isPositionInit = 0; DemoEffect_InitJewel(play, this); break; case DEMO_EFFECT_JEWEL_GORON: - this->jewelDisplayList = gGiGoronRubyGemDL; - this->jewelHolderDisplayList = gGiGoronRubySettingDL; + this->jewelDisplayList = gGiGoronRubyGem; + this->jewelHolderDisplayList = gGiGoronRubySetting; this->jewel.type = DEMO_EFFECT_JEWEL_GORON; this->jewel.isPositionInit = 0; DemoEffect_InitJewel(play, this); break; case DEMO_EFFECT_JEWEL_ZORA: - this->jewelDisplayList = gGiZoraSapphireGemDL; - this->jewelHolderDisplayList = gGiZoraSapphireSettingDL; + this->jewelDisplayList = gGiZoraSapphireGem; + this->jewelHolderDisplayList = gGiZoraSapphireSetting; this->jewel.type = DEMO_EFFECT_JEWEL_ZORA; this->jewel.isPositionInit = 0; DemoEffect_InitJewel(play, this); @@ -687,12 +691,12 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play) { void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { s32 effectType = PARAMS_GET_S(this->actor.params, 0, 8); - if (!SkelCurve_Init(play, &this->skelCurve, &gTimeWarpSkel, &gTimeWarpAnim)) { + if (!SkelCurve_Init(play, &this->skelCurve, &D_060012E8, &D_06000050)) { ASSERT(0, "0", "../z_demo_effect.c", 1283); } if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { - SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 1.0f, 1.7f); + SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 59.0f, 1.0f, 1.7f); SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_InitTimeWarpTimeblock; @@ -703,12 +707,12 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { } } else if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 4 || (gSaveContext.save.entranceIndex == ENTR_TEMPLE_OF_TIME_4 && !GET_EVENTCHKINF(EVENTCHKINF_C9))) { - SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 59.0f, 0.0f); + SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 59.0f, 59.0f, 0.0f); SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpReturnFromChamberOfSages; PRINTF(VT_FGCOL(CYAN) T(" 縮むバージョン \n", " Shrinking version \n") VT_RST); } else { - SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 59.0f, 1.0f, 1.0f); + SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 59.0f, 1.0f, 1.0f); SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpPullMasterSword; PRINTF(VT_FGCOL(CYAN) T(" 通常 バージョン \n", " Normal version \n") VT_RST); @@ -717,7 +721,7 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { /** * Update function for the Timewarp Actor that is used when Link pulls the Mastersword - * It changes the Background Music and updates its SkelCurve animation. + * It changes the Background Music and updates it's SkelCurve animation. */ void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play) { if (CutsceneFlags_Get(play, 1)) { @@ -727,7 +731,7 @@ void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play) } if (SkelCurve_Update(play, &this->skelCurve)) { - SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 60.0f, 59.0f, 0.0f); + SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 60.0f, 59.0f, 0.0f); } } } @@ -742,7 +746,7 @@ void DemoEffect_TimewarpShrink(f32 size) { u8 sizes[3]; // This function uses the data in obj_efc_tw offset 0x0060 to 0x01B0 - vertices = SEGMENTED_TO_VIRTUAL(gTimeWarpVtx); + vertices = SEGMENTED_TO_VIRTUAL(object_efc_tw_000060_Vtx); sizes[0] = 0; sizes[1] = (s32)(202.0f * size); @@ -820,7 +824,7 @@ void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play) { Actor_PlaySfx_FlaggedCentered2(&this->actor, NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); if (SkelCurve_Update(play, &this->skelCurve)) { - SkelCurve_SetAnim(&this->skelCurve, &gTimeWarpAnim, 1.0f, 60.0f, 59.0f, 0.0f); + SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 60.0f, 59.0f, 0.0f); this->updateFunc = DemoEffect_UpdateTimeWarpTimeblock; this->timeWarp.shrinkTimer = 0; } @@ -1739,21 +1743,21 @@ void DemoEffect_DrawCrystalLight(Actor* thisx, PlayState* play) { Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2661); - gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL); + gSPDisplayList(POLY_XLU_DISP++, object_efc_crystal_light_000980_DL); Matrix_Pop(); Matrix_Push(); Matrix_RotateY(DEG_TO_RAD(120), MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2672); - gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL); + gSPDisplayList(POLY_XLU_DISP++, object_efc_crystal_light_000980_DL); Matrix_Pop(); Matrix_Push(); Matrix_RotateY(DEG_TO_RAD(240), MTXMODE_APPLY); Matrix_RotateX(DEG_TO_RAD(11), MTXMODE_APPLY); Matrix_Translate(0.0f, 150.0f, 0.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2683); - gSPDisplayList(POLY_XLU_DISP++, gCrystalLightDL); + gSPDisplayList(POLY_XLU_DISP++, object_efc_crystal_light_000980_DL); Matrix_Pop(); CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2688); } @@ -1771,7 +1775,7 @@ void DemoEffect_DrawFireBall(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 32, 1, 0, 128 - ((frames * 20) % 128) - 1, 32, 32)); - gSPDisplayList(POLY_XLU_DISP++, gCreationFireBallDL); + gSPDisplayList(POLY_XLU_DISP++, object_efc_fire_ball_000040_DL); CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2723); } @@ -1810,7 +1814,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_Push(); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2801); - gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessAuraDL); + gSPDisplayList(POLY_XLU_DISP++, object_god_lgt_000330_DL); Gfx_SetupDL_25Opa(play->state.gfxCtx); func_8002EBCC(&this->actor, play, 0); Matrix_Pop(); @@ -1826,7 +1830,7 @@ void DemoEffect_DrawGodLgt(Actor* thisx, PlayState* play) { Matrix_Translate(0.0f, -140.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(0.03f, 0.03f, 0.03f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_demo_effect.c", 2824); - gSPDisplayList(POLY_OPA_DISP++, gGoldenGoddessBodyDL); + gSPDisplayList(POLY_OPA_DISP++, object_god_lgt_003C50_DL); } CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2829); @@ -1897,7 +1901,7 @@ void DemoEffect_DrawLgtShower(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (frames * 5) % 1024, 0, 256, 64, 1, (frames * 10) % 128, 512 - ((frames * 50) % 512), 32, 16)); - gSPDisplayList(POLY_XLU_DISP++, gEnliveningLightDL); + gSPDisplayList(POLY_XLU_DISP++, object_efc_lgt_shower_0011D0_DL); CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2942); } @@ -1915,7 +1919,7 @@ void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play2) { gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (frames * 5) % 64, 512 - ((frames * 2) % 512) - 1, 16, 128, 1, 0, 0, 8, 1024)); - gSPDisplayList(POLY_XLU_DISP++, gGoldenGoddessLightRingDL); + gSPDisplayList(POLY_XLU_DISP++, object_light_ring_000190_DL); CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2978); } @@ -1923,7 +1927,7 @@ void DemoEffect_DrawLightRing(Actor* thisx, PlayState* play2) { void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) { DemoEffect* this = (DemoEffect*)thisx; s32 pad; - Vtx* vertices = SEGMENTED_TO_VIRTUAL(gTriforceVtx); + Vtx* vertices = SEGMENTED_TO_VIRTUAL(object_triforce_spot_000000_Vtx); u32 frames = play->gameplayFrames; OPEN_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 2994); @@ -1942,7 +1946,7 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) { vertices[93].n.a = vertices[94].n.a = vertices[95].n.a = (s8)this->triforceSpot.lightColumnOpacity; gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 180, 255, 255, this->triforceSpot.lightColumnOpacity); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 150, 255); - gSPDisplayList(POLY_XLU_DISP++, gTriforceLightColumnDL); + gSPDisplayList(POLY_XLU_DISP++, object_triforce_spot_000840_DL); Matrix_Pop(); } @@ -1960,7 +1964,7 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 16, 1, 0, 0, 16, 8)); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 160, this->triforceSpot.triforceSpotOpacity); gDPSetEnvColor(POLY_XLU_DISP++, 170, 140, 0, 255); - gSPDisplayList(POLY_XLU_DISP++, gTriforceDL); + gSPDisplayList(POLY_XLU_DISP++, object_triforce_spot_000600_DL); } else { func_8002EBCC(&this->actor, play, 0); Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -1971,7 +1975,7 @@ void DemoEffect_DrawTriforceSpot(Actor* thisx, PlayState* play) { Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 32, 16, 1, 0, 0, 16, 8)); gDPSetPrimColor(POLY_OPA_DISP++, 128, 128, 255, 255, 160, 255); gDPSetEnvColor(POLY_OPA_DISP++, 170, 140, 0, 255); - gSPDisplayList(POLY_OPA_DISP++, gTriforceDL); + gSPDisplayList(POLY_OPA_DISP++, object_triforce_spot_000600_DL); } } } @@ -1994,7 +1998,7 @@ void DemoEffect_DrawGetItem(Actor* thisx, PlayState* play) { } } -s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 DemoEffect_DrawTimewarpLimbs(PlayState* play, SkelAnimeCurve* skelCuve, s32 limbIndex, void* thisx) { s32 pad; DemoEffect* this = (DemoEffect*)thisx; u32 frames = play->gameplayFrames; @@ -2010,13 +2014,13 @@ s32 DemoEffect_OverrideLimbDrawTimeWarp(PlayState* play, SkelCurve* skelCurve, s CLOSE_DISPS(play->state.gfxCtx, "../z_demo_effect.c", 3172); if (limbIndex == 0) { - s16* transform = skelCurve->jointTable[0]; + LimbTransform* transform = &skelCuve->transforms[0]; - transform[2] = transform[0] = 1024; - transform[1] = 1024; + transform->scale.y = 1024; + transform->scale.z = transform->scale.x = 1024; } - return true; + return 1; } void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { @@ -2027,12 +2031,9 @@ void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play) { 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) { OPEN_DISPS(gfxCtx, "../z_demo_effect.c", 3201); - POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_25); Matrix_Scale(2.0f, 2.0f, 2.0f, MTXMODE_APPLY); - SkelCurve_Draw(&this->actor, play, &this->skelCurve, DemoEffect_OverrideLimbDrawTimeWarp, NULL, 1, - &this->actor); - + SkelCurve_Draw(thisx, play, &this->skelCurve, DemoEffect_DrawTimewarpLimbs, NULL, 1, this); CLOSE_DISPS(gfxCtx, "../z_demo_effect.c", 3216); } } 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 05747ff8dd5..1ad121c81ba 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -3,11 +3,10 @@ #include "ultra64.h" #include "actor.h" -#include "curve.h" struct DemoEffect; -typedef void (*DemoEffectFunc)(struct DemoEffect*, struct PlayState*); +typedef void (*DemoEffectFunc)(struct DemoEffect* this, struct PlayState* play); typedef struct DemoEffectFireBall { /* 0x00 */ u8 timer; @@ -79,7 +78,7 @@ typedef struct DemoEffectDust { typedef struct DemoEffect { /* 0x0000 */ Actor actor; - /* 0x014C */ SkelCurve skelCurve; + /* 0x014C */ SkelAnimeCurve skelCurve; /* 0x016C */ u8 requiredObjectSlot; /* 0x0170 */ Gfx* jewelDisplayList; /* 0x0174 */ Gfx* jewelHolderDisplayList; 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 1837fc7671b..43ff20ec191 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -1,19 +1,12 @@ -/* - * File: z_demo_ext.c - * Overlay: Demo_Ext - * Description: Magic Vortex in Silver Gauntlets Cutscene - */ - #include "z_demo_ext.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" #include "regs.h" #include "sfx.h" #include "sys_matrix.h" -#include "terminal.h" -#include "translation.h" #include "play_state.h" #include "skin.h" @@ -21,238 +14,233 @@ #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED -typedef enum DemoExtAction { - /* 0x00 */ EXT_WAIT, - /* 0x01 */ EXT_MAINTAIN, - /* 0x02 */ EXT_DISPELL -} DemoExtAction; - -typedef enum DemoExtDrawMode { - /* 0x00 */ EXT_DRAW_NOTHING, - /* 0x01 */ EXT_DRAW_VORTEX -} DemoExtDrawMode; - void DemoExt_Init(Actor* thisx, PlayState* play); void DemoExt_Destroy(Actor* thisx, PlayState* play); void DemoExt_Update(Actor* thisx, PlayState* play); void DemoExt_Draw(Actor* thisx, PlayState* play); +void func_80977854(DemoExt*, PlayState*); +void func_80977874(DemoExt* this, PlayState* play); +void func_809778AC(DemoExt* this, PlayState* arg1); +void func_80977944(DemoExt* arg0, PlayState* arg1); +void func_80977950(DemoExt* this, PlayState* play); + +typedef void (*DemoExtUpdateFunc)(DemoExt*, PlayState*); +static DemoExtUpdateFunc sUpdateFuncs[] = { + func_80977854, + func_80977874, + func_809778AC, +}; +typedef void (*DemoExtDrawFunc)(DemoExt*, PlayState*); +static DemoExtDrawFunc sDrawFuncs[] = { + func_80977944, + func_80977950, +}; +ActorProfile Demo_Ext_Profile = { + /**/ ACTOR_DEMO_EXT, + /**/ ACTORCAT_NPC, + /**/ FLAGS, + /**/ OBJECT_FHG, + /**/ sizeof(DemoExt), + /**/ DemoExt_Init, + /**/ DemoExt_Destroy, + /**/ DemoExt_Update, + /**/ DemoExt_Draw, +}; + void DemoExt_Destroy(Actor* thisx, PlayState* play) { } void DemoExt_Init(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; - this->scrollIncr[0] = 25; - this->scrollIncr[1] = 40; - this->scrollIncr[2] = 5; - this->scrollIncr[3] = 30; - this->primAlpha = kREG(28) + 255; - this->envAlpha = kREG(32) + 255; - this->scale.x = kREG(19) + 400.0f; - this->scale.y = kREG(20) + 100.0f; - this->scale.z = kREG(21) + 400.0f; + this->texScrollStep[0] = 25; + this->texScrollStep[1] = 40; + this->texScrollStep[2] = 5; + this->texScrollStep[3] = 30; + this->unk170 = gRegEditor->data[0xA3C] + 0xFF; + this->unk174 = gRegEditor->data[0xA40] + 0xFF; + this->unk178.x = gRegEditor->data[0xA33] + 400.0f; + this->unk178.y = gRegEditor->data[0xA34] + 100.0f; + this->unk178.z = gRegEditor->data[0xA35] + 400.0f; } -void DemoExt_PlayVortexSFX(DemoExt* this) { - if (this->alphaTimer <= (kREG(35) + 40.0f) - 15.0f) { +void func_80977450(DemoExt* this) { + if (this->unk16C <= (gRegEditor->data[0xA43] + 40.0f - 15.0f)) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EV_FANTOM_WARP_L - SFX_FLAG); } } -CsCmdActorCue* DemoExt_GetCue(PlayState* play, s32 cueChannel) { +CsCmdActorCue* func_809774D8(PlayState* play, s32 arg1) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorCue* cue = play->csCtx.actorCues[cueChannel]; + CsCmdActorCue* cue = play->csCtx.actorCues[arg1]; return cue; } - return NULL; } -void DemoExt_SetupWait(DemoExt* this) { - this->action = EXT_WAIT; - this->drawMode = EXT_DRAW_NOTHING; +void func_809774FC(DemoExt* this) { + this->unk14C = 0; + this->unk150 = 0; } -void DemoExt_SetupMaintainVortex(DemoExt* this, PlayState* play) { - CsCmdActorCue* cue = DemoExt_GetCue(play, 5); +void func_80977508(DemoExt* this, PlayState* play) { + CsCmdActorCue* temp_v0; + s16 temp_v1; - if (cue != NULL) { - this->actor.world.pos.x = cue->startPos.x; - this->actor.world.pos.y = cue->startPos.y; - this->actor.world.pos.z = cue->startPos.z; - this->actor.world.rot.y = this->actor.shape.rot.y = cue->rot.y; + temp_v0 = func_809774D8(play, 5); + if (temp_v0 != NULL) { + this->actor.world.pos.x = temp_v0->startPos.x; + this->actor.world.pos.y = temp_v0->startPos.y; + this->actor.world.pos.z = temp_v0->startPos.z; + temp_v1 = temp_v0->rot.y; + this->actor.shape.rot.y = temp_v1; + this->actor.world.rot.y = temp_v1; } - this->action = EXT_MAINTAIN; - this->drawMode = EXT_DRAW_VORTEX; + this->unk14C = 1; + this->unk150 = 1; } -void DemoExt_SetupDispellVortex(DemoExt* this) { - this->action = EXT_DISPELL; - this->drawMode = EXT_DRAW_VORTEX; +void func_80977590(DemoExt* this) { + this->unk14C = 2; + this->unk150 = 1; } -void DemoExt_FinishClosing(DemoExt* this) { - this->alphaTimer += 1.0f; - if ((kREG(35) + 40.0f) <= this->alphaTimer) { +void func_809775A4(DemoExt* this) { + this->unk16C += 1.0f; + if ((gRegEditor->data[0xA43] + 40.0f) <= this->unk16C) { Actor_Kill(&this->actor); } } -void DemoExt_HandleCues(DemoExt* this, PlayState* play) { - CsCmdActorCue* cue = DemoExt_GetCue(play, 5); - s32 nextCueId; - s32 currentCueId; - - if (cue != NULL) { - nextCueId = cue->id; - currentCueId = this->cueId; +void func_80977610(DemoExt* this, PlayState* play) { + CsCmdActorCue* temp_v0; + s32 temp_a2; + s32 v; - if (nextCueId != currentCueId) { - switch (nextCueId) { + temp_v0 = func_809774D8(play, 5); + if (temp_v0 != NULL) { + temp_a2 = temp_v0->id; + v = this->cueId; + if (temp_a2 != v) { + switch (temp_a2) { case 1: - DemoExt_SetupWait(this); + func_809774FC(this); break; + case 2: - DemoExt_SetupMaintainVortex(this, play); + func_80977508(this, play); break; + case 3: - DemoExt_SetupDispellVortex(this); + func_80977590(this); break; + default: - PRINTF(T("Demo_Ext_Check_DemoMode:そんな動作は無い!!!!!!!!\n", - "Demo_Ext_Check_DemoMode: There is no such action!!!!!!!!\n")); + PRINTF("Demo_Ext_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); break; } - this->cueId = nextCueId; + this->cueId = temp_a2; } } } -void DemoExt_SetScrollAndRotation(DemoExt* this) { - s16* scrollIncr = this->scrollIncr; - s16* curScroll = this->curScroll; - s32 i; +void func_809776D0(DemoExt* this) { + s16* texScrollPos = this->texScrollPos; + s16* texScrollStep = this->texScrollStep; + s32 var_v0; - for (i = 3; i != 0; i--) { - curScroll[i] += scrollIncr[i]; + for (var_v0 = 3; var_v0 != 0; var_v0--) { + texScrollPos[var_v0] += texScrollStep[var_v0]; } - this->rotationPitch += (s16)(kREG(34) + 1000); + this->unk168 += (s16)(gRegEditor->data[0xA42] + 0x3E8); } -void DemoExt_SetColorsAndScales(DemoExt* this) { - Vec3f* scale = &this->scale; - f32 shrinkFactor; +void func_8097771C(DemoExt* this) { + Vec3f* temp_v0; + f32 var_fv0; - shrinkFactor = ((kREG(35) + 40.0f) - this->alphaTimer) / (kREG(35) + 40.0f); - if (shrinkFactor < 0.0f) { - shrinkFactor = 0.0f; + temp_v0 = &this->unk178; + var_fv0 = ((gRegEditor->data[0xA43] + 40.0f) - this->unk16C) / (gRegEditor->data[0xA43] + 40.0f); + if (var_fv0 < 0.0f) { + var_fv0 = 0.0f; } - - this->primAlpha = (u32)(kREG(28) + 255) * shrinkFactor; - this->envAlpha = (u32)(kREG(32) + 255) * shrinkFactor; - scale->x = (kREG(19) + 400.0f) * shrinkFactor; - scale->y = (kREG(20) + 100.0f) * shrinkFactor; - scale->z = (kREG(21) + 400.0f) * shrinkFactor; + this->unk170 = (s32)((u32)(gRegEditor->data[0xA3C] + 0xFF) * var_fv0); + this->unk174 = (s32)((u32)(gRegEditor->data[0xA40] + 0xFF) * var_fv0); + temp_v0->x = (gRegEditor->data[0xA33] + 400.0f) * var_fv0; + temp_v0->y = (gRegEditor->data[0xA34] + 100.0f) * var_fv0; + temp_v0->z = (gRegEditor->data[0xA35] + 400.0f) * var_fv0; } -void DemoExt_Wait(DemoExt* this, PlayState* play) { - DemoExt_HandleCues(this, play); +void func_80977854(DemoExt* this, PlayState* play) { + func_80977610(this, play); } -void DemoExt_MaintainVortex(DemoExt* this, PlayState* play) { - DemoExt_PlayVortexSFX(this); - DemoExt_SetScrollAndRotation(this); - DemoExt_HandleCues(this, play); +void func_80977874(DemoExt* this, PlayState* play) { + func_80977450(this); + func_809776D0(this); + func_80977610(this, play); } -void DemoExt_DispellVortex(DemoExt* this, PlayState* play) { - DemoExt_PlayVortexSFX(this); - DemoExt_SetScrollAndRotation(this); - DemoExt_SetColorsAndScales(this); - DemoExt_FinishClosing(this); +void func_809778AC(DemoExt* this, PlayState* play) { + func_80977450(this); + func_809776D0(this); + func_8097771C(this); + func_809775A4(this); } -static DemoExtActionFunc sActionFuncs[] = { - DemoExt_Wait, - DemoExt_MaintainVortex, - DemoExt_DispellVortex, -}; - void DemoExt_Update(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; - if ((this->action < EXT_WAIT) || (this->action > EXT_DISPELL) || sActionFuncs[this->action] == NULL) { - PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); - } else { - sActionFuncs[this->action](this, play); + if ((this->unk14C < 0) || (this->unk14C >= ARRAY_COUNT(sUpdateFuncs)) || (sUpdateFuncs[this->unk14C] == NULL)) { + PRINTF("\x1b[31mメインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n\x1b[m"); + return; } + sUpdateFuncs[this->unk14C](this, play); } -void DemoExt_DrawNothing(Actor* thisx, PlayState* play) { +void func_80977944(DemoExt* this, PlayState* play) { } -void DemoExt_DrawVortex(Actor* thisx, PlayState* play) { - DemoExt* this = (DemoExt*)thisx; - Mtx* mtx; +void func_80977950(DemoExt* this, PlayState* play) { GraphicsContext* gfxCtx; - s16* curScroll; - Vec3f* scale; + Mtx* mtx; + Vec3f* temp_v0; + s16* texScrollPos; + s32 pad; - curScroll = this->curScroll; - scale = &this->scale; gfxCtx = play->state.gfxCtx; - mtx = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); - + texScrollPos = this->texScrollPos; + temp_v0 = &this->unk178; + mtx = GRAPH_ALLOC(gfxCtx, 0x40U); OPEN_DISPS(gfxCtx, "../z_demo_ext.c", 460); Matrix_Push(); - Matrix_Scale(scale->x, scale->y, scale->z, MTXMODE_APPLY); - Matrix_RotateZYX((s16)(kREG(16) + 0x4000), this->rotationPitch, kREG(18), MTXMODE_APPLY); - Matrix_Translate(kREG(22), kREG(23), kREG(24), MTXMODE_APPLY); + Matrix_Scale(temp_v0->x, temp_v0->y, temp_v0->z, MTXMODE_APPLY); + Matrix_RotateZYX(gRegEditor->data[0xA30] + 0x4000, this->unk168, gRegEditor->data[0xA32], MTXMODE_APPLY); + Matrix_Translate(gRegEditor->data[0xA36], gRegEditor->data[0xA37], gRegEditor->data[0xA38], MTXMODE_APPLY); MATRIX_TO_MTX(mtx, "../z_demo_ext.c", 476); Matrix_Pop(); Gfx_SetupDL_25Xlu(gfxCtx); - - 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); - gSPSegment( - POLY_XLU_DISP++, 0x08, - Gfx_TwoTexScroll(gfxCtx, 0, curScroll[0], curScroll[1], 0x40, 0x40, 1, curScroll[2], curScroll[3], 0x40, 0x40)); - + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, gRegEditor->data[0xA41] + 0x80, gRegEditor->data[0xA39] + 0x8C, + gRegEditor->data[0xA3A] + 0x50, gRegEditor->data[0xA3B] + 0x8C, this->unk170); + gDPSetEnvColor(POLY_XLU_DISP++, gRegEditor->data[0xA3D] + 0x5A, gRegEditor->data[0xA3E] + 0x32, + gRegEditor->data[0xA3F] + 0x5F, this->unk174); + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(gfxCtx, 0, texScrollPos[0], texScrollPos[1], 64, 64, 1, texScrollPos[2], + texScrollPos[3], 64, 64)); gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPhantomWarpDL); gSPPopMatrix(POLY_XLU_DISP++, G_MTX_MODELVIEW); - CLOSE_DISPS(gfxCtx, "../z_demo_ext.c", 512); } -static DemoExtDrawFunc sDrawFuncs[] = { - DemoExt_DrawNothing, - DemoExt_DrawVortex, -}; - void DemoExt_Draw(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; - if ((this->drawMode < EXT_DRAW_NOTHING) || (this->drawMode > EXT_DRAW_VORTEX) || - sDrawFuncs[this->drawMode] == NULL) { - PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); - } else { - sDrawFuncs[this->drawMode](thisx, play); + if ((this->unk150 < 0) || (this->unk150 >= ARRAY_COUNT(sDrawFuncs)) || (sDrawFuncs[this->unk150] == NULL)) { + PRINTF("\x1b[31m描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n\x1b[m"); + return; } + sDrawFuncs[this->unk150](this, play); } - -ActorProfile Demo_Ext_Profile = { - /**/ ACTOR_DEMO_EXT, - /**/ ACTORCAT_NPC, - /**/ FLAGS, - /**/ OBJECT_FHG, - /**/ sizeof(DemoExt), - /**/ DemoExt_Init, - /**/ DemoExt_Destroy, - /**/ DemoExt_Update, - /**/ DemoExt_Draw, -}; diff --git a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h index e34a059d50a..1b2d8bd2757 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.h @@ -6,21 +6,19 @@ struct DemoExt; -typedef void (*DemoExtActionFunc)(struct DemoExt*, struct PlayState*); -typedef void (*DemoExtDrawFunc)(Actor*, struct PlayState*); - typedef struct DemoExt { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 action; - /* 0x014C */ s32 drawMode; - /* 0x0154 */ s32 cueId; - /* 0x015E */ s16 scrollIncr[4]; - /* 0x0160 */ s16 curScroll[4]; - /* 0x0168 */ s16 rotationPitch; - /* 0x016C */ f32 alphaTimer; - /* 0x0170 */ s32 primAlpha; - /* 0x0174 */ s32 envAlpha; - /* 0x0178 */ Vec3f scale; -} DemoExt; // size = 0x0184 + /* 0x000 */ Actor actor; + /* 0x14C */ s32 unk14C; + /* 0x150 */ s32 unk150; + /* 0x154 */ s32 cueId; + /* 0x158 */ s16 texScrollStep[4]; + /* 0x160 */ s16 texScrollPos[4]; + /* 0x168 */ s16 unk168; + /* 0x16A */ char pad16A[2]; + /* 0x16C */ f32 unk16C; + /* 0x170 */ s32 unk170; + /* 0x174 */ s32 unk174; + /* 0x178 */ Vec3f unk178; +} DemoExt; // size = 0x184 #endif diff --git a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 32f31eec3f0..0b53ab06f5a 100644 --- a/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -61,7 +61,7 @@ ActorProfile Demo_Go_Profile = { /**/ DemoGo_Draw, }; -s32 DemoGo_GetCueChannel(DemoGo* this) { +UNK_TYPE DemoGo_GetCueChannel(DemoGo* this) { s32 ret; switch (this->actor.params) { @@ -106,7 +106,7 @@ void func_8097C930(DemoGo* this) { s32 pad[3]; if (DECR(*something) == 0) { - *something = Rand_S16Offset(60, 60); + *something = Rand_S16Offset(0x3C, 0x3C); } *other = *something; if (*other >= 3) { @@ -373,7 +373,7 @@ void func_8097D29C(DemoGo* this, PlayState* play) { void DemoGo_Draw(Actor* thisx, PlayState* play) { DemoGo* this = (DemoGo*)thisx; - if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == NULL) { + if (this->drawConfig < 0 || this->drawConfig >= 2 || D_8097D468[this->drawConfig] == 0) { PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; diff --git a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index b172a29d3dd..6e380f9f88b 100644 --- a/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -276,7 +276,7 @@ void DemoIk_Type1PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s switch (this->actor.params) { case 0: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_demo_ik_inArmer.c", 390); - gSPDisplayList(POLY_XLU_DISP++, gIronKnuckleArmorRivetAndSymbolDL); + gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); break; case 2: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_demo_ik_inArmer.c", 396); @@ -438,7 +438,7 @@ void DemoIk_Type2PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s break; case 5: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_demo_ik_inFace.c", 286); - gSPDisplayList(POLY_XLU_DISP++, gIronKnuckleArmorRivetAndSymbolDL); + gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); break; default: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_demo_ik_inFace.c", 292); diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index b3441b5ac63..0a8ae2070c5 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -1174,7 +1174,7 @@ void DemoIm_Destroy(Actor* thisx, PlayState* play) { DemoIm_DestroyCollider(thisx, play); } -s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_80987514(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { DemoIm* this = (DemoIm*)thisx; s32* unk_2D0 = &this->unk_2D0; @@ -1194,14 +1194,15 @@ s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* } } - if ((*unk_2D0 != 0) && (limbIndex == IMPA_LIMB_RIGHT_HAND)) { - *dList = gImpaHandPointingDL; + if (*unk_2D0 != 0) { + if (limbIndex == IMPA_LIMB_RIGHT_HAND) { + *dList = gImpaHandPointingDL; + } } - - return false; + return 0; } -void DemoIm_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_809875C0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { DemoIm* this = (DemoIm*)thisx; if (limbIndex == IMPA_LIMB_HEAD) { @@ -1236,8 +1237,8 @@ void DemoIm_DrawSolid(DemoIm* this, PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); - SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - DemoIm_OverrideLimbDraw, DemoIm_PostLimbDraw, this); + SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, func_80987514, + func_809875C0, this); CLOSE_DISPS(play->state.gfxCtx, "../z_demo_im.c", 925); } 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 74272d963c9..0c0795a9fe4 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 @@ -6,10 +6,11 @@ #include "printf.h" #include "sfx.h" #include "translation.h" -#include "curve.h" #include "play_state.h" #include "save.h" +#include "functions.h" + #include "assets/objects/object_box/object_box.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -48,7 +49,7 @@ ActorProfile Demo_Tre_Lgt_Profile = { /**/ DemoTreLgt_Draw, }; -static CurveAnimationHeader* sAnimations[] = { &gTreasureChestCurveAnim_4B60, &gTreasureChestCurveAnim_4F70 }; +static TransformUpdateIndex* sTransformUpdIdx[] = { &gTreasureChestCurveAnim_4B60, &gTreasureChestCurveAnim_4F70 }; static DemoTreLgtActionFunc sActionFuncs[] = { func_8099375C, @@ -58,7 +59,7 @@ static DemoTreLgtActionFunc sActionFuncs[] = { void DemoTreLgt_Init(Actor* thisx, PlayState* play) { DemoTreLgt* this = (DemoTreLgt*)thisx; - if (!SkelCurve_Init(play, &this->skelCurve, &gTreasureChestCurveSkel, sAnimations[0])) { + if (!SkelCurve_Init(play, &this->skelCurve, &gTreasureChestCurveSkel, sTransformUpdIdx[0])) { PRINTF(T("Demo_Tre_Lgt_Actor_ct();コンストラクト失敗\n", "Demo_Tre_Lgt_Actor_ct(); Construct failed\n")); } @@ -83,18 +84,18 @@ void func_80993754(DemoTreLgt* this) { void func_8099375C(DemoTreLgt* this, PlayState* play) { EnBox* treasureChest = (EnBox*)this->actor.parent; - if ((treasureChest != NULL) && Animation_OnFrame(&treasureChest->skelanime, 10.0f)) { + if (treasureChest != NULL && Animation_OnFrame(&treasureChest->skelanime, 10.0f)) { func_809937B4(this, play, treasureChest->skelanime.curFrame); } } void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame) { - SkelCurve* skelCurve = &this->skelCurve; + SkelAnimeCurve* skelCurve = &this->skelCurve; s32 pad[2]; this->action = DEMO_TRE_LGT_ACTION_ANIMATE; - SkelCurve_SetAnim(skelCurve, sAnimations[gSaveContext.save.linkAge], 1.0f, + SkelCurve_SetAnim(skelCurve, sTransformUpdIdx[gSaveContext.save.linkAge], 1.0f, sDemoTreLgtInfo[gSaveContext.save.linkAge].endFrame + sDemoTreLgtInfo[gSaveContext.save.linkAge].unk_08, currentFrame, 1.0f); @@ -102,27 +103,26 @@ void func_809937B4(DemoTreLgt* this, PlayState* play, f32 currentFrame) { } void func_80993848(DemoTreLgt* this, PlayState* play) { - f32 currentFrame = this->skelCurve.curFrame; + f32 currentFrame = this->skelCurve.animCurFrame; - if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].endFrame) { + if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].endFrame) { this->unk_170 = 255; } else { - if (currentFrame <= (sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].endFrame + - sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].unk_08)) { - this->unk_170 = ((((sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].endFrame - currentFrame) / - sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].unk_08) * + if (currentFrame <= (sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].endFrame + + sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].unk_08)) { + this->unk_170 = ((((sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].endFrame - currentFrame) / + sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].unk_08) * 255.0f) + 255.0f); } else { this->unk_170 = 0; } } - if (currentFrame < sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].unk_0C) { + if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].unk_0C) { this->unk_174 = 255; - } else if (currentFrame < (sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].unk_0C + 10.0f)) { + } else if (currentFrame < (sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].unk_0C + 10.0f)) { this->unk_174 = - ((((sDemoTreLgtInfo[((void)0, gSaveContext.save.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) + - 255.0f); + ((((sDemoTreLgtInfo[(0, gSaveContext.save.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) + 255.0f); } else { this->unk_174 = 0; } @@ -141,7 +141,7 @@ void DemoTreLgt_Update(Actor* thisx, PlayState* play) { sActionFuncs[this->action](this, play); } -s32 DemoTreLgt_OverrideLimbDraw(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { +s32 DemoTreLgt_OverrideLimbDraw(PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) { s32 pad; DemoTreLgt* this = (DemoTreLgt*)thisx; @@ -159,14 +159,9 @@ s32 DemoTreLgt_OverrideLimbDraw(PlayState* play, SkelCurve* skelCurve, s32 limbI CLOSE_DISPS(play->state.gfxCtx, "../z_demo_tre_lgt.c", 448); //! @bug missing return - //! If the returned value (i.e. the contents of v0) ends up being false (0), the limb won't draw. Therefore what - //! matters is what was last written to v0 before the end of the function. - //! - In debug versions, the last instruction that does this is in `Graph_CloseDisps`. - //! - In retail versions, `gDPSetPrimColor` writes to it last. - //! In both cases, that instruction sets v0 to a non-NULL pointer, which is "true", so the limb happens to be drawn. -#ifdef AVOID_UB - return true; -#endif + // If the return value ends up being false (0), the limb won't draw (meaning no limb at all will draw). + // In MQ Debug, `Graph_CloseDisps` has the last instruction writing to v0 before this function ends. + // That instruction sets v0 to a non-NULL pointer, which is "true", so the limbs get drawn. } void DemoTreLgt_Draw(Actor* thisx, PlayState* play) { @@ -181,7 +176,7 @@ void DemoTreLgt_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Xlu(gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 200, 255, 0, 0); - SkelCurve_Draw(&this->actor, play, &this->skelCurve, DemoTreLgt_OverrideLimbDraw, NULL, 1, &this->actor); + SkelCurve_Draw(&this->actor, play, &this->skelCurve, DemoTreLgt_OverrideLimbDraw, NULL, 1, thisx); CLOSE_DISPS(gfxCtx, "../z_demo_tre_lgt.c", 476); } 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 5b4947575b4..8f61a1e2866 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 @@ -3,7 +3,6 @@ #include "ultra64.h" #include "actor.h" -#include "curve.h" struct DemoTreLgt; @@ -11,7 +10,7 @@ typedef void (*DemoTreLgtActionFunc)(struct DemoTreLgt*, struct PlayState*); typedef struct DemoTreLgt { /* 0x0000 */ Actor actor; - /* 0x014C */ SkelCurve skelCurve; + /* 0x014C */ SkelAnimeCurve skelCurve; /* 0x016C */ s32 action; /* 0x0170 */ u32 unk_170; // some sort of alpha /* 0x0174 */ u32 unk_174; // another sort of alpha diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c index c4c9d2f25e3..205a18ec896 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.c +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.c @@ -35,8 +35,8 @@ static InitChainEntry sInitChain[] = { }; void DoorToki_Init(Actor* thisx, PlayState* play) { - s32 pad; DoorToki* this = (DoorToki*)thisx; + s32 pad; CollisionHeader* colHeader = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); diff --git a/src/overlays/actors/ovl_Door_Toki/z_door_toki.h b/src/overlays/actors/ovl_Door_Toki/z_door_toki.h index fd0d8105b1a..23b4949fac5 100644 --- a/src/overlays/actors/ovl_Door_Toki/z_door_toki.h +++ b/src/overlays/actors/ovl_Door_Toki/z_door_toki.h @@ -8,7 +8,7 @@ struct DoorToki; typedef struct DoorToki { /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ char unk_164[0x4]; + /* 0x0164 */ char unk_164[4]; } DoorToki; // size = 0x0168 #endif 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 f7c9e270c6c..407730e989c 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -19,7 +19,7 @@ #include "assets/objects/object_warp1/object_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" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:0 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index b42d9bd29f1..ef135f4e907 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -70,18 +70,20 @@ static ColliderCylinderInit sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -void EnAni_SetupAction(EnAni* this, EnAniActionFunc actionFunc) { - this->actionFunc = actionFunc; -} - static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 850, ICHAIN_STOP), }; +static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f }; + +void EnAni_SetupAction(EnAni* this, EnAniActionFunc actionFunc) { + this->actionFunc = actionFunc; +} + void EnAni_Init(Actor* thisx, PlayState* play) { - s32 pad; EnAni* this = (EnAni*)thisx; + s32 pad; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, -2800.0f, ActorShadow_DrawCircle, 36.0f); @@ -191,14 +193,14 @@ void func_809B07F8(EnAni* this, PlayState* play) { } else { EnAni_SetupAction(this, func_809B0524); } - } else if (yawDiff > -0x36B0 && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && + } else if (yawDiff >= -0x36AF && yawDiff < 0 && this->actor.xzDistToPlayer < 150.0f && -80.0f < this->actor.yDistToPlayer) { if (GET_ITEMGETINF(ITEMGETINF_15)) { EnAni_SetText(this, play, 0x5056); } else { EnAni_SetText(this, play, 0x5055); } - } else if (yawDiff > -0x3E8 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { + } else if (yawDiff >= -0x3E7 && yawDiff < 0x36B0 && this->actor.xzDistToPlayer < 350.0f) { if (!GET_EVENTCHKINF(EVENTCHKINF_2F)) { textId = 0x5052; } else { @@ -287,12 +289,12 @@ void EnAni_Update(Actor* thisx, PlayState* play) { Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100); } - if (DECR(this->blinkTimer) == 0) { - this->blinkTimer = Rand_S16Offset(60, 60); + if (DECR(this->unk_2AE) == 0) { + this->unk_2AE = Rand_S16Offset(60, 60); } - this->eyeIndex = this->blinkTimer; - if (this->eyeIndex >= 3) { - this->eyeIndex = 0; + this->unk_2AC = this->unk_2AE; + if (this->unk_2AC >= 3) { + this->unk_2AC = 0; } } @@ -307,7 +309,6 @@ s32 EnAni_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p } void EnAni_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - static Vec3f sMultVec = { 800.0f, 500.0f, 0.0f }; EnAni* this = (EnAni*)thisx; if (limbIndex == 15) { @@ -328,7 +329,7 @@ void EnAni_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->unk_2AC])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnAni_OverrideLimbDraw, EnAni_PostLimbDraw, this); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.h b/src/overlays/actors/ovl_En_Ani/z_en_ani.h index 024f4310d1a..97a3ad01456 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.h +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.h @@ -18,8 +18,8 @@ typedef struct EnAni { /* 0x02A2 */ Vec3s unk_2A2; /* 0x02A8 */ u16 unk_2A8; /* 0x02AA */ u16 unk_2AA; - /* 0x02AC */ s16 eyeIndex; - /* 0x02AE */ s16 blinkTimer; + /* 0x02AC */ s16 unk_2AC; + /* 0x02AE */ s16 unk_2AE; /* 0x02B0 */ EnAniActionFunc actionFunc; } EnAni; // size = 0x02B4 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 913e722a8b1..3b30029d236 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -37,8 +37,8 @@ void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play); void EnAnubice_SetupIdle(EnAnubice* this, PlayState* play); void EnAnubice_Idle(EnAnubice* this, PlayState* play); void EnAnubice_GoToHome(EnAnubice* this, PlayState* play); -void EnAnubice_SetupShootFireball(EnAnubice* this, PlayState* play); -void EnAnubice_ShootFireball(EnAnubice* this, PlayState* play); +void EnAnubis_SetupShootFireball(EnAnubice* this, PlayState* play); +void EnAnubis_ShootFireball(EnAnubice* this, PlayState* play); void EnAnubice_Die(EnAnubice* this, PlayState* play); ActorProfile En_Anubice_Profile = { @@ -73,45 +73,39 @@ static ColliderCylinderInit sCylinderInit = { { 29, 103, 0, { 0, 0, 0 } }, }; -typedef enum AnubiceDamageReaction { - /* 0x0 */ ANUBICE_DMG_REACT_NONE, - /* 0x2 */ ANUBICE_DMG_REACT_FIRE = 2, - /* 0xF */ ANUBICE_DMG_REACT_0xF = 0xF // Treated the same as ANUBICE_DMG_REACT_NONE in code -} AnubiceDamageReaction; - static DamageTable sDamageTable[] = { - /* Deku nut */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Deku stick */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Slingshot */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Explosive */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Boomerang */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Normal arrow */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Hammer swing */ DMG_ENTRY(1, ANUBICE_DMG_REACT_0xF), - /* Hookshot */ DMG_ENTRY(2, ANUBICE_DMG_REACT_0xF), - /* Kokiri sword */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Master sword */ DMG_ENTRY(2, ANUBICE_DMG_REACT_0xF), - /* Giant's Knife */ DMG_ENTRY(6, ANUBICE_DMG_REACT_0xF), - /* Fire arrow */ DMG_ENTRY(2, ANUBICE_DMG_REACT_FIRE), - /* Ice arrow */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Light arrow */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Unk arrow 1 */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Unk arrow 2 */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Unk arrow 3 */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Fire magic */ DMG_ENTRY(3, ANUBICE_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Light magic */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Shield */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Giant spin */ DMG_ENTRY(6, ANUBICE_DMG_REACT_0xF), - /* Master spin */ DMG_ENTRY(2, ANUBICE_DMG_REACT_0xF), - /* Kokiri jump */ DMG_ENTRY(0, ANUBICE_DMG_REACT_0xF), - /* Giant jump */ DMG_ENTRY(12, ANUBICE_DMG_REACT_0xF), - /* Master jump */ DMG_ENTRY(4, ANUBICE_DMG_REACT_0xF), - /* Unknown 1 */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, ANUBICE_DMG_REACT_NONE), + /* Deku nut */ DMG_ENTRY(0, 0x0), + /* Deku stick */ DMG_ENTRY(0, 0xF), + /* Slingshot */ DMG_ENTRY(0, 0xF), + /* Explosive */ DMG_ENTRY(0, 0xF), + /* Boomerang */ DMG_ENTRY(0, 0xF), + /* Normal arrow */ DMG_ENTRY(0, 0xF), + /* Hammer swing */ DMG_ENTRY(1, 0xF), + /* Hookshot */ DMG_ENTRY(2, 0xF), + /* Kokiri sword */ DMG_ENTRY(0, 0xF), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(6, 0xF), + /* Fire arrow */ DMG_ENTRY(2, 0x2), + /* Ice arrow */ DMG_ENTRY(0, 0xF), + /* Light arrow */ DMG_ENTRY(0, 0xF), + /* Unk arrow 1 */ DMG_ENTRY(0, 0xF), + /* Unk arrow 2 */ DMG_ENTRY(0, 0xF), + /* Unk arrow 3 */ DMG_ENTRY(0, 0xF), + /* Fire magic */ DMG_ENTRY(3, 0x2), + /* Ice magic */ DMG_ENTRY(0, 0x0), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(0, 0xF), + /* Giant spin */ DMG_ENTRY(6, 0xF), + /* Master spin */ DMG_ENTRY(2, 0xF), + /* Kokiri jump */ DMG_ENTRY(0, 0xF), + /* Giant jump */ DMG_ENTRY(12, 0xF), + /* Master jump */ DMG_ENTRY(4, 0xF), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(0, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; void EnAnubice_Hover(EnAnubice* this, PlayState* play) { @@ -124,19 +118,19 @@ void EnAnubice_Hover(EnAnubice* this, PlayState* play) { this->actor.velocity.y = Math_SinS(this->hoverVelocityTimer); } -void EnAnubice_AimFireball(EnAnubice* this, PlayState* play) { - f32 xzDist; +void EnAnubice_SetFireballRot(EnAnubice* this, PlayState* play) { + f32 xzdist; f32 x; f32 y; f32 z; Player* player = GET_PLAYER(play); - x = player->actor.world.pos.x - this->headPos.x; - y = player->actor.world.pos.y + 10.0f - this->headPos.y; - z = player->actor.world.pos.z - this->headPos.z; - xzDist = sqrtf(SQ(x) + SQ(z)); + x = player->actor.world.pos.x - this->fireballPos.x; + y = player->actor.world.pos.y + 10.0f - this->fireballPos.y; + z = player->actor.world.pos.z - this->fireballPos.z; + xzdist = sqrtf(SQ(x) + SQ(z)); - this->fireballRot.x = -RAD_TO_BINANG(Math_FAtan2F(y, xzDist)); + this->fireballRot.x = -RAD_TO_BINANG(Math_FAtan2F(y, xzdist)); this->fireballRot.y = RAD_TO_BINANG(Math_FAtan2F(x, z)); } @@ -144,16 +138,15 @@ void EnAnubice_Init(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); - SkelAnime_Init(play, &this->skelAnime, &gAnubiceSkel, &gAnubiceIdleAnim, this->jointTable, this->morphTable, - ANUBICE_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &gAnubiceSkel, &gAnubiceIdleAnim, this->jointTable, this->morphTable, 16); PRINTF("\n\n"); PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ アヌビス発生 ☆☆☆☆☆ \n", "☆☆☆☆☆ Anubis spawn ☆☆☆☆☆ \n") VT_RST); this->actor.naviEnemyId = NAVI_ENEMY_ANUBIS; - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->col); + Collider_SetCylinder(play, &this->col, &this->actor, &sCylinderInit); Actor_SetScale(&this->actor, 0.015f); @@ -169,16 +162,16 @@ void EnAnubice_Init(Actor* thisx, PlayState* play) { void EnAnubice_Destroy(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; - EnAnubiceTag* tag; + EnAnubiceTag* temp_v1; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->col); if (this->actor.params != 0) { if (this->actor.parent) {} - tag = (EnAnubiceTag*)this->actor.parent; - if (tag != NULL && tag->actor.update != NULL) { - tag->anubis = NULL; + temp_v1 = (EnAnubiceTag*)this->actor.parent; + if (temp_v1 != NULL && temp_v1->actor.update != NULL) { + temp_v1->anubis = NULL; } } } @@ -187,7 +180,7 @@ void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play) { Actor* currentProp; s32 flameCirclesFound; - if (this->isMirroringPlayer) { + if (this->isMirroringLink) { if (!this->hasSearchedForFlameCircles) { flameCirclesFound = 0; currentProp = play->actorCtx.actorLists[ACTORCAT_PROP].head; @@ -200,7 +193,7 @@ void EnAnubice_FindFlameCircles(EnAnubice* this, PlayState* play) { flameCirclesFound); PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ 火は幾つ? ☆☆☆☆☆ %x\n", "☆☆☆☆☆ How many fires? ☆☆☆☆☆ %x\n") VT_RST, this->flameCircles[flameCirclesFound]); - if (flameCirclesFound < ARRAY_COUNT(this->flameCircles) - 1) { + if (flameCirclesFound < 4) { flameCirclesFound++; } currentProp = currentProp->next; @@ -237,8 +230,8 @@ void EnAnubice_Idle(EnAnubice* this, PlayState* play) { this->actor.shape.yOffset = 0.0f; if (player->meleeWeaponState != 0) { - this->actionFunc = EnAnubice_SetupShootFireball; - } else if (this->isPlayerOutOfRange) { + this->actionFunc = EnAnubis_SetupShootFireball; + } else if (this->isLinkOutOfRange) { this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; this->actionFunc = EnAnubice_GoToHome; @@ -247,9 +240,9 @@ void EnAnubice_Idle(EnAnubice* this, PlayState* play) { } void EnAnubice_GoToHome(EnAnubice* this, PlayState* play) { - f32 xzDist; - f32 normalizedX; - f32 normalizedY; + f32 xzdist; + f32 xRatio; + f32 zRatio; f32 x; f32 z; @@ -261,33 +254,32 @@ void EnAnubice_GoToHome(EnAnubice* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 3000, 0); } - if ((fabsf(this->home.x - this->actor.world.pos.x) > 3.0f) && - (fabsf(this->home.z - this->actor.world.pos.z) > 3.0f)) { + if (fabsf(this->home.x - this->actor.world.pos.x) > 3.0f && fabsf(this->home.z - this->actor.world.pos.z) > 3.0f) { x = this->home.x - this->actor.world.pos.x; z = this->home.z - this->actor.world.pos.z; - xzDist = sqrtf(SQ(x) + SQ(z)); - normalizedX = x / xzDist; - normalizedY = z / xzDist; - this->actor.world.pos.x += normalizedX * 8; - this->actor.world.pos.z += normalizedY * 8.0f; + xzdist = sqrtf(SQ(x) + SQ(z)); + xRatio = ((x) / xzdist); + zRatio = ((z) / xzdist); + this->actor.world.pos.x += (xRatio * 8); + this->actor.world.pos.z += (zRatio * 8.0f); } else if (this->actor.shape.yOffset < -4220.0f) { this->actor.shape.yOffset = -4230.0f; - this->isMirroringPlayer = this->isPlayerOutOfRange = false; + this->isMirroringLink = this->isLinkOutOfRange = false; this->actionFunc = EnAnubice_FindFlameCircles; this->actor.gravity = 0.0f; } } -void EnAnubice_SetupShootFireball(EnAnubice* this, PlayState* play) { +void EnAnubis_SetupShootFireball(EnAnubice* this, PlayState* play) { f32 lastFrame = Animation_GetLastFrame(&gAnubiceAttackingAnim); this->animLastFrame = lastFrame; Animation_Change(&this->skelAnime, &gAnubiceAttackingAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -10.0f); - this->actionFunc = EnAnubice_ShootFireball; + this->actionFunc = EnAnubis_ShootFireball; this->actor.velocity.x = this->actor.velocity.z = 0.0f; } -void EnAnubice_ShootFireball(EnAnubice* this, PlayState* play) { +void EnAnubis_ShootFireball(EnAnubice* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -296,11 +288,11 @@ void EnAnubice_ShootFireball(EnAnubice* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 3000, 0); } - EnAnubice_AimFireball(this, play); + EnAnubice_SetFireballRot(this, play); if (curFrame == 12.0f) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ANUBICE_FIRE, this->headPos.x, this->headPos.y + 15.0f, - this->headPos.z, this->fireballRot.x, this->fireballRot.y, 0, 0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ANUBICE_FIRE, this->fireballPos.x, this->fireballPos.y + 15.0f, + this->fireballPos.z, this->fireballRot.x, this->fireballRot.y, 0, 0); } if (this->animLastFrame <= curFrame) { @@ -314,15 +306,15 @@ void EnAnubice_SetupDie(EnAnubice* this, PlayState* play) { this->animLastFrame = lastFrame; Animation_Change(&this->skelAnime, &gAnubiceFallDownAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -20.0f); - this->isNearWall = false; - this->fallTargetYaw = 0; + this->unk_256 = false; + this->unk_258 = 0; this->deathTimer = 20; this->actor.velocity.x = this->actor.velocity.z = 0.0f; this->actor.gravity = -1.0f; - if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->headPos, 70.0f)) { - this->isNearWall = true; - this->fallTargetYaw = this->actor.shape.rot.x - 0x7F00; + if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->fireballPos, 70.0f)) { + this->unk_256 = true; + this->unk_258 = this->actor.shape.rot.x - 0x7F00; } this->actionFunc = EnAnubice_Die; @@ -330,39 +322,36 @@ void EnAnubice_SetupDie(EnAnubice* this, PlayState* play) { void EnAnubice_Die(EnAnubice* this, PlayState* play) { f32 curFrame; - f32 rotX; - Vec3f baseFireEffectPos = { 0.0f, 0.0f, 0.0f }; - Vec3f rotatedFireEffectPos = { 0.0f, 0.0f, 0.0f }; + f32 phi_f2; + Vec3f sp4C = { 0.0f, 0.0f, 0.0f }; + Vec3f fireEffectPos = { 0.0f, 0.0f, 0.0f }; s32 pad; SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.shape.shadowScale, 0.4f, 0.25f); - // If near a wall, turn away from it while dying to avoid going through it. - // The implementation of this is bugged in the sense that the target angle is hardcoded in practice. If the poly - // already has an angle of -0x7F00, the expected behavior won't occur. - if (this->isNearWall) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->fallTargetYaw, 1, 10000, 0); - if (fabsf(this->actor.shape.rot.y - this->fallTargetYaw) < 100.0f) { - this->isNearWall = false; + if (this->unk_256) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_258, 1, 10000, 0); + if (fabsf(this->actor.shape.rot.y - this->unk_258) < 100.0f) { + this->unk_256 = false; } } curFrame = this->skelAnime.curFrame; - rotX = curFrame * -3000.0f; - rotX = CLAMP_MIN(rotX, -11000.0f); + phi_f2 = curFrame * -3000.0f; + phi_f2 = CLAMP_MIN(phi_f2, -11000.0f); Matrix_RotateY(BINANG_TO_RAD_ALT(this->actor.shape.rot.y), MTXMODE_NEW); - Matrix_RotateX(BINANG_TO_RAD_ALT(rotX), MTXMODE_APPLY); - baseFireEffectPos.y = Rand_CenteredFloat(10.0f) + 30.0f; - Matrix_MultVec3f(&baseFireEffectPos, &rotatedFireEffectPos); - rotatedFireEffectPos.x += this->actor.world.pos.x + Rand_CenteredFloat(40.0f); - rotatedFireEffectPos.y += this->actor.world.pos.y + Rand_CenteredFloat(40.0f); - rotatedFireEffectPos.z += this->actor.world.pos.z + Rand_CenteredFloat(30.0f); - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 128, COLORFILTER_BUFFLAG_OPA, 8); - EffectSsEnFire_SpawnVec3f(play, &this->actor, &rotatedFireEffectPos, 100, 0, 0, -1); - - if ((this->animLastFrame <= curFrame) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Matrix_RotateX(BINANG_TO_RAD_ALT(phi_f2), MTXMODE_APPLY); + sp4C.y = Rand_CenteredFloat(10.0f) + 30.0f; + Matrix_MultVec3f(&sp4C, &fireEffectPos); + fireEffectPos.x += this->actor.world.pos.x + Rand_CenteredFloat(40.0f); + fireEffectPos.y += this->actor.world.pos.y + Rand_CenteredFloat(40.0f); + fireEffectPos.z += this->actor.world.pos.z + Rand_CenteredFloat(30.0f); + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 0x80, COLORFILTER_BUFFLAG_OPA, 8); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &fireEffectPos, 100, 0, 0, -1); + + if (this->animLastFrame <= curFrame && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Math_ApproachF(&this->actor.shape.yOffset, -4230.0f, 0.5f, 300.0f); if (this->actor.shape.yOffset < -2000.0f) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, @@ -376,19 +365,19 @@ void EnAnubice_Update(Actor* thisx, PlayState* play) { f32 zero; BgHidanCurtain* flameCircle; s32 i; - Vec3f baseKnockbackVelocity; - Vec3f rotatedKnockbackVelocity; + Vec3f sp48; + Vec3f sp3C; EnAnubice* this = (EnAnubice*)thisx; - if ((this->actionFunc != EnAnubice_SetupDie) && (this->actionFunc != EnAnubice_Die) && - (this->actor.shape.yOffset == 0.0f)) { + if (this->actionFunc != EnAnubice_SetupDie && this->actionFunc != EnAnubice_Die && + this->actor.shape.yOffset == 0.0f) { EnAnubice_Hover(this, play); - for (i = 0; i < ARRAY_COUNT(this->flameCircles); i++) { + for (i = 0; i < 5; i++) { flameCircle = this->flameCircles[i]; - if ((flameCircle != NULL) && (fabsf(flameCircle->actor.world.pos.x - this->actor.world.pos.x) < 60.0f) && - (fabsf(this->flameCircles[i]->actor.world.pos.z - this->actor.world.pos.z) < 60.0f) && - (flameCircle->timer != 0)) { + if (flameCircle != NULL && fabsf(flameCircle->actor.world.pos.x - this->actor.world.pos.x) < 60.0f && + fabsf(this->flameCircles[i]->actor.world.pos.z - this->actor.world.pos.z) < 60.0f && + flameCircle->timer != 0) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Enemy_StartFinishingBlow(play, &this->actor); @@ -398,9 +387,9 @@ void EnAnubice_Update(Actor* thisx, PlayState* play) { } } - if (this->collider.base.acFlags & AC_HIT) { - this->collider.base.acFlags &= ~AC_HIT; - if (this->actor.colChkInfo.damageReaction == ANUBICE_DMG_REACT_FIRE) { + if (this->col.base.acFlags & 2) { + this->col.base.acFlags &= ~2; + if (this->actor.colChkInfo.damageReaction == 2) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Enemy_StartFinishingBlow(play, &this->actor); @@ -413,20 +402,20 @@ void EnAnubice_Update(Actor* thisx, PlayState* play) { this->knockbackTimer = 10; this->isKnockedback = true; - baseKnockbackVelocity.x = 0.0f; - baseKnockbackVelocity.y = 0.0f; - baseKnockbackVelocity.z = -10.0f; - rotatedKnockbackVelocity.x = 0.0f; - rotatedKnockbackVelocity.y = 0.0f; - rotatedKnockbackVelocity.z = 0.0f; + sp48.x = 0.0f; + sp48.y = 0.0f; + sp48.z = -10.0f; + sp3C.x = 0.0f; + sp3C.y = 0.0f; + sp3C.z = 0.0f; Matrix_RotateY(BINANG_TO_RAD_ALT(this->actor.shape.rot.y), MTXMODE_NEW); - Matrix_MultVec3f(&baseKnockbackVelocity, &rotatedKnockbackVelocity); + Matrix_MultVec3f(&sp48, &sp3C); - this->actor.velocity.x = rotatedKnockbackVelocity.x; - this->actor.velocity.z = rotatedKnockbackVelocity.z; - this->knockbackRecoveryVelocity.x = -rotatedKnockbackVelocity.x; - this->knockbackRecoveryVelocity.z = -rotatedKnockbackVelocity.z; + this->actor.velocity.x = sp3C.x; + this->actor.velocity.z = sp3C.z; + this->knockbackRecoveryVelocity.x = -sp3C.x; + this->knockbackRecoveryVelocity.z = -sp3C.z; Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_CUTBODY); } @@ -463,7 +452,7 @@ void EnAnubice_Update(Actor* thisx, PlayState* play) { this->actor.velocity.y += this->actor.gravity; Actor_UpdatePos(&this->actor); - if (!this->isPlayerOutOfRange) { + if (!this->isLinkOutOfRange) { Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 5.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); @@ -472,37 +461,37 @@ void EnAnubice_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); } - if ((this->actionFunc != EnAnubice_SetupDie) && (this->actionFunc != EnAnubice_Die)) { + if (this->actionFunc != EnAnubice_SetupDie && this->actionFunc != EnAnubice_Die) { Actor_SetFocus(&this->actor, this->focusHeightOffset); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->col); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->col.base); - if (!this->isKnockedback && (this->actor.shape.yOffset == 0.0f)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + if (!this->isKnockedback && this->actor.shape.yOffset == 0.0f) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->col.base); } } } -s32 EnAnubice_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnAnubis_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnAnubice* this = (EnAnubice*)thisx; - if (limbIndex == ANUBICE_LIMB_HEAD) { - rot->z += this->headPitch; + if (limbIndex == 13) { + rot->z += this->unk_278; } return false; } -void EnAnubice_PostLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnAnubis_PostLimbDraw(struct PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnAnubice* this = (EnAnubice*)thisx; Vec3f pos = { 0.0f, 0.0f, 0.0f }; - if (limbIndex == ANUBICE_LIMB_HEAD) { + if (limbIndex == 13) { OPEN_DISPS(play->state.gfxCtx, "../z_en_anubice.c", 853); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_anubice.c", 856); gSPDisplayList(POLY_XLU_DISP++, gAnubiceEyesDL); - Matrix_MultVec3f(&pos, &this->headPos); + Matrix_MultVec3f(&pos, &this->fireballPos); CLOSE_DISPS(play->state.gfxCtx, "../z_en_anubice.c", 868); } @@ -512,6 +501,6 @@ void EnAnubice_Draw(Actor* thisx, PlayState* play) { EnAnubice* this = (EnAnubice*)thisx; Gfx_SetupDL_25Xlu(play->state.gfxCtx); - SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnAnubice_OverrideLimbDraw, - EnAnubice_PostLimbDraw, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnAnubis_OverrideLimbDraw, + EnAnubis_PostLimbDraw, this); } 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 fd54405a294..9abce19bcdc 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.h @@ -13,31 +13,31 @@ typedef void (*EnAnubiceActionFunc)(struct EnAnubice*, struct PlayState*); typedef struct EnAnubice { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[ANUBICE_LIMB_MAX]; - /* 0x01F0 */ Vec3s morphTable[ANUBICE_LIMB_MAX]; + /* 0x0190 */ Vec3s jointTable[16]; + /* 0x01F0 */ Vec3s morphTable[16]; /* 0x0250 */ EnAnubiceActionFunc actionFunc; /* 0x0254 */ s16 timeAlive; - /* 0x0256 */ s16 isNearWall; // Technically any bg poly, but in practice usually a wall - /* 0x0258 */ s16 fallTargetYaw; + /* 0x0256 */ s16 unk_256; + /* 0x0258 */ s16 unk_258; /* 0x025A */ s16 deathTimer; /* 0x025C */ s16 knockbackTimer; - /* 0x025E */ s16 isMirroringPlayer; - /* 0x0260 */ s16 isPlayerOutOfRange; - /* 0x0262 */ s16 isKnockedback; // Hit by an attack without ANUBICE_DMG_REACT_FIRE + /* 0x025E */ s16 isMirroringLink; + /* 0x0260 */ s16 isLinkOutOfRange; + /* 0x0262 */ s16 isKnockedback; /* 0x0264 */ s16 hasSearchedForFlameCircles; /* 0x0268 */ f32 hoverVelocityTimer; /* 0x026C */ f32 animLastFrame; /* 0x0270 */ f32 targetHeight; /* 0x0274 */ f32 playerHeightOffset; // How high above the player to hover at - /* 0x0278 */ f32 headPitch; // Never changed from initial value 0 + /* 0x0278 */ f32 unk_278; /* 0x027C */ f32 focusHeightOffset; - /* 0x0280 */ Vec3f headPos; + /* 0x0280 */ Vec3f fireballPos; /* 0x028C */ Vec3f fireballRot; /* 0x0298 */ Vec3f home; /* 0x02A4 */ Vec3f knockbackRecoveryVelocity; /* 0x02B0 */ struct BgHidanCurtain* flameCircles[5]; - /* 0x02C4 */ char unk_2C4[0x4]; // Possibly another element of flameCircles - /* 0x02C8 */ ColliderCylinder collider; + /* 0x02C4 */ char unk_2C0[4]; + /* 0x02C8 */ ColliderCylinder col; } EnAnubice; // size = 0x0314 #endif diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c index 9d49a272346..a3cf5c79eb1 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.c @@ -49,7 +49,7 @@ void EnAnubiceTag_Init(Actor* thisx, PlayState* play) { this->actor.params = 0; } if (this->actor.params != 0) { - this->extraTriggerRange = this->actor.params * 40.0f; + this->triggerRange = this->actor.params * 40.0f; } this->actionFunc = EnAnubiceTag_SpawnAnubis; } @@ -86,16 +86,21 @@ void EnAnubiceTag_ManageAnubis(EnAnubiceTag* this, PlayState* play) { return; } - if (this->actor.xzDistToPlayer < (200.0f + this->extraTriggerRange)) { - if (!anubis->isPlayerOutOfRange && !anubis->isKnockedback) { - anubis->isMirroringPlayer = true; - offset.x = -Math_SinS(this->actor.yawTowardsPlayer) * this->actor.xzDistToPlayer; - offset.z = -Math_CosS(this->actor.yawTowardsPlayer) * this->actor.xzDistToPlayer; - Math_ApproachF(&anubis->actor.world.pos.x, this->actor.world.pos.x + offset.x, 0.3f, 10.0f); - Math_ApproachF(&anubis->actor.world.pos.z, this->actor.world.pos.z + offset.z, 0.3f, 10.0f); + if (this->actor.xzDistToPlayer < (200.0f + this->triggerRange)) { + if (!anubis->isLinkOutOfRange) { + if (!anubis->isKnockedback) { + anubis->isMirroringLink = true; + offset.x = -Math_SinS(this->actor.yawTowardsPlayer) * this->actor.xzDistToPlayer; + offset.z = -Math_CosS(this->actor.yawTowardsPlayer) * this->actor.xzDistToPlayer; + Math_ApproachF(&anubis->actor.world.pos.x, (this->actor.world.pos.x + offset.x), 0.3f, 10.0f); + Math_ApproachF(&anubis->actor.world.pos.z, (this->actor.world.pos.z + offset.z), 0.3f, 10.0f); + return; + } + } + } else { + if (anubis->isMirroringLink) { + anubis->isLinkOutOfRange = true; } - } else if (anubis->isMirroringPlayer) { - anubis->isPlayerOutOfRange = true; } } @@ -111,6 +116,6 @@ void EnAnubiceTag_Draw(Actor* thisx, PlayState* play) { if (DEBUG_FEATURES && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, - 1.0f, 255, 0, 0, 255, 4, play->state.gfxCtx); + 1.0f, 0xFF, 0, 0, 0xFF, 4, play->state.gfxCtx); } } diff --git a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h index afbc61970bd..72fe06ddd99 100644 --- a/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h +++ b/src/overlays/actors/ovl_En_Anubice_Tag/z_en_anubice_tag.h @@ -12,7 +12,7 @@ typedef struct EnAnubiceTag { /* 0x0000 */ Actor actor; /* 0x014C */ EnAnubiceTagActionFunc actionFunc; /* 0x0150 */ struct EnAnubice* anubis; - /* 0x0154 */ f32 extraTriggerRange; + /* 0x0154 */ f32 triggerRange; } EnAnubiceTag; // size = 0x0158 #endif 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 59a3a06a221..66d51b8539a 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -568,7 +568,7 @@ void EnBb_Blue(EnBb* this, PlayState* play) { Math_SmoothStepToF(&this->flameScaleY, 80.0f, 1.0f, 10.0f, 0.0f); Math_SmoothStepToF(&this->flameScaleX, 100.0f, 1.0f, 10.0f, 0.0f); - if (this->actor.floorHeight > BGCHECK_Y_MIN) { + if (this->actor.floorHeight > -32000.0f) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 50.0f + this->flyHeightMod, 1.0f, 0.5f, 0.0f); } 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 8c59981d488..579cd34f130 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -1,9 +1,3 @@ -/* - * File: z_en_bili.c - * Overlay: ovl_En_Bili - * Description: Biri (small jellyfish-like enemy) - */ - #include "z_en_bili.h" #include "libc64/qrand.h" @@ -30,19 +24,35 @@ void EnBili_Destroy(Actor* thisx, PlayState* play); void EnBili_Update(Actor* thisx, PlayState* play2); void EnBili_Draw(Actor* thisx, PlayState* play); -void EnBili_SetupFloatIdle(EnBili* this); -void EnBili_SetupSpawnedFlyApart(EnBili* this); -void EnBili_FloatIdle(EnBili* this, PlayState* play); -void EnBili_SpawnedFlyApart(EnBili* this, PlayState* play); -void EnBili_DischargeLightning(EnBili* this, PlayState* play); -void EnBili_Climb(EnBili* this, PlayState* play); -void EnBili_ApproachPlayer(EnBili* this, PlayState* play); -void EnBili_SetNewHomeHeight(EnBili* this, PlayState* play); -void EnBili_Recoil(EnBili* this, PlayState* play); -void EnBili_Burnt(EnBili* this, PlayState* play); -void EnBili_Die(EnBili* this, PlayState* play); -void EnBili_Stunned(EnBili* this, PlayState* play); -void EnBili_Frozen(EnBili* this, PlayState* play); +void func_809BF9BC(EnBili* this); +void func_809BFA14(EnBili* this); +void func_809BFA8C(EnBili* this); +void func_809BFAE8(EnBili* this); +void func_809BFB40(EnBili* this); +void func_809BFB5C(EnBili* this); +void func_809BFBC4(EnBili* this); +void func_809BFC48(EnBili* this); +void func_809BFCE8(EnBili* this); +void func_809BFD18(EnBili* this); +void func_809BFD94(EnBili* this, PlayState* play); +void func_809BFF6C(EnBili* this); +void func_809C008C(EnBili* this); +void func_809C0174(EnBili* this, PlayState* play); +void func_809C0260(EnBili* this, PlayState* play); +void func_809C02B8(EnBili* this, PlayState* play); +void func_809C04B4(EnBili* this, PlayState* play); +void func_809C0570(EnBili* this, PlayState* play); +void func_809C0600(EnBili* this, PlayState* play); +void func_809C067C(EnBili* this, PlayState* play); +void func_809C06E0(EnBili* this, PlayState* play); +void func_809C0754(EnBili* this, PlayState* play); +void func_809C0980(EnBili* this, PlayState* play); +void func_809C09E0(EnBili* this, PlayState* play); +void func_809C0A70(EnBili* this, PlayState* play); +void func_809C0E08(EnBili* this, f32 arg1, Vec3f* arg2); +void func_809C1020(EnBili* this, f32 arg1, Vec3f* arg2); +void func_809C1240(EnBili* this, f32 arg1, Vec3f* arg2); +s32 EnBili_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx); ActorProfile En_Bili_Profile = { /**/ ACTOR_EN_BILI, @@ -56,7 +66,7 @@ ActorProfile En_Bili_Profile = { /**/ EnBili_Draw, }; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_809C1640 = { { COL_MATERIAL_HIT8, AT_ON | AT_TYPE_ENEMY, @@ -76,539 +86,452 @@ static ColliderCylinderInit sCylinderInit = { { 9, 28, -20, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 9, 28, -20, 30 }; - -typedef enum BiriDamageReaction { - /* 0x0 */ BIRI_DMG_REACT_NONE, - /* 0x1 */ BIRI_DMG_REACT_DEKUNUT, - /* 0x2 */ BIRI_DMG_REACT_FIRE, - /* 0x3 */ BIRI_DMG_REACT_ICE, - /* 0xE */ BIRI_DMG_REACT_SLINGSHOT = 0xE, - /* 0xF */ BIRI_DMG_REACT_SWORD -} BiriDamageReaction; - -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, BIRI_DMG_REACT_DEKUNUT), - /* Deku stick */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Slingshot */ DMG_ENTRY(0, BIRI_DMG_REACT_SLINGSHOT), - /* Explosive */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(1, BIRI_DMG_REACT_NONE), - /* Normal arrow */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Hookshot */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Kokiri sword */ DMG_ENTRY(1, BIRI_DMG_REACT_SWORD), - /* Master sword */ DMG_ENTRY(2, BIRI_DMG_REACT_SWORD), - /* Giant's Knife */ DMG_ENTRY(4, BIRI_DMG_REACT_SWORD), - /* Fire arrow */ DMG_ENTRY(4, BIRI_DMG_REACT_FIRE), - /* Ice arrow */ DMG_ENTRY(4, BIRI_DMG_REACT_ICE), - /* Light arrow */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Unk arrow 1 */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Unk arrow 2 */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Unk arrow 3 */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Fire magic */ DMG_ENTRY(4, BIRI_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(4, BIRI_DMG_REACT_ICE), - /* Light magic */ DMG_ENTRY(0, BIRI_DMG_REACT_NONE), - /* Shield */ DMG_ENTRY(0, BIRI_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, BIRI_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, BIRI_DMG_REACT_NONE), - /* Giant spin */ DMG_ENTRY(4, BIRI_DMG_REACT_NONE), - /* Master spin */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Kokiri jump */ DMG_ENTRY(2, BIRI_DMG_REACT_NONE), - /* Giant jump */ DMG_ENTRY(8, BIRI_DMG_REACT_NONE), - /* Master jump */ DMG_ENTRY(4, BIRI_DMG_REACT_NONE), - /* Unknown 1 */ DMG_ENTRY(0, BIRI_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, BIRI_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, BIRI_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, BIRI_DMG_REACT_NONE), +static CollisionCheckInfoInit2 D_809C166C = { 1, 9, 0x1C, -0x14, 0x1E }; +static DamageTable D_809C1678 = { + { + 0x10, 2, 0xE0, 2, 1, 2, 2, 2, 0xF1, 0xF2, 0xF4, 0x24, 0x34, 2, 2, 2, + 2, 0x24, 0x34, 0, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, + }, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_809C1698[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIRI, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_STOP), }; +static Color_RGBA8 D_809C16A0 = { 0xFF, 0xFF, 0xFF, 0xFF }; +static Color_RGBA8 D_809C16A4 = { 0xC8, 0xFF, 0xFF, 0xFF }; void EnBili_Init(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->actor, D_809C1698); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &gBiriSkel, &gBiriDefaultAnim, this->jointTable, this->morphTable, - BIRI_LIMB_MAX); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->playFlySfx = false; - - if (this->actor.params == EN_BILI_TYPE_NORMAL) { - EnBili_SetupFloatIdle(this); + SkelAnime_Init(play, &this->unk14C, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->unk198, this->unk1B6, 5); + Collider_InitCylinder(play, &this->unk1D4); + Collider_SetCylinder(play, &this->unk1D4, &this->actor, &D_809C1640); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_809C1678, &D_809C166C); + this->unk195 = 0; + if (this->actor.params == -1) { + func_809BF9BC(this); } else { - EnBili_SetupSpawnedFlyApart(this); + func_809BFA14(this); } } void EnBili_Destroy(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk1D4); } -// Setup Action Functions - -void EnBili_SetupFloatIdle(EnBili* this) { +void func_809BF9BC(EnBili* this) { this->actor.speed = 0.7f; - this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; - this->timer = 32; + this->unk1D4.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; + this->unk196 = 0x20; this->actor.home.pos.y = this->actor.world.pos.y; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - this->collider.base.atFlags |= AT_ON; - this->collider.base.acFlags |= AC_ON; - this->actionFunc = EnBili_FloatIdle; + this->unk1D4.base.atFlags |= AT_ON; + this->unk1D4.base.acFlags |= AC_ON; + this->unk190 = func_809C0174; } -/** - * Separates the Biri spawned by a dying EnVali. - */ -void EnBili_SetupSpawnedFlyApart(EnBili* this) { - Animation_PlayLoop(&this->skelAnime, &gBiriDefaultAnim); - this->timer = 25; +void func_809BFA14(EnBili* this) { + Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); + this->unk196 = 0x19; this->actor.velocity.y = 6.0f; this->actor.gravity = -0.3f; - this->collider.base.atFlags &= ~AT_ON; - this->actionFunc = EnBili_SpawnedFlyApart; this->actor.speed = 3.0f; + this->unk1D4.base.atFlags &= ~AT_ON; + this->unk190 = func_809C0260; } -/** - * Used for both touching player/player's shield and being hit with sword. What to do next is determined by params. - */ -void EnBili_SetupDischargeLightning(EnBili* this) { - Animation_PlayLoop(&this->skelAnime, &gBiriDischargeLightningAnim); - this->timer = 10; - this->actionFunc = EnBili_DischargeLightning; +void func_809BFA8C(EnBili* this) { + Animation_PlayLoop(&this->unk14C, &object_bl_Anim_000024); + this->unk196 = 0xA; + this->unk190 = func_809C02B8; this->actor.speed = 0.0f; this->actor.velocity.y = -1.0f; } -void EnBili_SetupClimb(EnBili* this) { - Animation_PlayOnce(&this->skelAnime, &gBiriClimbAnim); - this->collider.base.atFlags &= ~AT_ON; - this->actionFunc = EnBili_Climb; +void func_809BFAE8(EnBili* this) { + Animation_PlayOnce(&this->unk14C, &object_bl_Anim_000064); + this->unk1D4.base.atFlags &= ~AT_ON; + this->unk190 = func_809C04B4; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; } -void EnBili_SetupApproachPlayer(EnBili* this) { +void func_809BFB40(EnBili* this) { this->actor.speed = 1.2f; - this->actionFunc = EnBili_ApproachPlayer; + this->unk190 = func_809C0570; } -void EnBili_SetupSetNewHomeHeight(EnBili* this) { - Animation_PlayLoop(&this->skelAnime, &gBiriDefaultAnim); - this->timer = 96; +void func_809BFB5C(EnBili* this) { + Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); + this->unk196 = 0x60; this->actor.speed = 0.9f; - this->collider.base.atFlags |= AT_ON; - this->actionFunc = EnBili_SetNewHomeHeight; this->actor.home.pos.y = this->actor.world.pos.y; + this->unk1D4.base.atFlags |= 1; + this->unk190 = func_809C0600; } -void EnBili_SetupRecoil(EnBili* this) { - if (this->skelAnime.animation != &gBiriDefaultAnim) { - Animation_PlayLoop(&this->skelAnime, &gBiriDefaultAnim); +void func_809BFBC4(EnBili* this) { + if (this->unk14C.animation != &object_bl_Anim_0000A4) { + Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); } - - this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->collider.base.ac->prevPos) + 0x8000; - this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->collider.base.ac->prevPos); - this->actionFunc = EnBili_Recoil; + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->unk1D4.base.ac->prevPos) + 0x8000; + this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->unk1D4.base.ac->prevPos); + this->unk190 = func_809C067C; this->actor.speed = 5.0f; } -/** - * Used for both fire damage and generic damage - */ -void EnBili_SetupBurnt(EnBili* this) { - if (this->actionFunc == EnBili_Climb) { - Animation_PlayLoop(&this->skelAnime, &gBiriDefaultAnim); +void func_809BFC48(EnBili* this) { + if (this->unk190 == func_809C04B4) { + Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); } - - this->timer = 20; - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; + this->unk196 = 0x14; + this->unk1D4.base.atFlags &= ~AT_ON; + this->unk1D4.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_XLU, 20); - this->actionFunc = EnBili_Burnt; + this->unk190 = func_809C06E0; } -void EnBili_SetupDie(EnBili* this) { - this->timer = 18; +void func_809BFCE8(EnBili* this) { + this->unk196 = 0x12; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = EnBili_Die; + this->unk190 = func_809C0754; this->actor.speed = 0.0f; } -/** - * Falls to ground - */ -void EnBili_SetupStunned(EnBili* this) { - this->timer = 80; - this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; +void func_809BFD18(EnBili* this) { + this->unk196 = 0x50; + this->unk1D4.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; this->actor.gravity = -1.0f; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 80); Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->collider.base.atFlags &= ~AT_ON; - this->actionFunc = EnBili_Stunned; + this->unk1D4.base.atFlags &= ~AT_ON; + this->unk190 = func_809C0980; } -void EnBili_SetupFrozen(EnBili* this, PlayState* play) { - s32 i; - Vec3f effectPos; +void func_809BFD94(EnBili* this, PlayState* play) { + s32 var_s0; + Vec3f sp80; if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { this->actor.gravity = -1.0f; } - this->actor.velocity.y = 0.0f; - effectPos.y = this->actor.world.pos.y - 15.0f; - - for (i = 0; i < 8; i++) { - - effectPos.x = this->actor.world.pos.x + ((i & 1) ? 7.0f : -7.0f); - effectPos.y += 2.5f; - effectPos.z = this->actor.world.pos.z + ((i & 4) ? 7.0f : -7.0f); - - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effectPos, 150, 150, 150, 250, 235, 245, 255, + sp80.y = this->actor.world.pos.y - 15.0f; + for (var_s0 = 0; var_s0 < 8; var_s0++) { + sp80.x = ((var_s0 & 1) ? 7.0f : -7.0f) + this->actor.world.pos.x; + sp80.y += 2.5f; + sp80.z = ((var_s0 & 4) ? 7.0f : -7.0f) + this->actor.world.pos.z; + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp80, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 0.7f); } - this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 10); - this->collider.base.atFlags &= ~AT_ON; - this->collider.base.acFlags &= ~AC_ON; - this->timer = 300; - this->actionFunc = EnBili_Frozen; -} - -// Miscellaneous - -/** - * Changes the texture displayed on the oral arms limb using the current frame. - */ -void EnBili_UpdateTentaclesIndex(EnBili* this) { - s16 curFrame = this->skelAnime.curFrame; - s16 temp; // Not strictly necessary, but avoids a few s16 casts - - if (this->actionFunc == EnBili_DischargeLightning) { - temp = 3 - curFrame; - this->tentaclesTexIndex = (ABS(temp) + 5) % 8; - } else if (this->actionFunc == EnBili_Climb) { - if (curFrame <= 9) { - temp = curFrame >> 1; - this->tentaclesTexIndex = CLAMP_MAX(temp, 3); - } else if (curFrame <= 18) { - temp = 17 - curFrame; - this->tentaclesTexIndex = CLAMP_MIN(temp, 0) >> 1; - } else if (curFrame <= 36) { - this->tentaclesTexIndex = ((36 - curFrame) / 3) + 2; + this->unk1D4.base.atFlags &= ~AT_ON; + this->unk1D4.base.acFlags &= ~AC_ON; + this->unk196 = 0x12C; + this->unk190 = func_809C09E0; +} + +void func_809BFF6C(EnBili* this) { + s16 temp_v1_2; + s16 temp_v1_4; + s16 temp_ft1; + s16 temp_v1_3; + + temp_ft1 = this->unk14C.curFrame; + if (this->unk190 == func_809C02B8) { + temp_v1_2 = 3 - temp_ft1; + this->unk194 = (ABS(temp_v1_2) + 5) % 8; + } else if (this->unk190 == func_809C04B4) { + temp_v1_3 = temp_ft1 >> 1; + if (temp_ft1 < 0xA) { + if (temp_v1_3 >= 4) { + this->unk194 = 3; + } else { + this->unk194 = temp_v1_3; + } + } else if (temp_ft1 < 0x13) { + temp_v1_4 = 0x11 - temp_ft1; + this->unk194 = CLAMP_MIN(temp_v1_4, 0) >> 1; + } else if (temp_ft1 < 0x25) { + this->unk194 = ((0x24 - temp_ft1) / 3) + 2; } else { - this->tentaclesTexIndex = (40 - curFrame) >> 1; + this->unk194 = (0x28 - temp_ft1) >> 1; } } else { - this->tentaclesTexIndex = curFrame >> 1; + this->unk194 = temp_ft1 >> 1; } } -/** - * Tracks Player height, with oscillation, and moves away from walls - */ -void EnBili_UpdateFloating(EnBili* this) { - f32 playerHeight = this->actor.world.pos.y + this->actor.yDistToPlayer; - f32 heightOffset = ((this->actionFunc == EnBili_SetNewHomeHeight) ? 100.0f : 40.0f); - f32 baseHeight = CLAMP_MIN(this->actor.floorHeight, playerHeight); +void func_809C008C(EnBili* this) { + f32 temp_fv0; + f32 temp_fv1; + f32 var_fa0; + f32 var_fa1; - Math_StepToF(&this->actor.home.pos.y, baseHeight + heightOffset, 1.0f); - this->actor.world.pos.y = this->actor.home.pos.y + (sinf(this->timer * (M_PI / 16)) * 3.0f); - - // Turn around if touching wall + temp_fv0 = this->actor.world.pos.y + this->actor.yDistToPlayer; + if (this->unk190 == func_809C0600) { + var_fa1 = 100.0f; + } else { + var_fa1 = 40.0f; + } + temp_fv1 = this->actor.floorHeight; + if (temp_fv1 < temp_fv0) { + var_fa0 = temp_fv0; + } else { + var_fa0 = temp_fv1; + } + Math_StepToF(&this->actor.home.pos.y, var_fa0 + var_fa1, 1.0f); + this->actor.world.pos.y = (sinf(this->unk196 * 0.19634955f) * 3.0f) + this->actor.home.pos.y; if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.wallYaw; } } -// Action functions - -void EnBili_FloatIdle(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if (this->timer != 0) { - this->timer--; +void func_809C0174(EnBili* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if (this->unk196 != 0) { + this->unk196--; } - - if (!(this->timer % 4)) { + if (!(this->unk196 % 4)) { this->actor.world.rot.y += Rand_CenteredFloat(1820.0f); } - - EnBili_UpdateFloating(this); - - if (this->timer == 0) { - this->timer = 32; + func_809C008C(this); + if (this->unk196 == 0) { + this->unk196 = 0x20; } - if ((this->actor.xzDistToPlayer < 160.0f) && (fabsf(this->actor.yDistToPlayer) < 45.0f)) { - EnBili_SetupApproachPlayer(this); + func_809BFB40(this); } } -void EnBili_SpawnedFlyApart(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - if (this->timer != 0) { - this->timer--; +void func_809C0260(EnBili* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if (this->unk196 != 0) { + this->unk196--; } - - if (this->timer == 0) { - EnBili_SetupFloatIdle(this); + if (this->unk196 == 0) { + func_809BF9BC(this); } } -void EnBili_DischargeLightning(EnBili* this, PlayState* play) { - static Color_RGBA8 primColor = { 255, 255, 255, 255 }; - static Color_RGBA8 envColor = { 200, 255, 255, 255 }; - s32 i; - Vec3f effectPos; - s16 effectYaw; +void func_809C02B8(EnBili* this, PlayState* play) { + s16 temp_s1; + Vec3f sp78; + s32 var_s0; - for (i = 0; i < 4; i++) { - if (!((this->timer + (i << 1)) % 4)) { - effectYaw = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; - effectPos.x = Rand_CenteredFloat(5.0f) + this->actor.world.pos.x; - effectPos.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y + 2.5f; - effectPos.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; - EffectSsLightning_Spawn(play, &effectPos, &primColor, &envColor, 15, effectYaw, 6, 2); + for (var_s0 = 0; var_s0 < 4; var_s0++) { + if (!((s32)(this->unk196 + (var_s0 << 1)) % 4)) { + temp_s1 = (s16)Rand_CenteredFloat(12288.0f) + (var_s0 * 0x4000) + 0x2000; + sp78.x = Rand_CenteredFloat(5.0f) + this->actor.world.pos.x; + sp78.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y + 2.5f; + sp78.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; + EffectSsLightning_Spawn(play, (Vec3f*)&sp78, &D_809C16A0, &D_809C16A4, 0xF, (s16)(s32)temp_s1, 6, 2); } } - - SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->unk14C); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); - - if (this->timer != 0) { - this->timer--; + if (this->unk196 != 0) { + this->unk196--; } - this->actor.velocity.y *= -1.0f; - - if ((this->timer == 0) && Animation_OnFrame(&this->skelAnime, 0.0f)) { - if (this->actor.params == EN_BILI_TYPE_DYING) { - EnBili_SetupDie(this); + if ((this->unk196 == 0) && Animation_OnFrame(&this->unk14C, 0.0f)) { + if (this->actor.params == 1) { + func_809BFCE8(this); } else { - EnBili_SetupClimb(this); + func_809BFAE8(this); } } } -void EnBili_Climb(EnBili* this, PlayState* play) { - s32 animFinished = SkelAnime_Update(&this->skelAnime); - f32 curFrame = this->skelAnime.curFrame; +void func_809C04B4(EnBili* this, PlayState* play) { + s32 animFinished; + f32 sp28; - if (Animation_OnFrame(&this->skelAnime, 9.0f)) { - Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_JUMP); + animFinished = SkelAnime_Update(&this->unk14C); + sp28 = this->unk14C.curFrame; + if (Animation_OnFrame(&this->unk14C, 9.0f)) { + Actor_PlaySfx(&this->actor, 0x3899U); } - - if (curFrame > 9.0f) { + if (sp28 > 9.0f) { Math_ApproachF(&this->actor.world.pos.y, this->actor.world.pos.y + this->actor.yDistToPlayer + 100.0f, 0.5f, 5.0f); } - if (animFinished) { - EnBili_SetupSetNewHomeHeight(this); + func_809BFB5C(this); } } -void EnBili_ApproachPlayer(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 1820); - - if (this->timer != 0) { - this->timer--; +void func_809C0570(EnBili* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x71C); + if (this->unk196 != 0) { + this->unk196--; } - - EnBili_UpdateFloating(this); - - if (this->timer == 0) { - this->timer = 32; + func_809C008C(this); + if (this->unk196 == 0) { + this->unk196 = 0x20; } - if (this->actor.xzDistToPlayer > 200.0f) { - EnBili_SetupFloatIdle(this); + func_809BF9BC(this); } } -void EnBili_SetNewHomeHeight(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if (this->timer != 0) { - this->timer--; +void func_809C0600(EnBili* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if (this->unk196 != 0) { + this->unk196--; } - - Math_ScaledStepToS(&this->actor.world.rot.y, (s16)(this->actor.yawTowardsPlayer + 0x8000), 910); - EnBili_UpdateFloating(this); - - if (this->timer == 0) { - EnBili_SetupFloatIdle(this); + Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 0x38E); + func_809C008C(this); + if (this->unk196 == 0) { + func_809BF9BC(this); } } -void EnBili_Recoil(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if (Math_StepToF(&this->actor.speed, 0.0f, 0.3f)) { +void func_809C067C(EnBili* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if (Math_StepToF(&this->actor.speed, 0.0f, 0.3f) != 0) { this->actor.world.rot.y += 0x8000; - EnBili_SetupFloatIdle(this); + func_809BF9BC(this); } } -void EnBili_Burnt(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - +void func_809C06E0(EnBili* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { - this->actor.colorFilterTimer = 20; + this->actor.colorFilterTimer = 0x14; } else { - if (this->timer != 0) { - this->timer--; + if (this->unk196 != 0) { + this->unk196--; } - - if (this->timer == 0) { - EnBili_SetupDie(this); + if (this->unk196 == 0) { + func_809BFCE8(this); } } } -void EnBili_Die(EnBili* this, PlayState* play) { - static Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; - static Vec3f effectAccel = { 0.0f, 0.0f, 0.0f }; - s16 effectScale; - Vec3f effectPos; - s32 i; +void func_809C0754(EnBili* this, PlayState* play) { + static Vec3f D_809C16A8 = { 0.0f, 0.0f, 0.0f }; + static Vec3f D_809C16B4 = { 0.0f, 0.0f, 0.0f }; + s16 temp_s0; + Vec3f sp78; + s32 var_s1; if (this->actor.draw != NULL) { - if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { + this->actor.draw = NULL; + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, + COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); + } else { return; } - this->actor.draw = NULL; - Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, - COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); } - - if (this->timer != 0) { - this->timer--; + if (this->unk196 != 0) { + this->unk196--; } - - if (this->timer != 0) { - for (i = 0; i < 2; i++) { - effectPos.x = ((Rand_ZeroOne() * 10.0f) + this->actor.world.pos.x) - 5.0f; - effectPos.y = ((Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y) - 2.5f; - effectPos.z = ((Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z) - 5.0f; - - effectVelocity.y = Rand_ZeroOne() + 1.0f; - effectScale = Rand_S16Offset(40, 40); - + if (this->unk196 != 0) { + for (var_s1 = 0; var_s1 < 2; var_s1++) { + sp78.x = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.x - 5.0f; + sp78.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y - 2.5f; + sp78.z = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z - 5.0f; + D_809C16A8.y = Rand_ZeroOne() + 1.0f; + temp_s0 = Rand_S16Offset(0x28, 0x28); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 2, - 1); + EffectSsDtBubble_SpawnColorProfile(play, (Vec3f*)&sp78, &D_809C16A8, &D_809C16B4, temp_s0, 0x19, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(play, &effectPos, &effectVelocity, &effectAccel, effectScale, 25, 0, - 1); + EffectSsDtBubble_SpawnColorProfile(play, (Vec3f*)&sp78, &D_809C16A8, &D_809C16B4, temp_s0, 0x19, 0, 1); } } } else { Actor_Kill(&this->actor); } - - if (this->timer == 14) { - SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BIRI_BUBLE); + if (this->unk196 == 0xE) { + SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 0x28, NA_SE_EN_BIRI_BUBLE); } } -void EnBili_Stunned(EnBili* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; - } +static Vec3f D_809C16C0 = { 1.0f, 1.0f, 1.0f }; +static s32 D_809C16CC[9] = { + 0x06000E08, 0x06001708, 0x06002008, 0x06002908, 0x06003208, 0x06003B08, 0x06004408, 0x06004D08, 0, +}; +#include "assets/overlays/ovl_En_Bili/ovl_En_Bili.c" +void func_809C0980(EnBili* this, PlayState* play) { + if (this->unk196 != 0) { + this->unk196--; + } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); } - - if (this->timer == 0) { - EnBili_SetupFloatIdle(this); + if (this->unk196 == 0) { + func_809BF9BC(this); } } -void EnBili_Frozen(EnBili* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; +void func_809C09E0(EnBili* this, PlayState* play) { + if (this->unk196 != 0) { + this->unk196--; } - if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { this->actor.gravity = -1.0f; } - #if OOT_VERSION < NTSC_1_1 - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.floorHeight == BGCHECK_Y_MIN)) + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #else - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #endif - { this->actor.colorFilterTimer = 0; - EnBili_SetupDie(this); + func_809BFCE8(this); } else { - this->actor.colorFilterTimer = 10; + this->actor.colorFilterTimer = 0xA; } } -void EnBili_UpdateDamage(EnBili* this, PlayState* play) { - u8 damageReaction; - - if ((this->actor.colChkInfo.health != 0) && (this->collider.base.acFlags & AC_HIT)) { - this->collider.base.acFlags &= ~AC_HIT; - Actor_SetDropFlag(&this->actor, &this->collider.elem, true); - - if ((this->actor.colChkInfo.damageReaction != 0) || (this->actor.colChkInfo.damage != 0)) { +void func_809C0A70(EnBili* this, PlayState* play) { + if ((this->actor.colChkInfo.health != 0) && (this->unk1D4.base.acFlags & AC_HIT)) { + this->unk1D4.base.acFlags &= ~AC_HIT; + Actor_SetDropFlag(&this->actor, &this->unk1D4.elem, true); + if ((((this->actor.colChkInfo.damageReaction != 0)) || (this->actor.colChkInfo.damage != 0))) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_DEAD); Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } - - damageReaction = this->actor.colChkInfo.damageReaction; - - if (damageReaction == BIRI_DMG_REACT_DEKUNUT) { - if (this->actionFunc != EnBili_Stunned) { - EnBili_SetupStunned(this); + if (this->actor.colChkInfo.damageReaction == 1) { + if (this->unk190 != func_809C0980) { + func_809BFD18(this); } - } else if (damageReaction == BIRI_DMG_REACT_SWORD) { - if (this->actionFunc != EnBili_Stunned) { + } else if (this->actor.colChkInfo.damageReaction == 0xF) { + if (this->unk190 != func_809C0980) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_XLU, 10); - if (this->actor.colChkInfo.health == 0) { - this->actor.params = EN_BILI_TYPE_DYING; + this->actor.params = 1; } - EnBili_SetupDischargeLightning(this); + func_809BFA8C(this); } else { - EnBili_SetupBurnt(this); + func_809BFC48(this); } - } else if (damageReaction == BIRI_DMG_REACT_FIRE) { - EnBili_SetupBurnt(this); - this->timer = 2; - } else if (damageReaction == BIRI_DMG_REACT_ICE) { - EnBili_SetupFrozen(this, play); - } else if (damageReaction == BIRI_DMG_REACT_SLINGSHOT) { - EnBili_SetupRecoil(this); + } else if (this->actor.colChkInfo.damageReaction == 2) { + func_809BFC48(this); + this->unk196 = 2; + } else if (this->actor.colChkInfo.damageReaction == 3) { + func_809BFD94(this, play); + } else if (this->actor.colChkInfo.damageReaction == 0xE) { + func_809BFBC4(this); } else { - EnBili_SetupBurnt(this); + func_809BFC48(this); } - - if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_ARROW) { + if (this->unk1D4.elem.acHitElem->atDmgInfo.dmgFlags & DMG_ARROW) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; } } @@ -616,177 +539,159 @@ void EnBili_UpdateDamage(EnBili* this, PlayState* play) { } void EnBili_Update(Actor* thisx, PlayState* play2) { - PlayState* play = play2; EnBili* this = (EnBili*)thisx; + PlayState* play = play2; - if (this->collider.base.atFlags & AT_HIT) { - this->collider.base.atFlags &= ~AT_HIT; - EnBili_SetupDischargeLightning(this); - } - - EnBili_UpdateDamage(this, play); - this->actionFunc(this, play); - - if (this->actionFunc != EnBili_Die) { - EnBili_UpdateTentaclesIndex(this); - if (Animation_OnFrame(&this->skelAnime, 9.0f)) { - if ((this->actionFunc == EnBili_FloatIdle) || (this->actionFunc == EnBili_SetNewHomeHeight) || - (this->actionFunc == EnBili_ApproachPlayer) || (this->actionFunc == EnBili_Recoil)) { - if (this->playFlySfx) { - Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_FLY); - this->playFlySfx = false; - } else { - this->playFlySfx = true; - } + if (this->unk1D4.base.atFlags & AT_HIT) { + this->unk1D4.base.atFlags &= ~AT_HIT; + func_809BFA8C(this); + } + func_809C0A70(this, play); + this->unk190(this, play); + if (this->unk190 != func_809C0754) { + func_809BFF6C(this); + if (Animation_OnFrame(&this->unk14C, 9.0f) && + (((this->unk190 == func_809C0174)) || (this->unk190 == func_809C0600) || (this->unk190 == func_809C0570) || + (this->unk190 == func_809C067C))) { + if (this->unk195 != 0) { + Actor_PlaySfx(&this->actor, 0x3898U); + this->unk195 = 0; + } else { + this->unk195 = 1; } } - if (this->actionFunc == EnBili_Recoil) { + if (this->unk190 == func_809C067C) { Actor_MoveXYZ(&this->actor); } else { Actor_MoveXZGravity(&this->actor); } - - Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, this->collider.dim.radius, this->collider.dim.height, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, this->unk1D4.dim.radius, this->unk1D4.dim.height, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); - Collider_UpdateCylinder(&this->actor, &this->collider); - - if (this->collider.base.atFlags & AT_ON) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk1D4); + if (this->unk1D4.base.atFlags & 1) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1D4.base); } - if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + if (this->unk1D4.base.acFlags & 1) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1D4.base); } - - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk1D4.base); Actor_SetFocus(&this->actor, 0.0f); } } -// Draw and associated functions +void func_809C0E08(EnBili* this, f32 arg1, Vec3f* arg2) { + f32 temp_fv0; + f32 temp_fv0_2; + f32 temp_fv1; -void EnBili_PulseLimb3(EnBili* this, f32 frame, Vec3f* arg2) { - f32 cos; - f32 sin; - - if (this->actionFunc == EnBili_DischargeLightning) { - arg2->y = 1.0f - (sinf((M_PI * 0.16667f) * frame) * 0.26f); - } else if (this->actionFunc == EnBili_Climb) { - if (frame <= 8.0f) { - arg2->y = (cosf((M_PI * 0.125f) * frame) * 0.15f) + 0.85f; - } else if (frame <= 18.0f) { - cos = cosf((frame - 8.0f) * (M_PI * 0.1f)); - arg2->y = 1.0f - (0.3f * cos); - arg2->x = (0.2f * cos) + 0.8f; + if (this->unk190 == func_809C02B8) { + arg2->y = 1.0f - (sinf(0.5236092f * arg1) * 0.26f); + } else if (this->unk190 == func_809C04B4) { + if (arg1 <= 8.0f) { + arg2->y = (cosf(0.3926991f * arg1) * 0.15f) + 0.85f; + } else if (arg1 <= 18.0f) { + temp_fv0 = cosf((arg1 - 8.0f) * 0.31415927f); + arg2->y = 1.0f - (0.3f * temp_fv0); + arg2->x = (0.2f * temp_fv0) + 0.8f; } else { - cos = cosf((frame - 18.0f) * (M_PI * 0.0227f)); - arg2->y = (0.31f * cos) + 1.0f; - arg2->x = 1.0f - (0.4f * cos); + temp_fv0_2 = cosf((arg1 - 18.0f) * 0.071314156f); + arg2->y = (0.31f * temp_fv0_2) + 1.0f; + arg2->x = 1.0f - (0.4f * temp_fv0_2); } - arg2->z = arg2->x; - } else if (this->actionFunc == EnBili_Stunned) { - sin = sinf((M_PI * 0.1f) * this->timer) * 0.08f; - arg2->x -= sin; - arg2->y += sin; - arg2->z -= sin; + } else if (this->unk190 == func_809C0980) { + temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; + arg2->x -= temp_fv1; + arg2->y += temp_fv1; + arg2->z -= temp_fv1; } else { - arg2->y = (cosf((M_PI * 0.125f) * frame) * 0.13f) + 0.87f; + arg2->y = (cosf(0.3926991f * arg1) * 0.13f) + 0.87f; } } -void EnBili_PulseLimb2(EnBili* this, f32 frame, Vec3f* arg2) { - f32 cos; - f32 sin; +void func_809C1020(EnBili* this, f32 arg1, Vec3f* arg2) { + f32 temp_fv0; + f32 temp_fv0_2; + f32 temp_fv1; - if (this->actionFunc == EnBili_DischargeLightning) { - arg2->y = (sinf((M_PI * 0.16667f) * frame) * 0.2f) + 1.0f; - } else if (this->actionFunc == EnBili_Climb) { - if (frame <= 8.0f) { - arg2->x = 1.125f - (cosf((M_PI * 0.125f) * frame) * 0.125f); - } else if (frame <= 18.0f) { - cos = cosf((frame - 8.0f) * (M_PI * 0.1f)); - arg2->x = (0.275f * cos) + 0.975f; - arg2->y = 1.25f - (0.25f * cos); + if (this->unk190 == func_809C02B8) { + arg2->y = (sinf(0.5236092f * arg1) * 0.2f) + 1.0f; + } else if (this->unk190 == func_809C04B4) { + if (arg1 <= 8.0f) { + arg2->x = 1.125f - (cosf(0.3926991f * arg1) * 0.125f); + } else if (arg1 <= 18.0f) { + temp_fv0 = cosf((arg1 - 8.0f) * 0.31415927f); + arg2->x = (0.275f * temp_fv0) + 0.975f; + arg2->y = 1.25f - (0.25f * temp_fv0); } else { - cos = cosf((frame - 18.0f) * (M_PI * 0.0227f)); - arg2->x = 1.0f - (0.3f * cos); - arg2->y = (0.48f * cos) + 1.0f; + temp_fv0_2 = cosf((arg1 - 18.0f) * 0.071314156f); + arg2->x = 1.0f - (0.3f * temp_fv0_2); + arg2->y = (0.48f * temp_fv0_2) + 1.0f; } arg2->z = arg2->x; - } else if (this->actionFunc == EnBili_Stunned) { - sin = sinf((M_PI * 0.1f) * this->timer) * 0.08f; - arg2->x += sin; - arg2->y -= sin; - arg2->z += sin; + } else if (this->unk190 == func_809C0980) { + temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; + arg2->x += temp_fv1; + arg2->y -= temp_fv1; + arg2->z += temp_fv1; } else { - arg2->y = 1.1f - (cosf((M_PI * 0.125f) * frame) * 0.1f); + arg2->y = 1.1f - (cosf(0.3926991f * arg1) * 0.1f); } } -void EnBili_PulseLimb4(EnBili* this, f32 frame, Vec3f* arg2) { - f32 cos; +void func_809C1240(EnBili* this, f32 arg1, Vec3f* arg2) { + f32 temp_fv0; - if (this->actionFunc == EnBili_Climb) { - if (frame <= 8.0f) { - cos = cosf((M_PI * 0.125f) * frame); - arg2->x = 1.125f - (0.125f * cos); - arg2->y = (0.3f * cos) + 0.7f; - } else if (frame <= 18.0f) { - cos = cosf((frame - 8.0f) * (M_PI * 0.1f)); - arg2->x = (0.325f * cos) + 0.925f; - arg2->y = 0.95f - (0.55f * cos); + if (this->unk190 == func_809C04B4) { + if (arg1 <= 8.0f) { + temp_fv0 = cosf(0.3926991f * arg1); + arg2->x = 1.125f - (0.125f * temp_fv0); + arg2->y = (0.3f * temp_fv0) + 0.7f; + } else if (arg1 <= 18.0f) { + temp_fv0 = cosf((arg1 - 8.0f) * 0.31415927f); + arg2->x = (0.325f * temp_fv0) + 0.925f; + arg2->y = 0.95f - (0.55f * temp_fv0); } else { - cos = cosf((frame - 18.0f) * (M_PI * 0.0227f)); - arg2->x = 1.0f - (0.4f * cos); - arg2->y = (0.52f * cos) + 1.0f; + temp_fv0 = cosf((arg1 - 18.0f) * 0.071314156f); + arg2->x = 1.0f - (0.4f * temp_fv0); + arg2->y = (0.52f * temp_fv0) + 1.0f; } arg2->z = arg2->x; } } -s32 EnBili_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { - EnBili* this = (EnBili*)thisx; - Vec3f limbScale = { 1.0f, 1.0f, 1.0f }; - f32 curFrame = this->skelAnime.curFrame; +s32 EnBili_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx) { + EnBili* this = thisx; + Vec3f sp20; + f32 temp_fv0; - if (limbIndex == BIRI_LIMB_OUTER_HOOD) { - EnBili_PulseLimb3(this, curFrame, &limbScale); - } else if (limbIndex == BIRI_LIMB_INNER_HOOD) { - EnBili_PulseLimb2(this, curFrame, &limbScale); - } else if (limbIndex == BIRI_LIMB_TENTACLES) { - EnBili_PulseLimb4(this, curFrame, &limbScale); - rot->y = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y) + 0x8000; + sp20 = D_809C16C0; + temp_fv0 = this->unk14C.curFrame; + if (arg1 == 3) { + func_809C0E08(this, temp_fv0, &sp20); + } else if (arg1 == 2) { + func_809C1020(this, temp_fv0, &sp20); + } else if (arg1 == 4) { + func_809C1240(this, temp_fv0, &sp20); + arg4->y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000; } - - Matrix_Scale(limbScale.x, limbScale.y, limbScale.z, MTXMODE_APPLY); - return false; + Matrix_Scale(sp20.x, sp20.y, sp20.z, MTXMODE_APPLY); + return 0; } -static void* sTentaclesTextures[] = { - gBiriTentacles0Tex, gBiriTentacles1Tex, gBiriTentacles2Tex, gBiriTentacles3Tex, - gBiriTentacles4Tex, gBiriTentacles5Tex, gBiriTentacles6Tex, gBiriTentacles7Tex, -}; - -#include "assets/overlays/ovl_En_Bili/ovl_En_Bili.c" - void EnBili_Draw(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_bili.c", 1521); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - - this->tentaclesTexIndex = CLAMP_MAX(this->tentaclesTexIndex, 7); - - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sTentaclesTextures[this->tentaclesTexIndex])); - - if ((this->actionFunc == EnBili_DischargeLightning) && ((this->timer & 1) != 0)) { - gSPSegment(POLY_XLU_DISP++, 0x09, D_809C16F0); + this->unk194 = CLAMP_MAX(this->unk194, 7); + gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_809C16CC[this->unk194])); + if ((this->unk190 == func_809C02B8) && (this->unk196 & 1)) { + gSPSegment(POLY_XLU_DISP++, 9, D_809C16F0); } else { - gSPSegment(POLY_XLU_DISP++, 0x09, D_809C1700); + gSPSegment(POLY_XLU_DISP++, 9, D_809C1700); } - - POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBili_OverrideLimbDraw, - NULL, this, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, EnBili_OverrideLimbDraw, NULL, + this, POLY_XLU_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_bili.c", 1552); } 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 0675847ee26..31dc7e2fbca 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -4,28 +4,18 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_bl/object_bl.h" - struct EnBili; -typedef void (*EnBiliActionFunc)(struct EnBili*, struct PlayState*); - typedef struct EnBili { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ EnBiliActionFunc actionFunc; - /* 0x0194 */ u8 tentaclesTexIndex; - /* 0x0195 */ u8 playFlySfx; - /* 0x0196 */ s16 timer; - /* 0x0198 */ Vec3s jointTable[BIRI_LIMB_MAX]; - /* 0x01B6 */ Vec3s morphTable[BIRI_LIMB_MAX]; - /* 0x01D4 */ ColliderCylinder collider; -} EnBili; // size = 0x0220 - -typedef enum EnBiliType { - /* -1 */ EN_BILI_TYPE_NORMAL = -1, - /* 0 */ EN_BILI_TYPE_VALI_SPAWNED, - /* 1 */ EN_BILI_TYPE_DYING -} EnBiliType; + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ void (*unk190)(struct EnBili*, struct PlayState*); + /* 0x194 */ u8 unk194; + /* 0x195 */ u8 unk195; + /* 0x196 */ s16 unk196; + /* 0x198 */ Vec3s unk198[5]; + /* 0x1B6 */ Vec3s unk1B6[5]; + /* 0x1D4 */ ColliderCylinder unk1D4; +} EnBili; // size = 0x220 #endif 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 2fff5313e5c..c3e501bd412 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 @@ -1,4 +1,6 @@ #include "z_en_bom_bowl_man.h" +#include "overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" +#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" #include "overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.h" #include "gfx.h" @@ -9,8 +11,6 @@ #include "regs.h" #include "segmented_address.h" #include "sfx.h" -#include "terminal.h" -#include "translation.h" #include "effect.h" #include "play_state.h" #include "player.h" @@ -22,33 +22,25 @@ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ ACTOR_FLAG_DRAW_CULLING_DISABLED | ACTOR_FLAG_LOCK_ON_DISABLED) -typedef enum BombchuGirlEyeMode { - /* 0 */ CHU_GIRL_EYES_ASLEEP, - /* 1 */ CHU_GIRL_EYES_OPEN_SLOWLY, - /* 2 */ CHU_GIRL_EYES_BLINK_RAPIDLY, - /* 3 */ CHU_GIRL_EYES_AWAKE -} BombchuGirlEyeMode; - void EnBomBowlMan_Init(Actor* thisx, PlayState* play2); void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play); void EnBomBowlMan_Update(Actor* thisx, PlayState* play); void EnBomBowlMan_Draw(Actor* thisx, PlayState* play); -void EnBomBowlMan_SetupWaitAsleep(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_WaitAsleep(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_TalkAsleep(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_WakeUp(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_BlinkAwake(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_CheckBeatenDC(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_WaitNotBeatenDC(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_TalkNotBeatenDC(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_SetupRunGame(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_RunGame(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play); +void func_809C3820(EnBomBowlMan* this, PlayState* play); +void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play); +void func_809C395C(EnBomBowlMan* this, PlayState* play); +void func_809C39D0(EnBomBowlMan* this, PlayState* play); +void func_809C3A54(EnBomBowlMan* this, PlayState* play); +void func_809C3B50(EnBomBowlMan* this, PlayState* play); +void func_809C3C7C(EnBomBowlMan* this, PlayState* play); +void func_809C3CD4(EnBomBowlMan* this, PlayState* play); +void func_809C3DC4(EnBomBowlMan* this, PlayState* play); +void func_809C4040(EnBomBowlMan* this, PlayState* play); void func_809C41FC(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_SetupChooseShowPrize(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play); +void func_809C4318(EnBomBowlMan* this, PlayState* play); +void func_809C441C(EnBomBowlMan* this, PlayState* play); +void func_809C4664(EnBomBowlMan* this, PlayState* play); ActorProfile En_Bom_Bowl_Man_Profile = { /**/ ACTOR_EN_BOM_BOWL_MAN, @@ -62,483 +54,448 @@ ActorProfile En_Bom_Bowl_Man_Profile = { /**/ EnBomBowlMan_Draw, }; +typedef struct struct_809C4A10 { + f32 unk0; + f32 unk4; + s32 unk8; // unused +} struct_809C4A10; +struct_809C4A10 D_809C4A10[2] = { { 16.0f, 46.0f, 0 }, { 36.0f, 56.0f, 0 } }; +Vec3f D_809C4A28[2] = { { 60.0f, -60.0f, -430.0f }, { 0.0f, -120.0f, -620.0f } }; +f32 D_809C4A40[2] = { 0.01f, 0.03f }; +Vec3f D_809C4A48 = { 0.0f, 0.1f, 0.0f }; +Vec3f D_809C4A54 = { 0.0f, 0.0f, 0.0f }; +Vec3f D_809C4A60[5] = { + { 0.0f, 22.0f, 0.0f }, { 0.0f, 22.0f, 0.0f }, { 0.0f, 8.0f, 0.0f }, { 0.0f, 9.0f, 0.0f }, { 0.0f, -2.0f, 0.0f }, +}; +static s16 D_809C4A9C[6] = { 0x4268, 0x4268, -0x3E8, 0, 0x4268, 0 }; +static s32 D_809C4AA8[6] = { 0x06004110, 0x06004910, 0x06005110, 0, 0, 0 }; + void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { - static f32 cuccoColliderDims[][3] = { { 16.0f, 46.0f, 0.0f }, { 36.0f, 56.0f, 0.0f } }; - static Vec3f cuccoSpawnPos[] = { { 60, -60, -430 }, { 0, -120, -620 } }; - static f32 cuccoScales[] = { 0.01f, 0.03f }; EnBomBowlMan* this = (EnBomBowlMan*)thisx; - EnSyatekiNiw* cucco; - s32 i; PlayState* play = play2; + s32 var_s1; + EnSyatekiNiw* temp_v0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gChuGirlSkel, &gChuGirlNoddingOffAnim, this->jointTable, - this->morphTable, 11); - PRINTF(VT_FGCOL(GREEN) T("☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n", "☆ Man, my shoulders hurt~ \t\t ☆ \n") VT_RST); - PRINTF(VT_FGCOL(GREEN) T("☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n", - "☆ Isn't there some sort of job that will pay better and be more relaxing? ☆ %d\n") VT_RST, - play->bombchuBowlingStatus); - this->posCopy = this->actor.world.pos; + SkelAnime_InitFlex(play, &this->unk14C, &object_bg_006EB0_Skel, &object_bg_000710_Anim, &this->unk190, + &this->unk1D2, 0xB); + PRINTF("\x1b[32m☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n\x1b[m"); + PRINTF("\x1b[32m☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n\x1b[m", play->bombchuBowlingStatus); + this->unk248 = this->actor.world.pos; this->actor.shape.yOffset = -60.0f; Actor_SetScale(&this->actor, 0.013f); - - for (i = 0; i < 2; i++) { - cucco = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SYATEKI_NIW, cuccoSpawnPos[i].x, - cuccoSpawnPos[i].y, cuccoSpawnPos[i].z, 0, 0, 0, SYATEKI_MINIGAME_ALLEY); - if (cucco != NULL) { - cucco->scale = cuccoScales[i]; - cucco->collider.dim.radius = (s16)cuccoColliderDims[i][0]; - cucco->collider.dim.height = (s16)cuccoColliderDims[i][1]; + for (var_s1 = 0; var_s1 < 2; var_s1++) { + temp_v0 = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, 0x143, D_809C4A28[var_s1].x, D_809C4A28[var_s1].y, + D_809C4A28[var_s1].z, 0, 0, 0, 1); + if (temp_v0 != NULL) { + temp_v0->scale = D_809C4A40[var_s1]; + temp_v0->collider.dim.radius = (s16)(s32)D_809C4A10[var_s1].unk0; + temp_v0->collider.dim.height = (s16)(s32)D_809C4A10[var_s1].unk4; } } - - this->prizeSelect = (s16)Rand_ZeroFloat(4.99f); + this->unk242 = (u16)(s32)Rand_ZeroFloat(4.99f); this->actor.attentionRangeType = ATTENTION_RANGE_1; - this->actionFunc = EnBomBowlMan_SetupWaitAsleep; + this->actionFunc = func_809C3820; } void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowlMan_SetupWaitAsleep(EnBomBowlMan* this, PlayState* play) { - this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlNoddingOffAnim); - Animation_Change(&this->skelAnime, &gChuGirlNoddingOffAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, -10.0f); +void func_809C3820(EnBomBowlMan* this, PlayState* play) { + this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_000710_Anim); + Animation_Change(&this->unk14C, &object_bg_000710_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, ANIMMODE_LOOP, + -10.0f); this->actor.textId = 0xC0; - this->dialogState = TEXT_STATE_EVENT; - this->actionFunc = EnBomBowlMan_WaitAsleep; + this->unk22E = TEXT_STATE_EVENT; + this->actionFunc = func_809C38A8_WaitTalk; } -void EnBomBowlMan_WaitAsleep(EnBomBowlMan* this, PlayState* play) { - s16 yawDiff; - - SkelAnime_Update(&this->skelAnime); +void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play) { + s16 relYawTowardsPlayer; + s16 relYawTowardsPlayerAbs; + SkelAnime_Update(&this->unk14C); if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnBomBowlMan_TalkAsleep; + this->actionFunc = func_809C395C; } else { - yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); - - if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + relYawTowardsPlayerAbs = ABS(relYawTowardsPlayer); + if (!(this->actor.xzDistToPlayer > 120.0f) && (relYawTowardsPlayerAbs < 0x4300)) { Actor_OfferTalk(&this->actor, play, 120.0f); } } } -void EnBomBowlMan_TalkAsleep(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { +void func_809C395C(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = MSGMODE_PAUSED; - this->actionFunc = EnBomBowlMan_WakeUp; + this->actionFunc = func_809C39D0; } } -void EnBomBowlMan_WakeUp(EnBomBowlMan* this, PlayState* play) { - this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlWakeUpAnim); - Animation_Change(&this->skelAnime, &gChuGirlWakeUpAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_ONCE, -10.0f); - this->eyeMode = CHU_GIRL_EYES_OPEN_SLOWLY; - this->actionFunc = EnBomBowlMan_BlinkAwake; +void func_809C39D0(EnBomBowlMan* this, PlayState* play) { + this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_000080_Anim); + Animation_Change(&this->unk14C, &object_bg_000080_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, ANIMMODE_ONCE, + -10.0f); + this->unk238 = 1; + this->actionFunc = func_809C3A54; } -void EnBomBowlMan_BlinkAwake(EnBomBowlMan* this, PlayState* play) { - f32 frameCount = this->skelAnime.curFrame; +void func_809C3A54(EnBomBowlMan* this, PlayState* play) { + f32 sp1C; - SkelAnime_Update(&this->skelAnime); - if (frameCount == 30.0f) { - this->dialogState = TEXT_STATE_EVENT; - - // Check for beaten Dodongo's Cavern - if (GET_EVENTCHKINF(EVENTCHKINF_25) || BREG(2)) { + sp1C = this->unk14C.curFrame; + SkelAnime_Update(&this->unk14C); + if (sp1C == 30.0f) { + this->unk22E = TEXT_STATE_EVENT; + if (GET_EVENTCHKINF(EVENTCHKINF_25) || (gRegEditor->data[0x962] != 0)) { this->actor.textId = 0xBF; } else { this->actor.textId = 0x7058; } } Message_ContinueTextbox(play, this->actor.textId); - - if ((this->eyeTextureIndex == 0) && (this->eyeMode == CHU_GIRL_EYES_BLINK_RAPIDLY) && (this->blinkTimer == 0)) { - // Blink twice, then move on - this->eyeTextureIndex = 2; - this->blinkCount++; - if (this->blinkCount >= 3) { - this->actionFunc = EnBomBowlMan_CheckBeatenDC; + if ((this->unk234 == 0) && (this->unk238 == 2) && (this->unk236 == 0)) { + this->unk234 = 2; + this->unk23A += 1; + if (this->unk23A >= 3) { + this->actionFunc = func_809C3B50; } } } -void EnBomBowlMan_CheckBeatenDC(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { +void func_809C3B50(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->frameCount = (f32)Animation_GetLastFrame(&gChuGirlLeanOverCounterAnim); - Animation_Change(&this->skelAnime, &gChuGirlLeanOverCounterAnim, 1.0f, 0.0f, this->frameCount, ANIMMODE_LOOP, - -10.0f); - this->eyeMode = CHU_GIRL_EYES_AWAKE; - this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; - - // Check for beaten Dodongo's Cavern - if (!(GET_EVENTCHKINF(EVENTCHKINF_25) || BREG(2))) { - this->actionFunc = EnBomBowlMan_WaitNotBeatenDC; + this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_0072AC_Anim); + Animation_Change(&this->unk14C, &object_bg_0072AC_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, + ANIMMODE_LOOP, -10.0f); + this->unk238 = 3; + this->unk236 = (s16)Rand_ZeroFloat(60.0f) + 0x14; + if (!GET_EVENTCHKINF(EVENTCHKINF_25) && (gRegEditor->data[0x962] == 0)) { + this->actionFunc = func_809C3C7C; } else { this->actor.textId = 0x18; - this->dialogState = TEXT_STATE_CHOICE; + this->unk22E = TEXT_STATE_CHOICE; Message_ContinueTextbox(play, this->actor.textId); - this->actionFunc = EnBomBowlMan_HandlePlayChoice; + this->actionFunc = func_809C4040; } } } -void EnBomBowlMan_WaitNotBeatenDC(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - +void func_809C3C7C(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnBomBowlMan_TalkNotBeatenDC; + this->actionFunc = func_809C3CD4; } else { Actor_OfferTalk(&this->actor, play, 120.0f); } } -void EnBomBowlMan_TalkNotBeatenDC(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { +void func_809C3CD4(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->actionFunc = EnBomBowlMan_WaitNotBeatenDC; + this->actionFunc = func_809C3C7C; } } -void EnBomBowlMan_SetupRunGame(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if (this->minigamePlayStatus == 0) { - if (!this->startedPlaying) { +void func_809C3D40(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if (this->unk_258 == 0) { + if (this->unk232 == 0) { this->actor.textId = 0x18; } else { this->actor.textId = 0x1A; } - - this->dialogState = TEXT_STATE_CHOICE; + this->unk22E = TEXT_STATE_CHOICE; } else { this->actor.textId = 0x19; - this->dialogState = TEXT_STATE_EVENT; + this->unk22E = TEXT_STATE_EVENT; } - - this->actionFunc = EnBomBowlMan_RunGame; + this->actionFunc = func_809C3DC4; } -void EnBomBowlMan_RunGame(EnBomBowlMan* this, PlayState* play) { - s16 yawDiff; - - SkelAnime_Update(&this->skelAnime); +void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { + s16 relYawTowardsPlayer; + s16 relYawTowardsPlayerAbs; - if (BREG(3)) { - PRINTF(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, play->bombchuBowlingStatus); - PRINTF(VT_FGCOL(RED) T("☆ 壁1の状態どう? ☆ %d\n", "☆ What's the state of wall 1? ☆ %d\n") VT_RST, - this->wallStatus[0]); - PRINTF(VT_FGCOL(RED) T("☆ 壁2の状態どう? ☆ %d\n", "☆ What's the state of wall 2? ☆ %d\n") VT_RST, - this->wallStatus[1]); - PRINTF(VT_FGCOL(RED) T("☆ 穴情報\t ☆ %d\n", "☆ Hole Information\t ☆ %d\n") VT_RST, - this->bowlPit->status); + SkelAnime_Update(&this->unk14C); + if (gRegEditor->data[0x963] != 0) { + PRINTF("\x1b[31m☆ game_play->bomchu_game_flag ☆ %d\n\x1b[m", play->bombchuBowlingStatus); + PRINTF("\x1b[31m☆ 壁1の状態どう? ☆ %d\n\x1b[m", this->unk23E_arr[0]); + PRINTF("\x1b[31m☆ 壁2の状態どう? ☆ %d\n\x1b[m", this->unk23E_arr[1]); + PRINTF("\x1b[31m☆ 穴情報\t ☆ %d\n\x1b[m", this->unk25C->unk164); PRINTF("\n\n"); } - - this->gameResult = 0; - - if (this->bowlPit != NULL) { - if ((this->wallStatus[0] != 1) && (this->wallStatus[1] != 1) && (this->bowlPit->status == 2)) { - this->gameResult = 1; // Won - this->bowlPit->status = 0; - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n", "☆☆☆☆☆ Center HIT!!!! ☆☆☆☆☆ \n") VT_RST); + this->unk244 = 0; + if (this->unk25C != NULL) { + if ((this->unk23E_arr[0] != 1) && (this->unk23E_arr[1] != 1) && (this->unk25C->unk164 == 2)) { + this->unk244 = 1; + this->unk25C->unk164 = 0U; + PRINTF("\x1b[35m☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n\x1b[m"); } - - if ((play->bombchuBowlingStatus == -1) && (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length == 0) && - (this->bowlPit->status == 0) && (this->wallStatus[0] != 1) && (this->wallStatus[1] != 1)) { - this->gameResult = 2; // Lost - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆☆ ボムチュウ消化 ☆☆☆☆☆ \n", "☆☆☆☆☆ Bombchu digestion ☆☆☆☆☆ \n") VT_RST); + if ((play->bombchuBowlingStatus == -1) && (play->actorCtx.actorLists[3].length == 0) && + (this->unk25C->unk164 == 0) && (this->unk23E_arr[0] != 1) && (this->unk23E_arr[1] != 1)) { + this->unk244 = 2; + PRINTF("\x1b[35m☆☆☆☆☆ ボムチュウ消化 ☆☆☆☆☆ \n\x1b[m"); } } - - if (this->gameResult != 0) { // won or lost + if (this->unk244 != 0) { this->actor.textId = 0x1A; - this->dialogState = TEXT_STATE_CHOICE; - this->minigamePlayStatus = 0; - - if ((this->exItem != NULL) && (this->exItem->actor.update != NULL)) { - this->exItem->killItem = true; - this->exItem = NULL; + this->unk22E = TEXT_STATE_CHOICE; + this->unk_258 = 0; + if ((this->unk260 != NULL) && (this->unk260->actor.update != NULL)) { + this->unk260->killItem = 1; + this->unk260 = NULL; } - play->bombchuBowlingStatus = 0; - this->playingAgain = true; + this->unk23C = 1; Message_StartTextbox(play, this->actor.textId, NULL); - - if (this->gameResult == 2) { + if (this->unk244 == 2) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); } - this->actionFunc = EnBomBowlMan_HandlePlayChoice; - } else { - if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (this->minigamePlayStatus == 0) { - this->actionFunc = EnBomBowlMan_HandlePlayChoice; - } else { - this->actionFunc = func_809C41FC; - } + this->actionFunc = func_809C4040; + } else if (Actor_TalkOfferAccepted(&this->actor, play)) { + if (this->unk_258 == 0) { + this->actionFunc = func_809C4040; } else { - yawDiff = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)); - - if (!(this->actor.xzDistToPlayer > 120.0f) && (yawDiff < 0x4300)) { - Actor_OfferTalk(&this->actor, play, 120.0f); - } + this->actionFunc = func_809C41FC; + } + } else { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + relYawTowardsPlayerAbs = ABS(relYawTowardsPlayer); + if (!(this->actor.xzDistToPlayer > 120.0f) && (relYawTowardsPlayerAbs < 0x4300)) { + Actor_OfferTalk(&this->actor, play, 120.0f); } } } -void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { +void func_809C4040(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - switch (play->msgCtx.choiceIndex) { - case 0: // Yes - if (gSaveContext.save.info.playerData.rupees >= 30) { - Rupees_ChangeBy(-30); - this->minigamePlayStatus = 1; - this->wallStatus[0] = this->wallStatus[1] = 0; - play->bombchuBowlingStatus = 10; + case 0: + if (gSaveContext.save.info.playerData.rupees >= 0x1E) { + Rupees_ChangeBy(-0x1E); + this->unk23E_arr[1] = 0; + this->unk_258 = 1; + this->unk23E_arr[0] = this->unk23E_arr[1]; + play->bombchuBowlingStatus = 0xA; Flags_SetSwitch(play, 0x38); - - if (!this->startedPlaying && !this->playingAgain) { + if ((this->unk232 == 0) && (this->unk23C == 0)) { this->actor.textId = 0x19; Message_ContinueTextbox(play, this->actor.textId); - this->dialogState = TEXT_STATE_EVENT; + this->unk22E = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } else { this->actor.textId = 0x1B; Message_ContinueTextbox(play, this->actor.textId); - this->dialogState = TEXT_STATE_EVENT; + this->unk22E = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = EnBomBowlMan_SetupChooseShowPrize; + this->actionFunc = func_809C4318; } } else { - this->playingAgain = false; + this->unk23C = 0; this->actor.textId = 0x85; Message_ContinueTextbox(play, this->actor.textId); - this->dialogState = TEXT_STATE_EVENT; + this->unk22E = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } break; - - case 1: // No - this->playingAgain = false; + case 1: + this->unk23C = 0; this->actor.textId = 0x2D; Message_ContinueTextbox(play, this->actor.textId); - this->dialogState = TEXT_STATE_EVENT; + this->unk22E = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; + break; } } } void func_809C41FC(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(play, 0x38)) { Flags_UnsetSwitch(play, 0x38); } - - if (this->minigamePlayStatus == 1) { + if (this->unk_258 == 1) { this->actor.textId = 0x1B; Message_ContinueTextbox(play, this->actor.textId); - this->dialogState = TEXT_STATE_EVENT; + this->unk22E = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = EnBomBowlMan_SetupChooseShowPrize; + this->actionFunc = func_809C4318; } else { - if (this->gameResult == 2) { + if (this->unk244 == 2) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); } - this->actionFunc = EnBomBowlMan_SetupRunGame; + this->actionFunc = func_809C3D40; } } } -void EnBomBowlMan_SetupChooseShowPrize(EnBomBowlMan* this, PlayState* play) { - Vec3f accel = { 0.0f, 0.1f, 0.0f }; - Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - Vec3f pos; - - SkelAnime_Update(&this->skelAnime); - - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { - pos.x = 148.0f; - pos.y = 40.0f; - pos.z = 300.0f; - EffectSsBomb2_SpawnLayered(play, &pos, &velocity, &accel, 50, 15); +void func_809C4318(EnBomBowlMan* this, PlayState* play) { + Vec3f sp44 = D_809C4A48; + Vec3f sp38 = D_809C4A54; + Vec3f sp2C; + + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + sp2C.x = 148.0f; + sp2C.y = 40.0f; + sp2C.z = 300.0f; + EffectSsBomb2_SpawnLayered(play, &sp2C, &sp38, &sp44, 50, 15); Actor_PlaySfx(&this->actor, NA_SE_IT_GOODS_APPEAR); - this->prizeRevealTimer = 10; - this->actionFunc = EnBomBowlMan_ChooseShowPrize; + this->unk22A = 0xA; + this->actionFunc = func_809C441C; } } -static Vec3f sPrizePosOffset[] = { - { 0.0f, 22.0f, 0.0f }, { 0.0f, 22.0f, 0.0f }, { 0.0f, 8.0f, 0.0f }, { 0.0f, 9.0f, 0.0f }, { 0.0f, -2.0f, 0.0f }, -}; - -static s16 sPrizeRot[] = { 0x4268, 0x4268, -0x03E8, 0x0000, 0x4268, 0x0000 }; - -void EnBomBowlMan_ChooseShowPrize(EnBomBowlMan* this, PlayState* play) { - s16 prizeTemp; +void func_809C441C(EnBomBowlMan* this, PlayState* play) { + s16 var_v1; s32 pad; - SkelAnime_Update(&this->skelAnime); - - if (this->prizeRevealTimer == 0) { - switch (this->prizeSelect) { + SkelAnime_Update(&this->unk14C); + if (this->unk22A == 0) { + switch (this->unk242) { case 0: - prizeTemp = EXITEM_BOMB_BAG_BOWLING; + var_v1 = 0; if (GET_ITEMGETINF(ITEMGETINF_11)) { - prizeTemp = EXITEM_PURPLE_RUPEE_BOWLING; + var_v1 = 4; } break; case 1: - prizeTemp = EXITEM_PURPLE_RUPEE_BOWLING; + var_v1 = 4; break; case 2: - prizeTemp = EXITEM_BOMBCHUS_BOWLING; + var_v1 = 2; break; case 3: - prizeTemp = EXITEM_HEART_PIECE_BOWLING; + var_v1 = 1; if (GET_ITEMGETINF(ITEMGETINF_12)) { - prizeTemp = EXITEM_PURPLE_RUPEE_BOWLING; + var_v1 = 4; } break; case 4: - prizeTemp = EXITEM_BOMBS_BOWLING; + var_v1 = 3; break; } - - this->prizeIndex = prizeTemp; - - if (BREG(7)) { - this->prizeIndex = BREG(7) - 1; + this->unk230 = var_v1; + if (gRegEditor->data[0x967] != 0) { + this->unk230 = gRegEditor->data[0x967] - 1; } - - this->exItem = (EnExItem*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, sPrizePosOffset[this->prizeIndex].x + 148.0f, - sPrizePosOffset[this->prizeIndex].y + 40.0f, sPrizePosOffset[this->prizeIndex].z + 300.0f, 0, - sPrizeRot[this->prizeIndex], 0, this->prizeIndex + EXITEM_BOMB_BAG_COUNTER); - - if (!this->startedPlaying) { - this->bowlPit = (EnBomBowlPit*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, - ACTOR_EN_BOM_BOWL_PIT, 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); - if (this->bowlPit != NULL) { - this->bowlPit->prizeIndex = this->prizeIndex; + this->unk260 = (EnExItem*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, D_809C4A60[this->unk230].x + 148.0f, + D_809C4A60[this->unk230].y + 40.0f, D_809C4A60[this->unk230].z + 300.0f, 0, D_809C4A9C[this->unk230], 0, + this->unk230 + 5); + if (this->unk232 == 0) { + this->unk25C = (EnBomBowlPit*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOM_BOWL_PIT, + 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); + if (this->unk25C != NULL) { + this->unk25C->unk15A = (s16)this->unk230; } } else { - this->bowlPit->prizeIndex = this->prizeIndex; + this->unk25C->unk15A = (s16)this->unk230; } - - this->bowlPit->start = 1; - this->minigamePlayStatus = 2; + this->unk25C->unk15C = 1; + this->unk_258 = 2; this->actor.textId = 0x405A; Message_ContinueTextbox(play, this->actor.textId); - this->dialogState = TEXT_STATE_EVENT; - - // Cycle through prizes in order - this->prizeSelect++; - if (this->prizeSelect >= 5) { - this->prizeSelect = 0; + this->unk22E = TEXT_STATE_EVENT; + this->unk242 += 1; + if ((s16)this->unk242 >= 5) { + this->unk242 = 0; } - this->actionFunc = EnBomBowlMan_BeginPlayGame; + this->actionFunc = func_809C4664; } } -void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if ((Message_GetState(&play->msgCtx) == this->dialogState) && Message_ShouldAdvance(play)) { +void func_809C4664(EnBomBowlMan* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); - this->startedPlaying = true; - - if (BREG(2)) { - BREG(2) = 0; + Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); + this->unk232 = 1; + if (gRegEditor->data[0x962] != 0) { + gRegEditor->data[0x962] = 0; } - - PRINTF(VT_FGCOL(YELLOW) T("☆ わー ☆ %d\n", "☆ Wow ☆ %d\n") VT_RST, play->bombchuBowlingStatus); + PRINTF("\x1b[33m☆ わー ☆ %d\n\x1b[m", play->bombchuBowlingStatus); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); - this->actionFunc = EnBomBowlMan_SetupRunGame; + this->actionFunc = func_809C3D40; } } void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; - this->timer++; + this->unk22C += 1; this->actor.focus.pos.y = 60.0f; Actor_SetFocus(&this->actor, 60.0f); - - switch (this->eyeMode) { - case CHU_GIRL_EYES_ASLEEP: - this->eyeTextureIndex = 2; + switch (this->unk238) { + case 0: + this->unk234 = 2; break; - case CHU_GIRL_EYES_OPEN_SLOWLY: - if (this->eyeTextureIndex > 0) { - this->eyeTextureIndex--; + case 1: + if (this->unk234 > 0) { + this->unk234 -= 1; } else { - this->blinkTimer = 30; - this->eyeMode = CHU_GIRL_EYES_BLINK_RAPIDLY; + this->unk236 = 0x1E; + this->unk238 = 2; } break; - case CHU_GIRL_EYES_BLINK_RAPIDLY: - if ((this->blinkTimer == 0) && (this->eyeTextureIndex > 0)) { - this->eyeTextureIndex--; + case 2: + if (this->unk236 == 0) { + if (this->unk234 > 0) { + this->unk234 -= 1; + } } break; default: - if (this->blinkTimer == 0) { - this->eyeTextureIndex++; - if (this->eyeTextureIndex >= 3) { - this->eyeTextureIndex = 0; - this->blinkTimer = (s16)Rand_ZeroFloat(60.0f) + 20; + if (this->unk236 == 0) { + this->unk234 += 1; + if (this->unk234 >= 3) { + this->unk234 = 0; + this->unk236 = (s16)Rand_ZeroFloat(60.0f) + 0x14; } } - - Actor_TrackPlayer(play, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk218, &this->unk224, this->actor.focus.pos); break; } + if (this->unk22A == 0) { - DECR(this->prizeRevealTimer); - DECR(this->blinkTimer); - + } else { + this->unk22A -= 1; + } + if (this->unk236 != 0) { + this->unk236 -= 1; + } this->actionFunc(this, play); } s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnBomBowlMan* this = (EnBomBowlMan*)thisx; + EnBomBowlMan* this = thisx; - if (limbIndex == 4) { // head - rot->x += this->unk_218.y; - rot->z += this->unk_218.z; + if (limbIndex == 4) { + rot->x += this->unk218.y; + rot->z += this->unk218.z; } - - return false; + return 0; } void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { - static void* eyeTextures[] = { gChuGirlEyeOpenTex, gChuGirlEyeHalfTex, gChuGirlEyeClosedTex }; EnBomBowlMan* this = (EnBomBowlMan*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); - Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeTextureIndex])); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809C4AA8[this->unk234])); + SkelAnime_DrawFlexOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, this->unk14C.dListCount, EnBomBowlMan_OverrideLimbDraw, NULL, this); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 923); } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index 2b85ab84acd..50b3e508e15 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -3,40 +3,42 @@ #include "ultra64.h" #include "actor.h" -#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" -#include "overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" struct EnBomBowlMan; typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, struct PlayState*); typedef struct EnBomBowlMan { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[11]; - /* 0x01D2 */ Vec3s morphTable[11]; - /* 0x0214 */ EnBomBowlManActionFunc actionFunc; - /* 0x0218 */ Vec3s unk_218; - /* 0x021E */ char unk_21E[0x6]; - /* 0x0224 */ Vec3s unk_224; - /* 0x022A */ s16 prizeRevealTimer; - /* 0x022C */ s16 timer; - /* 0x022E */ s16 dialogState; - /* 0x0230 */ s16 prizeIndex; - /* 0x0232 */ s16 startedPlaying; // set to true after starting the first round - /* 0x0234 */ s16 eyeTextureIndex; - /* 0x0236 */ s16 blinkTimer; - /* 0x0238 */ s16 eyeMode; - /* 0x023A */ s16 blinkCount; - /* 0x023C */ s16 playingAgain; // whether player is playing again after a game - /* 0x023E */ s16 wallStatus[2]; - /* 0x0242 */ s16 prizeSelect; - /* 0x0244 */ s16 gameResult; // 0 = default, 1 = lost, 2 = won - /* 0x0248 */ Vec3f posCopy; // Set and not used - /* 0x0254 */ f32 frameCount; - /* 0x0258 */ u8 minigamePlayStatus; // 0 = default, 1 = paid, 2 = playing - /* 0x025C */ EnBomBowlPit* bowlPit; - /* 0x0260 */ EnExItem* exItem; + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ Vec3s unk190; + /* 0x196 */ char pad196[0x3C]; /* maybe part of unk190[0xB]? */ + /* 0x1D2 */ Vec3s unk1D2; + /* 0x1D8 */ char pad1D8[0x3C]; /* maybe part of unk1D2[0xB]? */ + /* 0x214 */ EnBomBowlManActionFunc actionFunc; + /* 0x218 */ Vec3s unk218; + /* 0x21E */ char pad21E[6]; + /* 0x224 */ Vec3s unk224; + /* 0x22A */ s16 unk22A; + /* 0x22C */ s16 unk22C; + /* 0x22E */ s16 unk22E; + /* 0x230 */ s16 unk230; + /* 0x232 */ s16 unk232; + /* 0x234 */ s16 unk234; + /* 0x236 */ s16 unk236; + /* 0x238 */ s16 unk238; + /* 0x23A */ s16 unk23A; + /* 0x23C */ s16 unk23C; + /* 0x23E */ s16 unk23E_arr[2]; + /* 0x242 */ s16 unk242; + /* 0x244 */ s16 unk244; + /* 0x246 */ char pad246[2]; + /* 0x248 */ Vec3f unk248; + /* 0x254 */ f32 unk254_curAnimFraceCount; + /* 0x258 */ u8 unk_258; + /* 0x259 */ char pad259[3]; /* maybe part of unk_258[4]? */ + /* 0x25C */ struct EnBomBowlPit* unk25C; + /* 0x260 */ struct EnExItem* unk260; } EnBomBowlMan; // size = 0x0264 #endif diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index 43207a9992b..4fd42e74c81 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -1,15 +1,14 @@ #include "z_en_bom_bowl_pit.h" #include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" +#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" #include "printf.h" #include "regs.h" -#include "sfx.h" -#include "terminal.h" -#include "translation.h" -#include "z_lib.h" +#include "camera.h" #include "play_state.h" #include "player.h" #include "save.h" +#include "z_lib.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -17,16 +16,18 @@ void EnBomBowlPit_Init(Actor* thisx, PlayState* play); void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play); void EnBomBowlPit_Update(Actor* thisx, PlayState* play); -void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, PlayState* play); -void EnBomBowlPit_Reset(EnBomBowlPit* this, PlayState* play); - -static s32 sGetItemIds[] = { GI_BOMB_BAG_30, GI_HEART_PIECE, GI_BOMBCHUS_10, GI_BOMBS_1, GI_RUPEE_PURPLE }; +void func_809C4E60(EnBomBowlPit* this, PlayState* play); +void func_809C4E8C(EnBomBowlPit* this, PlayState* play); +void func_809C5184(EnBomBowlPit* this, PlayState* play); +void func_809C5360(EnBomBowlPit* this, PlayState* play); +void func_809C53F0(EnBomBowlPit* this, PlayState* play); +void func_809C54A8(EnBomBowlPit* this, PlayState* play); +void func_809C55B0(EnBomBowlPit* this, PlayState* play); +void func_809C5608(EnBomBowlPit* this, PlayState* play); + +static s32 D_809C56E0[5] = { + GI_BOMB_BAG_30, GI_HEART_PIECE, GI_BOMBCHUS_10, GI_BOMBS_1, GI_RUPEE_PURPLE, +}; ActorProfile En_Bom_Bowl_Pit_Profile = { /**/ ACTOR_EN_BOM_BOWL_PIT, @@ -43,89 +44,80 @@ ActorProfile En_Bom_Bowl_Pit_Profile = { void EnBomBowlPit_Init(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->actionFunc = EnBomBowlPit_SetupDetectHit; + this->unk14C = func_809C4E60; } void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowlPit_SetupDetectHit(EnBomBowlPit* this, PlayState* play) { - if (this->start != 0) { - this->start = this->status = 0; - this->actionFunc = EnBomBowlPit_DetectHit; +void func_809C4E60(EnBomBowlPit* this, PlayState* play) { + if (this->unk15C != 0) { + this->unk15C = this->unk164 = 0; + this->unk14C = func_809C4E8C; } } -void EnBomBowlPit_DetectHit(EnBomBowlPit* this, PlayState* play) { - EnBomChu* chu; - Vec3f chuPosDiff; +void func_809C4E8C(EnBomBowlPit* this, PlayState* play) { + Actor* var_v1; + EnBomChu* sp24; + Vec3f diff; + Actor* thisx = &this->actor; if (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { - chu = (EnBomChu*)play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; - - while (chu != NULL) { - if ((&chu->actor == &this->actor) || (chu->actor.id != ACTOR_EN_BOM_CHU)) { - chu = (EnBomChu*)chu->actor.next; + var_v1 = play->actorCtx.actorLists[3].head; + while (var_v1 != NULL) { + if ((var_v1 == thisx) || (var_v1->id != ACTOR_EN_BOM_CHU)) { + var_v1 = var_v1->next; continue; } - - chuPosDiff.x = chu->actor.world.pos.x - this->actor.world.pos.x; - chuPosDiff.y = chu->actor.world.pos.y - this->actor.world.pos.y; - chuPosDiff.z = chu->actor.world.pos.z - this->actor.world.pos.z; - - if (((fabsf(chuPosDiff.x) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.y) < 40.0f) || (BREG(2))) && - ((fabsf(chuPosDiff.z) < 40.0f) || (BREG(2)))) { + diff.x = var_v1->world.pos.x - this->actor.world.pos.x; + diff.y = var_v1->world.pos.y - this->actor.world.pos.y; + diff.z = var_v1->world.pos.z - this->actor.world.pos.z; + if (((fabsf(diff.x) < 40.0f) || (gRegEditor->data[0x962] != 0)) && + ((fabsf(diff.y) < 40.0f) || (gRegEditor->data[0x962] != 0)) && + ((fabsf(diff.z) < 40.0f) || (gRegEditor->data[0x962] != 0))) { + sp24 = (EnBomChu*)var_v1; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - chu->timer = 1; - + sp24->timer = 1; this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); - this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.1f; - this->subCamAt.x = this->viewAt.x = play->view.at.x; this->subCamAt.y = this->viewAt.y = play->view.at.y; this->subCamAt.z = this->viewAt.z = play->view.at.z; - this->subCamEye.x = this->viewEye.x = play->view.eye.x; this->subCamEye.y = this->viewEye.y = play->view.eye.y; this->subCamEye.z = this->viewEye.z = play->view.eye.z; - this->subCamAtNext.x = 20.0f; this->subCamAtNext.y = 100.0f; this->subCamAtNext.z = -800.0f; - this->subCamEyeNext.x = 20.0f; this->subCamEyeNext.y = 50.0f; this->subCamEyeNext.z = -485.0f; - - this->subCamEyeVel.x = fabsf(this->subCamEye.x - this->subCamEyeNext.x) * 0.02f; - this->subCamEyeVel.y = fabsf(this->subCamEye.y - this->subCamEyeNext.y) * 0.02f; - this->subCamEyeVel.z = fabsf(this->subCamEye.z - this->subCamEyeNext.z) * 0.02f; - + this->subCamEyeVel.x = fabsf(this->subCamEye.x - 20.0f) * 0.02f; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - 50.0f) * 0.02f; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - -485.0f) * 0.02f; this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.02f; this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.02f; this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.02f; - Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); this->actor.textId = 0xF; Message_StartTextbox(play, this->actor.textId, NULL); - this->unk_154 = TEXT_STATE_EVENT; - Sfx_PlaySfxCentered(NA_SE_EV_HIT_SOUND); + this->unk154 = 5; + Sfx_PlaySfxCentered(0x28D3U); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->status = 1; - this->actionFunc = EnBomBowlPit_CameraDollyIn; - break; - } else { - chu = (EnBomChu*)chu->actor.next; + this->unk164 = 1; + this->unk14C = func_809C5184; + return; } + var_v1 = var_v1->next; } } } -void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, PlayState* play) { +void func_809C5184(EnBomBowlPit* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, this->subCamAtVel.x); Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, this->subCamAtVel.y); @@ -134,13 +126,10 @@ void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, PlayState* play) { Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamEyeMaxVelFrac.y, this->subCamEyeVel.y); Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, this->subCamEyeVel.z); } - Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - - if ((this->unk_154 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->unk154 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); } - if ((fabsf(this->subCamEye.x - this->subCamEyeNext.x) < 5.0f) && (fabsf(this->subCamEye.y - this->subCamEyeNext.y) < 5.0f) && (fabsf(this->subCamEye.z - this->subCamEyeNext.z) < 5.0f) && @@ -148,84 +137,80 @@ void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, PlayState* play) { (fabsf(this->subCamAt.y - this->subCamAtNext.y) < 5.0f) && (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 5.0f)) { Message_CloseTextbox(play); - this->timer = 30; - this->actionFunc = EnBomBowlPit_SpawnPrize; + this->unk158 = 0x1E; + this->unk14C = func_809C5360; } } -void EnBomBowlPit_SpawnPrize(EnBomBowlPit* this, PlayState* play) { - if (this->timer == 0) { - this->exItem = (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, - this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z - 70.0f, 0, 0, 0, this->prizeIndex); - if (this->exItem != NULL) { - this->actionFunc = EnBomBowlPit_SetupGivePrize; +void func_809C5360(EnBomBowlPit* this, PlayState* play) { + if (this->unk158 == 0) { + this->unk1E0 = + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z - 70.0f, 0, 0, 0, this->unk15A); + if (this->unk1E0 != NULL) { + this->unk14C = func_809C53F0; } } } -void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, PlayState* play) { - if (this->exItemDone != 0) { - switch (this->prizeIndex) { - case EXITEM_BOMB_BAG_BOWLING: +void func_809C53F0(EnBomBowlPit* this, PlayState* play) { + if (this->unk156 != 0) { + switch (this->unk15A) { + case 0: SET_ITEMGETINF(ITEMGETINF_11); break; case EXITEM_HEART_PIECE_BOWLING: SET_ITEMGETINF(ITEMGETINF_12); break; } - Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = EnBomBowlPit_GivePrize; + this->unk14C = func_809C54A8; } } -void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play) { +void func_809C54A8(EnBomBowlPit* this, PlayState* play) { Player* player = GET_PLAYER(play); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); - this->getItemId = sGetItemIds[this->prizeIndex]; - - if ((this->getItemId == GI_BOMB_BAG_30) && (CUR_CAPACITY(UPG_BOMB_BAG) == 30)) { - this->getItemId = GI_BOMB_BAG_40; + this->unk160 = D_809C56E0[this->unk15A]; + if ((this->unk160 == GI_BOMB_BAG_30) && (CUR_CAPACITY(1) == 30)) { + this->unk160 = GI_BOMB_BAG_40; } - player->stateFlags1 &= ~PLAYER_STATE1_29; this->actor.parent = NULL; - Actor_OfferGetItem(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->unk160, 2000.0f, 1000.0f); player->stateFlags1 |= PLAYER_STATE1_29; - this->actionFunc = EnBomBowlPit_WaitTillPrizeGiven; + this->unk14C = func_809C55B0; } -void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, PlayState* play) { +void func_809C55B0(EnBomBowlPit* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = EnBomBowlPit_Reset; - } else { - Actor_OfferGetItem(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); + this->unk14C = func_809C5608; + return; } + Actor_OfferGetItem(&this->actor, play, this->unk160, 2000.0f, 1000.0f); } -void EnBomBowlPit_Reset(EnBomBowlPit* this, PlayState* play) { +void func_809C5608(EnBomBowlPit* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n", "☆☆☆☆☆ Normal termination ☆☆☆☆☆ \n") VT_RST); - if (this->getItemId == GI_HEART_PIECE) { + PRINTF("\x1b[32m☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n\x1b[m"); + if (this->unk160 == GI_HEART_PIECE) { gSaveContext.healthAccumulator = 0x140; - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ あぁ回復! ☆☆☆☆☆ \n", "☆☆☆☆☆ Ah recovery! ☆☆☆☆☆ \n") VT_RST); + PRINTF("\x1b[32m☆☆☆☆☆ あぁ回復! ☆☆☆☆☆ \n\x1b[m"); } - this->exItemDone = 0; - this->status = 2; - this->actionFunc = EnBomBowlPit_SetupDetectHit; + this->unk156 = 0; + this->unk164 = 2; + this->unk14C = func_809C4E60; } } void EnBomBowlPit_Update(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->actionFunc(this, play); - - if (this->timer != 0) { - this->timer--; + this->unk14C(this, play); + if (this->unk158 != 0) { + this->unk158--; } } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h index a75f4a9f729..4d5883a3eb1 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h @@ -3,7 +3,6 @@ #include "ultra64.h" #include "actor.h" -#include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" struct EnBomBowlPit; @@ -11,18 +10,18 @@ typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, struct PlayState*); typedef struct EnBomBowlPit { /* 0x0000 */ Actor actor; - /* 0x014C */ EnBomBowlPitActionFunc actionFunc; - /* 0x0150 */ u16 unk_150; + /* 0x014C */ EnBomBowlPitActionFunc unk14C; + /* 0x0150 */ char pad150[2]; /* 0x0152 */ s16 subCamId; - /* 0x0154 */ s16 unk_154; - /* 0x0156 */ s16 exItemDone; // Set by EnExItem? - /* 0x0158 */ s16 timer; - /* 0x015A */ s16 prizeIndex; - /* 0x015C */ s16 start; - /* 0x0160 */ s32 getItemId; - /* 0x0164 */ u8 status; - /* 0x0168 */ Vec3f viewAt; // set and not used - /* 0x0174 */ Vec3f viewEye; // set and not used + /* 0x0154 */ s16 unk154; + /* 0x0156 */ s16 unk156; + /* 0x0158 */ s16 unk158; + /* 0x015A */ s16 unk15A; + /* 0x015C */ s16 unk15C; + /* 0x0160 */ s32 unk160; + /* 0x0164 */ u8 unk164; + /* 0x0168 */ Vec3f viewAt; + /* 0x0174 */ Vec3f viewEye; /* 0x0180 */ Vec3f subCamAt; /* 0x018C */ Vec3f subCamEye; /* 0x0198 */ Vec3f subCamEyeNext; @@ -31,8 +30,8 @@ typedef struct EnBomBowlPit { /* 0x01BC */ Vec3f subCamAtNext; /* 0x01C8 */ Vec3f subCamAtMaxVelFrac; /* 0x01D4 */ Vec3f subCamAtVel; - /* 0x01E0 */ EnExItem* exItem; - /* 0x01E4 */ char unk_1E4[0x3520]; + /* 0x01E0 */ Actor* unk1E0; + /* 0x01E4 */ char pad1E4[0x3520]; } EnBomBowlPit; // size = 0x3704 #endif diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index c2ab0160da7..58de892d24d 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -414,7 +414,7 @@ void EnBomChu_Update(Actor* thisx, PlayState* play2) { if (this->actor.floorBgId != BGCHECK_SCENE) { yaw = this->actor.shape.rot.y; - DynaPolyActor_TransformCarriedActor(&play->colCtx, this->actor.floorBgId, &this->actor); + DynaPolyActor_TransformActorOnTop(&play->colCtx, this->actor.floorBgId, &this->actor); if (yaw != this->actor.shape.rot.y) { yaw = this->actor.shape.rot.y - yaw; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 18d35a395db..64f6ebf1878 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -146,7 +146,7 @@ void EnBoom_Fly(EnBoom* this, PlayState* play) { distXYZScale = 0.12f; } - if ((target != &player->actor) && ((target->update == NULL) || (ABS(yawDiff) > 0x4000))) { + if ((target != (Actor*)player) && ((target->update == NULL) || (ABS(yawDiff) > 0x4000))) { //! @bug This condition is why the boomerang will randomly fly off in a the down left direction sometimes. // If the actor targeted is not Link and the difference between the 2 y angles is greater than 0x4000, // the moveTo pointer is nulled and it flies off in a seemingly random direction. diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.h b/src/overlays/actors/ovl_En_Boom/z_en_boom.h index 83b960bc660..3a3506b8e2d 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -12,11 +12,11 @@ typedef void (*EnBoomActionFunc)(struct EnBoom*, struct PlayState*); typedef struct EnBoom { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderQuad collider; - /* 0x01CC */ Actor* moveTo; // actor boomerang moves toward - /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang - /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 - /* 0x01D5 */ u8 activeTimer; // increments once every update - /* 0x01D8 */ s32 effectIndex; + /* 0x01CC */ Actor* moveTo; // actor boomerang moves toward + /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang + /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 + /* 0x01D5 */ u8 activeTimer; // increments once every update + /* 0x01D8 */ u32 effectIndex; // set by Effect_Add /* 0x01DC */ WeaponInfo weaponInfo; /* 0x01F8 */ EnBoomActionFunc actionFunc; } EnBoom; // size = 0x01FC 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 3fc97657fdd..8f828d5dc7b 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -13,7 +13,6 @@ #include "sys_matrix.h" #include "z_lib.h" #include "audio.h" -#include "curve.h" #include "effect.h" #include "ocarina.h" #include "play_state.h" diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index 09ce94acac9..d741345527c 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -241,7 +241,7 @@ void func_809CEA24(EnBw* this, PlayState* play) { sp60 = ABS(sp58) * 85.0f; this->color1.g = sp60; } - if ((((play->gameplayFrames % 4) == (u32)this->actor.params) && (this->actor.speed != 0.0f) && + if ((((play->gameplayFrames % 4) == this->actor.params) && (this->actor.speed != 0.0f) && (sp64 = BgCheck_AnyLineTest2(&play->colCtx, &this->actor.world.pos, &this->unk_264, &sp68, &sp74, 1, 0, 0, 1))) || (this->unk_222 == 0)) { @@ -889,7 +889,7 @@ void EnBw_Draw(Actor* thisx, PlayState* play2) { EnBw_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); } - if (((play->gameplayFrames + 1) % 4) == (u32)thisx->params) { + if (((play->gameplayFrames + 1) % 4) == thisx->params) { spAC.z = thisx->scale.z * 375000.0f; Matrix_MultVec3f(&spAC, &this->unk_264); spAC.z = thisx->scale.z * 150000.0f; 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 c400d0e08de..0b6b284d6ba 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -1,9 +1,3 @@ -/* - * File: z_en_changer.c - * Overlay: ovl_En_Changer - * Description: Treasure Box Shop Minigame - */ - #include "z_en_changer.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" @@ -20,18 +14,13 @@ #define FLAGS 0 -typedef enum ChangerChestSide { - /* 0 */ CHEST_LEFT, - /* 1 */ CHEST_RIGHT -} ChangerChestSide; - void EnChanger_Init(Actor* thisx, PlayState* play2); void EnChanger_Destroy(Actor* thisx, PlayState* play); void EnChanger_Update(Actor* thisx, PlayState* play); -void EnChanger_Wait(EnChanger* this, PlayState* play); -void EnChanger_OpenChests(EnChanger* this, PlayState* play); -void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play); +void func_809D2CCC(EnChanger* this, PlayState* play); +void func_809D2D70(EnChanger* this, PlayState* play); +void func_809D2F74(EnChanger* this, PlayState* play); ActorProfile En_Changer_Profile = { /**/ ACTOR_EN_CHANGER, @@ -44,31 +33,17 @@ ActorProfile En_Changer_Profile = { /**/ EnChanger_Update, /**/ NULL, }; - -static Vec3f sLeftChestPos[] = { +static Vec3f sLeftChestPositions[6] = { { 0.0f, 0.0f, 0.0f }, { -100.0f, 20.0f, -245.0f }, { -100.0f, 20.0f, -685.0f }, { -100.0f, 20.0f, -1125.0f }, { -100.0f, 20.0f, -1565.0f }, { -100.0f, 20.0f, -2005.0f }, }; - -static Vec3f sRightChestPos[] = { +static Vec3f sRightChestPositions[6] = { { 0.0f, 0.0f, 0.0f }, { 140.0f, 20.0f, -245.0f }, { 140.0f, 20.0f, -685.0f }, { 140.0f, 20.0f, -1125.0f }, { 140.0f, 20.0f, -1565.0f }, { 140.0f, 20.0f, -2005.0f }, }; - -static s32 sLoserGetItemIds[] = { - GI_NONE, GI_RUPEE_GREEN_LOSE, GI_RUPEE_GREEN_LOSE, GI_RUPEE_BLUE_LOSE, GI_RUPEE_BLUE_LOSE, GI_RUPEE_RED_LOSE, -}; - -static s32 sItemEtcTypes[] = { - 0, - ITEM_ETC_RUPEE_GREEN_CHEST_GAME, - ITEM_ETC_RUPEE_GREEN_CHEST_GAME, - ITEM_ETC_RUPEE_BLUE_CHEST_GAME, - ITEM_ETC_RUPEE_BLUE_CHEST_GAME, - ITEM_ETC_RUPEE_RED_CHEST_GAME, -}; - -static s32 sTreasureFlags[] = { 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000A }; +static s32 D_809D3130[6] = { 0, 0x72, 0x72, 0x73, 0x73, 0x74 }; +static s32 D_809D3148[6] = { 0, 8, 8, 9, 9, 0xA }; +static s32 sTreasureFlags[6] = { 0, 2, 4, 6, 8, 0xA }; void EnChanger_Destroy(Actor* thisx, PlayState* play) { } @@ -76,216 +51,166 @@ void EnChanger_Destroy(Actor* thisx, PlayState* play) { void EnChanger_Init(Actor* thisx, PlayState* play2) { EnChanger* this = (EnChanger*)thisx; PlayState* play = play2; - s16 leftChestParams; - s16 rightChestParams; - s16 rewardChestParams; - s16 minigameRoomNum; - s16 rightChestItem; - s16 leftChestItem; - s32 rewardParams; - - minigameRoomNum = play->roomCtx.curRoom.num - 1; - if (minigameRoomNum < 0) { - minigameRoomNum = 0; + s16 sp6E_leftChestParams; + s16 sp6C_rightChestParams; + s16 sp6A_finalChestParams; + s16 temp_v1_curRoomIndex; + s16 sp66_rightChestThing; + s16 sp64_leftChestThing; + s32 new_var_someParams; + + temp_v1_curRoomIndex = play->roomCtx.curRoom.num - 1; + if (temp_v1_curRoomIndex < 0) { + temp_v1_curRoomIndex = 0; } - if (Flags_GetTreasure(play, sTreasureFlags[minigameRoomNum])) { - this->roomChestsOpened = true; + if (Flags_GetTreasure(play, sTreasureFlags[temp_v1_curRoomIndex])) { + this->unk168 = 1; } - PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n", "☆☆☆☆☆ Treasure found (which room?) %d\n") VT_RST, - play->roomCtx.curRoom.num); - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ ビットは? \t %x\n", "☆☆☆☆☆ What about bits? \t %x\n") VT_RST, - play->actorCtx.flags.chest); - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ セーブBITは? %x\n", "☆☆☆☆☆ What is the save BIT? %x\n") VT_RST, - sTreasureFlags[minigameRoomNum]); - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ もう、ゾンビ?\t %d\n", "☆☆☆☆☆ Already a zombie?\t %d\n") VT_RST, - this->roomChestsOpened); + PRINTF("\x1b[32m☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n\x1b[m", play->roomCtx.curRoom.num); + PRINTF("\x1b[32m☆☆☆☆☆ ビットは? \t %x\n\x1b[m", play->actorCtx.flags.chest); + PRINTF("\x1b[32m☆☆☆☆☆ セーブBITは? %x\n\x1b[m", sTreasureFlags[temp_v1_curRoomIndex]); + PRINTF("\x1b[32m☆☆☆☆☆ もう、ゾンビ?\t %d\n\x1b[m", this->unk168); PRINTF("\n\n"); - - minigameRoomNum *= 2; - // Spawn Heart Piece in chest (or Purple Rupee if won Heart Piece) + temp_v1_curRoomIndex = temp_v1_curRoomIndex * 2; if (play->roomCtx.curRoom.num >= 6) { - rewardChestParams = GET_ITEMGETINF(ITEMGETINF_1B) ? 0x4EA0 : 0x4EC0; - rewardChestParams = sTreasureFlags[5] | rewardChestParams; - this->finalChest = (EnBox*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOX, 20.0f, 20.0f, - -2500.0f, 0, 0x7FFF, 0, rewardChestParams); - if (this->finalChest != NULL) { - if (this->roomChestsOpened) { - Flags_SetTreasure(play, rewardChestParams & 0x1F); + sp6A_finalChestParams = GET_ITEMGETINF(ITEMGETINF_1B) ? 0x4EA0 : 0x4EC0; + sp6A_finalChestParams = sTreasureFlags[5] | sp6A_finalChestParams; + this->unk158 = (EnBox*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOX, 20.0f, 20.0f, + -2500.0f, 0, 0x7FFF, 0, sp6A_finalChestParams); + if (this->unk158 != NULL) { + if (this->unk168 != 0) { + Flags_SetTreasure(play, sp6A_finalChestParams & 0x1F); Actor_Kill(&this->actor); return; - } else { - rewardParams = (GET_ITEMGETINF(ITEMGETINF_1B) ? ITEM_ETC_RUPEE_PURPLE_CHEST_GAME - : ITEM_ETC_HEART_PIECE_CHEST_GAME) & - 0xFF; - Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, - ((sTreasureFlags[5] & 0x1F) << 8) + rewardParams); - PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ 中央宝発生(GREAT) ☆☆☆☆☆ %x\n", - "☆☆☆☆☆ Central treasure spawn (GREAT) ☆☆☆☆☆ %x\n") VT_RST, - rewardChestParams); - this->actionFunc = EnChanger_SetHeartPieceFlag; - return; } + new_var_someParams = ((gSaveContext.save.info.itemGetInf[1] & 0x800) ? 0xB : 0xC) & 0xFF; + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, + ((sTreasureFlags[5] & 0x1F) << 8) + new_var_someParams); + PRINTF("\x1b[33m☆☆☆☆☆ 中央宝発生(GREAT) ☆☆☆☆☆ %x\n\x1b[m", sp6A_finalChestParams); + this->unk14C = func_809D2F74; + return; } } - - // Set up items in chests, swap them round with probability 1/2 - leftChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000; - this->leftChestNum = minigameRoomNum; - this->leftChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num]; - leftChestItem = sItemEtcTypes[play->roomCtx.curRoom.num]; - leftChestParams |= minigameRoomNum; - rightChestParams = minigameRoomNum | 0x4E21; - this->rightChestNum = minigameRoomNum | 1; - this->rightChestGetItemId = GI_DOOR_KEY; - rightChestItem = ITEM_ETC_KEY_SMALL_CHEST_GAME; - + sp6E_leftChestParams = (D_809D3130[play->roomCtx.curRoom.num] << 5) | 0x4000; + this->unk15C_l = temp_v1_curRoomIndex; + sp6E_leftChestParams |= temp_v1_curRoomIndex; + this->unk160 = D_809D3130[play->roomCtx.curRoom.num]; + sp64_leftChestThing = D_809D3148[play->roomCtx.curRoom.num]; + sp6C_rightChestParams = temp_v1_curRoomIndex | 0x4E21; + this->unk15E_r = temp_v1_curRoomIndex | 1; + this->unk162 = 0x71; + sp66_rightChestThing = 0xD; if (Rand_ZeroFloat(1.99f) < 1.0f) { - rightChestParams = (sLoserGetItemIds[play->roomCtx.curRoom.num] << 5) | 0x4000; - this->rightChestNum = minigameRoomNum; - this->rightChestGetItemId = sLoserGetItemIds[play->roomCtx.curRoom.num]; - rightChestItem = sItemEtcTypes[play->roomCtx.curRoom.num]; - leftChestParams = minigameRoomNum | 0x4E21; - rightChestParams |= minigameRoomNum; - this->leftChestNum = minigameRoomNum | 1; - this->leftChestGetItemId = GI_DOOR_KEY; - leftChestItem = ITEM_ETC_KEY_SMALL_CHEST_GAME; + sp6C_rightChestParams = (D_809D3130[play->roomCtx.curRoom.num] << 5) | 0x4000; + this->unk15E_r = temp_v1_curRoomIndex; + this->unk162 = D_809D3130[play->roomCtx.curRoom.num]; + sp66_rightChestThing = D_809D3148[play->roomCtx.curRoom.num]; + sp6E_leftChestParams = temp_v1_curRoomIndex | 0x4E21; + sp6C_rightChestParams |= temp_v1_curRoomIndex; + this->unk15C_l = temp_v1_curRoomIndex | 1; + this->unk160 = 0x71; + sp64_leftChestThing = 0xD; } - - this->leftChest = (EnBox*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_BOX, sLeftChestPos[play->roomCtx.curRoom.num].x, - sLeftChestPos[play->roomCtx.curRoom.num].y, sLeftChestPos[play->roomCtx.curRoom.num].z, 0, -0x3FFF, 0, - leftChestParams); - - if (this->leftChest != NULL) { - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆☆ 左宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n", - "☆☆☆☆☆ Left treasure spawn (what does it contain?) ☆☆☆☆☆ %x\n") VT_RST, - leftChestParams); - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆☆ 部屋番号は? %x\n", "☆☆☆☆☆ What is the room number? %x\n") VT_RST, - play->roomCtx.curRoom.num); - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆☆ ビットはなぁに? %x\n", "☆☆☆☆☆ What is the bit? %x\n") VT_RST, - this->rightChestNum); - // "Sukesuke-kun" (something to do with being invisible) - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆☆ すけすけ君? %x\n", "☆☆☆☆☆ See-through guy? %x\n") VT_RST, rightChestItem); + this->unk150 = (EnBox*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_BOX, sLeftChestPositions[play->roomCtx.curRoom.num].x, + sLeftChestPositions[play->roomCtx.curRoom.num].y, sLeftChestPositions[play->roomCtx.curRoom.num].z, 0, -0x3FFF, + 0, sp6E_leftChestParams); + if (this->unk150 != NULL) { + PRINTF("\x1b[35m☆☆☆☆☆ 左宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n\x1b[m", sp6E_leftChestParams); + PRINTF("\x1b[35m☆☆☆☆☆ 部屋番号は? %x\n\x1b[m", play->roomCtx.curRoom.num); + PRINTF("\x1b[35m☆☆☆☆☆ ビットはなぁに? %x\n\x1b[m", this->unk15E_r); + PRINTF("\x1b[35m☆☆☆☆☆ すけすけ君? %x\n\x1b[m", sp66_rightChestThing); PRINTF("\n\n"); - if (this->roomChestsOpened) { - Flags_SetTreasure(play, this->leftChestNum & 0x1F); + if (this->unk168 != 0) { + Flags_SetTreasure(play, this->unk15C_l & 0x1F); } else { - Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, sLeftChestPos[play->roomCtx.curRoom.num].x, - sLeftChestPos[play->roomCtx.curRoom.num].y, sLeftChestPos[play->roomCtx.curRoom.num].z, 0, 0, 0, - ((this->leftChestNum & 0x1F) << 8) + (leftChestItem & 0xFF)); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, sLeftChestPositions[play->roomCtx.curRoom.num].x, + sLeftChestPositions[play->roomCtx.curRoom.num].y, + sLeftChestPositions[play->roomCtx.curRoom.num].z, 0, 0, 0, + ((this->unk15C_l & 0x1F) << 8) + (sp64_leftChestThing & 0xFF)); } } - - this->rightChest = (EnBox*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_BOX, sRightChestPos[play->roomCtx.curRoom.num].x, - sRightChestPos[play->roomCtx.curRoom.num].y, sRightChestPos[play->roomCtx.curRoom.num].z, 0, 0x3FFF, 0, - rightChestParams); - - if (this->rightChest != NULL) { - PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆☆ 右宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n", - "☆☆☆☆☆ Right treasure spawn (what does it contain?) ☆☆☆☆☆ %x\n") VT_RST, - rightChestParams); - PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆☆ 部屋番号は? %d\n", "☆☆☆☆☆ What is the room number? %d\n") VT_RST, - play->roomCtx.curRoom.num); - PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆☆ ビットはなぁに? %x\n", "☆☆☆☆☆ What is the bit? %x\n") VT_RST, - this->leftChestNum); - // "Sukesuke-kun" (something to do with being invisible) - PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆☆ すけすけ君? %x\n", "☆☆☆☆☆ See-through guy? %x\n") VT_RST, leftChestItem); + this->unk154 = (EnBox*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_BOX, sRightChestPositions[play->roomCtx.curRoom.num].x, + sRightChestPositions[play->roomCtx.curRoom.num].y, sRightChestPositions[play->roomCtx.curRoom.num].z, 0, 0x3FFF, + 0, sp6C_rightChestParams); + if (this->unk154 != NULL) { + PRINTF("\x1b[36m☆☆☆☆☆ 右宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n\x1b[m", sp6C_rightChestParams); + PRINTF("\x1b[36m☆☆☆☆☆ 部屋番号は? %d\n\x1b[m", play->roomCtx.curRoom.num); + PRINTF("\x1b[36m☆☆☆☆☆ ビットはなぁに? %x\n\x1b[m", this->unk15C_l); + PRINTF("\x1b[36m☆☆☆☆☆ すけすけ君? %x\n\x1b[m", sp64_leftChestThing); PRINTF("\n\n"); - - if (this->roomChestsOpened) { - Flags_SetTreasure(play, this->rightChestNum & 0x1F); + if (this->unk168 != 0) { + Flags_SetTreasure(play, this->unk15E_r & 0x1F); Actor_Kill(&this->actor); return; } - - Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, sRightChestPos[play->roomCtx.curRoom.num].x, - sRightChestPos[play->roomCtx.curRoom.num].y, sRightChestPos[play->roomCtx.curRoom.num].z, 0, 0, 0, - ((this->rightChestNum & 0x1F) << 8) + (rightChestItem & 0xFF)); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, sRightChestPositions[play->roomCtx.curRoom.num].x, + sRightChestPositions[play->roomCtx.curRoom.num].y, + sRightChestPositions[play->roomCtx.curRoom.num].z, 0, 0, 0, + ((this->unk15E_r & 0x1F) << 8) + (sp66_rightChestThing & 0xFF)); } - this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = EnChanger_Wait; + this->unk14C = func_809D2CCC; } -void EnChanger_Wait(EnChanger* this, PlayState* play) { - if (this->leftChest->unk_1F4 != 0) { - this->timer = 80; - Flags_SetTreasure(play, this->rightChestNum & 0x1F); - this->actionFunc = EnChanger_OpenChests; - } else if (this->rightChest->unk_1F4 != 0) { - this->selectedChest = CHEST_RIGHT; - this->timer = 80; - Flags_SetTreasure(play, this->leftChestNum & 0x1F); - this->actionFunc = EnChanger_OpenChests; +void func_809D2CCC(EnChanger* this, PlayState* play) { + if (this->unk150->unk_1F4 != 0) { + this->unk166 = 0x50; + Flags_SetTreasure(play, this->unk15E_r & 0x1F); + this->unk14C = func_809D2D70; + } else if (this->unk154->unk_1F4 != 0) { + this->unk164 = 1; + this->unk166 = 0x50; + Flags_SetTreasure(play, this->unk15C_l & 0x1F); + this->unk14C = func_809D2D70; } } -// Spawns the EnExItem showing what was in the other chest -void EnChanger_OpenChests(EnChanger* this, PlayState* play) { - f32 zPos; - f32 yPos; - f32 xPos; - s16 selectedChest; - s16 unopenedChestItemType; - EnBox* left; - EnBox* right; - - left = this->leftChest; - right = this->rightChest; - - if (this->timer == 0) { - // `unopenedChestItemType` being set here is required for matching, but doesn't do anything useful - unopenedChestItemType = selectedChest = this->selectedChest; - - switch (selectedChest) { - case CHEST_LEFT: - xPos = right->dyna.actor.world.pos.x; - yPos = right->dyna.actor.world.pos.y; - zPos = right->dyna.actor.world.pos.z; - - if (this->rightChestGetItemId == GI_DOOR_KEY) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, - EXITEM_SMALL_KEY_CHEST); +void func_809D2D70(EnChanger* this, PlayState* play) { + Vec3f pos; + EnBox* temp_v0; + EnBox* temp_v1; + s16 temp_s0; + + temp_v0 = this->unk150; + temp_v1 = this->unk154; + if (this->unk166 == 0) { + switch (this->unk164) { + case 0: + pos.x = temp_v1->dyna.actor.world.pos.x; + pos.y = temp_v1->dyna.actor.world.pos.y; + pos.z = temp_v1->dyna.actor.world.pos.z; + if (this->unk162 == 0x71) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, pos.x, pos.y, pos.z, 0, 0, 0, 0xF); Flags_SetSwitch(play, 0x32); } else { - unopenedChestItemType = - (s16)(this->rightChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST; - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Right treasure open ☆☆☆☆☆ %d\n") - VT_RST, - unopenedChestItemType); - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, - unopenedChestItemType); + temp_s0 = (s16)(this->unk162 - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST; + PRINTF("\x1b[32m☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n\x1b[m", temp_s0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, pos.x, pos.y, pos.z, 0, 0, 0, temp_s0); } break; - case CHEST_RIGHT: - xPos = left->dyna.actor.world.pos.x; - yPos = left->dyna.actor.world.pos.y; - zPos = left->dyna.actor.world.pos.z; - - if (this->leftChestGetItemId == GI_DOOR_KEY) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, - EXITEM_SMALL_KEY_CHEST); + case 1: + pos.x = temp_v0->dyna.actor.world.pos.x; + pos.y = temp_v0->dyna.actor.world.pos.y; + pos.z = temp_v0->dyna.actor.world.pos.z; + if (this->unk160 == 0x71) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, pos.x, pos.y, pos.z, 0, 0, 0, 0xF); Flags_SetSwitch(play, 0x32); } else { - unopenedChestItemType = - (s16)(this->leftChestGetItemId - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST; - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Left treasure open ☆☆☆☆☆ %d\n") VT_RST, - unopenedChestItemType); - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, xPos, yPos, zPos, 0, 0, 0, - unopenedChestItemType); + temp_s0 = (s16)(this->unk160 - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST; + PRINTF("\x1b[32m☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n\x1b[m", temp_s0); + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, pos.x, pos.y, pos.z, 0, 0, 0, temp_s0); } break; } - Actor_Kill(&this->actor); } } -void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play) { - if (this->finalChest->unk_1F4 != 0) { +void func_809D2F74(EnChanger* this, PlayState* play) { + if (this->unk158->unk_1F4 != 0) { if (!GET_ITEMGETINF(ITEMGETINF_1B)) { SET_ITEMGETINF(ITEMGETINF_1B); } @@ -296,13 +221,11 @@ void EnChanger_SetHeartPieceFlag(EnChanger* this, PlayState* play) { void EnChanger_Update(Actor* thisx, PlayState* play) { EnChanger* this = (EnChanger*)thisx; - this->actionFunc(this, play); - - if (this->timer != 0) { - this->timer--; + this->unk14C(this, play); + if (this->unk166 != 0) { + this->unk166--; } - - if (DEBUG_FEATURES && BREG(0) != 0) { + if (DEBUG_FEATURES && gRegEditor->data[0x960] != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Changer/z_en_changer.h b/src/overlays/actors/ovl_En_Changer/z_en_changer.h index 45f8799a5f8..af4ff04f817 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.h +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.h @@ -9,18 +9,19 @@ struct EnChanger; typedef void (*EnChangerActionFunc)(struct EnChanger*, struct PlayState*); typedef struct EnChanger { - /* 0x0000 */ Actor actor; - /* 0x014C */ EnChangerActionFunc actionFunc; - /* 0x0150 */ struct EnBox* leftChest; - /* 0x0154 */ struct EnBox* rightChest; - /* 0x0158 */ struct EnBox* finalChest; - /* 0x015C */ s16 leftChestNum; - /* 0x015E */ s16 rightChestNum; - /* 0x0160 */ s16 leftChestGetItemId; - /* 0x0162 */ s16 rightChestGetItemId; - /* 0x0164 */ s16 selectedChest; - /* 0x0166 */ s16 timer; - /* 0x0168 */ s16 roomChestsOpened; + /* 0x000 */ Actor actor; + /* 0x14C */ EnChangerActionFunc unk14C; + /* 0x150 */ struct EnBox* unk150; + /* 0x154 */ struct EnBox* unk154; + /* 0x158 */ struct EnBox* unk158; + /* 0x15C */ s16 unk15C_l; + /* 0x15E */ s16 unk15E_r; + /* 0x160 */ s16 unk160; + /* 0x162 */ s16 unk162; + /* 0x164 */ s16 unk164; + /* 0x166 */ s16 unk166; + /* 0x168 */ s16 unk168; + /* 0x16A */ char pad16A[2]; } EnChanger; // size = 0x016C #endif diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index ec6bdd99254..b8fc55f9142 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -477,7 +477,7 @@ void EnClearTag_Update(Actor* thisx, PlayState* play2) { Math_ApproachS(&this->actor.world.rot.z, 0, 15, this->targetDirection.z); Math_ApproachF(&this->targetDirection.z, 0x500, 1.0f, 0x100); - // Check if the Arwing should fire its laser. + // Check if the Arwing should fire it's laser. if ((this->frameCounter % 4) == 0 && (Rand_ZeroOne() < 0.75f) && (this->state == CLEAR_TAG_STATE_TARGET_LOCKED)) { this->shouldShootLaser = true; @@ -825,7 +825,7 @@ void EnClearTag_UpdateEffects(PlayState* play) { effect->velocity.y *= -0.5f; effect->timer = ((s16)Rand_ZeroFloat(20)) + 25; } else { - // The Debris effect is done bouncing. Set its velocity and acceleration to 0. + // The Debris effect is done bounding. Set it's velocity and acceleration to 0. effect->velocity.x = effect->velocity.z = effect->acceleration.y = effect->velocity.y = 0.0f; } diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 2b185e6362a..f1ad26b625c 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -22,13 +22,13 @@ void EnCrow_Destroy(Actor* thisx, PlayState* play); void EnCrow_Update(Actor* thisx, PlayState* play); void EnCrow_Draw(Actor* thisx, PlayState* play); -void EnCrow_SetupFlyIdle(EnCrow* this); -void EnCrow_FlyIdle(EnCrow* this, PlayState* play); -void EnCrow_Respawn(EnCrow* this, PlayState* play); -void EnCrow_DiveAttack(EnCrow* this, PlayState* play); +void EnCrow_SetupWait(EnCrow* this); +void EnCrow_Wait(EnCrow* this, PlayState* play); +void func_809E10A8(EnCrow* this, PlayState* play); +void func_809E0C8C(EnCrow* this, PlayState* play); void EnCrow_Die(EnCrow* this, PlayState* play); -void EnCrow_TurnAway(EnCrow* this, PlayState* play); -void EnCrow_Damaged(EnCrow* this, PlayState* play); +void func_809E1004(EnCrow* this, PlayState* play); +void func_809E0E2C(EnCrow* this, PlayState* play); static Vec3f sZeroVecAccel = { 0.0f, 0.0f, 0.0f }; @@ -130,7 +130,7 @@ void EnCrow_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 2000.0f, ActorShadow_DrawCircle, 20.0f); sDeathCount = 0; - EnCrow_SetupFlyIdle(this); + EnCrow_SetupWait(this); } void EnCrow_Destroy(Actor* thisx, PlayState* play) { @@ -139,23 +139,21 @@ void EnCrow_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -// Setup Action functions - -void EnCrow_SetupFlyIdle(EnCrow* this) { +void EnCrow_SetupWait(EnCrow* this) { this->timer = 100; this->collider.base.acFlags |= AC_ON; - this->actionFunc = EnCrow_FlyIdle; + this->actionFunc = EnCrow_Wait; this->skelAnime.playSpeed = 1.0f; } -void EnCrow_SetupDiveAttack(EnCrow* this) { +void func_809E0384(EnCrow* this) { this->timer = 300; this->actor.speed = 4.0f; this->skelAnime.playSpeed = 2.0f; - this->actionFunc = EnCrow_DiveAttack; + this->actionFunc = func_809E0C8C; } -void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { +void func_809E03B4(EnCrow* this, PlayState* play) { s32 i; f32 scale; Vec3f iceParticlePos; @@ -170,7 +168,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { this->actor.lockOnArrowOffset = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_DEAD); - if (this->actor.colChkInfo.damageReaction == 3) { // Ice arrows + if (this->actor.colChkInfo.damageReaction == 3) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 40); for (i = 0; i < 8; i++) { iceParticlePos.x = ((i & 1 ? 7.0f : -7.0f) * scale) + this->actor.world.pos.x; @@ -179,7 +177,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, ((Rand_ZeroOne() * 0.15f) + 0.85f) * scale); } - } else if (this->actor.colChkInfo.damageReaction == 2) { // Fire arrows and Din's Fire + } else if (this->actor.colChkInfo.damageReaction == 2) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); for (i = 0; i < 4; i++) { @@ -196,7 +194,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->actionFunc = EnCrow_Damaged; + this->actionFunc = func_809E0E2C; } void EnCrow_SetupDie(EnCrow* this) { @@ -204,7 +202,7 @@ void EnCrow_SetupDie(EnCrow* this) { this->actionFunc = EnCrow_Die; } -void EnCrow_SetupTurnAway(EnCrow* this) { +void func_809E06E8(EnCrow* this) { this->timer = 100; this->actor.speed = 3.5f; this->aimRotX = -0x1000; @@ -212,10 +210,10 @@ void EnCrow_SetupTurnAway(EnCrow* this) { this->skelAnime.playSpeed = 2.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 5); Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->actionFunc = EnCrow_TurnAway; + this->actionFunc = func_809E1004; } -void EnCrow_SetupRespawn(EnCrow* this) { +void func_809E0770(EnCrow* this) { if (sDeathCount == 10) { this->actor.params = 1; sDeathCount = 0; @@ -234,12 +232,10 @@ void EnCrow_SetupRespawn(EnCrow* this) { this->actor.shape.yOffset = 2000; this->actor.lockOnArrowOffset = 2000.0f; this->actor.draw = NULL; - this->actionFunc = EnCrow_Respawn; + this->actionFunc = func_809E10A8; } -// Action functions - -void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { +void EnCrow_Wait(EnCrow* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 skelanimeUpdated; s16 var; @@ -292,11 +288,11 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & PLAYER_STATE1_23) && (this->actor.depthInWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { - EnCrow_SetupDiveAttack(this); + func_809E0384(this); } } -void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { +void func_809E0C8C(EnCrow* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 facingPlayer; @@ -335,11 +331,11 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_KAICHO_ATTACK); } - EnCrow_SetupFlyIdle(this); + EnCrow_SetupWait(this); } } -void EnCrow_Damaged(EnCrow* this, PlayState* play) { +void func_809E0E2C(EnCrow* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; @@ -373,13 +369,13 @@ void EnCrow_Die(EnCrow* this, PlayState* play) { } else { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); } - EnCrow_SetupRespawn(this); + func_809E0770(this); } this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; } -void EnCrow_TurnAway(EnCrow* this, PlayState* play) { +void func_809E1004(EnCrow* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -395,11 +391,11 @@ void EnCrow_TurnAway(EnCrow* this, PlayState* play) { this->timer--; } if (this->timer == 0) { - EnCrow_SetupFlyIdle(this); + EnCrow_SetupWait(this); } } -void EnCrow_Respawn(EnCrow* this, PlayState* play) { +void func_809E10A8(EnCrow* this, PlayState* play) { f32 target; if (this->timer != 0) { @@ -418,24 +414,24 @@ void EnCrow_Respawn(EnCrow* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.colChkInfo.health = 1; - EnCrow_SetupFlyIdle(this); + EnCrow_SetupWait(this); } this->actor.scale.z = this->actor.scale.y = this->actor.scale.x; } } -void EnCrow_UpdateDamage(EnCrow* this, PlayState* play) { +void func_809E1174(EnCrow* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elements[0].base, true); if ((this->actor.colChkInfo.damageReaction != 0) || (this->actor.colChkInfo.damage != 0)) { - if (this->actor.colChkInfo.damageReaction == 1) { // Deku Nuts - EnCrow_SetupTurnAway(this); + if (this->actor.colChkInfo.damageReaction == 1) { + func_809E06E8(this); } else { Actor_ApplyDamage(&this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Enemy_StartFinishingBlow(play, &this->actor); - EnCrow_SetupDamaged(this, play); + func_809E03B4(this, play); } } } @@ -447,13 +443,13 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { f32 height; f32 scale; - EnCrow_UpdateDamage(this, play); + func_809E1174(this, play); this->actionFunc(this, play); scale = this->actor.scale.x * 100.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actor.world.rot.x = -this->actor.shape.rot.x; - if (this->actionFunc != EnCrow_Respawn) { + if (this->actionFunc != func_809E10A8) { if (this->actor.colChkInfo.health != 0) { height = 20.0f * scale; Actor_MoveXYZ(&this->actor); @@ -471,7 +467,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + height; this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - if (this->actionFunc == EnCrow_DiveAttack) { + if (this->actionFunc == func_809E0C8C) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } @@ -479,7 +475,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - if (this->actionFunc != EnCrow_Respawn) { + if (this->actionFunc != func_809E10A8) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } 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 51825392be6..ee32cbebc2c 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -267,7 +267,7 @@ void EnCs_HandleTalking(EnCs* this, PlayState* play) { Actor_GetScreenPos(play, &this->actor, &sp2A, &sp28); if ((sp2A >= 0) && (sp2A <= 320) && (sp28 >= 0) && (sp28 <= 240) && - Actor_OfferTalk(&this->actor, play, 100.0f)) { + (Actor_OfferTalk(&this->actor, play, 100.0f))) { this->actor.textId = EnCs_GetTextId(this, play); } } 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 a133dda66ba..19e9ac39c15 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1,5 +1,4 @@ #include "z_en_dekubaba.h" -#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" #include "array_count.h" #include "gfx.h" @@ -24,24 +23,23 @@ void EnDekubaba_Destroy(Actor* thisx, PlayState* play); void EnDekubaba_Update(Actor* thisx, PlayState* play); void EnDekubaba_Draw(Actor* thisx, PlayState* play); -void EnDekubaba_SetupWait(EnDekubaba* this); -void EnDekubaba_SetupGrow(EnDekubaba* this); -void EnDekubaba_Wait(EnDekubaba* this, PlayState* play); -void EnDekubaba_Grow(EnDekubaba* this, PlayState* play); -void EnDekubaba_Retract(EnDekubaba* this, PlayState* play); -void EnDekubaba_DecideLunge(EnDekubaba* this, PlayState* play); -void EnDekubaba_Lunge(EnDekubaba* this, PlayState* play); -void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play); -void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play); -void EnDekubaba_Recover(EnDekubaba* this, PlayState* play); -void EnDekubaba_Hit(EnDekubaba* this, PlayState* play); -void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play); -void EnDekubaba_Sway(EnDekubaba* this, PlayState* play); -void EnDekubaba_PrunedSomersault(EnDekubaba* this, PlayState* play); -void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play); -void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play); - -static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; +void func_809E5ABC(EnDekubaba* this); +void func_809E64F4(EnDekubaba* this, PlayState* play); +void func_809E65A0(EnDekubaba* this, PlayState* play); +void func_809E6A04(EnDekubaba* this, PlayState* play); +void func_809E6ED4(EnDekubaba* this, PlayState* play); +void func_809E7104(EnDekubaba* this, PlayState* play); +void func_809E738C(EnDekubaba* this, PlayState* play); +void func_809E7458(EnDekubaba* this, PlayState* play); +void func_809E77E4(EnDekubaba* this, PlayState* play); +void func_809E78DC(EnDekubaba* this, PlayState* play); +void func_809E79EC(EnDekubaba* this, PlayState* play); +void func_809E7A88(EnDekubaba* this, PlayState* play); +void func_809E7BB0(EnDekubaba* this, PlayState* play); +void func_809E7F14(EnDekubaba* this, PlayState* play); +void func_809E80D8(EnDekubaba* this, PlayState* play); + +static Vec3f D_809E8EA0 = { 0.0f, 0.0f, 0.0f }; ActorProfile En_Dekubaba_Profile = { /**/ ACTOR_EN_DEKUBABA, @@ -55,7 +53,7 @@ ActorProfile En_Dekubaba_Profile = { /**/ EnDekubaba_Draw, }; -static ColliderJntSphElementInit sJntSphElementsInit[] = { +static ColliderJntSphElementInit D_809E8ECC[7] = { { { ELEM_MATERIAL_UNK0, @@ -135,7 +133,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { }, }; -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit D_809E8FC8 = { { COL_MATERIAL_HIT6, AT_ON | AT_TYPE_ENEMY, @@ -144,873 +142,711 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, + 7, + D_809E8ECC, }; -static CollisionCheckInfoInit sColChkInfoInit = { 2, 25, 25, MASS_IMMOVABLE }; - -typedef enum DekuBabaDamageReaction { - /* 0x0 */ DEKUBABA_DMG_REACT_NONE, - /* 0x1 */ DEKUBABA_DMG_REACT_DEKUNUT, - /* 0x2 */ DEKUBABA_DMG_REACT_FIRE, - /* 0xE */ DEKUBABA_DMG_REACT_BOOMERANG = 14, - /* 0xF */ DEKUBABA_DMG_REACT_SWORD -} DekuBabaDamageReaction; - -static DamageTable sDekuBabaDamageTable = { - /* Deku nut */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_DEKUNUT), - /* Deku stick */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Slingshot */ DMG_ENTRY(1, DEKUBABA_DMG_REACT_NONE), - /* Explosive */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_BOOMERANG), - /* Normal arrow */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Hookshot */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Kokiri sword */ DMG_ENTRY(1, DEKUBABA_DMG_REACT_SWORD), - /* Master sword */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_SWORD), - /* Giant's Knife */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_SWORD), - /* Fire arrow */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_FIRE), - /* Ice arrow */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Light arrow */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Unk arrow 1 */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Unk arrow 2 */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Unk arrow 3 */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Fire magic */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Light magic */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Shield */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, DEKUBABA_DMG_REACT_SWORD), - /* Giant spin */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_SWORD), - /* Master spin */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_SWORD), - /* Kokiri jump */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_SWORD), - /* Giant jump */ DMG_ENTRY(8, DEKUBABA_DMG_REACT_SWORD), - /* Master jump */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_SWORD), - /* Unknown 1 */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), +static CollisionCheckInfoInit D_809E8FD8 = { 2, 0x19, 0x19, 0xFF }; +static DamageTable D_809E8FE0 = { + { + 0x10, 2, 1, 2, 0xE2, 2, 2, 2, 0xF1, 0xF2, 0xF4, 0x24, 2, 2, 2, 2, + 2, 0x24, 0, 0, 0, 0, 0xF1, 0xF4, 0xF2, 0xF2, 0xF8, 0xF4, 0, 0, 4, 0, + }, }; - -// The only difference is that for Big Deku Babas, Hookshot will act the same as Deku Nuts: i.e. it will stun, but -// cannot kill. -static DamageTable sBigDekuBabaDamageTable = { - /* Deku nut */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_DEKUNUT), - /* Deku stick */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Slingshot */ DMG_ENTRY(1, DEKUBABA_DMG_REACT_NONE), - /* Explosive */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_BOOMERANG), - /* Normal arrow */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Hookshot */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_DEKUNUT), - /* Kokiri sword */ DMG_ENTRY(1, DEKUBABA_DMG_REACT_SWORD), - /* Master sword */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_SWORD), - /* Giant's Knife */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_SWORD), - /* Fire arrow */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_FIRE), - /* Ice arrow */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Light arrow */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Unk arrow 1 */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Unk arrow 2 */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Unk arrow 3 */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_NONE), - /* Fire magic */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Light magic */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Shield */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, DEKUBABA_DMG_REACT_SWORD), - /* Giant spin */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_SWORD), - /* Master spin */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_SWORD), - /* Kokiri jump */ DMG_ENTRY(2, DEKUBABA_DMG_REACT_SWORD), - /* Giant jump */ DMG_ENTRY(8, DEKUBABA_DMG_REACT_SWORD), - /* Master jump */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_SWORD), - /* Unknown 1 */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, DEKUBABA_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, DEKUBABA_DMG_REACT_NONE), +static DamageTable D_809E9000 = { + { + 0x10, 2, 1, 2, 0xE2, 2, 2, 0x10, 0xF1, 0xF2, 0xF4, 0x24, 2, 2, 2, 2, + 2, 0x24, 0, 0, 0, 0, 0xF1, 0xF4, 0xF2, 0xF2, 0xF8, 0xF4, 0, 0, 4, 0, + }, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_809E9020[] = { ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP), }; +static Color_RGBA8 D_809E9024 = { 0x69, 0xFF, 0x69, 0xFF }; +static Color_RGBA8 D_809E9028 = { 0x96, 0xFA, 0x96, 0 }; +static Gfx* D_809E902C[] = { + object_dekubaba_DL_001330, + object_dekubaba_DL_001628, + object_dekubaba_DL_001828, +}; void EnDekubaba_Init(Actor* thisx, PlayState* play) { + s32 var_a0; EnDekubaba* this = (EnDekubaba*)thisx; - s32 i; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->actor, D_809E9020); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, - 8); - Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - - if (this->actor.params == DEKUBABA_BIG) { - this->size = 2.5f; - - for (i = 0; i < sJntSphInit.count; i++) { - this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius = - (sJntSphElementsInit[i].dim.modelSphere.radius * 2.50f); + SkelAnime_Init(play, &this->unk17C, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->unk1D0, + this->unk200, 8); + Collider_InitJntSph(play, &this->unk238); + Collider_SetJntSph(play, &this->unk238, &this->actor, &D_809E8FC8, this->unk258); + if (this->actor.params == 1) { + this->unk230 = 2.50f; + for (var_a0 = 0; var_a0 < D_809E8FC8.count; var_a0++) { + this->unk238.elements[var_a0].dim.worldSphere.radius = + this->unk238.elements[var_a0].dim.modelSphere.radius = D_809E8ECC[var_a0].dim.modelSphere.radius * 2.5f; } - - // This and its counterpart below mean that a Deku Stick jumpslash will not trigger the Deku Stick drop route. - // (Of course they reckoned without each age being able to use the other's items, so Stick and Master Sword - // jumpslash can give the Stick drop as adult, and neither will as child.) if (!LINK_IS_ADULT) { - sBigDekuBabaDamageTable.table[0x1B] = DMG_ENTRY(4, DEKUBABA_DMG_REACT_NONE); // DMG_JUMP_MASTER + D_809E9000.table[0x1B] = 4; } - - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sBigDekuBabaDamageTable, &sColChkInfoInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E9000, &D_809E8FD8); this->actor.colChkInfo.health = 4; this->actor.naviEnemyId = NAVI_ENEMY_BIG_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_2; } else { - this->size = 1.0f; - - for (i = 0; i < sJntSphInit.count; i++) { - this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; + this->unk230 = 1.0f; + for (var_a0 = 0; var_a0 < D_809E8FC8.count; var_a0++) { + this->unk238.elements[var_a0].dim.worldSphere.radius = this->unk238.elements[var_a0].dim.modelSphere.radius; } - if (!LINK_IS_ADULT) { - sDekuBabaDamageTable.table[0x1B] = DMG_ENTRY(4, DEKUBABA_DMG_REACT_NONE); // DMG_JUMP_MASTER + D_809E8FE0.table[0x1B] = 4; } - - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDekuBabaDamageTable, &sColChkInfoInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E8FE0, &D_809E8FD8); this->actor.naviEnemyId = NAVI_ENEMY_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_1; } - - EnDekubaba_SetupWait(this); - this->timer = 0; - this->boundFloor = NULL; - this->bodyPartsPos[3] = this->actor.home.pos; + func_809E5ABC(this); + this->unk1C6 = 0; + this->unk170 = this->actor.home.pos; + this->unk234 = NULL; } void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; - Collider_DestroyJntSph(play, &this->collider); + Collider_DestroyJntSph(play, &this->unk238); } -void EnDekubaba_DisableACColliderElems(EnDekubaba* this) { +void func_809E5A38(EnDekubaba* this) { s32 i; - for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].base.acElemFlags &= ~ACELEM_ON; + for (i = 1; i < 7; i++) { + this->unk238.elements[i].base.acElemFlags &= ~ACELEM_ON; } } -void EnDekubaba_SetupWait(EnDekubaba* this) { +void func_809E5ABC(EnDekubaba* this) { + ColliderJntSphElement* temp_v0_2; + s16 temp_v0; s32 i; - ColliderJntSphElement* element; - - this->actor.shape.rot.x = -0x4000; - this->stemSectionAngle[0] = this->stemSectionAngle[1] = this->stemSectionAngle[2] = this->actor.shape.rot.x; + this->unk1CA_arr[0] = this->unk1CA_arr[1] = this->unk1CA_arr[2] = this->actor.shape.rot.x = -0x4000; this->actor.world.pos.x = this->actor.home.pos.x; this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.y = this->actor.home.pos.y + 14.0f * this->size; - - Actor_SetScale(&this->actor, this->size * 0.01f * 0.5f); - - this->collider.base.colMaterial = COL_MATERIAL_HARD; - this->collider.base.acFlags |= AC_HARD; - this->timer = 45; - - for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { - element = &this->collider.elements[i]; - element->dim.worldSphere.center.x = this->actor.world.pos.x; - element->dim.worldSphere.center.y = (s16)this->actor.world.pos.y - 7; - element->dim.worldSphere.center.z = this->actor.world.pos.z; + this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->unk230); + Actor_SetScale(&this->actor, this->unk230 * 0.01f * 0.5f); + this->unk238.base.colMaterial = COL_MATERIAL_HARD; + this->unk238.base.acFlags |= AC_HARD; + this->unk1C6 = 0x2D; + for (i = 1; i < 7; i++) { + temp_v0_2 = &this->unk238.elements[i]; + temp_v0_2->dim.worldSphere.center.x = this->actor.world.pos.x; + temp_v0_2->dim.worldSphere.center.y = (s16)this->actor.world.pos.y - 7; + temp_v0_2->dim.worldSphere.center.z = this->actor.world.pos.z; } - - this->actionFunc = EnDekubaba_Wait; + this->unk1C0 = func_809E64F4; } -void EnDekubaba_SetupGrow(EnDekubaba* this) { +void func_809E5D28(EnDekubaba* this) { s32 i; - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, - Animation_GetLastFrame(&gDekuBabaFastChompAnim) * (1.0f / 15), 0.0f, - Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_ONCE, 0.0f); - - this->timer = 15; - - for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].base.ocElemFlags |= OCELEM_ON; + Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8) * 0.06666667f, 0.0f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_ONCE, 0.0f); + this->unk1C6 = 0xF; + for (i = 2; i < 7; i++) { + this->unk238.elements[i].base.ocElemFlags |= 1; } - - this->collider.base.colMaterial = COL_MATERIAL_HIT6; - this->collider.base.acFlags &= ~AC_HARD; + this->unk238.base.colMaterial = COL_MATERIAL_HIT6; + this->unk238.base.acFlags &= ~AC_HARD; Actor_PlaySfx(&this->actor, NA_SE_EN_DUMMY482); - this->actionFunc = EnDekubaba_Grow; + this->unk1C0 = func_809E65A0; } -void EnDekubaba_SetupRetract(EnDekubaba* this) { +void func_809E5E58(EnDekubaba* this) { s32 i; - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, -1.5f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), - 0.0f, ANIMMODE_ONCE, -3.0f); - - this->timer = 15; - - for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].base.ocElemFlags &= ~OCELEM_ON; + Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, -1.5f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); + this->unk1C6 = 0xF; + for (i = 2; i < 7; i++) { + this->unk238.elements[i].base.ocElemFlags &= ~1; } - - this->actionFunc = EnDekubaba_Retract; + this->unk1C0 = func_809E6A04; } -void EnDekubaba_SetupDecideLunge(EnDekubaba* this) { - this->timer = Animation_GetLastFrame(&gDekuBabaFastChompAnim) * 2; - Animation_MorphToLoop(&this->skelAnime, &gDekuBabaFastChompAnim, -3.0f); - this->actionFunc = EnDekubaba_DecideLunge; +void func_809E5F44(EnDekubaba* this) { + this->unk1C6 = Animation_GetLastFrame(&object_dekubaba_Anim_0002B8) * 2; + Animation_MorphToLoop(&this->unk17C, &object_dekubaba_Anim_0002B8, -3.0f); + this->unk1C0 = func_809E6ED4; } -void EnDekubaba_SetupPrepareLunge(EnDekubaba* this) { - this->timer = 8; - this->skelAnime.playSpeed = 0.0f; - this->actionFunc = EnDekubaba_PrepareLunge; +void func_809E5F9C(EnDekubaba* this) { + this->unk1C6 = 8; + this->unk1C0 = func_809E738C; + this->unk17C.playSpeed = 0.0f; } -void EnDekubaba_SetupLunge(EnDekubaba* this) { - Animation_PlayOnce(&this->skelAnime, &gDekuBabaPauseChompAnim); - this->timer = 0; - this->actionFunc = EnDekubaba_Lunge; +void func_809E5FBC(EnDekubaba* this) { + Animation_PlayOnce(&this->unk17C, &object_dekubaba_Anim_000208); + this->unk1C6 = 0; + this->unk1C0 = func_809E7104; } -void EnDekubaba_SetupPullBack(EnDekubaba* this) { - Animation_Change(&this->skelAnime, &gDekuBabaPauseChompAnim, 1.0f, 15.0f, - Animation_GetLastFrame(&gDekuBabaPauseChompAnim), ANIMMODE_ONCE, -3.0f); - this->timer = 0; - this->actionFunc = EnDekubaba_PullBack; +void func_809E6000(EnDekubaba* this) { + Animation_Change(&this->unk17C, &object_dekubaba_Anim_000208, 1.0f, 15.0f, + Animation_GetLastFrame(&object_dekubaba_Anim_000208), ANIMMODE_ONCE, -3.0f); + this->unk1C6 = 0; + this->unk1C0 = func_809E7458; } -void EnDekubaba_SetupRecover(EnDekubaba* this) { - this->timer = 9; - this->collider.base.acFlags |= AC_ON; - this->skelAnime.playSpeed = -1.0f; - this->actionFunc = EnDekubaba_Recover; +void func_809E6078(EnDekubaba* this) { + this->unk1C6 = 9; + this->unk238.base.acFlags |= AC_ON; + this->unk1C0 = func_809E77E4; + this->unk17C.playSpeed = -1.0f; } -void EnDekubaba_SetupHit(EnDekubaba* this, s32 arg1) { - Animation_MorphToPlayOnce(&this->skelAnime, &gDekuBabaPauseChompAnim, -5.0f); - this->timer = arg1; - this->collider.base.acFlags &= ~AC_ON; - Actor_SetScale(&this->actor, this->size * 0.01f); - +void func_809E60A8(EnDekubaba* this, s32 arg1) { + Animation_MorphToPlayOnce(&this->unk17C, &object_dekubaba_Anim_000208, -5.0f); + this->unk1C6 = arg1; + this->unk238.base.acFlags &= ~AC_ON; + Actor_SetScale(&this->actor, this->unk230 * 0.01f); if (arg1 == 2) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 155, COLORFILTER_BUFFLAG_OPA, 62); } else { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 42); } - - this->actionFunc = EnDekubaba_Hit; + this->unk1C0 = func_809E78DC; } -void EnDekubaba_SetupPrunedSomersault(EnDekubaba* this) { - this->timer = 0; - this->skelAnime.playSpeed = 0.0f; +void func_809E6170(EnDekubaba* this) { + this->unk1C6 = 0; + this->unk17C.playSpeed = 0.0f; this->actor.gravity = -0.8f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; - this->collider.base.acFlags &= ~AC_ON; - this->actor.speed = this->size * 3.0f; + this->actor.speed = this->unk230 * 3.0f; + this->unk238.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED; - this->actionFunc = EnDekubaba_PrunedSomersault; + this->unk1C0 = func_809E7BB0; } -void EnDekubaba_SetupShrinkDie(EnDekubaba* this) { - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, -1.5f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), - 0.0f, ANIMMODE_ONCE, -3.0f); - this->collider.base.acFlags &= ~AC_ON; - this->actionFunc = EnDekubaba_ShrinkDie; +void func_809E61E0(EnDekubaba* this) { + Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, -1.5f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); + this->unk238.base.acFlags &= ~AC_ON; + this->unk1C0 = func_809E7F14; } -void EnDekubaba_SetupStunnedVertical(EnDekubaba* this) { +void func_809E6264(EnDekubaba* this) { s32 i; - for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { - this->collider.elements[i].base.acElemFlags |= ACELEM_ON; + for (i = 1; i < 7; i++) { + this->unk238.elements[i].base.acElemFlags |= ACELEM_ON; } - - if (this->timer == 1) { - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f, 0.0f, - Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); - this->timer = 40; + if (this->unk1C6 == 1) { + Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); + this->unk1C6 = 0x28; } else { - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 0.0f, 0.0f, - Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); - this->timer = 60; + Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); + this->unk1C6 = 0x3C; } - this->actor.world.pos.x = this->actor.home.pos.x; - this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * this->size); + this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * this->unk230); this->actor.world.pos.z = this->actor.home.pos.z; - this->actionFunc = EnDekubaba_StunnedVertical; + this->unk1C0 = func_809E79EC; } -void EnDekubaba_SetupSway(EnDekubaba* this) { - this->targetSwayAngle = -0x6000; - this->stemSectionAngle[2] = -0x5000; - this->stemSectionAngle[1] = -0x4800; - - EnDekubaba_DisableACColliderElems(this); +void func_809E63EC(EnDekubaba* this) { + this->unk1C8 = -0x6000; + this->unk1CA_arr[2] = -0x5000; + this->unk1CA_arr[1] = -0x4800; + func_809E5A38(this); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 35); - this->collider.base.acFlags &= ~AC_ON; - this->actionFunc = EnDekubaba_Sway; + this->unk238.base.acFlags &= ~AC_ON; + this->unk1C0 = func_809E7A88; } -void EnDekubaba_SetupDeadStickDrop(EnDekubaba* this, PlayState* play) { +void func_809E645C(EnDekubaba* this, PlayState* arg1) { Actor_SetScale(&this->actor, 0.03f); this->actor.shape.rot.x -= 0x4000; this->actor.shape.yOffset = 1000.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.shape.shadowScale = 3.0f; - Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(arg1, &arg1->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.flags &= ~ACTOR_FLAG_DRAW_CULLING_DISABLED; - this->timer = 200; - this->actionFunc = EnDekubaba_DeadStickDrop; + this->unk1C6 = 0xC8; + this->unk1C0 = func_809E80D8; } -// Action functions - -void EnDekubaba_Wait(EnDekubaba* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; +void func_809E64F4(EnDekubaba* this, PlayState* arg1) { + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - this->actor.world.pos.x = this->actor.home.pos.x; this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.y = this->actor.home.pos.y + 14.0f * this->size; - - if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f * this->size) && - (fabsf(this->actor.yDistToPlayer) < 30.0f * this->size)) { - EnDekubaba_SetupGrow(this); + this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->unk230); + if ((this->unk1C6 == 0) && (this->actor.xzDistToPlayer < (200.0f * this->unk230)) && + (fabsf(this->actor.yDistToPlayer) < (30.0f * this->unk230))) { + func_809E5D28(this); } } -void EnDekubaba_Grow(EnDekubaba* this, PlayState* play) { - Player* player = GET_PLAYER(play); - f32 headDistHorizontal; - f32 headDistVertical; - f32 headShiftX; - f32 headShiftZ; +void func_809E65A0(EnDekubaba* this, PlayState* play) { + Actor* sp64; + f32 var_fa0; + f32 sp5C; + f32 sp58; + f32 temp_ft5; - if (this->timer != 0) { - this->timer--; - } + sp64 = play->actorCtx.actorLists[2].head; - SkelAnime_Update(&this->skelAnime); + if (this->unk1C6 != 0) { + this->unk1C6--; + } + SkelAnime_Update(&this->unk17C); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = - this->size * 0.01f * (0.5f + (15 - this->timer) * 0.5f / 15.0f); + this->unk230 * 0.01f * (0.5f + (((0xF - this->unk1C6) * 0.5f) / 15.0f)); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800); - headDistVertical = sinf(CLAMP_MAX((15 - this->timer) * (1.0f / 15), 0.7f) * M_PI) * 32.0f + 14.0f; + sp5C = (sinf(CLAMP_MAX(((0xF - this->unk1C6)) * 0.06666667014f, 0.7f) * 3.1415927f) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { - headDistHorizontal = 0.0f; + var_fa0 = 0.0f; } else if (this->actor.shape.rot.x < -0x238E) { - Math_ScaledStepToS(&this->stemSectionAngle[0], -0x5555, 0x38E); - headDistHorizontal = Math_CosS(this->stemSectionAngle[0]) * 20.0f; + Math_ScaledStepToS(&this->unk1CA_arr[0], -0x5555, 0x38E); + var_fa0 = 20.0f * Math_CosS(this->unk1CA_arr[0]); } else if (this->actor.shape.rot.x < -0xE38) { - Math_ScaledStepToS(&this->stemSectionAngle[0], -0xAAA, 0x38E); - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x5555, 0x38E); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5555, 0x222); - - headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + - (headDistVertical - - 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * - Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + Math_ScaledStepToS(&this->unk1CA_arr[0], -0xAAA, 0x38E); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x5555, 0x38E); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5555, 0x222); + var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + + (((sp5C - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * + Math_CosS(this->unk1CA_arr[2])) / + -Math_SinS(this->unk1CA_arr[2])); } else { - Math_ScaledStepToS(&this->stemSectionAngle[0], -0xAAA, 0x38E); - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x31C7, 0x222); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5555, 0x222); - - headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + - (headDistVertical - - 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * - Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + Math_ScaledStepToS(&this->unk1CA_arr[0], -0xAAA, 0x38E); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x31C7, 0x222); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5555, 0x222); + var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + + (((sp5C - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * + Math_CosS(this->unk1CA_arr[2])) / + -Math_SinS(this->unk1CA_arr[2])); } - if (this->timer < 10) { - Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, - 0xE38); - if (headShiftZ) {} // One way of fake-matching + if (this->unk1C6 < 0xA) { + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &sp64->world.pos), 2, 0xE38); } - this->actor.world.pos.y = this->actor.home.pos.y + (headDistVertical * this->size); - headShiftX = headDistHorizontal * this->size * Math_SinS(this->actor.shape.rot.y); - headShiftZ = headDistHorizontal * this->size * Math_CosS(this->actor.shape.rot.y); - this->actor.world.pos.x = this->actor.home.pos.x + headShiftX; - this->actor.world.pos.z = this->actor.home.pos.z + headShiftZ; - - EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, - 1, HAHEN_OBJECT_DEFAULT, 10, NULL); - - if (this->timer == 0) { - if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 240.0f * this->size) { - EnDekubaba_SetupPrepareLunge(this); + this->actor.world.pos.y = this->actor.home.pos.y + (sp5C * this->unk230); + sp58 = Math_SinS(this->actor.shape.rot.y) * (var_fa0 * this->unk230); + temp_ft5 = var_fa0; + temp_ft5 = Math_CosS(this->actor.shape.rot.y) * (temp_ft5 * this->unk230); + this->actor.world.pos.x = this->actor.home.pos.x + sp58; + this->actor.world.pos.z = this->actor.home.pos.z + temp_ft5; + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, + this->unk230 * 5.0f, 1, -1, 10, NULL); + if (this->unk1C6 == 0) { + if (Math_Vec3f_DistXZ(&this->actor.home.pos, &sp64->world.pos) < (240.0f * this->unk230)) { + func_809E5F9C(this); } else { - EnDekubaba_SetupRetract(this); + func_809E5E58(this); } } } -void EnDekubaba_Retract(EnDekubaba* this, PlayState* play) { - f32 headDistHorizontal; - f32 headDistVertical; - f32 xShift; - f32 zShift; +void func_809E6A04(EnDekubaba* this, PlayState* play) { + f32 var_fa0; + f32 sp58; + f32 sp54; + f32 temp_ft5; - if (this->timer != 0) { - this->timer--; + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - - SkelAnime_Update(&this->skelAnime); - + SkelAnime_Update(&this->unk17C); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = - this->size * 0.01f * (0.5f + this->timer * (1.0f / 30)); + this->unk230 * 0.01f * (0.5f + (this->unk1C6 * 0.033333335f)); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); - - headDistVertical = (sinf(CLAMP_MAX(this->timer * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; - + sp58 = (sinf(CLAMP_MAX(this->unk1C6 * 0.033f, 0.7f) * 3.1415927f) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { - headDistHorizontal = 0.0f; + var_fa0 = 0.0f; } else if (this->actor.shape.rot.x < -0x238E) { - Math_ScaledStepToS(&this->stemSectionAngle[0], -0x4000, 0x555); - headDistHorizontal = Math_CosS(this->stemSectionAngle[0]) * 20.0f; + Math_ScaledStepToS(&this->unk1CA_arr[0], -0x4000, 0x555); + var_fa0 = Math_CosS(this->unk1CA_arr[0]) * 20.0f; } else if (this->actor.shape.rot.x < -0xE38) { - Math_ScaledStepToS(&this->stemSectionAngle[0], -0x5555, 0x555); - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x4000, 0x555); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x4000, 0x333); - - headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + - (headDistVertical - - 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * - Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + Math_ScaledStepToS(&this->unk1CA_arr[0], -0x5555, 0x555); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x4000, 0x555); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x4000, 0x333); + var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + + (((sp58 - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * + Math_CosS(this->unk1CA_arr[2])) / + -Math_SinS(this->unk1CA_arr[2])); } else { - Math_ScaledStepToS(&this->stemSectionAngle[0], -0x5555, 0x555); - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x5555, 0x333); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x4000, 0x333); - - headDistHorizontal = 20.0f * (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1])) + - (headDistVertical - - 20.0f * (-Math_SinS(this->stemSectionAngle[0]) - Math_SinS(this->stemSectionAngle[1]))) * - Math_CosS(this->stemSectionAngle[2]) / -Math_SinS(this->stemSectionAngle[2]); + Math_ScaledStepToS(&this->unk1CA_arr[0], -0x5555, 0x555); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x5555, 0x333); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x4000, 0x333); + var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + + (((sp58 - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * + Math_CosS(this->unk1CA_arr[2])) / + -Math_SinS(this->unk1CA_arr[2])); } - - this->actor.world.pos.y = this->actor.home.pos.y + (headDistVertical * this->size); - xShift = headDistHorizontal * this->size * Math_SinS(this->actor.shape.rot.y); - zShift = headDistHorizontal * this->size * Math_CosS(this->actor.shape.rot.y); - this->actor.world.pos.x = this->actor.home.pos.x + xShift; - this->actor.world.pos.z = this->actor.home.pos.z + zShift; - - EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, - 1, HAHEN_OBJECT_DEFAULT, 0xA, NULL); - - if (this->timer == 0) { - EnDekubaba_SetupWait(this); + this->actor.world.pos.y = this->actor.home.pos.y + (sp58 * this->unk230); + sp54 = Math_SinS(this->actor.shape.rot.y) * (var_fa0 * this->unk230); + temp_ft5 = Math_CosS(this->actor.shape.rot.y) * (var_fa0 * this->unk230); + this->actor.world.pos.x = this->actor.home.pos.x + sp54; + this->actor.world.pos.z = this->actor.home.pos.z + temp_ft5; + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, + this->unk230 * 5.0f, 1, -1, 10, NULL); + if (this->unk1C6 == 0) { + func_809E5ABC(this); } } -void EnDekubaba_UpdateHeadPosition(EnDekubaba* this) { - f32 horizontalHeadShift = (Math_CosS(this->stemSectionAngle[0]) + Math_CosS(this->stemSectionAngle[1]) + - Math_CosS(this->stemSectionAngle[2])) * - 20.0f; - - this->actor.world.pos.x = - this->actor.home.pos.x + Math_SinS(this->actor.shape.rot.y) * (horizontalHeadShift * this->size); +void func_809E6DCC(EnDekubaba* this) { + f32 sp2C; + f32 sp28; + f32 sp24; + + sp24 = Math_CosS(this->unk1CA_arr[1]); + sp28 = Math_CosS(this->unk1CA_arr[0]); + sp2C = (Math_CosS(this->unk1CA_arr[2]) + (sp28 + sp24)) * 20.0f; + this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y) * (sp2C * this->unk230)) + this->actor.home.pos.x; + sp24 = Math_SinS(this->unk1CA_arr[1]); + sp28 = Math_SinS(this->unk1CA_arr[0]); this->actor.world.pos.y = - this->actor.home.pos.y - (Math_SinS(this->stemSectionAngle[0]) + Math_SinS(this->stemSectionAngle[1]) + - Math_SinS(this->stemSectionAngle[2])) * - 20.0f * this->size; - this->actor.world.pos.z = - this->actor.home.pos.z + Math_CosS(this->actor.shape.rot.y) * (horizontalHeadShift * this->size); + this->actor.home.pos.y - ((Math_SinS(this->unk1CA_arr[2]) + (sp28 + sp24)) * 20.0f * this->unk230); + this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y) * (sp2C * this->unk230)) + this->actor.home.pos.z; } -void EnDekubaba_DecideLunge(EnDekubaba* this, PlayState* play) { - Player* player = GET_PLAYER(play); +void func_809E6ED4(EnDekubaba* this, PlayState* play) { + Actor* sp34; - SkelAnime_Update(&this->skelAnime); - if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - if (this->actor.params == DEKUBABA_BIG) { + sp34 = play->actorCtx.actorLists[2].head; + SkelAnime_Update(&this->unk17C); + if (Animation_OnFrame(&this->unk17C, 0.0f) || Animation_OnFrame(&this->unk17C, 12.0f)) { + if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_MOUTH); } } - - if (this->timer != 0) { - this->timer--; + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - - Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, - (this->timer % 5) * 0x222); - - if (this->timer < 10) { - this->stemSectionAngle[0] += 0x16C; - this->stemSectionAngle[1] += 0x16C; - this->stemSectionAngle[2] += 0xB6; + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &sp34->world.pos), 2, + (this->unk1C6 % 5) * 0x222); + if (this->unk1C6 < 0xA) { + this->unk1CA_arr[0] += 0x16C; + this->unk1CA_arr[1] += 0x16C; + this->unk1CA_arr[2] += 0xB6; this->actor.shape.rot.x += 0x222; - } else if (this->timer < 20) { - this->stemSectionAngle[0] -= 0x16C; - this->stemSectionAngle[1] += 0x111; - this->actor.shape.rot.x += 0x16C; - } else if (this->timer < 30) { - this->stemSectionAngle[1] -= 0x111; - this->actor.shape.rot.x -= 0xB6; } else { - this->stemSectionAngle[1] -= 0xB6; - this->stemSectionAngle[2] += 0xB6; - this->actor.shape.rot.x -= 0x16C; + if (this->unk1C6 < 0x14) { + this->unk1CA_arr[0] -= 0x16C; + this->unk1CA_arr[1] += 0x111; + this->actor.shape.rot.x += 0x16C; + } else if (this->unk1C6 < 0x1E) { + this->unk1CA_arr[1] -= 0x111; + this->actor.shape.rot.x -= 0xB6; + } else { + this->unk1CA_arr[1] -= 0xB6; + this->unk1CA_arr[2] += 0xB6; + this->actor.shape.rot.x -= 0x16C; + } } - - EnDekubaba_UpdateHeadPosition(this); - - if (240.0f * this->size < Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos)) { - EnDekubaba_SetupRetract(this); - } else if ((this->timer == 0) || (this->actor.xzDistToPlayer < 80.0f * this->size)) { - EnDekubaba_SetupPrepareLunge(this); + func_809E6DCC(this); + if ((240.0f * this->unk230) < Math_Vec3f_DistXZ(&this->actor.home.pos, &sp34->world.pos)) { + func_809E5E58(this); + } else if ((this->unk1C6 == 0) || (this->actor.xzDistToPlayer < (80.0f * this->unk230))) { + func_809E5F9C(this); } } -void EnDekubaba_Lunge(EnDekubaba* this, PlayState* play) { - static Color_RGBA8 primColor = { 105, 255, 105, 255 }; - static Color_RGBA8 envColor = { 150, 250, 150, 0 }; - s32 allStepsDone; - s16 curFrame10; - Vec3f velocity; - - SkelAnime_Update(&this->skelAnime); +void func_809E7104(EnDekubaba* this, PlayState* play) { + s32 sp4C; + s16 sp4A; + Vec3f sp3C; - if (this->timer == 0) { - if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - if (this->actor.params == DEKUBABA_BIG) { + SkelAnime_Update(&this->unk17C); + if (this->unk1C6 == 0) { + if (Animation_OnFrame(&this->unk17C, 1.0f)) { + if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_ATTACK); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_ATTACK); } } - Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x222); - - curFrame10 = this->skelAnime.curFrame * 10.0f; - - allStepsDone = true; - allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[0], -0xE38, curFrame10 + 0x38E); - allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[1], -0xE38, curFrame10 + 0x71C); - allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[2], -0xE38, curFrame10 + 0xE38); - - if (allStepsDone) { - Animation_PlayLoopSetSpeed(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f); - velocity.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; - velocity.y = 0.0f; - velocity.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; - - func_8002829C(play, &this->actor.world.pos, &velocity, &sZeroVec, &primColor, &envColor, 1, - this->size * 100.0f); - this->timer = 1; - this->collider.base.acFlags |= AC_ON; + sp4A = this->unk17C.curFrame * 10.0f; + sp4C = true; + sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[0], -0xE38, sp4A + 0x38E); + sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[1], -0xE38, sp4A + 0x71C); + sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[2], -0xE38, sp4A + 0xE38); + if (sp4C) { + Animation_PlayLoopSetSpeed(&this->unk17C, &object_dekubaba_Anim_0002B8, 4.0f); + sp3C.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; + sp3C.y = 0.0f; + sp3C.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; + func_8002829C(play, &this->actor.world.pos, &sp3C, &D_809E8EA0, &D_809E9024, &D_809E9028, 1, + this->unk230 * 100.0f); + this->unk1C6 = 1; + this->unk238.base.acFlags |= AC_ON; } - } else if (this->timer > 10) { - EnDekubaba_SetupPullBack(this); + } else if (this->unk1C6 >= 0xB) { + func_809E6000(this); } else { - this->timer++; - - if ((this->timer >= 4) && !Actor_IsFacingPlayer(&this->actor, 0x16C)) { - Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xF, 0x71C); + this->unk1C6 += 1; + if ((this->unk1C6 >= 4) && !Actor_IsFacingPlayer(&this->actor, 0x16C)) { + Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 15, 0x71C); } - - if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - if (this->actor.params == DEKUBABA_BIG) { + if (Animation_OnFrame(&this->unk17C, 0.0f) || Animation_OnFrame(&this->unk17C, 12.0f)) { + if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_MOUTH); } } } - - EnDekubaba_UpdateHeadPosition(this); + func_809E6DCC(this); } -void EnDekubaba_PrepareLunge(EnDekubaba* this, PlayState* play) { - Player* player = GET_PLAYER(play); +void func_809E738C(EnDekubaba* this, PlayState* play) { + Player* player; - if (this->timer != 0) { - this->timer--; + player = GET_PLAYER(play); + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 2, 0xE38, 0x71C); Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, 0xE38); - Math_ScaledStepToS(&this->stemSectionAngle[0], 0xAAA, 0x444); - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x4718, 0x888); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x6AA4, 0x888); - - if (this->timer == 0) { - EnDekubaba_SetupLunge(this); + Math_ScaledStepToS(&this->unk1CA_arr[0], 0xAAA, 0x444); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x4718, 0x888); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x6AA4, 0x888); + if (this->unk1C6 == 0) { + func_809E5FBC(this); } - - EnDekubaba_UpdateHeadPosition(this); + func_809E6DCC(this); } -void EnDekubaba_PullBack(EnDekubaba* this, PlayState* play) { - Vec3f dustPos; - f32 xIncr; - f32 zIncr; - s32 i; - - SkelAnime_Update(&this->skelAnime); +void func_809E7458(EnDekubaba* this, PlayState* play) { + Vec3f sp3C; + f32 sp38; + f32 var_fv1; + s32 var_v0; - if (this->timer == 0) { + SkelAnime_Update(&this->unk17C); + if (this->unk1C6 == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x38E); - Math_ScaledStepToS(&this->stemSectionAngle[0], -0x888, 0x16C); - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x888, 0x16C); - if (Math_ScaledStepToS(&this->stemSectionAngle[2], -0x888, 0x16C)) { - xIncr = Math_SinS(this->actor.shape.rot.y) * 30.0f * this->size; - zIncr = Math_CosS(this->actor.shape.rot.y) * 30.0f * this->size; - dustPos = this->actor.home.pos; - - for (i = 0; i < 3; i++) { - func_800286CC(play, &dustPos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 50.0f); - dustPos.x += xIncr; - dustPos.z += zIncr; + Math_ScaledStepToS(&this->unk1CA_arr[0], -0x888, 0x16C); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x888, 0x16C); + if (Math_ScaledStepToS(&this->unk1CA_arr[2], -0x888, 0x16C) != 0) { + sp38 = Math_SinS(this->actor.shape.rot.y) * 30.0f * this->unk230; + var_fv1 = Math_CosS(this->actor.shape.rot.y) * 30.0f * this->unk230; + sp3C = this->actor.home.pos; + for (var_v0 = 0; var_v0 < 3; var_v0++) { + func_800286CC(play, &sp3C, &D_809E8EA0, &D_809E8EA0, this->unk230 * 500.0f, this->unk230 * 50.0f); + sp3C.x += sp38; + sp3C.z += var_fv1; } - - this->timer = 1; + this->unk1C6 = 1; } - } else if (this->timer == 11) { + } else if (this->unk1C6 == 0xB) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x200); - Math_ScaledStepToS(&this->stemSectionAngle[0], -0xAAA, 0x200); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x200); - - if (Math_ScaledStepToS(&this->stemSectionAngle[1], 0x238C, 0x200)) { - this->timer = 12; + Math_ScaledStepToS(&this->unk1CA_arr[0], -0xAAA, 0x200); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x200); + if (Math_ScaledStepToS(&this->unk1CA_arr[1], 0x238C, 0x200)) { + this->unk1C6 = 0xC; } - } else if (this->timer == 18) { + } else if (this->unk1C6 == 0x12) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x2AA8, 0xAAA); - - if (Math_ScaledStepToS(&this->stemSectionAngle[0], 0x1554, 0x5B0)) { - this->timer = 25; + if (Math_ScaledStepToS(&this->unk1CA_arr[0], 0x1554, 0x5B0)) { + this->unk1C6 = 0x19; } - - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x38E3, 0xAAA); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x2D8); - } else if (this->timer == 25) { + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x38E3, 0xAAA); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x2D8); + } else if (this->unk1C6 == 0x19) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x5550, 0xAAA); - - if (Math_ScaledStepToS(&this->stemSectionAngle[0], -0x6388, 0x93E)) { - this->timer = 26; + if (Math_ScaledStepToS(&this->unk1CA_arr[0], -0x6388, 0x93E)) { + this->unk1C6 = 0x1A; } - - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x3FFC, 0x4FA); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x238C, 0x444); - } else if (this->timer == 26) { + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x3FFC, 0x4FA); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x238C, 0x444); + } else if (this->unk1C6 == 0x1A) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x93E); - - if (Math_ScaledStepToS(&this->stemSectionAngle[0], -0x1555, 0x71C)) { - this->timer = 27; + if (Math_ScaledStepToS(&this->unk1CA_arr[0], -0x1555, 0x71C)) { + this->unk1C6 = 0x1B; } - - Math_ScaledStepToS(&this->stemSectionAngle[1], -0x38E3, 0x2D8); - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x5B0); - } else if (this->timer >= 27) { - this->timer++; - - if (this->timer > 30) { - if (this->actor.xzDistToPlayer < 80.0f * this->size) { - EnDekubaba_SetupPrepareLunge(this); + Math_ScaledStepToS(&this->unk1CA_arr[1], -0x38E3, 0x2D8); + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x5B0); + } else if (this->unk1C6 >= 0x1B) { + this->unk1C6 += 1; + if (this->unk1C6 >= 0x1F) { + if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { + func_809E5F9C(this); } else { - EnDekubaba_SetupDecideLunge(this); + func_809E5F44(this); } } } else { - this->timer++; - - if (this->timer == 10) { + this->unk1C6 += 1; + if (this->unk1C6 == 0xA) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_SCRAPE); } - - if (this->timer >= 12) { - Math_ScaledStepToS(&this->stemSectionAngle[2], -0x5C71, 0x88); + if (this->unk1C6 >= 0xC) { + Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x88); } } - - EnDekubaba_UpdateHeadPosition(this); + func_809E6DCC(this); } -void EnDekubaba_Recover(EnDekubaba* this, PlayState* play) { - s32 anyStepsDone; - - SkelAnime_Update(&this->skelAnime); - - if (this->timer > 8) { - anyStepsDone = Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 1, 0x11C6, 0x71C); - anyStepsDone |= Math_SmoothStepToS(&this->stemSectionAngle[0], -0x1555, 1, 0xAAA, 0x71C); - anyStepsDone |= Math_SmoothStepToS(&this->stemSectionAngle[1], -0x38E3, 1, 0xE38, 0x71C); - anyStepsDone |= Math_SmoothStepToS(&this->stemSectionAngle[2], -0x5C71, 1, 0x11C6, 0x71C); - - if (!anyStepsDone) { - this->timer = 8; +void func_809E77E4(EnDekubaba* this, PlayState* play) { + s32 temp_s0; + + SkelAnime_Update(&this->unk17C); + if (this->unk1C6 >= 9) { + temp_s0 = 0; + temp_s0 |= Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 1, 0x11C6, 0x71C); + temp_s0 |= Math_SmoothStepToS(&this->unk1CA_arr[0], -0x1555, 1, 0xAAA, 0x71C); + temp_s0 |= Math_SmoothStepToS(&this->unk1CA_arr[1], -0x38E3, 1, 0xE38, 0x71C); + temp_s0 |= Math_SmoothStepToS(&this->unk1CA_arr[2], -0x5C71, 1, 0x11C6, 0x71C); + if (temp_s0 == 0) { + this->unk1C6 = 8; } } else { - if (this->timer != 0) { - this->timer--; + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - - if (this->timer == 0) { - EnDekubaba_SetupDecideLunge(this); + if (this->unk1C6 == 0) { + func_809E5F44(this); } } - - EnDekubaba_UpdateHeadPosition(this); + func_809E6DCC(this); } -/** - * Hit by a weapon or hit something when lunging. - */ -void EnDekubaba_Hit(EnDekubaba* this, PlayState* play) { - s32 allStepsDone; - - SkelAnime_Update(&this->skelAnime); - - allStepsDone = true; - allStepsDone &= Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0xE38); - allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[0], -0x4000, 0xE38); - allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[1], -0x4000, 0xE38); - allStepsDone &= Math_ScaledStepToS(&this->stemSectionAngle[2], -0x4000, 0xE38); +void func_809E78DC(EnDekubaba* this, PlayState* play) { + s32 temp_s0; - if (allStepsDone) { + SkelAnime_Update(&this->unk17C); + temp_s0 = true; + temp_s0 &= Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0xE38); + temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[0], -0x4000, 0xE38); + temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[1], -0x4000, 0xE38); + temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[2], -0x4000, 0xE38); + if (temp_s0) { if (this->actor.colChkInfo.health == 0) { - EnDekubaba_SetupShrinkDie(this); + func_809E61E0(this); } else { - this->collider.base.acFlags |= AC_ON; - if (this->timer == 0) { - if (this->actor.xzDistToPlayer < 80.0f * this->size) { - EnDekubaba_SetupPrepareLunge(this); + this->unk238.base.acFlags |= AC_ON; + if (this->unk1C6 == 0) { + if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { + func_809E5F9C(this); } else { - EnDekubaba_SetupRecover(this); + func_809E6078(this); } } else { - EnDekubaba_SetupStunnedVertical(this); + func_809E6264(this); } } } - - EnDekubaba_UpdateHeadPosition(this); + func_809E6DCC(this); } -void EnDekubaba_StunnedVertical(EnDekubaba* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - - if (this->timer != 0) { - this->timer--; +void func_809E79EC(EnDekubaba* this, PlayState* play) { + SkelAnime_Update(&this->unk17C); + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - - if (this->timer == 0) { - EnDekubaba_DisableACColliderElems(this); - - if (this->actor.xzDistToPlayer < 80.0f * this->size) { - EnDekubaba_SetupPrepareLunge(this); + if (this->unk1C6 == 0) { + func_809E5A38(this); + if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { + func_809E5F9C(this); } else { - EnDekubaba_SetupRecover(this); + func_809E6078(this); } } } -/** - * Sway back and forth with decaying amplitude until close enough to vertical. - */ -void EnDekubaba_Sway(EnDekubaba* this, PlayState* play) { - s16 angleToVertical; - - SkelAnime_Update(&this->skelAnime); - Math_ScaledStepToS(&this->actor.shape.rot.x, this->stemSectionAngle[0], 0x71C); - Math_ScaledStepToS(&this->stemSectionAngle[0], this->stemSectionAngle[1], 0x71C); - Math_ScaledStepToS(&this->stemSectionAngle[1], this->stemSectionAngle[2], 0x71C); +void func_809E7A88(EnDekubaba* this, PlayState* play) { + s16 temp_v0; - if (Math_ScaledStepToS(&this->stemSectionAngle[2], this->targetSwayAngle, 0x71C)) { - this->targetSwayAngle = -0x4000 - (this->targetSwayAngle + 0x4000) * 0.8f; + SkelAnime_Update(&this->unk17C); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1CA_arr[0], 0x71C); + Math_ScaledStepToS(&this->unk1CA_arr[0], this->unk1CA_arr[1], 0x71C); + Math_ScaledStepToS(&this->unk1CA_arr[1], this->unk1CA_arr[2], 0x71C); + if (Math_ScaledStepToS(&this->unk1CA_arr[2], this->unk1C8, 0x71C)) { + this->unk1C8 = (s16)(s32)(-16384.0f - ((this->unk1C8 + 0x4000) * 0.8f)); } - angleToVertical = this->targetSwayAngle + 0x4000; - - if (ABS(angleToVertical) < 0x100) { - this->collider.base.acFlags |= AC_ON; - if (this->actor.xzDistToPlayer < 80.0f * this->size) { - EnDekubaba_SetupPrepareLunge(this); + temp_v0 = this->unk1C8 + 0x4000; + if (ABS(temp_v0) < 0x100) { + this->unk238.base.acFlags |= AC_ON; + if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { + func_809E5F9C(this); } else { - EnDekubaba_SetupRecover(this); + func_809E6078(this); } } - - EnDekubaba_UpdateHeadPosition(this); + func_809E6DCC(this); } -void EnDekubaba_PrunedSomersault(EnDekubaba* this, PlayState* play) { - s32 i; - Vec3f dustPos; - f32 deltaX; - f32 deltaZ; - f32 deltaY; - - Math_StepToF(&this->actor.speed, 0.0f, this->size * 0.1f); +void func_809E7BB0(EnDekubaba* this, PlayState* play) { + s32 var_s0; + Vec3f sp78; + f32 temp_fs0; + f32 temp_fs1; + f32 temp_fs2; - if (this->timer == 0) { + Math_StepToF(&this->actor.speed, 0.0f, this->unk230 * 0.1f); + if (this->unk1C6 == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); - Math_ScaledStepToS(&this->stemSectionAngle[0], 0x4800, 0x71C); - Math_ScaledStepToS(&this->stemSectionAngle[1], 0x4800, 0x71C); - - EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, - this->size * 5.0f, 1, HAHEN_OBJECT_DEFAULT, 10, NULL); - - if ((this->actor.scale.x > 0.005f) && - ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { + Math_ScaledStepToS(&this->unk1CA_arr[0], 0x4800, 0x71C); + Math_ScaledStepToS(&this->unk1CA_arr[1], 0x4800, 0x71C); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, + this->unk230 * 5.0f, 1, -1, 10, NULL); + if ((this->actor.scale.x > 0.005f) && ((((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) != 0)) || + (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speed = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE); - EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->size * 3.0f, 0, this->size * 12.0f, - this->size * 5.0f, 15, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, + this->unk230 * 5.0f, 15, -1, 10, NULL); } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); - this->timer = 1; + this->unk1C6 = 1; } - } else if (this->timer == 1) { - dustPos = this->actor.world.pos; - - deltaY = 20.0f * Math_SinS(this->actor.shape.rot.x); - deltaX = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y); - deltaZ = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); - - for (i = 0; i < 4; i++) { - func_800286CC(play, &dustPos, &sZeroVec, &sZeroVec, 500, 50); - dustPos.x += deltaX; - dustPos.y += deltaY; - dustPos.z += deltaZ; + } else if (this->unk1C6 == 1) { + sp78 = this->actor.world.pos; + temp_fs2 = Math_SinS(this->actor.shape.rot.x) * 20.0f; + temp_fs0 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_SinS(this->actor.shape.rot.y); + temp_fs1 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_CosS(this->actor.shape.rot.y); + for (var_s0 = 0; var_s0 < 4; var_s0++) { + func_800286CC(play, &sp78, &D_809E8EA0, &D_809E8EA0, 500, 50); + sp78.x += temp_fs0; + sp78.y += temp_fs2; + sp78.z += temp_fs1; } - - func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); - EnDekubaba_SetupDeadStickDrop(this, play); + func_800286CC(play, &this->actor.home.pos, &D_809E8EA0, &D_809E8EA0, this->unk230 * 500.0f, + this->unk230 * 100.0f); + func_809E645C(this, play); } } -/** - * Die and drop Deku Nuts (Stick drop is handled elsewhere) - */ -void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play) { - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, this->size * 5.0f); - - if (Math_StepToF(&this->actor.scale.x, this->size * 0.1f * 0.01f, this->size * 0.1f * 0.01f)) { - func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->size * 500.0f, this->size * 100.0f); +void func_809E7F14(EnDekubaba* this, PlayState* play) { + Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, this->unk230 * 5.0f); + if (Math_StepToF(&this->actor.scale.x, this->unk230 * 0.1f * 0.01f, this->unk230 * 0.1f * 0.01f) != 0) { + func_800286CC(play, &this->actor.home.pos, &D_809E8EA0, &D_809E8EA0, this->unk230 * 500.0f, + this->unk230 * 100.0f); if (this->actor.dropFlag == 0) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); - - if (this->actor.params == DEKUBABA_BIG) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, 0xC); + if (this->actor.params == 1) { + Item_DropCollectible(play, &this->actor.world.pos, 0xC); + Item_DropCollectible(play, &this->actor.world.pos, 0xC); } } else { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, @@ -1018,105 +854,92 @@ void EnDekubaba_ShrinkDie(EnDekubaba* this, PlayState* play) { } Actor_Kill(&this->actor); } - this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; this->actor.shape.rot.z += 0x1C70; - EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->size * 3.0f, 0, this->size * 12.0f, this->size * 5.0f, - 1, HAHEN_OBJECT_DEFAULT, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, + this->unk230 * 5.0f, 1, -1, 10, NULL); } -void EnDekubaba_DeadStickDrop(EnDekubaba* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; +void func_809E80D8(EnDekubaba* this, PlayState* play) { + if (this->unk1C6 != 0) { + this->unk1C6 -= 1; } - - if (Actor_HasParent(&this->actor, play) || (this->timer == 0)) { + if (Actor_HasParent(&this->actor, play) || (this->unk1C6 == 0)) { Actor_Kill(&this->actor); - return; + } else { + Actor_OfferGetItemNearby(&this->actor, play, GI_DEKU_STICKS_1); } - - Actor_OfferGetItemNearby(&this->actor, play, GI_DEKU_STICKS_1); } -// Update and associated functions - -void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) { - Vec3f* firePos; - f32 fireScale; - s32 phi_s0; // Used for both health and iterator - - if (this->collider.base.acFlags & AC_HIT) { - this->collider.base.acFlags &= ~AC_HIT; - Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); - - if ((this->collider.base.colMaterial != COL_MATERIAL_HARD) && - ((this->actor.colChkInfo.damageReaction != DEKUBABA_DMG_REACT_NONE) || - (this->actor.colChkInfo.damage != 0))) { - - phi_s0 = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; +void func_809E8140(EnDekubaba* this, PlayState* play) { + float new_var2; + s32 var_s0; + s32 i; - if (this->actionFunc != EnDekubaba_StunnedVertical) { - if ((this->actor.colChkInfo.damageReaction == DEKUBABA_DMG_REACT_BOOMERANG) || - (this->actor.colChkInfo.damageReaction == DEKUBABA_DMG_REACT_DEKUNUT)) { - if (this->actor.colChkInfo.damageReaction == DEKUBABA_DMG_REACT_BOOMERANG) { - phi_s0 = this->actor.colChkInfo.health; + if (this->unk238.base.acFlags & AC_HIT) { + this->unk238.base.acFlags &= ~AC_HIT; + Actor_SetDropFlagJntSph(&this->actor, &this->unk238, true); + if ((this->unk238.base.colMaterial != COL_MATERIAL_HARD) && + (((this->actor.colChkInfo.damageReaction != 0)) || (this->actor.colChkInfo.damage != 0))) { + var_s0 = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; + if (this->unk1C0 != func_809E79EC) { + if ((this->actor.colChkInfo.damageReaction == 0xE) || (this->actor.colChkInfo.damageReaction == 1)) { + if (this->actor.colChkInfo.damageReaction == 0xE) { + var_s0 = this->actor.colChkInfo.health; } - - EnDekubaba_SetupHit(this, 2); - } else if (this->actionFunc == EnDekubaba_PullBack) { - if (phi_s0 <= 0) { - phi_s0 = 1; + func_809E60A8(this, 2); + } else if (this->unk1C0 == func_809E7458) { + if (var_s0 <= 0) { + var_s0 = 1; } - - EnDekubaba_SetupHit(this, 1); + func_809E60A8(this, 1); } else { - EnDekubaba_SetupHit(this, 0); + func_809E60A8(this, 0); } - } else if ((this->actor.colChkInfo.damageReaction == DEKUBABA_DMG_REACT_BOOMERANG) || - (this->actor.colChkInfo.damageReaction == DEKUBABA_DMG_REACT_SWORD)) { - if (phi_s0 > 0) { - EnDekubaba_SetupSway(this); + } else if ((this->actor.colChkInfo.damageReaction == 0xE) || + (this->actor.colChkInfo.damageReaction == 0xF)) { + if (var_s0 > 0) { + func_809E63EC(this); } else { - EnDekubaba_SetupPrunedSomersault(this); + func_809E6170(this); } - } else if (this->actor.colChkInfo.damageReaction != DEKUBABA_DMG_REACT_DEKUNUT) { - EnDekubaba_SetupHit(this, 0); + } else if (this->actor.colChkInfo.damageReaction != 1) { + func_809E60A8(this, 0); } else { return; } - - this->actor.colChkInfo.health = CLAMP_MIN(phi_s0, 0); - - if (this->actor.colChkInfo.damageReaction == DEKUBABA_DMG_REACT_FIRE) { - firePos = &this->actor.world.pos; - fireScale = (this->size * 70.0f); - - for (phi_s0 = 0; phi_s0 < 4; phi_s0++) { - EffectSsEnFire_SpawnVec3f(play, &this->actor, firePos, fireScale, 0, 0, phi_s0); + if (var_s0 < 0) { + this->actor.colChkInfo.health = 0; + } else { + this->actor.colChkInfo.health = var_s0; + } + if (this->actor.colChkInfo.damageReaction == 2) { + new_var2 = this->unk230 * 70.0f; + for (i = 0; i < 4; i++) { + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, new_var2, 0, 0, i); } } } else { return; } - } else if ((play->actorCtx.unk_02 != 0) && (this->collider.base.colMaterial != COL_MATERIAL_HARD) && - (this->actionFunc != EnDekubaba_StunnedVertical) && (this->actionFunc != EnDekubaba_Hit) && + } else if ((play->actorCtx.unk_02 != 0) && (this->unk238.base.colMaterial != COL_MATERIAL_HARD) && + (this->unk1C0 != func_809E79EC) && (this->unk1C0 != func_809E78DC) && (this->actor.colChkInfo.health != 0)) { this->actor.colChkInfo.health--; - this->actor.dropFlag = 0x00; - EnDekubaba_SetupHit(this, 1); + this->actor.dropFlag = 0; + func_809E60A8(this, 1); } else { return; } - if (this->actor.colChkInfo.health != 0) { - if (this->timer == 2) { + if (this->unk1C6 == 2) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DAMAGE); } } else { Enemy_StartFinishingBlow(play, &this->actor); - if (this->actor.params == DEKUBABA_BIG) { + if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DEAD); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); @@ -1125,205 +948,174 @@ void EnDekubaba_UpdateDamage(EnDekubaba* this, PlayState* play) { } void EnDekubaba_Update(Actor* thisx, PlayState* play) { - s32 pad; EnDekubaba* this = (EnDekubaba*)thisx; + s32 pad; - if (this->collider.base.atFlags & AT_HIT) { - this->collider.base.atFlags &= ~AT_HIT; - EnDekubaba_SetupRecover(this); + if (this->unk238.base.atFlags & AT_HIT) { + this->unk238.base.atFlags &= ~AT_HIT; + func_809E6078(this); } - - EnDekubaba_UpdateDamage(this, play); - this->actionFunc(this, play); - - if (this->actionFunc == EnDekubaba_PrunedSomersault) { + func_809E8140(this, play); + this->unk1C0(this, play); + if (this->unk1C0 == func_809E7BB0) { Actor_MoveXZGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->size * 15.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->unk230 * 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - } else if (this->actionFunc != EnDekubaba_DeadStickDrop) { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - if (this->boundFloor == NULL) { - this->boundFloor = this->actor.floorPoly; + } else { + if (this->unk1C0 != func_809E80D8) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + if (this->unk234 == NULL) { + this->unk234 = this->actor.floorPoly; + } } } - if (this->actionFunc == EnDekubaba_Lunge) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + if (this->unk1C0 == func_809E7104) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk238.base); this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } - - if (this->collider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + if (this->unk238.base.acFlags & 1) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk238.base); } - - if (this->actionFunc != EnDekubaba_DeadStickDrop) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (this->unk1C0 != func_809E80D8) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk238.base); } } -// Draw functions - -void EnDekubaba_DrawStemRetracted(EnDekubaba* this, PlayState* play) { - f32 horizontalScale; +void func_809E858C(EnDekubaba* this, PlayState* play) { + f32 sp44; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2445); - - horizontalScale = this->size * 0.01f; - - Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y + (-6.0f * this->size), this->actor.home.pos.z, + sp44 = this->unk230 * 0.01f; + Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y + (-6.0f * this->unk230), this->actor.home.pos.z, MTXMODE_NEW); - Matrix_RotateZYX(this->stemSectionAngle[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_Scale(horizontalScale, horizontalScale, horizontalScale, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk1CA_arr[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_Scale(sp44, sp44, sp44, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2461); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemTopDL); - + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001330); Actor_SetFocus(&this->actor, 0.0f); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2468); } -void EnDekubaba_DrawStemExtended(EnDekubaba* this, PlayState* play) { - static Gfx* stemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; - MtxF mtx; - s32 i; - f32 horizontalStepSize; +void func_809E86B8(EnDekubaba* this, PlayState* play) { + MtxF spB0; + f32 temp_fs0; + f32 temp_fs0_2; f32 spA4; - f32 scale; - s32 stemSections; + s32 i__var_s2; + s32 sp9C; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2487); - - if (this->actionFunc == EnDekubaba_PrunedSomersault) { - stemSections = 2; + if (this->unk1C0 == func_809E7BB0) { + sp9C = 2; } else { - stemSections = 3; + sp9C = 3; } - - scale = this->size * 0.01f; + temp_fs0 = this->unk230 * 0.01f; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); - Matrix_Get(&mtx); + Matrix_Scale(temp_fs0, temp_fs0, temp_fs0, MTXMODE_APPLY); + Matrix_Get(&spB0); if (this->actor.colorFilterTimer != 0) { - spA4 = this->size * 20.0f; - this->bodyPartsPos[2].x = this->actor.world.pos.x; - this->bodyPartsPos[2].y = this->actor.world.pos.y - spA4; - this->bodyPartsPos[2].z = this->actor.world.pos.z; + spA4 = this->unk230 * 20.0f; + this->unk164.x = this->actor.world.pos.x; + this->unk164.y = this->actor.world.pos.y - spA4; + this->unk164.z = this->actor.world.pos.z; } - - for (i = 0; i < stemSections; i++) { - mtx.yw += 20.0f * Math_SinS(this->stemSectionAngle[i]) * this->size; - horizontalStepSize = 20.0f * Math_CosS(this->stemSectionAngle[i]) * this->size; - mtx.xw -= horizontalStepSize * Math_SinS(this->actor.shape.rot.y); - mtx.zw -= horizontalStepSize * Math_CosS(this->actor.shape.rot.y); - - Matrix_Put(&mtx); - Matrix_RotateZYX(this->stemSectionAngle[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + for (i__var_s2 = 0; i__var_s2 < sp9C; i__var_s2++) { + spB0.mf[3][1] += 20.0f * Math_SinS(this->unk1CA_arr[i__var_s2]) * this->unk230; + temp_fs0_2 = Math_CosS(this->unk1CA_arr[i__var_s2]) * 20.0f * this->unk230; + spB0.mf[3][0] -= temp_fs0_2 * Math_SinS(this->actor.shape.rot.y); + spB0.mf[3][2] -= temp_fs0_2 * Math_CosS(this->actor.shape.rot.y); + Matrix_Put(&spB0); + Matrix_RotateZYX(this->unk1CA_arr[i__var_s2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2533); - - gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]); - - Collider_UpdateSpheres(51 + 2 * i, &this->collider); - Collider_UpdateSpheres(52 + 2 * i, &this->collider); - - if (i == 0) { - if (this->actionFunc != EnDekubaba_Sway) { - this->actor.focus.pos.x = mtx.xw; - this->actor.focus.pos.y = mtx.yw; - this->actor.focus.pos.z = mtx.zw; + gSPDisplayList(POLY_OPA_DISP++, D_809E902C[i__var_s2]); + Collider_UpdateSpheres(0x33 + (i__var_s2 * 2), &this->unk238); + Collider_UpdateSpheres(0x34 + (i__var_s2 * 2), &this->unk238); + if (i__var_s2 == 0) { + if (this->unk1C0 != func_809E7A88) { + this->actor.focus.pos.x = spB0.mf[3][0]; + this->actor.focus.pos.y = spB0.mf[3][1]; + this->actor.focus.pos.z = spB0.mf[3][2]; } else { this->actor.focus.pos.x = this->actor.home.pos.x; - this->actor.focus.pos.y = this->actor.home.pos.y + (40.0f * this->size); + this->actor.focus.pos.y = this->actor.home.pos.y + (40.0f * this->unk230); this->actor.focus.pos.z = this->actor.home.pos.z; } } - - if ((i < 2) && (this->actor.colorFilterTimer != 0)) { - // checking colorFilterTimer ensures that spA4 has been initialized earlier, so not a bug - this->bodyPartsPos[i].x = mtx.xw; - this->bodyPartsPos[i].y = mtx.yw - spA4; - this->bodyPartsPos[i].z = mtx.zw; + if ((i__var_s2 < 2) && (this->actor.colorFilterTimer != 0)) { + this->unk14C[i__var_s2].x = spB0.mf[3][0]; + this->unk14C[i__var_s2].y = spB0.mf[3][1] - spA4; + this->unk14C[i__var_s2].z = spB0.mf[3][2]; } } - CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2569); } -void EnDekubaba_DrawStemBasePruned(EnDekubaba* this, PlayState* play) { +void func_809E89E4(EnDekubaba* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2579); - - Matrix_RotateZYX(this->stemSectionAngle[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->unk1CA_arr[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2586); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); - - Collider_UpdateSpheres(55, &this->collider); - Collider_UpdateSpheres(56, &this->collider); + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); + Collider_UpdateSpheres(0x37, &this->unk238); + Collider_UpdateSpheres(0x38, &this->unk238); CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2596); } -void EnDekubaba_DrawBaseShadow(EnDekubaba* this, PlayState* play) { - MtxF mtx; - f32 horizontalScale; +void func_809E8AD8(EnDekubaba* this, PlayState* play) { + MtxF sp50; + f32 temp_fa0; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2692); Gfx_SetupDL_44Xlu(play->state.gfxCtx); - - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 255); - - func_80038A28(this->boundFloor, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &mtx); - Matrix_Mult(&mtx, MTXMODE_NEW); - - horizontalScale = this->size * 0.15f; - Matrix_Scale(horizontalScale, 1.0f, horizontalScale, MTXMODE_APPLY); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 0, 255); + func_80038A28(this->unk234, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &sp50); + Matrix_Mult(&sp50, MTXMODE_NEW); + temp_fa0 = this->unk230 * 0.15f; + Matrix_Scale(temp_fa0, 1.0f, temp_fa0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2710); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2715); } -void EnDekubaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnDekubaba* this = (EnDekubaba*)thisx; +void func_809E8C0C(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { + EnDekubaba* this = thisx; - if (limbIndex == 1) { - Collider_UpdateSpheres(limbIndex, &this->collider); + if (arg1 == 1) { + Collider_UpdateSpheres(arg1, &this->unk238); } } void EnDekubaba_Draw(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; - f32 scale; + f32 sp50; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2752); Gfx_SetupDL_25Opa(play->state.gfxCtx); - - if (this->actionFunc != EnDekubaba_DeadStickDrop) { - SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, - this); - - if (this->actionFunc == EnDekubaba_Wait) { - EnDekubaba_DrawStemRetracted(this, play); + if (this->unk1C0 != func_809E80D8) { + SkelAnime_DrawOpa(play, this->unk17C.skeleton, this->unk17C.jointTable, NULL, func_809E8C0C, this); + if (this->unk1C0 == func_809E64F4) { + func_809E858C(this, play); } else { - EnDekubaba_DrawStemExtended(this, play); + func_809E86B8(this, play); } - - scale = this->size * 0.01f; + sp50 = this->unk230 * 0.01f; Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->actor.home.rot.y), MTXMODE_APPLY); - Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + Matrix_Scale(sp50, sp50, sp50, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2780); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaBaseLeavesDL); - - if (this->actionFunc == EnDekubaba_PrunedSomersault) { - EnDekubaba_DrawStemBasePruned(this, play); + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_0010F0); + if (this->unk1C0 == func_809E7BB0) { + func_809E89E4(this, play); } - - if (this->boundFloor != NULL) { - EnDekubaba_DrawBaseShadow(this, play); + if (this->unk234 != NULL) { + func_809E8AD8(this, play); + } + } else { + if ((this->unk1C6 >= 0x29) || (this->unk1C6 & 1)) { + Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); + MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2797); + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_003070); } - - // Display solid until 40 frames left, then blink until killed. - } else if ((this->timer > 40) || ((this->timer % 2) != 0)) { - Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); - MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2797); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); } - CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2804); } 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 f1cce28c071..668ffc81a59 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -6,28 +6,23 @@ struct EnDekubaba; -typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, struct PlayState*); - -typedef enum DekuBabaType { - /* 0 */ DEKUBABA_NORMAL, - /* 1 */ DEKUBABA_BIG -} DekuBabaType; - typedef struct EnDekubaba { - /* 0x0000 */ Actor actor; - /* 0x014C */ Vec3f bodyPartsPos[4]; - /* 0x017C */ SkelAnime skelAnime; - /* 0x01C0 */ EnDekubabaActionFunc actionFunc; - /* 0x01C4 */ char pad[0x2]; - /* 0x01C6 */ s16 timer; - /* 0x01C8 */ s16 targetSwayAngle; - /* 0x01CA */ s16 stemSectionAngle[3]; // Used to calculate the position of the stem sections and head with spherical trigonometry - /* 0x01D0 */ Vec3s jointTable[8]; - /* 0x0200 */ Vec3s morphTable[8]; - /* 0x0230 */ f32 size; // Used everywhere to rescale offsets etc. for Big ones - /* 0x0234 */ struct CollisionPoly* boundFloor; - /* 0x0238 */ ColliderJntSph collider; - /* 0x0258 */ ColliderJntSphElement colliderElements[7]; -} EnDekubaba; // size = 0x0418 + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3f unk14C[2]; + /* 0x164 */ Vec3f unk164; + /* 0x170 */ Vec3f unk170; + /* 0x17C */ SkelAnime unk17C; + /* 0x1C0 */ void (*unk1C0)(struct EnDekubaba*, struct PlayState*); + /* 0x1C4 */ char pad1C4[2]; + /* 0x1C6 */ s16 unk1C6; + /* 0x1C8 */ s16 unk1C8; + /* 0x1CA */ s16 unk1CA_arr[3]; + /* 0x1D0 */ Vec3s unk1D0[8]; + /* 0x200 */ Vec3s unk200[8]; + /* 0x230 */ f32 unk230; + /* 0x234 */ struct CollisionPoly* unk234; + /* 0x238 */ ColliderJntSph unk238; + /* 0x258 */ ColliderJntSphElement unk258[7]; +} EnDekubaba; // size = 0x418 #endif 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 d56663831d8..84749916815 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -32,13 +32,13 @@ ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER) typedef enum EnDhAction { - /* 0 */ DH_WAIT, - /* 1 */ DH_RETREAT, - /* 2 */ DH_BURROW, - /* 3 */ DH_WALK, - /* 4 */ DH_ATTACK, - /* 5 */ DH_DEATH, - /* 6 */ DH_DAMAGE + DH_WAIT, + DH_RETREAT, + DH_BURROW, + DH_WALK, + DH_ATTACK, + DH_DEATH, + DH_DAMAGE } EnDhAction; void EnDh_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index f06b0e6c687..1cf1a85a632 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -426,7 +426,6 @@ void EnDha_UpdateHealth(EnDha* this, PlayState* play) { } } } - if ((this->actor.parent != NULL) && (this->actor.parent->params == ENDH_DEATH)) { EnDha_SetupDeath(this); } diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index ef9ada22585..b4231552c2a 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -3,7 +3,6 @@ * Overlay: En_Dns * Description: Deku Salesman - Sale Phase */ - #include "z_en_dns.h" #include "gfx.h" @@ -11,8 +10,6 @@ #include "ichain.h" #include "printf.h" #include "sfx.h" -#include "terminal.h" -#include "translation.h" #include "z_en_item00.h" #include "z_lib.h" #include "effect.h" @@ -29,15 +26,14 @@ void EnDns_Destroy(Actor* thisx, PlayState* play); void EnDns_Update(Actor* thisx, PlayState* play); void EnDns_Draw(Actor* thisx, PlayState* play); -u32 EnDns_CanBuyPrice(EnDns* this); u32 EnDns_CanBuyDekuNuts(EnDns* this); u32 EnDns_CanBuyDekuSticks(EnDns* this); +u32 EnDns_CanBuyPrice(EnDns* this); u32 EnDns_CanBuyDekuSeeds(EnDns* this); u32 EnDns_CanBuyDekuShield(EnDns* this); u32 EnDns_CanBuyBombs(EnDns* this); u32 EnDns_CanBuyArrows(EnDns* this); u32 EnDns_CanBuyBottle(EnDns* this); - void EnDns_PayPrice(EnDns* this); void EnDns_PayForDekuNuts(EnDns* this); void EnDns_PayForHeartPiece(EnDns* this); @@ -45,17 +41,15 @@ void EnDns_PayForBombs(EnDns* this); void EnDns_PayForArrows(EnDns* this); void EnDns_PayForDekuStickUpgrade(EnDns* this); void EnDns_PayForDekuNutUpgrade(EnDns* this); - -void EnDns_SetupIdle(EnDns* this, PlayState* play); -void EnDns_Idle(EnDns* this, PlayState* play); -void EnDns_Talk(EnDns* this, PlayState* play); -void EnDns_OfferSaleItem(EnDns* this, PlayState* play); -void EnDns_SetupSale(EnDns* this, PlayState* play); -void EnDns_Sale(EnDns* this, PlayState* play); -void EnDns_SetupBurrow(EnDns* this, PlayState* play); -void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play); -void EnDns_Burrow(EnDns* this, PlayState* play); -void EnDns_PostBurrow(EnDns* this, PlayState* play); +void EnDns_SetupIdle(EnDns*, PlayState*); +void EnDns_Idle(EnDns*, PlayState*); +void func_809EFC9C(EnDns*, PlayState*); +void EnDns_SetupSale(EnDns*, PlayState*); +void EnDns_Sale(EnDns*, PlayState*); +void EnDns_SetupBurrow(EnDns*, PlayState*); +void EnDns_SetupNoSaleBurrow(EnDns*, PlayState*); +void EnDns_Burrow(EnDns*, PlayState*); +void EnDns_PostBurrow(EnDns*, PlayState*); ActorProfile En_Dns_Profile = { /**/ ACTOR_EN_DNS, @@ -68,67 +62,86 @@ ActorProfile En_Dns_Profile = { /**/ EnDns_Update, /**/ EnDns_Draw, }; - -static ColliderCylinderInitType1 sCylinderInit = { - { - COL_MATERIAL_NONE, - AT_NONE, - AC_ON | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_ON, - }, - { 18, 32, 0, { 0, 0, 0 } }, +static ColliderCylinderInitType1 D_809F03E0 = { + { 0xA, 0, 9, 0x39, 1 }, + { 0, { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0 }, 0, 1, 1 }, + { 0x12, 0x20, 0, { 0, 0, 0 } }, }; - static u16 sStartingTextIds[] = { - 0x10A0, 0x10A1, 0x10A2, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, 0x10DC, 0x10DD, + 0x10A0, // DNS_TYPE_DEKU_NUTS_5 + 0x10A1, // DNS_TYPE_DEKU_STICKS_1 + 0x10A2, // DNS_TYPE_HEART_PIECE + 0x10CA, // DNS_TYPE_DEKU_SEEDS_30 + 0x10CB, // DNS_TYPE_DEKU_SHIELD + 0x10CC, // DNS_TYPE_BOMBS_5 + 0x10CD, // DNS_TYPE_ARROWS_30 + 0x10CE, // DNS_TYPE_RED_POTION + 0x10CF, // DNS_TYPE_GREEN_POTION + 0x10DC, // DNS_TYPE_DEKU_STICK_UPGRADE + 0x10DD, // DNS_TYPE_DEKU_NUT_UPGRADE }; - #if DEBUG_FEATURES static char* sItemDebugTxt[] = { - T("デクの実売り ", "Deku Nuts "), - T("デクの棒売り ", "Deku Sticks "), - T("ハートの欠片売り ", "Piece of Heart "), - T("デクの種売り ", "Deku Seeds "), - T("デクの盾売り ", "Deku Shield "), - T("バクダン売り ", "Bombs "), - T("矢売り ", "Arrows "), - T("赤のくすり売り ", "Red Potion "), - T("緑のくすり売り ", "Green Potion "), - T("デクの棒持てる数を増やす", "Deku Stick Upgrade "), - T("デクの実持てる数を増やす", "Deku Nut Upgrade "), + "デクの実売り ", // DNS_TYPE_DEKU_NUTS_5 + "デクの棒売り ", // DNS_TYPE_DEKU_STICKS_1 + "ハートの欠片売り ", // DNS_TYPE_HEART_PIECE + "デクの種売り ", // DNS_TYPE_DEKU_SEEDS_30 + "デクの盾売り ", // DNS_TYPE_DEKU_SHIELD + "バクダン売り ", // DNS_TYPE_BOMBS_5 + "矢売り ", // DNS_TYPE_ARROWS_30 + "赤のくすり売り ", // DNS_TYPE_RED_POTION + "緑のくすり売り ", // DNS_TYPE_GREEN_POTION + "デクの棒持てる数を増やす", // DNS_TYPE_DEKU_STICK_UPGRADE + "デクの実持てる数を増やす", // DNS_TYPE_DEKU_NUT_UPGRADE }; #endif - -static DnsItemEntry sItemDekuNuts = { 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts }; -static DnsItemEntry sItemDekuSticks = { 15, 1, GI_DEKU_STICKS_1, EnDns_CanBuyDekuSticks, EnDns_PayPrice }; -static DnsItemEntry sItemHeartPiece = { 10, 1, GI_HEART_PIECE, EnDns_CanBuyPrice, EnDns_PayForHeartPiece }; -static DnsItemEntry sItemDekuSeeds = { 40, 30, GI_DEKU_SEEDS_30, EnDns_CanBuyDekuSeeds, EnDns_PayPrice }; -static DnsItemEntry sItemDekuShield = { 50, 1, GI_SHIELD_DEKU, EnDns_CanBuyDekuShield, EnDns_PayPrice }; -static DnsItemEntry sItemBombs = { 40, 5, GI_BOMBS_5, EnDns_CanBuyBombs, EnDns_PayForBombs }; -static DnsItemEntry sItemArrows = { 70, 20, GI_ARROWS_30, EnDns_CanBuyArrows, EnDns_PayForArrows }; -static DnsItemEntry sItemRedPotion = { 40, 1, GI_BOTTLE_POTION_RED, EnDns_CanBuyBottle, EnDns_PayPrice }; -static DnsItemEntry sItemGreenPotion = { 40, 1, GI_BOTTLE_POTION_GREEN, EnDns_CanBuyBottle, EnDns_PayPrice }; - -static DnsItemEntry sItemDekuStickUpgrade = { 40, 1, GI_DEKU_STICK_UPGRADE_20, EnDns_CanBuyPrice, - EnDns_PayForDekuStickUpgrade }; -static DnsItemEntry sItemDekuNutUpgrade = { 40, 1, GI_DEKU_NUT_UPGRADE_30, EnDns_CanBuyPrice, - EnDns_PayForDekuNutUpgrade }; - -static DnsItemEntry* sItemEntries[] = { - &sItemDekuNuts, &sItemDekuSticks, &sItemHeartPiece, &sItemDekuSeeds, &sItemDekuShield, &sItemBombs, - &sItemArrows, &sItemRedPotion, &sItemGreenPotion, &sItemDekuStickUpgrade, &sItemDekuNutUpgrade, +static EnDnsPurchaseInfo sItemDekuNuts = { + 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts, }; - -static InitChainEntry sInitChain[] = { +static EnDnsPurchaseInfo sItemDekuSticks = { + 15, 1, GI_DEKU_STICKS_1, EnDns_CanBuyDekuSticks, EnDns_PayPrice, +}; +static EnDnsPurchaseInfo sItemHeartPiece = { + 10, 1, GI_HEART_PIECE, EnDns_CanBuyPrice, EnDns_PayForHeartPiece, +}; +static EnDnsPurchaseInfo sItemDekuSeeds = { + 40, 30, GI_DEKU_SEEDS_30, EnDns_CanBuyDekuSeeds, EnDns_PayPrice, +}; +static EnDnsPurchaseInfo sItemDekuShield = { + 50, 1, GI_SHIELD_DEKU, EnDns_CanBuyDekuShield, EnDns_PayPrice, +}; +static EnDnsPurchaseInfo sItemBombs = { + 40, 5, GI_BOMBS_5, EnDns_CanBuyBombs, EnDns_PayForBombs, +}; +static EnDnsPurchaseInfo sItemArrows = { + 70, 20, GI_ARROWS_30, EnDns_CanBuyArrows, EnDns_PayForArrows, +}; +static EnDnsPurchaseInfo sItemRedPotion = { + 40, 1, GI_BOTTLE_POTION_RED, EnDns_CanBuyBottle, EnDns_PayPrice, +}; +static EnDnsPurchaseInfo sItemGreenPotion = { + 40, 1, GI_BOTTLE_POTION_GREEN, EnDns_CanBuyBottle, EnDns_PayPrice, +}; +static EnDnsPurchaseInfo sItemDekuStickUpgrade = { + 40, 1, GI_DEKU_STICK_UPGRADE_20, EnDns_CanBuyPrice, EnDns_PayForDekuStickUpgrade, +}; +static EnDnsPurchaseInfo sItemDekuNutUpgrade = { + 40, 1, GI_DEKU_NUT_UPGRADE_30, EnDns_CanBuyPrice, EnDns_PayForDekuNutUpgrade, +}; +static EnDnsPurchaseInfo* sEnDnsPurchaseInfos[] = { + &sItemDekuNuts, // DNS_TYPE_DEKU_NUTS_5 + &sItemDekuSticks, // DNS_TYPE_DEKU_STICKS_1 + &sItemHeartPiece, // DNS_TYPE_HEART_PIECE + &sItemDekuSeeds, // DNS_TYPE_DEKU_SEEDS_30 + &sItemDekuShield, // DNS_TYPE_DEKU_SHIELD + &sItemBombs, // DNS_TYPE_BOMBS_5 + &sItemArrows, // DNS_TYPE_ARROWS_30 + &sItemRedPotion, // DNS_TYPE_RED_POTION + &sItemGreenPotion, // DNS_TYPE_GREEN_POTION + &sItemDekuStickUpgrade, // DNS_TYPE_DEKU_STICK_UPGRADE + &sItemDekuNutUpgrade, // DNS_TYPE_DEKU_NUT_UPGRADE +}; +static InitChainEntry D_809F052C[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 30, ICHAIN_STOP), @@ -144,98 +157,80 @@ void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; if (DNS_GET_TYPE(&this->actor) < 0) { - PRINTF(VT_FGCOL(RED) T("引数エラー(売りナッツ)[ arg_data = %d ]", - "Argument error (selling nuts) [ arg_data = %d ]") VT_RST "\n", - this->actor.params); + PRINTF("\x1b[31m引数エラー(売りナッツ)[ arg_data = %d ]\x1b[m\n", this->actor.params); Actor_Kill(&this->actor); return; } - - // Sell Seeds instead of Arrows if Link is child - if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == YEARS_CHILD)) { - DNS_GET_TYPE(&this->actor) = DNS_TYPE_DEKU_SEEDS_30; + if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == 5)) { + this->actor.params = DNS_TYPE_DEKU_SEEDS_30; } - - PRINTF(VT_FGCOL(GREEN) T("◆◆◆ 売りナッツ『%s』 ◆◆◆", "◆◆◆ Selling nuts『%s』 ◆◆◆") VT_RST "\n", - sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); - - Actor_ProcessInitChain(&this->actor, sInitChain); - - SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, - this->jointTable, this->morphTable, BUSINESS_SCRUB_LIMB_MAX); - - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); - + PRINTF("\x1b[32m◆◆◆ 売りナッツ『%s』 ◆◆◆\x1b[m\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); + Actor_ProcessInitChain(&this->actor, D_809F052C); + SkelAnime_InitFlex(play, &this->unk14C, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, + this->unk1FC, 0x12); + Collider_InitCylinder(play, &this->unk26C); + Collider_SetCylinderType1(play, &this->unk26C, &this->actor, &D_809F03E0); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; Actor_SetScale(&this->actor, 0.01f); - - this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->isColliderEnabled = true; - this->standOnGround = true; - this->dropCollectible = false; + this->actor.colChkInfo.mass = 0xFF; + this->isColliderEnabled = 1; + this->unk2BC = 1; + this->unk2BD = 0; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - this->dnsItemEntry = sItemEntries[DNS_GET_TYPE(&this->actor)]; - - this->actionFunc = EnDns_SetupIdle; + this->unk2C0 = sEnDnsPurchaseInfos[DNS_GET_TYPE(&this->actor)]; + this->unk268 = EnDns_SetupIdle; } void EnDns_Destroy(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk26C); } -void EnDns_ChangeAnim(EnDns* this, u8 index) { - s16 frameCount = Animation_GetLastFrame(sAnimationInfo[index].animation); +void EnDns_ChangeAnim(EnDns* this, u8 arg1) { + s16 temp_ft0; - this->animIndex = index; - Animation_Change(&this->skelAnime, sAnimationInfo[index].animation, 1.0f, 0.0f, frameCount, - sAnimationInfo[index].mode, sAnimationInfo[index].morphFrames); + temp_ft0 = Animation_GetLastFrame(sAnimationInfo[arg1].animation); + this->animIndex = arg1; + Animation_Change(&this->unk14C, sAnimationInfo[arg1].animation, 1.0f, 0.0f, temp_ft0, sAnimationInfo[arg1].mode, + sAnimationInfo[arg1].morphFrames); } -/* Item give checking functions */ - u32 EnDns_CanBuyDekuNuts(EnDns* this) { - if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (AMMO(ITEM_DEKU_NUT) >= CUR_CAPACITY(UPG_DEKU_NUTS))) { + if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (AMMO(ITEM_DEKU_NUT) >= (s32)CUR_CAPACITY(UPG_DEKU_NUTS))) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } if (Item_CheckObtainability(ITEM_DEKU_NUT) == ITEM_NONE) { return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM; } - return DNS_CANBUY_RESULT_SUCCESS; } u32 EnDns_CanBuyDekuSticks(EnDns* this) { - if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= CUR_CAPACITY(UPG_DEKU_STICKS))) { + if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= (s32)CUR_CAPACITY(UPG_DEKU_STICKS))) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } if (Item_CheckObtainability(ITEM_DEKU_STICK) == ITEM_NONE) { return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM; } - return DNS_CANBUY_RESULT_SUCCESS; } u32 EnDns_CanBuyPrice(EnDns* this) { - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } - return DNS_CANBUY_RESULT_SUCCESS; } @@ -247,15 +242,13 @@ u32 EnDns_CanBuyDekuSeeds(EnDns* this) { if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } if (Item_CheckObtainability(ITEM_DEKU_SEEDS) == ITEM_NONE) { return DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM; } - return DNS_CANBUY_RESULT_SUCCESS; } @@ -263,11 +256,9 @@ u32 EnDns_CanBuyDekuShield(EnDns* this) { if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } - return DNS_CANBUY_RESULT_SUCCESS; } @@ -279,11 +270,9 @@ u32 EnDns_CanBuyBombs(EnDns* this) { if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } - return DNS_CANBUY_RESULT_SUCCESS; } @@ -295,11 +284,9 @@ u32 EnDns_CanBuyArrows(EnDns* this) { if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } - return DNS_CANBUY_RESULT_SUCCESS; } @@ -307,62 +294,58 @@ u32 EnDns_CanBuyBottle(EnDns* this) { if (!Inventory_HasEmptyBottle()) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - - if (gSaveContext.save.info.playerData.rupees < this->dnsItemEntry->itemPrice) { + if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } - return DNS_CANBUY_RESULT_SUCCESS; } -/* Paying and flagging functions */ - void EnDns_PayPrice(EnDns* this) { - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_PayForDekuNuts(EnDns* this) { - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_PayForHeartPiece(EnDns* this) { SET_ITEMGETINF(ITEMGETINF_DEKU_HEART_PIECE); - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_PayForBombs(EnDns* this) { - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_PayForArrows(EnDns* this) { - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_PayForDekuStickUpgrade(EnDns* this) { SET_INFTABLE(INFTABLE_HAS_DEKU_STICK_UPGRADE); - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_PayForDekuNutUpgrade(EnDns* this) { SET_INFTABLE(INFTABLE_HAS_DEKU_NUT_UPGRADE); - Rupees_ChangeBy(-this->dnsItemEntry->itemPrice); + Rupees_ChangeBy(-this->unk2C0->price); } void EnDns_SetupIdle(EnDns* this, PlayState* play) { - if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - this->actionFunc = EnDns_Idle; + if (this->unk14C.curFrame == this->unk14C.endFrame) { + this->unk268 = EnDns_Idle; EnDns_ChangeAnim(this, DNS_ANIM_IDLE); } } void EnDns_Idle(EnDns* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 2000, 0); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnDns_Talk; + this->unk268 = func_809EFC9C; } else { - if ((this->collider.base.ocFlags1 & OC1_HIT) || this->actor.isLockedOn) { + if ((this->unk26C.base.ocFlags1 & OC1_HIT) || (this->actor.isLockedOn != 0)) { this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } else { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; @@ -373,37 +356,34 @@ void EnDns_Idle(EnDns* this, PlayState* play) { } } -void EnDns_Talk(EnDns* this, PlayState* play) { +void func_809EFC9C(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { - case 0: // OK - switch (this->dnsItemEntry->canBuy(this)) { + case 0: + switch (this->unk2C0->canBuy(this)) { case DNS_CANBUY_RESULT_NEED_RUPEES: Message_ContinueTextbox(play, 0x10A5); - this->actionFunc = EnDns_SetupNoSaleBurrow; - break; - + this->unk268 = EnDns_SetupNoSaleBurrow; + return; case DNS_CANBUY_RESULT_CAPACITY_FULL: Message_ContinueTextbox(play, 0x10A6); - this->actionFunc = EnDns_SetupNoSaleBurrow; - break; - + this->unk268 = EnDns_SetupNoSaleBurrow; + return; case DNS_CANBUY_RESULT_CANT_GET_NOW: Message_ContinueTextbox(play, 0x10DE); - this->actionFunc = EnDns_SetupNoSaleBurrow; - break; - + this->unk268 = EnDns_SetupNoSaleBurrow; + return; case DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM: case DNS_CANBUY_RESULT_SUCCESS: Message_ContinueTextbox(play, 0x10A7); - this->actionFunc = EnDns_SetupSale; - break; + this->unk268 = EnDns_SetupSale; + return; } break; - - case 1: // "No" + case 1: Message_ContinueTextbox(play, 0x10A4); - this->actionFunc = EnDns_SetupNoSaleBurrow; + this->unk268 = EnDns_SetupNoSaleBurrow; + break; } } } @@ -422,7 +402,7 @@ void EnDns_OfferSaleItem(EnDns* this, PlayState* play) { Actor_OfferGetItem(&this->actor, play, GI_DEKU_NUT_UPGRADE_40, 130.0f, 100.0f); } } else { - Actor_OfferGetItem(&this->actor, play, this->dnsItemEntry->getItemId, 130.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, this->unk2C0->gid, 130.0f, 100.0f); } } @@ -430,14 +410,14 @@ void EnDns_SetupSale(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); EnDns_OfferSaleItem(this, play); - this->actionFunc = EnDns_Sale; + this->unk268 = EnDns_Sale; } } void EnDns_Sale(EnDns* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->actionFunc = EnDns_SetupBurrow; + this->unk268 = EnDns_SetupBurrow; } else { EnDns_OfferSaleItem(this, play); } @@ -448,65 +428,64 @@ void EnDns_SetupBurrow(EnDns* this, PlayState* play) { if (player->stateFlags1 & PLAYER_STATE1_10) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->dnsItemEntry->payment(this); - this->dropCollectible = true; - this->isColliderEnabled = false; + this->unk2C0->payment(this); + this->unk2BD = 1; + this->isColliderEnabled = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); - this->actionFunc = EnDns_Burrow; + this->unk268 = EnDns_Burrow; } } else { - this->dnsItemEntry->payment(this); - this->dropCollectible = true; - this->isColliderEnabled = false; + this->unk2C0->payment(this); + this->unk2BD = 1; + this->isColliderEnabled = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); - this->actionFunc = EnDns_Burrow; + this->unk268 = EnDns_Burrow; } } void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->isColliderEnabled = false; + this->isColliderEnabled = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); - this->actionFunc = EnDns_Burrow; + this->unk268 = EnDns_Burrow; } } void EnDns_Burrow(EnDns* this, PlayState* play) { - f32 frameCount = Animation_GetLastFrame(&gBusinessScrubLeaveBurrowAnim); + f32 f = Animation_GetLastFrame(&gBusinessScrubLeaveBurrowAnim); - if (this->skelAnime.curFrame == frameCount) { + if (this->unk14C.curFrame == f) { Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->actionFunc = EnDns_PostBurrow; - this->standOnGround = false; - this->yInitPos = this->actor.world.pos.y; + this->unk268 = EnDns_PostBurrow; + this->unk2BC = 0; + this->unk2C4 = this->actor.world.pos.y; } } void EnDns_PostBurrow(EnDns* this, PlayState* play) { - f32 depthInGround = this->yInitPos - this->actor.world.pos.y; - Vec3f initPos; - s32 i; + f32 depthInGround; + Vec3f sp38; + s32 var_s0; - if ((this->dustTimer & 3) == 0) { - initPos.x = this->actor.world.pos.x; - initPos.y = this->yInitPos; - initPos.z = this->actor.world.pos.z; - func_80028990(play, 20.0f, &initPos); + depthInGround = this->unk2C4 - this->actor.world.pos.y; + if ((this->unk2B8 % 4) == 0) { + sp38.x = this->actor.world.pos.x; + sp38.y = this->unk2C4; + sp38.z = this->actor.world.pos.z; + func_80028990(play, 20.0f, &sp38); } this->actor.shape.rot.y += 0x2000; - if (depthInGround > 400.0f) { - if (this->dropCollectible) { - initPos.x = this->actor.world.pos.x; - initPos.y = this->yInitPos; - initPos.z = this->actor.world.pos.z; - - for (i = 0; i < 3; i++) { - Item_DropCollectible(play, &initPos, ITEM00_RECOVERY_HEART); + if (this->unk2BD != 0) { + sp38.x = this->actor.world.pos.x; + sp38.y = this->unk2C4; + sp38.z = this->actor.world.pos.z; + for (var_s0 = 0; var_s0 < 3; var_s0++) { + Item_DropCollectible(play, &sp38, 3); } } Actor_Kill(&this->actor); @@ -515,25 +494,21 @@ void EnDns_PostBurrow(EnDns* this, PlayState* play) { void EnDns_Update(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - s16 pad; + s32 pad; - this->dustTimer++; + this->unk2B8++; this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; - Actor_SetFocus(&this->actor, 60.0f); Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->unk14C); Actor_MoveXZGravity(&this->actor); - - this->actionFunc(this, play); - - if (this->standOnGround) { + this->unk268(this, play); + if (this->unk2BC != 0) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } - - if (this->isColliderEnabled) { - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + if (this->isColliderEnabled != 0) { + Collider_UpdateCylinder(&this->actor, &this->unk26C); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk26C.base); } } @@ -541,6 +516,6 @@ void EnDns_Draw(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, &this->actor); + SkelAnime_DrawFlexOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, this->unk14C.dListCount, NULL, NULL, + &this->actor); } 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 251cc4192bc..6cc9729f813 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -37,32 +37,28 @@ typedef enum EnDnsAnimation { struct EnDns; -typedef void (*EnDnsActionFunc)(struct EnDns*, struct PlayState*); -typedef u32 (*EnDnsCanBuyFunc)(struct EnDns*); -typedef void (*EnDnsPaymentFunc)(struct EnDns*); - -typedef struct DnsItemEntry { - /* 0x00 */ s16 itemPrice; - /* 0x02 */ u16 itemAmount; - /* 0x04 */ s32 getItemId; - /* 0x08 */ EnDnsCanBuyFunc canBuy; - /* 0x0C */ EnDnsPaymentFunc payment; -} DnsItemEntry; // size = 0x10 +typedef struct EnDnsPurchaseInfo { + /* 0x00 */ s16 price; + /* 0x02 */ s16 unk_2; // unused + /* 0x04 */ s32 gid; + /* 0x08 */ u32 (*canBuy)(struct EnDns*); + /* 0x0C */ void (*payment)(struct EnDns*); +} EnDnsPurchaseInfo; typedef struct EnDns { /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX]; - /* 0x01FC */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX]; - /* 0x0268 */ EnDnsActionFunc actionFunc; - /* 0x026C */ ColliderCylinder collider; - /* 0x02B8 */ s16 dustTimer; - /* 0x02BA */ u8 animIndex; // set but not read - /* 0x02BB */ u8 isColliderEnabled; - /* 0x02BC */ u8 standOnGround; - /* 0x02BD */ u8 dropCollectible; - /* 0x02C0 */ DnsItemEntry* dnsItemEntry; - /* 0x02C4 */ f32 yInitPos; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ Vec3s unk190[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x1FC */ Vec3s unk1FC[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x268 */ void (*unk268)(struct EnDns*, struct PlayState*); + /* 0x26C */ ColliderCylinder unk26C; + /* 0x2B8 */ s16 unk2B8; + /* 0x2BA */ u8 animIndex; + /* 0x2BB */ u8 isColliderEnabled; + /* 0x2BC */ u8 unk2BC; + /* 0x2BD */ u8 unk2BD; + /* 0x2C0 */ EnDnsPurchaseInfo* unk2C0; + /* 0x2C4 */ f32 unk2C4; } EnDns; // size = 0x02C8 #endif diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index 1097c47c4c4..e941edebf9b 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -649,7 +649,7 @@ s32 EnDodojr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f Matrix_MultVec3f(&D_809F7F64, &this->headPos); } - return false; + return 0; } void EnDodojr_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { 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 96ff5b3ff9a..e1516cd1bfd 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -92,7 +92,7 @@ typedef enum DogBehavior { /* 0x03 */ DOG_SIT, /* 0x04 */ DOG_SIT_2, /* 0x05 */ DOG_BOW, - /* 0x06 */ DOG_BOW_2 + /* 0x06 */ DOG_BOW_2, } DogBehavior; void EnDog_PlayWalkSFX(EnDog* this) { diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index a3ae11bf615..5d1c85a63a2 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -26,8 +26,8 @@ void EnDyExtra_Destroy(Actor* thisx, PlayState* play); void EnDyExtra_Update(Actor* thisx, PlayState* play); void EnDyExtra_Draw(Actor* thisx, PlayState* play); -void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play); -void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play); +void func_809FF7AC(EnDyExtra* this, PlayState* play); +void func_809FF840(EnDyExtra* this, PlayState* play); ActorProfile En_Dy_Extra_Profile = { /**/ ACTOR_EN_DY_EXTRA, @@ -51,30 +51,30 @@ void EnDyExtra_Init(Actor* thisx, PlayState* play) { PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ 大妖精効果 ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Big fairy effect ☆☆☆☆☆ %d\n") VT_RST, this->actor.params); this->type = this->actor.params; - this->scale.x = 0.025f; - this->scale.y = 0.039f; - this->scale.z = 0.025f; + this->unk_15C.x = 0.025f; + this->unk_15C.y = 0.039f; + this->unk_15C.z = 0.025f; this->unk_168 = this->actor.world.pos; this->actor.gravity = -0.2f; this->unk_158 = 1.0f; - this->timer = 60; - this->actionFunc = EnDyExtra_WaitForTrigger; + this->unk_154 = 0x3C; + this->actionFunc = func_809FF7AC; } -void EnDyExtra_WaitForTrigger(EnDyExtra* this, PlayState* play) { +void func_809FF7AC(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->actor.world.pos.y < -55.0f) { this->actor.velocity.y = 0.0f; } - if (this->timer == 0 && this->trigger != 0) { - this->timer = 200; - this->actionFunc = EnDyExtra_FallAndKill; + if (this->unk_154 == 0 && this->unk_152 != 0) { + this->unk_154 = 0xC8; + this->actionFunc = func_809FF840; } } -void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play) { +void func_809FF840(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); - if (this->timer == 0 || this->unk_158 < 0.02f) { + if (this->unk_154 == 0 || this->unk_158 < 0.02f) { Actor_Kill(&this->actor); return; } @@ -87,12 +87,10 @@ void EnDyExtra_FallAndKill(EnDyExtra* this, PlayState* play) { void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = (EnDyExtra*)thisx; - if (this->timer != 0) { - this->timer--; - } - this->actor.scale.x = this->scale.x; - this->actor.scale.y = this->scale.y; - this->actor.scale.z = this->scale.z; + DECR(this->unk_154); + this->actor.scale.x = this->unk_15C.x; + this->actor.scale.y = this->unk_15C.y; + this->actor.scale.z = this->unk_15C.z; Actor_PlaySfx(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); this->actionFunc(this, play); Actor_MoveXZGravity(&this->actor); diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h index a093b62b317..59f0329c024 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h @@ -12,11 +12,11 @@ typedef struct EnDyExtra { /* 0x0000 */ Actor actor; /* 0x014C */ EnDyExtraActionFunc actionFunc; /* 0x0150 */ s16 type; - /* 0x0152 */ s16 trigger; - /* 0x0154 */ s16 timer; + /* 0x0152 */ s16 unk_152; + /* 0x0154 */ s16 unk_154; /* 0x0158 */ f32 unk_158; - /* 0x015C */ Vec3f scale; - /* 0x0168 */ Vec3f unk_168; // Set and not used + /* 0x015C */ Vec3f unk_15C; + /* 0x0168 */ Vec3f unk_168; } EnDyExtra; // size = 0x0174 #endif 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 c882e0e973f..b2313bf8a3c 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -684,7 +684,6 @@ void func_80A0329C(EnElf* this, PlayState* play) { } if (!(this->fairyFlags & FAIRY_FLAG_BIG)) { - // GI_MAX in this case allows the player to catch the actor in a bottle Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 60.0f); } } 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 95bdbd2ee2e..344d813db78 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 @@ -325,7 +325,7 @@ void EnExItem_BowlPrize(EnExItem* this, PlayState* play) { PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 動いてねー? ☆☆☆☆☆ %x\n", " ☆☆☆☆☆ Is it moving? ☆☆☆☆☆ %x\n") VT_RST, this->actor.parent->update); if ((this->actor.parent != NULL) && (this->actor.parent->update != NULL)) { - ((EnBomBowlPit*)this->actor.parent)->exItemDone = 1; + ((EnBomBowlPit*)this->actor.parent)->unk156 = 1; PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ さぁきえるぞ! ☆☆☆☆☆ \n", " ☆☆☆☆☆ Now it's gone! ☆☆☆☆☆ \n") VT_RST); } Actor_Kill(&this->actor); @@ -402,30 +402,30 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { this->actor.world.pos.z += (tmpf3 / tmpf4) * 5.0f; } } else { - s32 getItemId; + s32 itemId; this->actor.draw = NULL; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); this->actor.parent = NULL; if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { - getItemId = GI_BULLET_BAG_40; + itemId = GI_BULLET_BAG_40; } else { - getItemId = GI_BULLET_BAG_50; + itemId = GI_BULLET_BAG_50; } - Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, itemId, 2000.0f, 1000.0f); this->actionFunc = EnExItem_TargetPrizeGive; } } void EnExItem_TargetPrizeGive(EnExItem* this, PlayState* play) { - s32 getItemId; + s32 itemId; if (Actor_HasParent(&this->actor, play)) { this->actionFunc = EnExItem_TargetPrizeFinish; } else { - getItemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40; + itemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40; - Actor_OfferGetItem(&this->actor, play, getItemId, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, itemId, 2000.0f, 1000.0f); } } 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 d9c95c05d3e..6d5749a424a 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -1,9 +1,3 @@ -/* - * File: z_en_fd.c - * Overlay: ovl_En_Fd - * Description: Flare Dancer (enflamed form) - */ - #include "z_en_fd.h" #include "libc64/math64.h" @@ -340,7 +334,7 @@ s32 EnFd_ColliderCheck(EnFd* this, PlayState* play) { */ s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, PlayState* play) { CollisionPoly* colPoly; - s32 bgId; + u32 bgId; Vec3f colPoint; s16 angle; s32 pad; @@ -428,7 +422,7 @@ Vec3f* EnFd_GetPosAdjAroundCircle(Vec3f* dst, EnFd* this, f32 radius, s16 dir) { s32 EnFd_ShouldStopRunning(EnFd* this, PlayState* play, f32 radius, s16* runDir) { CollisionPoly* poly; - s32 bgId; + u32 bgId; Vec3f colPoint; Vec3f pos; @@ -653,7 +647,7 @@ void EnFd_Run(EnFd* this, PlayState* play) { #define FLG_COREDONE (0x8000) /** - * En_Fw will set `this` params when it is done with its action. + * En_Fw will set `this` params when it is done with it's action. * It will set FLG_COREDONE when the core has returned to `this`'s initial * position, and FLG_COREDEAD when there is no health left */ 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 b65a6a92ddc..8184f6820ba 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 @@ -487,7 +487,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { switch (this->work[FHGFIRE_FIRE_MODE]) { case FHGFIRE_LIGHT_GREEN: canBottleReflect1 = - ((player->stateFlags1 & PLAYER_STATE1_SWINGING_BOTTLE) && + ((player->stateFlags1 & PLAYER_STATE1_1) && (ABS((s16)(player->actor.shape.rot.y - (s16)(bossGnd->actor.yawTowardsPlayer + 0x8000))) < 0x2000) && (sqrtf(SQ(dxL) + SQ(dyL) + SQ(dzL)) <= 25.0f)) 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 93ca3bc91bf..45a644b73d9 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -1,9 +1,3 @@ -/* - * File: z_en_firefly.c - * Overlay: ovl_En_Firefly - * Description: Keese (Normal, Fire, Ice) - */ - #include "z_en_firefly.h" #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" @@ -30,26 +24,19 @@ void EnFirefly_Init(Actor* thisx, PlayState* play); void EnFirefly_Destroy(Actor* thisx, PlayState* play); void EnFirefly_Update(Actor* thisx, PlayState* play2); -void EnFirefly_Draw(Actor* thisx, PlayState* play); - -void EnFirefly_DrawInvisible(Actor* thisx, PlayState* play); - -void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play); -void EnFirefly_Fall(EnFirefly* this, PlayState* play); -void EnFirefly_Die(EnFirefly* this, PlayState* play); -void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play); -void EnFirefly_Rebound(EnFirefly* this, PlayState* play); -void EnFirefly_FlyAway(EnFirefly* this, PlayState* play); -void EnFirefly_Stunned(EnFirefly* this, PlayState* play); -void EnFirefly_FrozenFall(EnFirefly* this, PlayState* play); -void EnFirefly_Perch(EnFirefly* this, PlayState* play); -void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play); - -typedef enum KeeseAuraType { - /* 0 */ KEESE_AURA_NONE, - /* 1 */ KEESE_AURA_FIRE, - /* 2 */ KEESE_AURA_ICE -} KeeseAuraType; +void EnFirefly_DrawOpa(Actor* thisx, PlayState* play); + +void func_80A13A08_Action(EnFirefly*, PlayState*); +void func_80A13C98_Action(EnFirefly*, PlayState*); +void func_80A13D68_Action(EnFirefly*, PlayState*); +void func_80A13DE4_Action(EnFirefly*, PlayState*); +void func_80A13FF4_Action(EnFirefly*, PlayState*); +void func_80A14088_Action(EnFirefly*, PlayState*); +void func_80A141F0_Action(EnFirefly*, PlayState*); +void func_80A14294_Action(EnFirefly*, PlayState*); +void func_80A142F4_Action_Perched_(EnFirefly*, PlayState*); +void func_80A143B4_Action_SwoopOnPlayer(EnFirefly*, PlayState*); +void EnFirefly_DrawXlu(Actor*, PlayState*); ActorProfile En_Firefly_Profile = { /**/ ACTOR_EN_FIREFLY, @@ -60,154 +47,99 @@ ActorProfile En_Firefly_Profile = { /**/ EnFirefly_Init, /**/ EnFirefly_Destroy, /**/ EnFirefly_Update, - /**/ EnFirefly_Draw, + /**/ EnFirefly_DrawOpa, }; - -static ColliderJntSphElementInit sJntSphElementsInit[] = { - { - { - ELEM_MATERIAL_UNK0, - { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_FIRE, 0x08 }, - { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_HARD, - ACELEM_ON, - OCELEM_ON, - }, - { 1, { { 0, 1000, 0 }, 15 }, 100 }, - }, +static ColliderJntSphElementInit D_80A14F30 = { + { 0, { 0xFFCFFFFF, 1, 8 }, { 0xFFCFFFFF, 0, 0 }, 9, 1, 1 }, + { 1, { { 0, 0x3E8, 0 }, 0xF }, 0x64 }, }; - -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit D_80A14F54 = { { 3, 0x11, 9, 0x39, 0x10, 0 }, 1, &D_80A14F30 }; +static CollisionCheckInfoInit D_80A14F64 = { 1, 0xA, 0xA, 0x1E }; +static DamageTable D_80A14F6C = { { - COL_MATERIAL_HIT3, - AT_ON | AT_TYPE_ENEMY, - AC_ON | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_JNTSPH, + 0x10, 2, 1, 2, 1, 2, 2, 2, 1, 2, 4, 0xF2, 0x34, 2, 2, 2, 2, 0x20, 0x34, 0, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, -}; - -static CollisionCheckInfoInit sColChkInfoInit = { 1, 10, 10, 30 }; - -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0x0), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(2, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0x0), - /* Master sword */ DMG_ENTRY(2, 0x0), - /* Giant's Knife */ DMG_ENTRY(4, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0xF), - /* Ice arrow */ DMG_ENTRY(4, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(0, 0x2), - /* Ice magic */ DMG_ENTRY(4, 0x3), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0x0), - /* Giant spin */ DMG_ENTRY(4, 0x0), - /* Master spin */ DMG_ENTRY(2, 0x0), - /* Kokiri jump */ DMG_ENTRY(2, 0x0), - /* Giant jump */ DMG_ENTRY(8, 0x0), - /* Master jump */ DMG_ENTRY(4, 0x0), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80A14F8C[5] = { ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(minVelocityY, -4, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 4000, ICHAIN_STOP), }; - -void EnFirefly_Extinguish(EnFirefly* this) { +static Color_RGBA8 D_80A14FA0 = { 0xFF, 0xFF, 0x64, 0xFF }; +static Color_RGBA8 D_80A14FA4 = { 0xFF, 0x32, 0, 0 }; +static Color_RGBA8 D_80A14FA8 = { 0x64, 0xC8, 0xFF, 0xFF }; +static Color_RGBA8 D_80A14FAC = { 0, 0, 0xFF, 0 }; +static Vec3f D_80A14FB0 = { 0.0f, 0.5f, 0.0f }; +static Vec3f D_80A14FBC = { 0.0f, 0.5f, 0.0f }; +static Vec3f D_80A14FC8 = { 0.0f, 0.0f, 0.0f }; + +void func_80A13070_Unignite_(EnFirefly* this) { this->actor.params += 2; - this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; - this->auraType = KEESE_AURA_NONE; - this->onFire = false; + this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; + this->unk1B8 = 0; + this->unk1B9 = 0; this->actor.naviEnemyId = NAVI_ENEMY_KEESE; } -void EnFirefly_Ignite(EnFirefly* this) { - if (this->actor.params == KEESE_ICE_FLY) { - this->actor.params = KEESE_FIRE_FLY; +void func_80A13098_Ignite_(EnFirefly* this) { + if (this->actor.params == 4) { + this->actor.params = 0; } else { this->actor.params -= 2; } - this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_FIRE; - this->auraType = KEESE_AURA_FIRE; - this->onFire = true; + this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_FIRE; + this->unk1B8 = 1; + this->unk1B9 = 1; this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; } void EnFirefly_Init(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->actor, D_80A14F8C); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 28); + SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->unk1BE, this->unk266, 0x1C); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - - if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1) != 0) { + Collider_SetJntSph(play, &this->collider, &this->actor, &D_80A14F54, this->colliderElements); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80A14F6C, &D_80A14F64); + if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; - if (1) {} - this->actor.draw = EnFirefly_DrawInvisible; + thisx->draw = EnFirefly_DrawXlu; this->actor.params &= 0x7FFF; } - - if (this->actor.params <= KEESE_FIRE_PERCH) { - this->onFire = true; + if (this->actor.params < 2) { + this->unk1B9 = 1; } else { - this->onFire = false; + this->unk1B9 = 0; } - - if (this->onFire) { - this->actionFunc = EnFirefly_FlyIdle; - this->timer = Rand_S16Offset(20, 60); + if (this->unk1B9 != 0) { + this->actionFunc = func_80A13A08_Action; + this->unk1BA_timer = Rand_S16Offset(20, 60); this->actor.shape.rot.x = 0x1554; - this->auraType = KEESE_AURA_FIRE; + this->unk1B8 = 1; this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; - this->maxAltitude = this->actor.home.pos.y; + this->unk310_homeY = this->actor.home.pos.y; } else { - if (this->actor.params == KEESE_NORMAL_PERCH) { - this->actionFunc = EnFirefly_Perch; + if (this->actor.params == 3) { + this->actionFunc = func_80A142F4_Action_Perched_; } else { - this->actionFunc = EnFirefly_FlyIdle; + this->actionFunc = func_80A13A08_Action; } - - if (this->actor.params == KEESE_ICE_FLY) { - this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_ICE; + if (this->actor.params == 4) { + this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_ICE; this->actor.naviEnemyId = NAVI_ENEMY_ICE_KEESE; } else { - this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; + this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; this->actor.naviEnemyId = NAVI_ENEMY_KEESE; } - - this->maxAltitude = this->actor.home.pos.y + 100.0f; - - if (this->actor.params == KEESE_ICE_FLY) { - this->auraType = KEESE_AURA_ICE; + this->unk310_homeY = this->actor.home.pos.y + 100.0f; + if (this->actor.params == 4) { + this->unk1B8 = 2; } else { - this->auraType = KEESE_AURA_NONE; + this->unk1B8 = 0; } } - - this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; + this->collider.elements->dim.worldSphere.radius = D_80A14F54.elements->dim.modelSphere.radius; } void EnFirefly_Destroy(Actor* thisx, PlayState* play) { @@ -216,224 +148,229 @@ void EnFirefly_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -void EnFirefly_SetupFlyIdle(EnFirefly* this) { - this->timer = Rand_S16Offset(70, 100); +void func_80A132F4_Setup(EnFirefly* this) { + s32 var_v0; + + this->unk1BA_timer = Rand_S16Offset(0x46, 0x64); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); - this->targetPitch = ((this->maxAltitude < this->actor.world.pos.y) ? 0xC00 : -0xC00) + 0x1554; + if (this->unk310_homeY < this->actor.world.pos.y) { + var_v0 = 0xC00; + } else { + var_v0 = -0xC00; + } + this->unk1BC_targetRotX = var_v0 + 0x1554; this->skelAnime.playSpeed = 1.0f; - this->actionFunc = EnFirefly_FlyIdle; + this->actionFunc = func_80A13A08_Action; } -void EnFirefly_SetupFall(EnFirefly* this) { - this->timer = 40; +void func_80A133A0_Setup(EnFirefly* this) { + this->unk1BA_timer = 0x28; this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &gKeeseFlyAnim, 0.5f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); - this->actionFunc = EnFirefly_Fall; + this->actionFunc = func_80A13C98_Action; } -void EnFirefly_SetupDie(EnFirefly* this) { - this->timer = 15; +void func_80A13444_Setup(EnFirefly* this) { + this->unk1BA_timer = 0xF; + this->actionFunc = func_80A13D68_Action; this->actor.speed = 0.0f; - this->actionFunc = EnFirefly_Die; } -void EnFirefly_SetupRebound(EnFirefly* this) { +void func_80A13464_Setup(EnFirefly* this) { this->actor.world.rot.x = 0x7000; - this->timer = 18; + this->unk1BA_timer = 18; + this->actionFunc = func_80A13FF4_Action; this->skelAnime.playSpeed = 1.0f; this->actor.speed = 2.5f; - this->actionFunc = EnFirefly_Rebound; } -void EnFirefly_SetupDiveAttack(EnFirefly* this) { - this->timer = Rand_S16Offset(70, 100); +void func_80A1349C_Setup(EnFirefly* this) { + s32 var_v0; + + this->unk1BA_timer = Rand_S16Offset(70, 100); this->skelAnime.playSpeed = 1.0f; - this->targetPitch = ((this->actor.yDistToPlayer > 0.0f) ? -0xC00 : 0xC00) + 0x1554; - this->actionFunc = EnFirefly_DiveAttack; + if (this->actor.yDistToPlayer > 0.0f) { + var_v0 = -0xC00; + } else { + var_v0 = 0xC00; + } + this->unk1BC_targetRotX = var_v0 + 0x1554; + this->actionFunc = func_80A13DE4_Action; } -void EnFirefly_SetupFlyAway(EnFirefly* this) { - this->timer = 150; +void func_80A1350C_Setup(EnFirefly* this) { + this->unk1BA_timer = 150; + this->unk1BC_targetRotX = 0x954; + this->actionFunc = func_80A14088_Action; this->skelAnime.playSpeed = 1.0f; - this->targetPitch = 0x954; - this->actionFunc = EnFirefly_FlyAway; } -void EnFirefly_SetupStunned(EnFirefly* this) { - this->timer = 80; +void func_80A13538_Setup(EnFirefly* this) { + this->unk1BA_timer = 80; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); - this->auraType = KEESE_AURA_NONE; + this->unk1B8 = 0; this->actor.velocity.y = 0.0f; this->skelAnime.playSpeed = 3.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->actionFunc = EnFirefly_Stunned; + this->actionFunc = func_80A141F0_Action; } -void EnFirefly_SetupFrozenFall(EnFirefly* this, PlayState* play) { - s32 i; - Vec3f iceParticlePos; +void func_80A135A8_Setup(EnFirefly* this, PlayState* play) { + s32 var_s0; + Vec3f sp78; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->auraType = KEESE_AURA_NONE; + this->unk1B8 = 0; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 255); Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); - - for (i = 0; i <= 7; i++) { - iceParticlePos.x = (i & 1 ? 7.0f : -7.0f) + this->actor.world.pos.x; - iceParticlePos.y = (i & 2 ? 7.0f : -7.0f) + this->actor.world.pos.y; - iceParticlePos.z = (i & 4 ? 7.0f : -7.0f) + this->actor.world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &iceParticlePos, 150, 150, 150, 250, 235, 245, 255, + for (var_s0 = 0; var_s0 < 8; var_s0++) { + sp78.x = this->actor.world.pos.x + ((var_s0 & 1) ? 7.0f : -7.0f); + sp78.y = this->actor.world.pos.y + ((var_s0 & 2) ? 7.0f : -7.0f); + sp78.z = this->actor.world.pos.z + ((var_s0 & 4) ? 7.0f : -7.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp78, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.15f) + 0.85f); } - - this->actionFunc = EnFirefly_FrozenFall; + this->actionFunc = func_80A14294_Action; } -void EnFirefly_SetupPerch(EnFirefly* this) { - this->timer = 1; +void func_80A13744_Setup_Perched_(EnFirefly* this) { + this->unk1BA_timer = 1; + this->actionFunc = func_80A142F4_Action_Perched_; this->actor.speed = 0.0f; - this->actionFunc = EnFirefly_Perch; } -void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { +void func_80A13764_Setup_SwoopOnPlayer(EnFirefly* this) { this->skelAnime.playSpeed = 3.0f; this->actor.shape.rot.x = 0x1554; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->timer = 50; + this->unk1BA_timer = 50; this->actor.speed = 3.0f; - this->actionFunc = EnFirefly_DisturbDiveAttack; + this->actionFunc = func_80A143B4_Action_SwoopOnPlayer; } -s32 EnFirefly_ReturnToPerch(EnFirefly* this, PlayState* play) { +s32 func_80A1379C_HoneInOnHomeIfPlayerFar_(EnFirefly* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 distFromHome; + f32 temp_fv0; + f32 temp_fv1; - if (this->actor.params != KEESE_NORMAL_PERCH) { - return 0; + if (this->actor.params != 3) { + return false; } - if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) > 300.0f) { - distFromHome = Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos); - - if (distFromHome < 5.0f) { - EnFirefly_SetupPerch(this); - return 1; - } - - distFromHome *= 0.05f; - - if (distFromHome < 1.0f) { - this->actor.speed *= distFromHome; + temp_fv0 = Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos); + if (temp_fv0 < 5.0f) { + func_80A13744_Setup_Perched_(this); + } else { + temp_fv1 = temp_fv0 * 0.05f; + if (temp_fv1 < 1.0f) { + this->actor.speed *= temp_fv1; + } + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x300); + Math_ScaledStepToS(&this->actor.shape.rot.x, + Actor_WorldPitchTowardPoint(&this->actor, &this->actor.home.pos) + 0x1554, 0x100); } - - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), - 0x300); - Math_ScaledStepToS(&this->actor.shape.rot.x, - Actor_WorldPitchTowardPoint(&this->actor, &this->actor.home.pos) + 0x1554, 0x100); - return 1; - } - - return 0; -} - -s32 EnFirefly_SeekTorch(EnFirefly* this, PlayState* play) { - ObjSyokudai* findTorch; - ObjSyokudai* closestTorch; - f32 torchDist; - f32 currentMinDist; - Vec3f flamePos; - - findTorch = (ObjSyokudai*)play->actorCtx.actorLists[ACTORCAT_PROP].head; - closestTorch = NULL; - currentMinDist = 35000.0f; - - while (findTorch != NULL) { - if ((findTorch->actor.id == ACTOR_OBJ_SYOKUDAI) && (findTorch->litTimer != 0)) { - torchDist = Actor_WorldDistXYZToActor(&this->actor, &findTorch->actor); - if (torchDist < currentMinDist) { - currentMinDist = torchDist; - closestTorch = findTorch; + return true; + } else { + return false; + } +} + +s32 func_80A138B8_HoneInOnLitTorch(EnFirefly* this, PlayState* play) { + Actor* iter; + f32 closestLitTorchDist; + f32 dist; + Actor* closestLitTorch; + Vec3f torchFlamePos; + + iter = play->actorCtx.actorLists[ACTORCAT_PROP].head; + closestLitTorch = NULL; + closestLitTorchDist = 35000.0f; + while (iter != NULL) { + if ((iter->id == ACTOR_OBJ_SYOKUDAI) && (((ObjSyokudai*)iter)->litTimer != 0)) { + dist = Actor_WorldDistXYZToActor(&this->actor, iter); + if (dist < closestLitTorchDist) { + closestLitTorchDist = dist; + closestLitTorch = iter; } } - findTorch = (ObjSyokudai*)findTorch->actor.next; - } - - if (closestTorch != NULL) { - flamePos.x = closestTorch->actor.world.pos.x; - flamePos.y = closestTorch->actor.world.pos.y + 52.0f + 15.0f; - flamePos.z = closestTorch->actor.world.pos.z; - if (Actor_WorldDistXYZToPoint(&this->actor, &flamePos) < 15.0f) { - EnFirefly_Ignite(this); - return 1; + iter = iter->next; + } + if (closestLitTorch != NULL) { + torchFlamePos.x = closestLitTorch->world.pos.x; + torchFlamePos.y = closestLitTorch->world.pos.y + 52.0f + 15.0f; + torchFlamePos.z = closestLitTorch->world.pos.z; + if (Actor_WorldDistXYZToPoint(&this->actor, &torchFlamePos) < 15.0f) { + func_80A13098_Ignite_(this); + return true; } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &closestTorch->actor), + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, closestLitTorch), 0x300); - Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &flamePos) + 0x1554, - 0x100); - return 1; + Math_ScaledStepToS(&this->actor.shape.rot.x, + Actor_WorldPitchTowardPoint(&this->actor, &torchFlamePos) + 0x1554, 0x100); + return true; } + } else { + return false; } - return 0; } -void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { - s32 skelanimeUpdated; - f32 rand; +void func_80A13A08_Action(EnFirefly* this, PlayState* play) { + s32 sp3C; + f32 temp_fv0; SkelAnime_Update(&this->skelAnime); - if (this->timer != 0) { - this->timer--; + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } - skelanimeUpdated = Animation_OnFrame(&this->skelAnime, 0.0f); + sp3C = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; - if (this->onFire || (this->actor.params == KEESE_ICE_FLY) || - ((EnFirefly_ReturnToPerch(this, play) == 0) && (EnFirefly_SeekTorch(this, play) == 0))) { - if (skelanimeUpdated) { - rand = Rand_ZeroOne(); - if (rand < 0.5f) { + if ((this->unk1B9 != 0) || (this->actor.params == 4) || + (!func_80A1379C_HoneInOnHomeIfPlayerFar_(this, play) && !func_80A138B8_HoneInOnLitTorch(this, play))) { + if (sp3C != 0) { + temp_fv0 = Rand_ZeroOne(); + if (temp_fv0 < 0.5f) { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); - } else if (rand < 0.8f) { - this->actor.shape.rot.y += Rand_CenteredFloat(1536.0f); + } else if (temp_fv0 < 0.8f) { + f32 new_var = Rand_CenteredFloat(1536.0f); + + this->actor.shape.rot.y = (s16)(s32)(this->actor.shape.rot.y + new_var); } - // Climb if too close to ground if (this->actor.world.pos.y < (this->actor.floorHeight + 20.0f)) { - this->targetPitch = 0x954; - // Descend if above maxAltitude - } else if (this->maxAltitude < this->actor.world.pos.y) { - this->targetPitch = 0x2154; - // Otherwise ascend or descend at random, biased towards ascending - } else if (0.35f < Rand_ZeroOne()) { - this->targetPitch = 0x954; + this->unk1BC_targetRotX = 0x954; + } else if (this->unk310_homeY < this->actor.world.pos.y) { + this->unk1BC_targetRotX = 0x2154; + } else if (Rand_ZeroOne() > 0.35f) { + this->unk1BC_targetRotX = 0x954; } else { - this->targetPitch = 0x2154; + this->unk1BC_targetRotX = 0x2154; } } else { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->targetPitch = 0x954; + this->unk1BC_targetRotX = 0x954; } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || - (this->maxAltitude < this->actor.world.pos.y)) { - this->targetPitch = 0x2154; + (this->unk310_homeY < this->actor.world.pos.y)) { + this->unk1BC_targetRotX = 0x2154; } } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } - if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { - EnFirefly_SetupDiveAttack(this); + if ((this->unk1BA_timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != 2)) { + func_80A1349C_Setup(this); } } -// Fall to the ground after being hit -void EnFirefly_Fall(EnFirefly* this, PlayState* play) { - if (Animation_OnFrame(&this->skelAnime, 6.0f)) { +void func_80A13C98_Action(EnFirefly* this, PlayState* play) { + if (Animation_OnFrame(&this->skelAnime, 6.0f) != 0) { this->skelAnime.playSpeed = 0.0f; } this->actor.colorFilterTimer = 40; @@ -444,242 +381,226 @@ void EnFirefly_Fall(EnFirefly* this, PlayState* play) { } else { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x6800, 0x200); this->actor.shape.rot.y -= 0x300; - if (this->timer != 0) { - this->timer--; + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->timer == 0)) { - EnFirefly_SetupDie(this); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->unk1BA_timer == 0)) { + func_80A13444_Setup(this); } } } -// Hit the ground or burn up, spawn drops -void EnFirefly_Die(EnFirefly* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; +void func_80A13D68_Action(EnFirefly* this, PlayState* play) { + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } Math_StepToF(&this->actor.scale.x, 0.0f, 0.00034f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; - if (this->timer == 0) { + if (this->unk1BA_timer == 0) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false)); Actor_Kill(&this->actor); } } -void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { - Player* player = GET_PLAYER(play); - Vec3f preyPos; +void func_80A13DE4_Action(EnFirefly* this, PlayState* play) { + Actor* sp44; + Vec3f sp38; + sp44 = play->actorCtx.actorLists[2].head; SkelAnime_Update(&this->skelAnime); - if (this->timer != 0) { - this->timer--; + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } Math_StepToF(&this->actor.speed, 4.0f, 0.5f); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); - } else if (Actor_IsFacingPlayer(&this->actor, 0x2800)) { - if (Animation_OnFrame(&this->skelAnime, 4.0f)) { + Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); + } else if (Actor_IsFacingPlayer(&this->actor, 0x2800) != 0) { + if (Animation_OnFrame(&this->skelAnime, 4.0f) != 0) { this->skelAnime.playSpeed = 0.0f; this->skelAnime.curFrame = 4.0f; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300); - preyPos.x = player->actor.world.pos.x; - preyPos.y = player->actor.world.pos.y + 20.0f; - preyPos.z = player->actor.world.pos.z; - Math_SmoothStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &preyPos) + 0x1554, 2, - 0x400, 0x100); + sp38.x = sp44->world.pos.x; + sp38.y = sp44->world.pos.y + 20.0f; + sp38.z = sp44->world.pos.z; + Math_SmoothStepToS(&this->actor.shape.rot.x, + (s16)(Actor_WorldPitchTowardPoint(&this->actor, (Vec3f*)&sp38) + 0x1554), 2, 0x400, 0x100); } else { this->skelAnime.playSpeed = 1.5f; if (this->actor.xzDistToPlayer > 80.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->targetPitch = 0x954; + this->unk1BC_targetRotX = 0x954; } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->maxAltitude < this->actor.world.pos.y)) { - this->targetPitch = 0x2154; + if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->unk310_homeY < this->actor.world.pos.y)) { + this->unk1BC_targetRotX = 0x2154; } else { - this->targetPitch = 0x954; + this->unk1BC_targetRotX = 0x954; } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); } - if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL)) { - EnFirefly_SetupFlyAway(this); + if ((this->unk1BA_timer == 0) || (Player_GetMask(play) == 2)) { + func_80A1350C_Setup(this); } } -// Knockback after hitting player -void EnFirefly_Rebound(EnFirefly* this, PlayState* play) { +void func_80A13FF4_Action(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); Math_StepToF(&this->actor.velocity.y, 0.0f, 0.4f); - if (Math_StepToF(&this->actor.speed, 0.0f, 0.15f)) { - if (this->timer != 0) { - this->timer--; + if (Math_StepToF(&this->actor.speed, 0.0f, 0.15f) != 0) { + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } - if (this->timer == 0) { - EnFirefly_SetupFlyAway(this); + if (this->unk1BA_timer == 0) { + func_80A1350C_Setup(this); } } } -void EnFirefly_FlyAway(EnFirefly* this, PlayState* play) { +void func_80A14088_Action(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->timer != 0) { - this->timer--; + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } - if (((fabsf(this->actor.world.pos.y - this->maxAltitude) < 10.0f) && + if (((fabsf(this->actor.world.pos.y - this->unk310_homeY) < 10.0f) && (Math_Vec3f_DistXZ(&this->actor.world.pos, &this->actor.home.pos) < 20.0f)) || - (this->timer == 0)) { - EnFirefly_SetupFlyIdle(this); - return; - } - Math_StepToF(&this->actor.speed, 3.0f, 0.3f); - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->targetPitch = 0x954; - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->maxAltitude < this->actor.world.pos.y)) { - this->targetPitch = 0x2154; + (this->unk1BA_timer == 0)) { + func_80A132F4_Setup(this); } else { - this->targetPitch = 0x954; - } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); - } else { - Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), - 0x300); + Math_StepToF(&this->actor.speed, 3.0f, 0.3f); + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + this->unk1BC_targetRotX = 0x954; + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->unk310_homeY < this->actor.world.pos.y)) { + this->unk1BC_targetRotX = 0x2154; + } else { + this->unk1BC_targetRotX = 0x954; + } + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); + } else { + Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), + 0x300); + } + Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } -void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { +void func_80A141F0_Action(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speed, 0.0f, 0.5f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1554, 0x100); - if (this->timer != 0) { - this->timer--; - } - if (this->timer == 0) { - if (this->onFire) { - this->auraType = KEESE_AURA_FIRE; - } else if (this->actor.params == KEESE_ICE_FLY) { - this->auraType = KEESE_AURA_ICE; + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; + } + if (this->unk1BA_timer == 0) { + if (this->unk1B9 != 0) { + this->unk1B8 = 1; + } else if (this->actor.params == 4) { + this->unk1B8 = 2; } - EnFirefly_SetupFlyIdle(this); + func_80A132F4_Setup(this); } } -void EnFirefly_FrozenFall(EnFirefly* this, PlayState* play) { +void func_80A14294_Action(EnFirefly* this, PlayState* play) { #if OOT_VERSION < NTSC_1_1 - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.floorHeight == BGCHECK_Y_MIN)) + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #else - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #endif - { this->actor.colorFilterTimer = 0; - EnFirefly_SetupDie(this); + func_80A13444_Setup(this); } else { - this->actor.colorFilterTimer = 255; + this->actor.colorFilterTimer = 0xFF; } } -// When perching, sit on collision and flap at random intervals -void EnFirefly_Perch(EnFirefly* this, PlayState* play) { +void func_80A142F4_Action_Perched_(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); - - if (this->timer != 0) { + if (this->unk1BA_timer != 0) { SkelAnime_Update(&this->skelAnime); - if (Animation_OnFrame(&this->skelAnime, 6.0f)) { - this->timer--; + if (Animation_OnFrame(&this->skelAnime, 6.0f) != 0) { + this->unk1BA_timer--; } } else if (Rand_ZeroOne() < 0.02f) { - this->timer = 1; + this->unk1BA_timer = 1; } - if (this->actor.xzDistToPlayer < 120.0f) { - EnFirefly_SetupDisturbDiveAttack(this); + func_80A13764_Setup_SwoopOnPlayer(this); } } -void EnFirefly_DisturbDiveAttack(EnFirefly* this, PlayState* play) { - Player* player = GET_PLAYER(play); - Vec3f preyPos; +void func_80A143B4_Action_SwoopOnPlayer(EnFirefly* this, PlayState* play) { + Player* temp_a2 = GET_PLAYER(play); + Vec3f sp28; SkelAnime_Update(&this->skelAnime); - - if (this->timer != 0) { - this->timer--; + if (this->unk1BA_timer != 0) { + this->unk1BA_timer--; } - - if (this->timer < 40) { + if (this->unk1BA_timer < 40) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0xAAC, 0x100); } else { - preyPos.x = player->actor.world.pos.x; - preyPos.y = player->actor.world.pos.y + 20.0f; - preyPos.z = player->actor.world.pos.z; - Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &preyPos) + 0x1554, - 0x100); + sp28.x = temp_a2->actor.world.pos.x; + sp28.y = temp_a2->actor.world.pos.y + 20.0f; + sp28.z = temp_a2->actor.world.pos.z; + Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &sp28) + 0x1554, 0x100); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x300); } - - if (this->timer == 0) { - EnFirefly_SetupFlyIdle(this); + if (this->unk1BA_timer == 0) { + func_80A132F4_Setup(this); } } -void EnFirefly_Combust(EnFirefly* this, PlayState* play) { - s32 i; +void func_80A1448C_SpawnFireEffects(EnFirefly* this, PlayState* play) { + s32 bodyPart; - for (i = 0; i <= 2; i++) { - EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0, 0, i); + for (bodyPart = 0; bodyPart < EN_FIREFLY_BODY_PART_MAX; bodyPart++) { + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0, 0, bodyPart); } - - this->auraType = KEESE_AURA_NONE; + this->unk1B8 = 0; } -void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { - u8 damageReaction; - +void func_80A1450C_ReactToAC(EnFirefly* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Actor_SetDropFlag(&this->actor, &this->collider.elements[0].base, true); - + Actor_SetDropFlag(&this->actor, &this->collider.elements->base, true); if ((this->actor.colChkInfo.damageReaction != 0) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } - - damageReaction = this->actor.colChkInfo.damageReaction; - - if (damageReaction == 2) { // Din's Fire - if (this->actor.params == KEESE_ICE_FLY) { + if (this->actor.colChkInfo.damageReaction == 2) { + if (this->actor.params == 4) { this->actor.colChkInfo.health = 0; Enemy_StartFinishingBlow(play, &this->actor); - EnFirefly_Combust(this, play); - EnFirefly_SetupFall(this); - } else if (!this->onFire) { - EnFirefly_Ignite(this); - if (this->actionFunc == EnFirefly_Perch) { - EnFirefly_SetupFlyIdle(this); + func_80A1448C_SpawnFireEffects(this, play); + func_80A133A0_Setup(this); + } else if (this->unk1B9 == 0) { + func_80A13098_Ignite_(this); + if (this->actionFunc == func_80A142F4_Action_Perched_) { + func_80A132F4_Setup(this); } } - } else if (damageReaction == 3) { // Ice Arrows or Ice Magic - if (this->actor.params == KEESE_ICE_FLY) { - EnFirefly_SetupFall(this); + } else if (this->actor.colChkInfo.damageReaction == 3) { + if (this->actor.params == 4) { + func_80A133A0_Setup(this); } else { - EnFirefly_SetupFrozenFall(this, play); + func_80A135A8_Setup(this, play); } - } else if (damageReaction == 1) { // Deku Nuts - if (this->actionFunc != EnFirefly_Stunned) { - EnFirefly_SetupStunned(this); + } else if (this->actor.colChkInfo.damageReaction == 1) { + if (this->actionFunc != func_80A141F0_Action) { + func_80A13538_Setup(this); } - } else { // Fire Arrows - if ((damageReaction == 0xF) && (this->actor.params == KEESE_ICE_FLY)) { - EnFirefly_Combust(this, play); + } else { + if ((this->actor.colChkInfo.damageReaction == 0xF) && (this->actor.params == 4)) { + func_80A1448C_SpawnFireEffects(this, play); } - EnFirefly_SetupFall(this); + func_80A133A0_Setup(this); } } } @@ -688,64 +609,57 @@ void EnFirefly_UpdateDamage(EnFirefly* this, PlayState* play) { void EnFirefly_Update(Actor* thisx, PlayState* play2) { EnFirefly* this = (EnFirefly*)thisx; PlayState* play = play2; + f32 sp34; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_ATTACK); - if (this->onFire) { - EnFirefly_Extinguish(this); + if (this->unk1B9 != 0) { + func_80A13070_Unignite_(this); } - if (this->actionFunc != EnFirefly_DisturbDiveAttack) { - EnFirefly_SetupRebound(this); + if (this->actionFunc != func_80A143B4_Action_SwoopOnPlayer) { + func_80A13464_Setup(this); } } - - EnFirefly_UpdateDamage(this, play); - + func_80A1450C_ReactToAC(this, play); this->actionFunc(this, play); - if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { - if ((this->actor.colChkInfo.health == 0) || (this->actionFunc == EnFirefly_Stunned)) { + if ((this->actor.colChkInfo.health == 0) || ((this->actionFunc == func_80A141F0_Action))) { Actor_MoveXZGravity(&this->actor); } else { - if (this->actionFunc != EnFirefly_Rebound) { + if (this->actionFunc != func_80A13FF4_Action) { this->actor.world.rot.x = 0x1554 - this->actor.shape.rot.x; } Actor_MoveXYZ(&this->actor); } } - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 15.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); - this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; - this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + 10.0f; - this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; - - if ((this->actionFunc == EnFirefly_DiveAttack) || (this->actionFunc == EnFirefly_DisturbDiveAttack)) { + this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.elements->dim.worldSphere.center.y = this->actor.world.pos.y + 10.0f; + this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; + if ((this->actionFunc == func_80A13DE4_Action) || (this->actionFunc == func_80A143B4_Action_SwoopOnPlayer)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->actor.colChkInfo.health != 0) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Animation_OnFrame(&this->skelAnime, 5.0f)) { + if (Animation_OnFrame(&this->skelAnime, 5.0f) != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_FLY); } } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - this->actor.focus.pos.x = - (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y)) + this->actor.world.pos.x; - this->actor.focus.pos.y = (10.0f * Math_CosS(this->actor.shape.rot.x)) + this->actor.world.pos.y; - this->actor.focus.pos.z = - (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y)) + this->actor.world.pos.z; + sp34 = Math_SinS(this->actor.shape.rot.x); + this->actor.focus.pos.x = (Math_SinS(this->actor.shape.rot.y) * (10.0f * sp34)) + this->actor.world.pos.x; + this->actor.focus.pos.y = (Math_CosS(this->actor.shape.rot.x) * 10.0f) + this->actor.world.pos.y; + sp34 = Math_SinS(this->actor.shape.rot.x); + this->actor.focus.pos.z = (Math_CosS(this->actor.shape.rot.y) * (10.0f * sp34)) + this->actor.world.pos.z; } s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - EnFirefly* this = (EnFirefly*)thisx; - - if ((this->actor.draw == EnFirefly_DrawInvisible) && !play->actorCtx.lensActive) { + EnFirefly* this = thisx; + if ((this->actor.draw == EnFirefly_DrawXlu) && (play->actorCtx.lensActive == 0)) { *dList = NULL; } else if (limbIndex == 1) { pos->y += 2300.0f; @@ -754,105 +668,87 @@ s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 } void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { - static Color_RGBA8 fireAuraPrimColor = { 255, 255, 100, 255 }; - static Color_RGBA8 fireAuraEnvColor = { 255, 50, 0, 0 }; - static Color_RGBA8 iceAuraPrimColor = { 100, 200, 255, 255 }; - static Color_RGBA8 iceAuraEnvColor = { 0, 0, 255, 0 }; - static Vec3f effVelocity = { 0.0f, 0.5f, 0.0f }; - static Vec3f effAccel = { 0.0f, 0.5f, 0.0f }; - static Vec3f limbSrc = { 0.0f, 0.0f, 0.0f }; - Vec3f effPos; - Vec3f* limbDest; - Color_RGBA8* effPrimColor; - Color_RGBA8* effEnvColor; - MtxF mtx; - s16 effScaleStep; - s16 effLife; - EnFirefly* this = (EnFirefly*)thisx; - - if (!this->onFire && (limbIndex == 27)) { + Vec3f sp94; + Vec3f* var_a1; + Color_RGBA8* var_v1; + Color_RGBA8* var_v0; + MtxF sp48; + EnFirefly* this = thisx; + s16 var_t0; + s16 var_t1; + + if ((this->unk1B9 == 0) && (limbIndex == 0x1B)) { gSPDisplayList((*gfx)++, gKeeseEyesDL); } else { - if ((this->auraType == KEESE_AURA_FIRE) || (this->auraType == KEESE_AURA_ICE)) { - if ((limbIndex == 15) || (limbIndex == 21)) { - if (this->actionFunc != EnFirefly_Die) { - Matrix_Get(&mtx); - effPos.x = (Rand_ZeroOne() * 5.0f) + mtx.xw; - effPos.y = (Rand_ZeroOne() * 5.0f) + mtx.yw; - effPos.z = (Rand_ZeroOne() * 5.0f) + mtx.zw; - effScaleStep = -40; - effLife = 3; - } else { - if (limbIndex == 15) { - effPos.x = (Math_SinS(9100 * this->timer) * this->timer) + this->actor.world.pos.x; - effPos.z = (Math_CosS(9100 * this->timer) * this->timer) + this->actor.world.pos.z; - } else { - effPos.x = this->actor.world.pos.x - (Math_SinS(9100 * this->timer) * this->timer); - effPos.z = this->actor.world.pos.z - (Math_CosS(9100 * this->timer) * this->timer); - } - - effPos.y = this->actor.world.pos.y + ((15 - this->timer) * 1.5f); - effScaleStep = -5; - effLife = 10; - } - - if (this->auraType == KEESE_AURA_FIRE) { - effPrimColor = &fireAuraPrimColor; - effEnvColor = &fireAuraEnvColor; + if (((this->unk1B8 == 1) || (this->unk1B8 == 2)) && ((limbIndex == 0xF) || (limbIndex == 0x15))) { + if (this->actionFunc != func_80A13D68_Action) { + Matrix_Get(&sp48); + sp94.x = (Rand_ZeroOne() * 5.0f) + sp48.xw; + sp94.y = (Rand_ZeroOne() * 5.0f) + sp48.yw; + sp94.z = (Rand_ZeroOne() * 5.0f) + sp48.zw; + var_t0 = -0x28; + var_t1 = 3; + } else { + if (limbIndex == 0xF) { + sp94.x = (Math_SinS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer) + this->actor.world.pos.x; + sp94.z = (Math_CosS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer) + this->actor.world.pos.z; } else { - effPrimColor = &iceAuraPrimColor; - effEnvColor = &iceAuraEnvColor; + sp94.x = this->actor.world.pos.x - (Math_SinS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer); + sp94.z = this->actor.world.pos.z - (Math_CosS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer); } - - func_8002843C(play, &effPos, &effVelocity, &effAccel, effPrimColor, effEnvColor, 250, effScaleStep, - effLife); + var_t0 = -5; + var_t1 = 0xA; + sp94.y = this->actor.world.pos.y + ((0xF - this->unk1BA_timer) * 1.5f); + } + if (this->unk1B8 == 1) { + var_v0 = &D_80A14FA0; + var_v1 = &D_80A14FA4; + } else { + var_v0 = &D_80A14FA8; + var_v1 = &D_80A14FAC; } + func_8002843C(play, &sp94, &D_80A14FB0, &D_80A14FBC, var_v0, var_v1, 250, var_t0, var_t1); } } - if ((limbIndex == 15) || (limbIndex == 21) || (limbIndex == 10)) { - if (limbIndex == 15) { - limbDest = &this->bodyPartsPos[0]; - } else if (limbIndex == 21) { - limbDest = &this->bodyPartsPos[1]; + if ((limbIndex == 0xF) || (limbIndex == 0x15) || (limbIndex == 0xA)) { + if (limbIndex == 0xF) { + var_a1 = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LIMB_15]; + } else if (limbIndex == 0x15) { + var_a1 = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LIMB_21]; } else { - limbDest = &this->bodyPartsPos[2]; + var_a1 = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LIMB_10]; } - - Matrix_MultVec3f(&limbSrc, limbDest); - limbDest->y -= 5.0f; + Matrix_MultVec3f(&D_80A14FC8, var_a1); + var_a1->y -= 5.0f; } } -void EnFirefly_Draw(Actor* thisx, PlayState* play) { +void EnFirefly_DrawOpa(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1733); + OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 0x6C5); Gfx_SetupDL_25Opa(play->state.gfxCtx); - - if (this->onFire) { + if (this->unk1B9 != 0) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); } else { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); } - POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, &this->actor, POLY_OPA_DISP); + EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, this, POLY_OPA_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1763); } -void EnFirefly_DrawInvisible(Actor* thisx, PlayState* play) { +void EnFirefly_DrawXlu(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1775); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - - if (this->onFire) { + if (this->unk1B9 != 0) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); } else { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 255); } - POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, this, POLY_XLU_DISP); + EnFirefly_OverrideLimbDraw, EnFirefly_PostLimbDraw, thisx, POLY_XLU_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1805); } 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 d49e8b19431..146027067bb 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -6,30 +6,29 @@ struct EnFirefly; +typedef enum EnFireflyBodyPart { + /* 0 */ EN_FIREFLY_BODY_PART_LIMB_15, + /* 1 */ EN_FIREFLY_BODY_PART_LIMB_21, + /* 2 */ EN_FIREFLY_BODY_PART_LIMB_10, + /* 3 */ EN_FIREFLY_BODY_PART_MAX +} EnFireflyBodyPart; + typedef void (*EnFireflyActionFunc)(struct EnFirefly*, struct PlayState*); typedef struct EnFirefly { - /* 0x0000 */ Actor actor; - /* 0x014C */ Vec3f bodyPartsPos[3]; - /* 0x0170 */ SkelAnime skelAnime; - /* 0x01B4 */ EnFireflyActionFunc actionFunc; - /* 0x01B8 */ u8 auraType; - /* 0x01B9 */ u8 onFire; - /* 0x01BA */ s16 timer; - /* 0x01BC */ s16 targetPitch; - /* 0x01BE */ Vec3s jointTable[28]; - /* 0x0266 */ Vec3s morphTable[28]; - /* 0x0310 */ f32 maxAltitude; - /* 0x0314 */ ColliderJntSph collider; - /* 0x0344 */ ColliderJntSphElement colliderElements[1]; + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3f bodyPartsPos[EN_FIREFLY_BODY_PART_MAX]; + /* 0x170 */ SkelAnime skelAnime; + /* 0x1B4 */ EnFireflyActionFunc actionFunc; + /* 0x1B8 */ u8 unk1B8; + /* 0x1B9 */ u8 unk1B9; + /* 0x1BA */ s16 unk1BA_timer; + /* 0x1BC */ s16 unk1BC_targetRotX; + /* 0x1BE */ Vec3s unk1BE[0x1C]; + /* 0x266 */ Vec3s unk266[0x1C]; + /* 0x310 */ f32 unk310_homeY; + /* 0x314 */ ColliderJntSph collider; + /* 0x334 */ ColliderJntSphElement colliderElements[1]; } EnFirefly; // size = 0x0374 -typedef enum KeeseType { - /* 0 */ KEESE_FIRE_FLY, - /* 1 */ KEESE_FIRE_PERCH, - /* 2 */ KEESE_NORMAL_FLY, - /* 3 */ KEESE_NORMAL_PERCH, - /* 4 */ KEESE_ICE_FLY -} KeeseType; - #endif diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index f207e8a6124..b720e9ee553 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -1,27 +1,17 @@ -/* - * File: z_en_fish.c - * Overlay: ovl_En_Fish - * Description: Fish - */ - #include "z_en_fish.h" #include "libc64/qrand.h" -#include "array_count.h" -#include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" #include "printf.h" #include "sfx.h" -#include "terminal.h" -#include "translation.h" #include "z_lib.h" #include "item.h" #include "play_state.h" #include "player.h" -#include "assets/objects/gameplay_keep/gFishInWaterAnim.h" -#include "assets/objects/gameplay_keep/gFishOutOfWaterAnim.h" +#include "assets/objects/gameplay_keep/gFish1Anim.h" +#include "assets/objects/gameplay_keep/gFish2Anim.h" #include "assets/objects/gameplay_keep/gameplay_keep_0x18610.h" #define FLAGS 0 @@ -31,29 +21,42 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2); void EnFish_Update(Actor* thisx, PlayState* play); void EnFish_Draw(Actor* thisx, PlayState* play); -void EnFish_Respawning_SetupSlowDown(EnFish* this); -void EnFish_Respawning_SlowDown(EnFish* this, PlayState* play); -void EnFish_Respawning_SetupFollowChild(EnFish* this); -void EnFish_Respawning_FollowChild(EnFish* this, PlayState* play); -void EnFish_Respawning_SetupFleePlayer(EnFish* this); -void EnFish_Respawning_FleePlayer(EnFish* this, PlayState* play); -void EnFish_Respawning_SetupApproachPlayer(EnFish* this); -void EnFish_Respawning_ApproachPlayer(EnFish* this, PlayState* play); -void EnFish_Dropped_SetupFall(EnFish* this); -void EnFish_Dropped_Fall(EnFish* this, PlayState* play); -void EnFish_Dropped_SetupFlopOnGround(EnFish* this); -void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play); -void EnFish_Dropped_SetupSwimAway(EnFish* this); -void EnFish_Dropped_SwimAway(EnFish* this, PlayState* play); -void EnFish_Unique_SetupSwimIdle(EnFish* this); -void EnFish_Unique_SwimIdle(EnFish* this, PlayState* play); - -// Used in the cutscene functions -static Actor* D_80A17010 = NULL; +f32 func_80A15280(Vec3f* arg0, Vec3f* arg1); +void func_80A152AC(EnFish* this); +void func_80A15310(EnFish* this); +void func_80A15374(EnFish* this); +void func_80A153AC(EnFish* this2); +void func_80A15444(EnFish* this); +void func_80A155D0(EnFish* this); +s32 func_80A15688(EnFish* this, PlayState* play); +s32 func_80A15774(EnFish* this, PlayState* play); +void func_80A157A4(EnFish* this); +void func_80A157FC(EnFish* this, PlayState* play); +void func_80A158EC(EnFish* this); +void func_80A15944(EnFish* this, PlayState* play); +void func_80A15AD4(EnFish* this); +void func_80A15B2C(EnFish* this, PlayState* play); +void func_80A15D18(EnFish* this); +void func_80A15D68(EnFish* this, PlayState* play); +void func_80A15F24(EnFish* this); +void func_80A15F84(EnFish* this, PlayState* play); +void func_80A160BC(EnFish* this); +void func_80A16200(EnFish* this, PlayState* play); +void func_80A163DC(EnFish* this); +void func_80A16450(EnFish* this, PlayState* play); +void func_80A16618(EnFish* this); +void func_80A16670(EnFish* this, PlayState* play); +void func_80A16898(EnFish* this, PlayState* play); +void func_80A169C8(EnFish* this, PlayState* play); +void func_80A16A64(EnFish* this, PlayState* play); +void func_80A16C68(EnFish* this, PlayState* play); +void func_80A16DEC(EnFish* this, PlayState* play); + +static EnFish* D_80A17010 = NULL; static f32 D_80A17014 = 0.0f; static f32 D_80A17018 = 0.0f; -static ColliderJntSphElementInit sJntSphElementsInit[] = { +static ColliderJntSphElementInit D_80A1701C[1] = { { { ELEM_MATERIAL_UNK0, @@ -67,7 +70,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { }, }; -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit D_80A17040 = { { COL_MATERIAL_NONE, AT_NONE, @@ -76,8 +79,8 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, + 1, + D_80A1701C, }; ActorProfile En_Fish_Profile = { @@ -92,52 +95,65 @@ ActorProfile En_Fish_Profile = { /**/ EnFish_Draw, }; -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80A17070[4] = { ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 900, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 40, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 700, ICHAIN_STOP), }; -f32 EnFish_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { - return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); +typedef struct struct_80A17080 { + /* 0x0 */ f32 unk0; + /* 0x4 */ f32 unk4; + /* 0x8 */ f32 unk8; +} struct_80A17080; // size = 0xC +static struct_80A17080 D_80A17080 = { 0.0f, 0.04f, 0.09f }; +static struct_80A17080 D_80A1708C = { 0.5f, 0.1f, 0.15f }; + +f32 func_80A15280(Vec3f* arg0, Vec3f* arg1) { + f32 temp_fa0; + f32 temp_fv1; + + temp_fv1 = arg0->x - arg1->x; + temp_fa0 = arg0->z - arg1->z; + return SQ(temp_fv1) + SQ(temp_fa0); } -void EnFish_SetInWaterAnimation(EnFish* this) { - Animation_Change(&this->skelAnime, &gFishInWaterAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gFishInWaterAnim), - ANIMMODE_LOOP_INTERP, 2.0f); +void func_80A152AC(EnFish* this) { + Animation_Change(&this->unk1AC, &gFish2Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish2Anim), ANIMMODE_LOOP_INTERP, + 2.0f); } -void EnFish_SetOutOfWaterAnimation(EnFish* this) { - Animation_Change(&this->skelAnime, &gFishOutOfWaterAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gFishOutOfWaterAnim), - ANIMMODE_LOOP_INTERP, 2.0f); +void func_80A15310(EnFish* this) { + Animation_Change(&this->unk1AC, &gFish1Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish1Anim), ANIMMODE_LOOP_INTERP, + 2.0f); } -void EnFish_BeginRespawn(EnFish* this) { - this->respawnTimer = 400; +void func_80A15374(EnFish* this) { + this->unk24A = 0x190; Actor_SetScale(&this->actor, 0.001f); this->actor.draw = NULL; } -void EnFish_SetCutsceneData(EnFish* this) { - Actor* thisx = &this->actor; +void func_80A153AC(EnFish* this2) { + EnFish* this = this2; if (D_80A17010 == NULL) { - D_80A17010 = thisx; - Actor_SetScale(thisx, 0.01f); - thisx->draw = EnFish_Draw; - thisx->shape.rot.x = 0; - thisx->shape.rot.y = -0x6410; - thisx->shape.rot.z = 0x4000; - thisx->shape.yOffset = 600.0f; + D_80A17010 = this; + Actor_SetScale(&this->actor, 0.01f); + this->actor.draw = EnFish_Draw; + this->actor.shape.rot.x = 0; + this->actor.shape.rot.y = -0x6410; + this->actor.shape.rot.z = 0x4000; + this->actor.shape.yOffset = 600.0f; D_80A17014 = 10.0f; D_80A17018 = 0.0f; - thisx->flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - EnFish_SetOutOfWaterAnimation(this); + this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; + func_80A15310(this); } } -void EnFish_ClearCutsceneData(EnFish* this) { +void func_80A15444(EnFish* this) { D_80A17010 = NULL; D_80A17014 = 0.0f; D_80A17018 = 0.0f; @@ -145,24 +161,24 @@ void EnFish_ClearCutsceneData(EnFish* this) { void EnFish_Init(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - s16 params = this->actor.params; - - Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, 7); - Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - this->actor.colChkInfo.mass = 50; - this->slowPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); - this->fastPhase = Rand_ZeroOne() * (0xFFFF + 0.5f); - - if (params == FISH_DROPPED) { + s16 sp3A; + + sp3A = this->actor.params; + Actor_ProcessInitChain(&this->actor, D_80A17070); + SkelAnime_InitFlex(play, &this->unk1AC, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); + Collider_InitJntSph(play, &this->unk14C); + Collider_SetJntSph(play, &this->unk14C, &this->actor, &D_80A17040, &this->unk16C); + this->actor.colChkInfo.mass = 0x32; + this->unk24C = (s16)(s32)(Rand_ZeroOne() * 65535.5f); + this->unk24E = (s16)(s32)(Rand_ZeroOne() * 65535.5f); + if (sp3A == 0) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 8.0f); - EnFish_Dropped_SetupFall(this); - } else if (params == FISH_SWIMMING_UNIQUE) { - EnFish_Unique_SetupSwimIdle(this); + func_80A15F24(this); + } else if (sp3A == 1) { + func_80A16618(this); } else { - EnFish_Respawning_SetupSlowDown(this); + func_80A157A4(this); } } @@ -170,441 +186,385 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnFish* this = (EnFish*)thisx; - Collider_DestroyJntSph(play, &this->collider); + Collider_DestroyJntSph(play, &this->unk14C); } -void EnFish_SetYOffset(EnFish* this) { - this->actor.shape.yOffset += (Math_SinS(this->slowPhase) * 10.0f + Math_SinS(this->fastPhase) * 5.0f); +void func_80A155D0(EnFish* this) { + this->actor.shape.yOffset += (Math_SinS(this->unk24C) * 10.0f) + (Math_SinS(this->unk24E) * 5.0f); this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -200.0f, 200.0f); } -s32 EnFish_InBottleRange(EnFish* this, PlayState* play) { +s32 func_80A15688(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(play); + Actor* temp_v0; Vec3f sp1C; + temp_v0 = play->actorCtx.actorLists[2].head; if (this->actor.xzDistToPlayer < 32.0f) { - sp1C.x = (Math_SinS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + player->actor.world.pos.x; - sp1C.y = player->actor.world.pos.y; - sp1C.z = (Math_CosS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + player->actor.world.pos.z; - - //! @bug: this check is superfluous: it is automatically satisfied if the coarse check is satisfied. It may have - //! been intended to check the actor is in front of Player, but yawTowardsPlayer does not depend on Player's - //! world rotation. - if (EnFish_XZDistanceSquared(&sp1C, &this->actor.world.pos) <= SQ(20.0f)) { - return true; + sp1C.x = (Math_SinS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + temp_v0->world.pos.x; + sp1C.y = temp_v0->world.pos.y; + sp1C.z = (Math_CosS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + temp_v0->world.pos.z; + if (func_80A15280(&sp1C, &this->actor.world.pos) <= SQ(20.0f)) { + return 1; } } - - return false; + return 0; } -s32 EnFish_CheckXZDistanceToPlayer(EnFish* this, PlayState* play) { - return (this->actor.xzDistToPlayer < 60.0f); +s32 func_80A15774(EnFish* this, PlayState* play) { + return this->actor.xzDistToPlayer < 60.0f; } -// Respawning type functions - -void EnFish_Respawning_SetupSlowDown(EnFish* this) { +void func_80A157A4(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->timer = Rand_S16Offset(5, 35); - this->unk_250 = 0; - EnFish_SetInWaterAnimation(this); - this->actionFunc = EnFish_Respawning_SlowDown; + this->unk248 = Rand_S16Offset(5, 0x23); + this->unk250 = 0; + func_80A152AC(this); + this->unk244 = func_80A157FC; } -void EnFish_Respawning_SlowDown(EnFish* this, PlayState* play) { - EnFish_SetYOffset(this); +void func_80A157FC(EnFish* this, PlayState* play) { + func_80A155D0(this); Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.05f, 0.3f, 0.0f); - this->skelAnime.playSpeed = CLAMP_MAX(this->actor.speed * 1.4f + 0.8f, 2.0f); - SkelAnime_Update(&this->skelAnime); + this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.4f) + 0.8f, 2.0f); + SkelAnime_Update(&this->unk1AC); this->actor.shape.rot.y = this->actor.world.rot.y; - - if (this->timer <= 0) { - EnFish_Respawning_SetupFollowChild(this); - } else if (&this->actor == this->actor.child) { - EnFish_Respawning_SetupApproachPlayer(this); - } else if (EnFish_CheckXZDistanceToPlayer(this, play)) { - EnFish_Respawning_SetupFleePlayer(this); + if (this->unk248 <= 0) { + func_80A158EC(this); + } else if (this->actor.child == &this->actor) { + func_80A15D18(this); + } else if (func_80A15774(this, play)) { + func_80A15AD4(this); } } -// The three following actionfunctions also turn the yaw to home if the fish is too far from it. - -void EnFish_Respawning_SetupFollowChild(EnFish* this) { +void func_80A158EC(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->timer = Rand_S16Offset(15, 45); - this->unk_250 = 0; - EnFish_SetInWaterAnimation(this); - this->actionFunc = EnFish_Respawning_FollowChild; + this->unk248 = Rand_S16Offset(0xF, 0x2D); + this->unk250 = 0; + func_80A152AC(this); + this->unk244 = func_80A15944; } -void EnFish_Respawning_FollowChild(EnFish* this, PlayState* play) { +void func_80A15944(EnFish* this, PlayState* play) { s32 pad; - EnFish_SetYOffset(this); + func_80A155D0(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.08f, 0.4f, 0.0f); - - if ((EnFish_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) || (this->timer < 4)) { + if ((func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) || (this->unk248 < 4)) { Math_StepToAngleS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), - 3000); - } else if ((this->actor.child != NULL) && (&this->actor != this->actor.child)) { - Math_StepToAngleS(&this->actor.world.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos), 3000); + 0xBB8); + } else { + if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { + Math_StepToAngleS(&this->actor.world.rot.y, + Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos), 0xBB8); + } } - this->actor.shape.rot.y = this->actor.world.rot.y; - this->skelAnime.playSpeed = CLAMP_MAX(this->actor.speed * 1.5f + 0.8f, 4.0f); - SkelAnime_Update(&this->skelAnime); - - if (this->timer <= 0) { - EnFish_Respawning_SetupSlowDown(this); - } else if (&this->actor == this->actor.child) { - EnFish_Respawning_SetupApproachPlayer(this); - } else if (EnFish_CheckXZDistanceToPlayer(this, play)) { - EnFish_Respawning_SetupFleePlayer(this); + this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); + SkelAnime_Update(&this->unk1AC); + if (this->unk248 <= 0) { + func_80A157A4(this); + } else if (this->actor.child == &this->actor) { + func_80A15D18(this); + } else if (func_80A15774(this, play)) { + func_80A15AD4(this); } } -void EnFish_Respawning_SetupFleePlayer(EnFish* this) { +void func_80A15AD4(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->timer = Rand_S16Offset(10, 40); - this->unk_250 = 0; - EnFish_SetInWaterAnimation(this); - this->actionFunc = EnFish_Respawning_FleePlayer; + this->unk248 = Rand_S16Offset(0xA, 0x28); + this->unk250 = 0; + func_80A152AC(this); + this->unk244 = func_80A15B2C; } -void EnFish_Respawning_FleePlayer(EnFish* this, PlayState* play) { - s32 pad; - s16 pad2; - s16 frames; - s16 yaw; - s16 playerClose; +void func_80A15B2C(EnFish* this, PlayState* play) { + s16 temp_v0_2; + s16 var_a1; + s32 pad2; + s16 pad; + s16 sp34; - EnFish_SetYOffset(this); - playerClose = EnFish_CheckXZDistanceToPlayer(this, play); + func_80A155D0(this); + sp34 = func_80A15774(this, play); Math_SmoothStepToF(&this->actor.speed, 4.2f, 0.08f, 1.4f, 0.0f); - - if (EnFish_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); - Math_StepToAngleS(&this->actor.world.rot.y, yaw, 3000); - } else if ((this->actor.child != NULL) && (&this->actor != this->actor.child)) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos); - Math_StepToAngleS(&this->actor.world.rot.y, yaw, 2000); - } else if (playerClose) { - yaw = this->actor.yawTowardsPlayer + 0x8000; - frames = play->state.frames; - - if (frames & 0x10) { - if (frames & 0x20) { - yaw += 0x2000; - } - } else { - if (frames & 0x20) { - yaw -= 0x2000; + if (func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { + var_a1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); + Math_StepToAngleS(&this->actor.world.rot.y, var_a1, 0xBB8); + } else { + if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { + var_a1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos); + Math_StepToAngleS(&this->actor.world.rot.y, var_a1, 0x7D0); + } else if (sp34) { + temp_v0_2 = play->state.frames; + if (play) {} + var_a1 = this->actor.yawTowardsPlayer + 0x8000; + if (temp_v0_2 & 0x10) { + if (temp_v0_2 & 0x20) { + var_a1 += 0x2000; + } + } else { + if (temp_v0_2 & 0x20) { + var_a1 -= 0x2000; + } } + Math_StepToAngleS(&this->actor.world.rot.y, var_a1, 0x7D0); } - if (play) {} - Math_StepToAngleS(&this->actor.world.rot.y, yaw, 2000); } - this->actor.shape.rot.y = this->actor.world.rot.y; - this->skelAnime.playSpeed = CLAMP_MAX(this->actor.speed * 1.5f + 0.8f, 4.0f); - - SkelAnime_Update(&this->skelAnime); - - if ((this->timer <= 0) || !playerClose) { - EnFish_Respawning_SetupSlowDown(this); - } else if (&this->actor == this->actor.child) { - EnFish_Respawning_SetupApproachPlayer(this); + this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); + SkelAnime_Update(&this->unk1AC); + if ((this->unk248 <= 0) || !sp34) { + func_80A157A4(this); + } else if (this->actor.child == &this->actor) { + func_80A15D18(this); } } -void EnFish_Respawning_SetupApproachPlayer(EnFish* this) { +void func_80A15D18(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - EnFish_SetInWaterAnimation(this); - this->timer = Rand_S16Offset(10, 40); - this->unk_250 = 0; - this->actionFunc = EnFish_Respawning_ApproachPlayer; + func_80A152AC(this); + this->unk248 = Rand_S16Offset(0xA, 0x28); + this->unk250 = 0; + this->unk244 = func_80A15D68; } -void EnFish_Respawning_ApproachPlayer(EnFish* this, PlayState* play) { +void func_80A15D68(EnFish* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(play); + Player* sp48; s32 pad2; Vec3f sp38; - s16 yaw; + s16 v; s16 temp_a0_2; - EnFish_SetYOffset(this); + sp48 = GET_PLAYER(play); + func_80A155D0(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.1f, 0.5f, 0.0f); - - if (EnFish_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) { - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); - Math_StepToAngleS(&this->actor.world.rot.y, yaw, 3000); + if (func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) { + v = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); + Math_StepToAngleS(&this->actor.world.rot.y, v, 0xBB8); } else { if ((s16)play->state.frames & 0x40) { temp_a0_2 = (this->actor.yawTowardsPlayer + 0x9000); } else { temp_a0_2 = (this->actor.yawTowardsPlayer + 0x7000); } - - sp38.x = player->actor.world.pos.x + (Math_SinS(temp_a0_2) * 20.0f); - sp38.y = player->actor.world.pos.y; - sp38.z = player->actor.world.pos.z + (Math_CosS(temp_a0_2) * 20.0f); - - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &sp38); - Math_StepToAngleS(&this->actor.world.rot.y, yaw, 3000); + sp38.x = (Math_SinS(temp_a0_2) * 20.0f) + sp48->actor.world.pos.x; + sp38.y = sp48->actor.world.pos.y; + sp38.z = (Math_CosS(temp_a0_2) * 20.0f) + sp48->actor.world.pos.z; + v = Math_Vec3f_Yaw(&this->actor.world.pos, &sp38); + Math_StepToAngleS(&this->actor.world.rot.y, v, 0xBB8); } - this->actor.shape.rot.y = this->actor.world.rot.y; - this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); - - SkelAnime_Update(&this->skelAnime); - - if (this->timer <= 0) { - EnFish_Respawning_SetupSlowDown(this); + this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); + SkelAnime_Update(&this->unk1AC); + if (this->unk248 <= 0) { + func_80A157A4(this); } } -// Dropped type functions - -void EnFish_Dropped_SetupFall(EnFish* this) { +void func_80A15F24(EnFish* this) { this->actor.gravity = -1.0f; this->actor.minVelocityY = -10.0f; this->actor.shape.yOffset = 0.0f; - EnFish_SetOutOfWaterAnimation(this); - this->unk_250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; - this->actionFunc = EnFish_Dropped_Fall; - this->timer = 300; + func_80A15310(this); + this->unk250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; + this->unk244 = func_80A15F84; + this->unk248 = 0x12C; } -void EnFish_Dropped_Fall(EnFish* this, PlayState* play) { +void func_80A15F84(EnFish* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.1f, 0.0f); - Math_StepToAngleS(&this->actor.world.rot.x, 0x4000, 100); - Math_StepToAngleS(&this->actor.world.rot.z, -0x4000, 100); + Math_StepToAngleS(&this->actor.world.rot.x, 0x4000, 0x64); + Math_StepToAngleS(&this->actor.world.rot.z, -0x4000, 0x64); this->actor.shape.rot.x = this->actor.world.rot.x; this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.shape.rot.z = this->actor.world.rot.z; - SkelAnime_Update(&this->skelAnime); - + SkelAnime_Update(&this->unk1AC); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->timer = 400; - EnFish_Dropped_SetupFlopOnGround(this); + this->unk248 = 0x190; + func_80A160BC(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - EnFish_Dropped_SetupSwimAway(this); - } else if ((this->timer <= 0) && (this->actor.params == FISH_DROPPED) && - (this->actor.floorHeight < BGCHECK_Y_MIN + 10.0f)) { + func_80A163DC(this); + } else if ((this->unk248 <= 0) && (this->actor.params == 0) && + (this->actor.floorHeight < (BGCHECK_Y_MIN + 10.0f))) { PRINTF_COLOR_WARNING(); - PRINTF(T("BG 抜け? Actor_delete します(%s %d)\n", "BG missing? Running Actor_delete (%s %d)\n"), - "../z_en_sakana.c", 822); + PRINTF("BG 抜け? Actor_delete します(%s %d)\n", "../z_en_sakana.c", 822); PRINTF_RST(); Actor_Kill(&this->actor); } } -/** - * If the fish is on a floor, this function is looped back to by EnFish_Dropped_FlopOnGround to set a new flopping - * height and whether the sound should play again. - */ -void EnFish_Dropped_SetupFlopOnGround(EnFish* this) { - s32 pad; - f32 randomFloat; - s32 playSfx; +void func_80A160BC(EnFish* this) { + s32 pad[2]; + s32 var_v0; + f32 temp_fv0; this->actor.gravity = -1.0f; this->actor.minVelocityY = -10.0f; - randomFloat = Rand_ZeroOne(); - - if (randomFloat < 0.1f) { + temp_fv0 = Rand_ZeroOne(); + if (temp_fv0 < 0.1f) { this->actor.velocity.y = (Rand_ZeroOne() * 3.0f) + 2.5f; - playSfx = true; - } else if (randomFloat < 0.2f) { + var_v0 = 1; + } else if (temp_fv0 < 0.2f) { this->actor.velocity.y = (Rand_ZeroOne() * 1.2f) + 0.2f; - playSfx = true; + var_v0 = 1; } else { this->actor.velocity.y = 0.0f; - if (Rand_ZeroOne() < 0.2f) { - playSfx = true; + var_v0 = 1; } else { - playSfx = false; + var_v0 = 0; } } - this->actor.shape.yOffset = 300.0f; - EnFish_SetOutOfWaterAnimation(this); - this->actionFunc = EnFish_Dropped_FlopOnGround; - this->unk_250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; - - if (playSfx && (this->actor.draw != NULL)) { + func_80A15310(this); + this->unk244 = func_80A16200; + this->unk250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; + if ((var_v0 != 0) && (this->actor.draw != NULL)) { Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); } } -void EnFish_Dropped_FlopOnGround(EnFish* this, PlayState* play) { - s32 pad; - s16 frames = play->state.frames; - s16 targetXRot; +void func_80A16200(EnFish* this, PlayState* play) { + s16 temp_ft1; + s16 pad; + s16 temp_v0_sp42; + temp_v0_sp42 = play->state.frames; // unk9E; Math_SmoothStepToF(&this->actor.speed, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); - - targetXRot = (s16)((((frames >> 5) & 2) | ((frames >> 2) & 1)) << 0xB) * 0.3f; - - if (frames & 4) { - targetXRot = -targetXRot; + temp_ft1 = (s16)(s32)((s16)((((temp_v0_sp42 >> 5) & 2) | ((temp_v0_sp42 >> 2) & 1)) * 0x800) * 0.3f); + if (temp_v0_sp42 & 4) { + temp_ft1 = temp_ft1 * -1; } - - Math_StepToAngleS(&this->actor.world.rot.x, targetXRot, 4000); - Math_StepToAngleS(&this->actor.world.rot.z, 0x4000, 1000); + Math_StepToAngleS(&this->actor.world.rot.x, temp_ft1, 0xFA0); + Math_StepToAngleS(&this->actor.world.rot.z, 0x4000, 0x3E8); this->actor.world.rot.y += - (s16)(((Math_SinS(this->slowPhase) * 2000.0f) + (Math_SinS(this->fastPhase) * 1000.0f)) * Rand_ZeroOne()); + (s16)(s32)(((Math_SinS(this->unk24C) * 2000.0f) + (Math_SinS(this->unk24E) * 1000.0f)) * Rand_ZeroOne()); this->actor.shape.rot = this->actor.world.rot; - - SkelAnime_Update(&this->skelAnime); - - if (this->timer <= 0) { + SkelAnime_Update(&this->unk1AC); + if (this->unk248 <= 0) { Actor_Kill(&this->actor); return; } - - if (this->timer <= 60) { - // Blink when about to disappear - if (frames & 4) { + if (this->unk248 < 0x3D) { + if (temp_v0_sp42 & 4) { this->actor.draw = EnFish_Draw; } else { this->actor.draw = NULL; } } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - EnFish_Dropped_SetupSwimAway(this); + func_80A163DC(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - EnFish_Dropped_SetupFlopOnGround(this); + func_80A160BC(this); } } -void EnFish_Dropped_SetupSwimAway(EnFish* this) { +void func_80A163DC(EnFish* this) { this->actor.home.pos = this->actor.world.pos; this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->actor.shape.yOffset = 0.0f; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->timer = 200; - EnFish_SetInWaterAnimation(this); - this->actionFunc = EnFish_Dropped_SwimAway; - this->unk_250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; + this->unk248 = 0xC8; + func_80A152AC(this); + this->unk244 = func_80A16450; + this->unk250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; } -void EnFish_Dropped_SwimAway(EnFish* this, PlayState* play) { +void func_80A16450(EnFish* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speed, 2.8f, 0.1f, 0.4f, 0.0f); - - // If touching wall or not in water, turn back and slow down for one frame. if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { this->actor.home.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); this->actor.speed *= 0.5f; } - - Math_StepToAngleS(&this->actor.world.rot.x, 0, 1500); - Math_StepToAngleS(&this->actor.world.rot.y, this->actor.home.rot.y, 3000); - Math_StepToAngleS(&this->actor.world.rot.z, 0, 1000); - + Math_StepToAngleS(&this->actor.world.rot.x, 0, 0x5DC); + Math_StepToAngleS(&this->actor.world.rot.y, this->actor.home.rot.y, 0xBB8); + Math_StepToAngleS(&this->actor.world.rot.z, 0, 0x3E8); this->actor.shape.rot = this->actor.world.rot; - - // Raise if on a floor. if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 4.0f, 2.0f); } else { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 10.0f, 2.0f); } - - // Shrink when close to disappearing. - if (this->timer < 100) { + if (this->unk248 < 0x64) { Actor_SetScale(&this->actor, this->actor.scale.x * 0.982f); } - - this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 1.0f, 4.0f); - SkelAnime_Update(&this->skelAnime); - - if (this->timer <= 0) { + this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 1.0f, 4.0f); + SkelAnime_Update(&this->unk1AC); + if (this->unk248 <= 0) { Actor_Kill(&this->actor); } } -// Unique type functions - -void EnFish_Unique_SetupSwimIdle(EnFish* this) { +void func_80A16618(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->timer = Rand_S16Offset(5, 35); - this->unk_250 = 0; - EnFish_SetInWaterAnimation(this); - this->actionFunc = EnFish_Unique_SwimIdle; -} - -void EnFish_Unique_SwimIdle(EnFish* this, PlayState* play) { - static f32 speedStopping[] = { 0.0f, 0.04f, 0.09f }; - static f32 speedMoving[] = { 0.5f, 0.1f, 0.15f }; - f32 playSpeed; - u32 frames = play->gameplayFrames; - f32* speed; + this->unk248 = Rand_S16Offset(5, 0x23); + this->unk250 = 0; + func_80A152AC(this); + this->unk244 = func_80A16670; +} + +void func_80A16670(EnFish* this, PlayState* play) { s32 pad2; - f32 extraPlaySpeed; + u32 sp50; + struct_80A17080* var_v0_sp4C; s32 pad3; + f32 sp44; + s32 pad; + sp50 = play->gameplayFrames; if (this->actor.xzDistToPlayer < 60.0f) { - if (this->timer < 12) { - speed = speedMoving; + if (this->unk248 < 0xC) { + var_v0_sp4C = &D_80A1708C; } else { - speed = speedStopping; + var_v0_sp4C = &D_80A17080; } } else { - if (this->timer < 4) { - speed = speedMoving; + if (this->unk248 < 4) { + var_v0_sp4C = &D_80A1708C; } else { - speed = speedStopping; + var_v0_sp4C = &D_80A17080; } } - - EnFish_SetYOffset(this); - Math_SmoothStepToF(&this->actor.speed, speed[0], speed[1], speed[2], 0.0f); - - extraPlaySpeed = 0.0f; - - if ((EnFish_XZDistanceSquared(&this->actor.world.pos, &this->actor.home.pos) > SQ(15.0f))) { + func_80A155D0(this); + Math_SmoothStepToF(&this->actor.speed, var_v0_sp4C->unk0, var_v0_sp4C->unk4, var_v0_sp4C->unk8, 0.0f); + sp44 = 0.0f; + if (func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(15.0f)) { if (!Math_ScaledStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), - 200)) { - extraPlaySpeed = 0.5f; + 0xC8)) { + sp44 = 0.5f; } - } else if ((this->timer < 4) && !Math_ScaledStepToS(&this->actor.world.rot.y, frames * 0x80, 100)) { - extraPlaySpeed = 0.5f; + } else if ((this->unk248 < 4) && !Math_ScaledStepToS(&this->actor.world.rot.y, sp50 * 0x80, 0x64)) { + sp44 = 0.5f; } - this->actor.shape.rot.y = this->actor.world.rot.y; - playSpeed = (this->actor.speed * 1.2f) + 0.2f + extraPlaySpeed; - this->skelAnime.playSpeed = CLAMP(playSpeed, 1.5f, 0.5); - SkelAnime_Update(&this->skelAnime); - - if (this->timer <= 0) { - this->timer = Rand_S16Offset(5, 80); + //! @bug swapped min and max clamp bounds + this->unk1AC.playSpeed = CLAMP((this->actor.speed * 1.2f) + 0.2f + sp44, 1.5f, 0.5); + SkelAnime_Update(&this->unk1AC); + if (this->unk248 <= 0) { + this->unk248 = Rand_S16Offset(5, 0x50); } } -// Cutscene functions - -void EnFish_Cutscene_FlopOnGround(EnFish* this, PlayState* play) { - f32 sp24 = Math_SinS(this->slowPhase); - f32 sp20 = Math_SinS(this->fastPhase); +void func_80A16898(EnFish* this, PlayState* play) { + f32 sp24; + f32 sp20; + sp24 = Math_SinS(this->unk24C); + sp20 = Math_SinS(this->unk24E); D_80A17014 += D_80A17018; - if (D_80A17014 <= 1.0f) { D_80A17014 = 1.0f; - if (Rand_ZeroOne() < 0.1f) { D_80A17018 = (Rand_ZeroOne() * 3.0f) + 2.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); @@ -614,144 +574,130 @@ void EnFish_Cutscene_FlopOnGround(EnFish* this, PlayState* play) { } else { D_80A17018 -= 0.4f; } - - this->skelAnime.playSpeed = ((sp24 + sp20) * 0.5f) + 2.0f; - SkelAnime_Update(&this->skelAnime); + this->unk1AC.playSpeed = ((sp24 + sp20) * 0.5f) + 2.0f; + SkelAnime_Update(&this->unk1AC); } -void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, PlayState* play) { +void func_80A169C8(EnFish* this, PlayState* play) { s32 pad; - f32 sp28 = Math_SinS(this->slowPhase); - f32 sp24 = Math_SinS(this->fastPhase); + f32 sp28; + f32 sp24; - this->actor.shape.rot.x -= 500; - this->actor.shape.rot.z += 100; + sp28 = Math_SinS(this->unk24C); + sp24 = Math_SinS(this->unk24E); + this->actor.shape.rot.x -= 0x1F4; + this->actor.shape.rot.z += 0x64; Math_StepToF(&D_80A17014, 0.0f, 1.0f); - this->skelAnime.playSpeed = ((sp28 + sp24) * 0.5f) + 2.0f; - SkelAnime_Update(&this->skelAnime); + this->unk1AC.playSpeed = ((sp28 + sp24) * 0.5f) + 2.0f; + SkelAnime_Update(&this->unk1AC); } -void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { +void func_80A16A64(EnFish* this, PlayState* play) { + f32 temp_fv0; s32 pad; + CsCmdActorCue* sp4C; + Vec3f sp40; + Vec3f sp34; s32 pad2; - CsCmdActorCue* cue = play->csCtx.actorCues[1]; - Vec3f startPos; - Vec3f endPos; - f32 lerp; - s32 bgId; + s32 sp2C; + if (play) {} if (play) {} - if (cue == NULL) { - PRINTF(T("Warning : dousa 3 消滅 が呼ばれずにデモが終了した(%s %d)(arg_data 0x%04x)\n", - "Warning : Demo ended without action 3 being called (%s %d)(arg_data 0x%04x)\n"), - "../z_en_sakana.c", 1169, this->actor.params); - EnFish_ClearCutsceneData(this); + sp4C = play->csCtx.actorCues[1]; + if (sp4C == NULL) { + if (1) {} + PRINTF("Warning : dousa 3 消滅 が呼ばれずにデモが終了した(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1169, + this->actor.params); + func_80A15444(this); Actor_Kill(&this->actor); return; } - - this->slowPhase += 0x111; - this->fastPhase += 0x500; - - switch (cue->id) { + this->unk24C += 0x111; + this->unk24E += 0x500; + switch (sp4C->id) { case 1: - EnFish_Cutscene_FlopOnGround(this, play); + func_80A16898(this, play); break; + case 2: - EnFish_Cutscene_WiggleFlyingThroughAir(this, play); + func_80A169C8(this, play); break; + case 3: - PRINTF(T("デモ魚消滅\n", "Demo fish disappearance\n")); - EnFish_ClearCutsceneData(this); + PRINTF("デモ魚消滅\n"); + func_80A15444(this); Actor_Kill(&this->actor); return; + default: - PRINTF(T("不正なデモ動作(%s %d)(arg_data 0x%04x)\n", "Incorrect demo behavior (%s %d)(arg_data 0x%04x)\n"), - "../z_en_sakana.c", 1200, this->actor.params); + PRINTF("不正なデモ動作(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1200, this->actor.params); break; } - - startPos.x = cue->startPos.x; - startPos.y = cue->startPos.y; - startPos.z = cue->startPos.z; - - endPos.x = cue->endPos.x; - endPos.y = cue->endPos.y; - endPos.z = cue->endPos.z; - - lerp = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); - - this->actor.world.pos.x = (endPos.x - startPos.x) * lerp + startPos.x; - this->actor.world.pos.y = (endPos.y - startPos.y) * lerp + startPos.y + D_80A17014; - this->actor.world.pos.z = (endPos.z - startPos.z) * lerp + startPos.z; - + sp40.x = sp4C->startPos.x; + sp40.y = sp4C->startPos.y; + sp40.z = sp4C->startPos.z; + sp34.x = sp4C->endPos.x; + sp34.y = sp4C->endPos.y; + sp34.z = sp4C->endPos.z; + temp_fv0 = Environment_LerpWeight(sp4C->endFrame, sp4C->startFrame, play->csCtx.curFrame); + this->actor.world.pos.x = ((sp34.x - sp40.x) * temp_fv0) + sp40.x; + this->actor.world.pos.y = ((sp34.y - sp40.y) * temp_fv0) + sp40.y + D_80A17014; + this->actor.world.pos.z = ((sp34.z - sp40.z) * temp_fv0) + sp40.z; this->actor.floorHeight = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); + BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &this->actor.world.pos); } -// Update functions and Draw - -void EnFish_OrdinaryUpdate(EnFish* this, PlayState* play) { - if (this->timer > 0) { - this->timer--; +void func_80A16C68(EnFish* this, PlayState* play) { + if (this->unk248 > 0) { + this->unk248--; } - - this->slowPhase += 0x111; - this->fastPhase += 0x500; - - if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (&this->actor != this->actor.child)) { + this->unk24C += 0x111; + this->unk24E += 0x500; + if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { this->actor.child = NULL; } - - if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { + if ((this->unk244 == NULL) || (this->unk244(this, play), (this->actor.update != NULL))) { Actor_MoveXZGravity(&this->actor); - - if (this->unk_250 != 0) { - Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->unk_250); + if (this->unk250 != 0) { + Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->unk250); } - if (this->actor.xzDistToPlayer < 70.0f) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); } - Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.01f); - if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - - if (this->actor.params == FISH_DROPPED) { + if (this->actor.params == 0) { Actor_Kill(&this->actor); - return; + } else { + func_80A15374(this); } - - EnFish_BeginRespawn(this); - } else if (EnFish_InBottleRange(this, play)) { - // GI_MAX in this case allows the player to catch the actor in a bottle + } else if (func_80A15688(this, play) != 0) { Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 20.0f); } } } -void EnFish_RespawningUpdate(EnFish* this, PlayState* play) { - if (this->actor.params == FISH_SWIMMING_UNIQUE) { +void func_80A16DEC(EnFish* this, PlayState* play) { + f32 var_fv1; + + if (this->actor.params == 1) { Actor_Kill(&this->actor); return; } - - if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (&this->actor != this->actor.child)) { + if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { this->actor.child = NULL; } - - if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { + if ((this->unk244 == NULL) || (this->unk244(this, play), (this->actor.update != NULL))) { Actor_MoveXZGravity(&this->actor); - - if (this->respawnTimer == 20) { + if (this->unk24A == 0x14) { this->actor.draw = EnFish_Draw; - } else if (this->respawnTimer == 0) { + } else if (this->unk24A == 0) { Actor_SetScale(&this->actor, 0.01f); - } else if (this->respawnTimer < 20) { - Actor_SetScale(&this->actor, CLAMP_MAX(this->actor.scale.x + 0.001f, 0.01f)); + } else if (this->unk24A < 0x14) { + var_fv1 = CLAMP_MAX(this->actor.scale.x + 0.001f, 0.01f); + Actor_SetScale(&this->actor, var_fv1); } } } @@ -759,18 +705,17 @@ void EnFish_RespawningUpdate(EnFish* this, PlayState* play) { void EnFish_Update(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - if ((D_80A17010 == NULL) && (this->actor.params == FISH_DROPPED) && (play->csCtx.state != CS_STATE_IDLE) && + if ((D_80A17010 == NULL) && (this->actor.params == 0) && (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[1] != NULL)) { - EnFish_SetCutsceneData(this); + func_80A153AC(this); } - - if ((D_80A17010 != NULL) && (&this->actor == D_80A17010)) { - EnFish_UpdateCutscene(this, play); - } else if (this->respawnTimer > 0) { - this->respawnTimer--; - EnFish_RespawningUpdate(this, play); + if ((D_80A17010 != NULL) && (D_80A17010 == this)) { + func_80A16A64(this, play); + } else if (this->unk24A > 0) { + this->unk24A--; + func_80A16DEC(this, play); } else { - EnFish_OrdinaryUpdate(this, play); + func_80A16C68(this, play); } } @@ -778,7 +723,7 @@ void EnFish_Draw(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, - NULL, NULL); - Collider_UpdateSpheres(0, &this->collider); + SkelAnime_DrawFlexOpa(play, this->unk1AC.skeleton, this->unk1AC.jointTable, this->unk1AC.dListCount, NULL, NULL, + NULL); + Collider_UpdateSpheres(0, &this->unk14C); } 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 8019ff06cbc..e3a23434581 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -6,27 +6,19 @@ struct EnFish; -typedef void (*EnFishActionFunc)(struct EnFish*, struct PlayState*); - typedef struct EnFish { - /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderJntSph collider; - /* 0x016C */ ColliderJntSphElement colliderElements[1]; - /* 0x01AC */ SkelAnime skelAnime; - /* 0x01F0 */ Vec3s jointTable[7]; - /* 0x021A */ Vec3s morphTable[7]; - /* 0x0244 */ EnFishActionFunc actionFunc; - /* 0x0248 */ s16 timer; - /* 0x024A */ s16 respawnTimer; - /* 0x024C */ s16 slowPhase; - /* 0x024E */ s16 fastPhase; - /* 0x0250 */ s32 unk_250; // Set to 0 or 5, arg5 of Actor_UpdateBgCheckInfo -} EnFish; // size = 0x0254 - -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 -} EnFishType; + /* 0x000 */ Actor actor; + /* 0x14C */ ColliderJntSph unk14C; + /* 0x16C */ ColliderJntSphElement unk16C; + /* 0x1AC */ SkelAnime unk1AC; + /* 0x1F0 */ Vec3s unk1F0[7]; + /* 0x21A */ Vec3s unk21A[7]; + /* 0x244 */ void (*unk244)(struct EnFish*, struct PlayState*); + /* 0x248 */ s16 unk248; + /* 0x24A */ s16 unk24A; + /* 0x24C */ s16 unk24C; + /* 0x24E */ s16 unk24E; + /* 0x250 */ s32 unk250; +} EnFish; // size = 0x254 #endif 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 1d70c37e8fe..12951a209e5 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -83,12 +83,12 @@ static Vec3f sMtxSrc = { typedef enum EnFuFace { /* 0x00 */ FU_FACE_CALM, - /* 0x01 */ FU_FACE_MAD + /* 0x01 */ FU_FACE_MAD, } EnFuFace; void EnFu_Init(Actor* thisx, PlayState* play) { - s32 pad; EnFu* this = (EnFu*)thisx; + s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->skelanime, &gWindmillManSkel, &gWindmillManPlayStillAnim, this->jointTable, @@ -146,8 +146,9 @@ void func_80A1DA04(EnFu* this, PlayState* play) { } void EnFu_WaitChild(EnFu* this, PlayState* play) { - u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_WINDMILL_MAN); + u16 textId; + textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_WINDMILL_MAN); if (textId == 0) { textId = GET_EVENTCHKINF(EVENTCHKINF_DRAINED_WELL) ? 0x5033 : 0x5032; } @@ -202,7 +203,6 @@ void func_80A1DBD4(EnFu* this, PlayState* play) { void EnFu_WaitForPlayback(EnFu* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->stateFlags2 |= PLAYER_STATE2_23; // if dialog state is 7, player has played back the song if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { @@ -213,7 +213,6 @@ void EnFu_WaitForPlayback(EnFu* this, PlayState* play) { void EnFu_TeachSong(EnFu* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->stateFlags2 |= PLAYER_STATE2_23; // if dialog state is 2, start song demonstration if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { @@ -249,8 +248,8 @@ void EnFu_WaitAdult(EnFu* this, PlayState* play) { } void EnFu_Update(Actor* thisx, PlayState* play) { - s32 pad; EnFu* this = (EnFu*)thisx; + s32 pad; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); 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 6e08db02828..8e1e22ce68e 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -1,9 +1,3 @@ -/* - * File: z_en_fw.c - * Overlay: ovl_En_Fw - * Description: Flare Dancer Core - */ - #include "z_en_fw.h" #include "overlays/actors/ovl_En_Bom/z_en_bom.h" @@ -117,7 +111,7 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) { s32 EnFw_PlayerInRange(EnFw* this, PlayState* play) { Player* player = GET_PLAYER(play); CollisionPoly* poly; - s32 bgId; + u32 bgId; Vec3f collisionPos; if (this->actor.xzDistToPlayer > 300.0f) { 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 891ae41d941..5bf7e07b99f 100644 --- a/src/overlays/actors/ovl_En_Fz/z_en_fz.h +++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.h @@ -16,7 +16,7 @@ typedef struct EnFzEffect { /* 0x0010 */ Vec3f velocity; /* 0x001C */ Vec3f accel; /* 0x0028 */ char unk_28[0x4]; - /* 0x002C */ s16 primAlpha; // transparency in RGBA color system + /* 0x002C */ s16 primAlpha; // transparency in RGBA colour system /* 0x002E */ s16 primAlphaState; // 0: increasing (more opaque) 1: decreasing (more transparent) 2: collision /* 0x0030 */ f32 xyScale; /* 0x0034 */ f32 xyScaleTarget; @@ -42,7 +42,7 @@ typedef struct EnFz { /* 0x024C */ f32 iceSmokeFreezingSpawnHeight; // Height for Ice Smoke Spawn, only when freezing /* 0x0250 */ f32 unusedFloat; // Set to 135.0f /* 0x0254 */ f32 speedXZ; // Set to 4.0f when moving - /* 0x0258 */ u32 envAlpha; // transparency in RGBA color system + /* 0x0258 */ u32 envAlpha; // transparency in RGBA colour system /* 0x025C */ u16 unusedNum1; // Only set to 0 /* 0x025E */ u16 unusedNum2; // Set to either 0 when hidden or 4000 when growing /* 0x0260 */ u8 state; // 0 (hidden) 1 (growning/shrinking) 2 (full size) 3 (melting from fire) 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 0830301e04f..f20b91fc838 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 @@ -36,95 +36,7 @@ ActorProfile En_Ganon_Organ_Profile = { static u64 sForceAlignment = 0; -#define sRoomCarpetTex_WIDTH 64 -#define sRoomCarpetTex_HEIGHT 16 -static u64 sRoomCarpetTex[TEX_LEN(u64, sRoomCarpetTex_WIDTH, sRoomCarpetTex_HEIGHT, 16)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomCarpetTex.rgba16.inc.c" -}; - -#define sRoomOrganPipeTex_WIDTH 16 -#define sRoomOrganPipeTex_HEIGHT 64 -static u64 sRoomOrganPipeTex[TEX_LEN(u64, sRoomOrganPipeTex_WIDTH, sRoomOrganPipeTex_HEIGHT, 4)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganPipeTex.i4.inc.c" -}; - -#define sRoomOrganCorbelsTex_WIDTH 16 -#define sRoomOrganCorbelsTex_HEIGHT 16 -static u64 sRoomOrganCorbelsTex[TEX_LEN(u64, sRoomOrganCorbelsTex_WIDTH, sRoomOrganCorbelsTex_HEIGHT, 4)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganCorbelsTex.i4.inc.c" -}; - -#define sRoomOrganGrillTex_WIDTH 16 -#define sRoomOrganGrillTex_HEIGHT 16 -static u64 sRoomOrganGrillTex[TEX_LEN(u64, sRoomOrganGrillTex_WIDTH, sRoomOrganGrillTex_HEIGHT, 16)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganGrillTex.rgba16.inc.c" -}; - -#define sRoomCrestFriezeTex_WIDTH 32 -#define sRoomCrestFriezeTex_HEIGHT 32 -static u64 sRoomCrestFriezeTex[TEX_LEN(u64, sRoomCrestFriezeTex_WIDTH, sRoomCrestFriezeTex_HEIGHT, 4)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomCrestFriezeTex.i4.inc.c" -}; - -#define sRoomColumnFriezeAndCanopyTex_WIDTH 16 -#define sRoomColumnFriezeAndCanopyTex_HEIGHT 16 -static u64 sRoomColumnFriezeAndCanopyTex[TEX_LEN(u64, sRoomColumnFriezeAndCanopyTex_WIDTH, - sRoomColumnFriezeAndCanopyTex_HEIGHT, 4)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomColumnFriezeAndCanopyTex.i4.inc.c" -}; - -#define sRoomColumnMetalEdgingTex_WIDTH 16 -#define sRoomColumnMetalEdgingTex_HEIGHT 16 -static u64 - sRoomColumnMetalEdgingTex[TEX_LEN(u64, sRoomColumnMetalEdgingTex_WIDTH, sRoomColumnMetalEdgingTex_HEIGHT, 16)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomColumnMetalEdgingTex.rgba16.inc.c" - }; - -#define sRoomStatueWingTex_WIDTH 16 -#define sRoomStatueWingTex_HEIGHT 16 -static u64 sRoomStatueWingTex[TEX_LEN(u64, sRoomStatueWingTex_WIDTH, sRoomStatueWingTex_HEIGHT, 16)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomStatueWingTex.rgba16.inc.c" -}; - -#define sRoomPillarTex_WIDTH 8 -#define sRoomPillarTex_HEIGHT 32 -static u64 sRoomPillarTex[TEX_LEN(u64, sRoomPillarTex_WIDTH, sRoomPillarTex_HEIGHT, 8)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomPillarTex.i8.inc.c" -}; - -#define sRoomOrganKeyboardTex_WIDTH 32 -#define sRoomOrganKeyboardTex_HEIGHT 8 -static u64 sRoomOrganKeyboardTex[TEX_LEN(u64, sRoomOrganKeyboardTex_WIDTH, sRoomOrganKeyboardTex_HEIGHT, 16)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganKeyboardTex.rgba16.inc.c" -}; - -#define sRoomOrganKeyEndTex_WIDTH 4 -#define sRoomOrganKeyEndTex_HEIGHT 8 -static u64 sRoomOrganKeyEndTex[TEX_LEN(u64, sRoomOrganKeyEndTex_WIDTH, sRoomOrganKeyEndTex_HEIGHT, 16)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganKeyEndTex.rgba16.inc.c" -}; - -#define sRoomStepTex_WIDTH 16 -#define sRoomStepTex_HEIGHT 16 -static u64 sRoomStepTex[TEX_LEN(u64, sRoomStepTex_WIDTH, sRoomStepTex_HEIGHT, 4)] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomStepTex.i4.inc.c" -}; - -static Vtx sRoomOrganAndFloorVtx[] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganAndFloorVtx.inc.c" -}; - -static Gfx sRoomOrganAndFloorDL[429] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomOrganAndFloorDL.inc.c" -}; - -static Vtx sRoomStatuesVtx[] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomStatuesVtx.inc.c" -}; - -static Gfx sRoomStatuesDL[152] = { -#include "assets/overlays/ovl_En_Ganon_Organ/sRoomStatuesDL.inc.c" -}; +#include "assets/overlays/ovl_En_Ganon_Organ/ovl_En_Ganon_Organ.c" void EnGanonOrgan_Init(Actor* thisx, PlayState* play) { thisx->flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; @@ -197,9 +109,8 @@ void EnGanonOrgan_Draw(Actor* thisx, PlayState* play) { Matrix_Translate(0.0f, 0.0f, 0.0f, MTXMODE_NEW); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_ganon_organ.c", 221); - gSPDisplayList(POLY_OPA_DISP++, sRoomOrganAndFloorDL); - gSPDisplayList(POLY_OPA_DISP++, sRoomStatuesDL); - + gSPDisplayList(POLY_OPA_DISP++, sGanonOrgan1DL); + gSPDisplayList(POLY_OPA_DISP++, sGanonOrgan2DL); PRINTF("ORGAN DRAW 2\n"); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ganon_organ.c", 230); 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 cf3a74c2922..8c7d47c4e3c 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -1,9 +1,3 @@ -/* - * File: z_en_ge1.c - * Overlay: ovl_En_Ge1 - * Description: White-clothed Gerudo - */ - #include "z_en_ge1.h" #include "libu64/debug.h" @@ -13,8 +7,6 @@ #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" -#include "terminal.h" -#include "translation.h" #include "z_lib.h" #include "face_reaction.h" #include "horse.h" @@ -26,34 +18,23 @@ #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) -#define GE1_STATE_TALKING (1 << 0) -#define GE1_STATE_GIVE_QUIVER (1 << 1) -#define GE1_STATE_IDLE_ANIM (1 << 2) -#define GE1_STATE_STOP_FIDGET (1 << 3) - -typedef enum EnGe1Hairstyle { - /* 00 */ GE1_HAIR_BOB, - /* 01 */ GE1_HAIR_STRAIGHT, - /* 02 */ GE1_HAIR_SPIKY -} EnGe1Hairstyle; - void EnGe1_Init(Actor* thisx, PlayState* play); void EnGe1_Destroy(Actor* thisx, PlayState* play); void EnGe1_Update(Actor* thisx, PlayState* play); void EnGe1_Draw(Actor* thisx, PlayState* play); -s32 EnGe1_CheckAllCarpentersRescued(void); -void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play); -void EnGe1_SetNormalText(EnGe1* this, PlayState* play); -void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play); -void EnGe1_GetReaction_ValleyFloor(EnGe1* this, PlayState* play); -void EnGe1_CheckForCard_GTGGuard(EnGe1* this, PlayState* play); -void EnGe1_CheckGate_GateOp(EnGe1* this, PlayState* play); -void EnGe1_GetReaction_GateGuard(EnGe1* this, PlayState* play); -void EnGe1_TalkAfterGame_Archery(EnGe1* this, PlayState* play); -void EnGe1_Wait_Archery(EnGe1* this, PlayState* play); -void EnGe1_CueUpAnimation(EnGe1* this); -void EnGe1_StopFidget(EnGe1* this); +s32 func_80A30DCC(void); +void func_80A30F48(EnGe1* this, PlayState* play); +void func_80A31094(EnGe1* this, PlayState* play); +void func_80A310C4(EnGe1* this, PlayState* play); +void func_80A3118C(EnGe1* this, PlayState* play); +void func_80A31514(EnGe1* this, PlayState* play); +void func_80A317C0(EnGe1* this, PlayState* play); +void func_80A31880(EnGe1* this, PlayState* play); +void func_80A31E2C(EnGe1* this, PlayState* play); +void func_80A31FE0(EnGe1* this, PlayState* play); +void func_80A323B0(EnGe1* this); +void func_80A323EC(EnGe1* this); ActorProfile En_Ge1_Profile = { /**/ ACTOR_EN_GE1, @@ -67,7 +48,7 @@ ActorProfile En_Ge1_Profile = { /**/ EnGe1_Draw, }; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_80A32770 = { { COL_MATERIAL_NONE, AT_NONE, @@ -87,509 +68,465 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -static Gfx* sHairstyleDLists[] = { - gGerudoWhiteHairstyleBobDL, - gGerudoWhiteHairstyleStraightFringeDL, - gGerudoWhiteHairstyleSpikyDL, -}; - +static Gfx* D_80A3279C[3] = { object_ge1_009198_DL, object_ge1_009430_DL, object_ge1_009690_DL }; static Vec3f D_80A327A8 = { 600.0f, 700.0f, 0.0f }; - -static void* sEyeTextures[] = { - gGerudoWhiteEyeOpenTex, - gGerudoWhiteEyeHalfTex, - gGerudoWhiteEyeClosedTex, -}; +static s32 D_80A327B4[3] = { 0x06000708, 0x06000F08, 0x06001708 }; void EnGe1_Init(Actor* thisx, PlayState* play) { - s32 pad; EnGe1* this = (EnGe1*)thisx; + s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoWhiteSkel, &gGerudoWhiteIdleAnim, this->jointTable, - this->morphTable, GERUDO_WHITE_LIMB_MAX); - Animation_PlayOnce(&this->skelAnime, &gGerudoWhiteIdleAnim); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->unk198, &object_ge1_000330_Skel, &object_ge1_000228_Anim, this->unk1DC, + this->unk23C, 16); + Animation_PlayOnce(&this->unk198, &object_ge1_000228_Anim); + Collider_InitCylinder(play, &this->unk14C); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A32770); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->animation = &gGerudoWhiteIdleAnim; - this->animFunc = EnGe1_CueUpAnimation; + this->unk2B0 = &object_ge1_000228_Anim; + this->unk2B8 = func_80A323B0; this->actor.attentionRangeType = ATTENTION_RANGE_6; Actor_SetScale(&this->actor, 0.01f); - - this->actor.cullingVolumeDistance = ((play->sceneId == SCENE_GERUDO_VALLEY) ? 1000.0f : 1200.0f); - + if (play->sceneId == SCENE_GERUDO_VALLEY) { + this->actor.cullingVolumeDistance = 1000.0f; + } else { + this->actor.cullingVolumeDistance = 1200.0f; + } switch (PARAMS_GET_U(this->actor.params, 0, 8)) { - - case GE1_TYPE_GATE_GUARD: - this->hairstyle = GE1_HAIR_SPIKY; - this->actionFunc = EnGe1_GetReaction_GateGuard; + case 0x0: + this->unk2AE = 2; + this->unk2B4 = func_80A31880; break; - case GE1_TYPE_GATE_OPERATOR: - this->hairstyle = GE1_HAIR_STRAIGHT; - - if (EnGe1_CheckAllCarpentersRescued()) { - this->actionFunc = EnGe1_CheckGate_GateOp; + case 0x1: + this->unk2AE = 1; + if (func_80A30DCC() != 0) { + this->unk2B4 = func_80A317C0; } else { - this->actionFunc = EnGe1_WatchForPlayerFrontOnly; + this->unk2B4 = func_80A30F48; } break; - case GE1_TYPE_NORMAL: - this->hairstyle = GE1_HAIR_STRAIGHT; - - if (EnGe1_CheckAllCarpentersRescued()) { - this->actionFunc = EnGe1_SetNormalText; + case 0x4: + this->unk2AE = 1; + if (func_80A30DCC() != 0) { + this->unk2B4 = func_80A31094; } else { - this->actionFunc = EnGe1_WatchForAndSensePlayer; + this->unk2B4 = func_80A310C4; } break; - case GE1_TYPE_VALLEY_FLOOR: + case 0x5: if (LINK_IS_ADULT) { - PRINTF(VT_FGCOL(CYAN) T("谷底 ゲルド 撤退 \n", "Valley floor Gerudo withdrawal \n") VT_RST); + PRINTF("\x1b[36m谷底 ゲルド 撤退 \n\x1b[m"); Actor_Kill(&this->actor); return; } - this->hairstyle = GE1_HAIR_BOB; - this->actionFunc = EnGe1_GetReaction_ValleyFloor; + this->unk2AE = 0; + this->unk2B4 = func_80A3118C; break; - case GE1_TYPE_HORSEBACK_ARCHERY: - if (INV_CONTENT(SLOT_BOW) == ITEM_NONE) { + case 0x45: + if (INV_CONTENT(ITEM_BOW) == ITEM_NONE) { Actor_Kill(&this->actor); return; } this->actor.attentionRangeType = ATTENTION_RANGE_3; - this->hairstyle = GE1_HAIR_BOB; - PRINTF(VT_FGCOL(CYAN) - T("やぶさめ ゲルド EVENT_INF(0) = %x\n", "Horseback archery Gerudo EVENT_INF(0) = %x\n") VT_RST, - gSaveContext.eventInf[0]); - + this->unk2AE = 0; + PRINTF("\x1b[36mやぶさめ ゲルド EVENT_INF(0) = %x\n\x1b[m", gSaveContext.eventInf[0]); if (GET_EVENTINF(EVENTINF_HORSES_08)) { - this->actionFunc = EnGe1_TalkAfterGame_Archery; - } else if (EnGe1_CheckAllCarpentersRescued()) { - this->actionFunc = EnGe1_Wait_Archery; + this->unk2B4 = func_80A31E2C; + } else if (func_80A30DCC() != 0) { + this->unk2B4 = func_80A31FE0; } else { - this->actionFunc = EnGe1_WatchForPlayerFrontOnly; + this->unk2B4 = func_80A30F48; } break; - case GE1_TYPE_TRAINING_GROUNDS_GUARD: - this->hairstyle = GE1_HAIR_STRAIGHT; - - if (EnGe1_CheckAllCarpentersRescued()) { - this->actionFunc = EnGe1_CheckForCard_GTGGuard; + case 0x46: + this->unk2AE = 1; + if (func_80A30DCC() != 0) { + this->unk2B4 = func_80A31514; } else { - this->actionFunc = EnGe1_WatchForPlayerFrontOnly; + this->unk2B4 = func_80A30F48; } break; } - - this->stateFlags = 0; + this->unk2AC = 0; } void EnGe1_Destroy(Actor* thisx, PlayState* play) { EnGe1* this = (EnGe1*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk14C); } -s32 EnGe1_SetTalkAction(EnGe1* this, PlayState* play, u16 textId, f32 arg3, EnGe1ActionFunc actionFunc) { +s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionFunc arg4) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = actionFunc; - this->animFunc = EnGe1_StopFidget; - this->stateFlags &= ~GE1_STATE_IDLE_ANIM; - this->animation = &gGerudoWhiteIdleAnim; - Animation_Change(&this->skelAnime, &gGerudoWhiteIdleAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoWhiteIdleAnim), ANIMMODE_ONCE, -8.0f); - return true; - } - - this->actor.textId = textId; - - if (this->actor.xzDistToPlayer < arg3) { - Actor_OfferTalk(&this->actor, play, arg3); + this->unk2B4 = arg4; + this->unk2B8 = func_80A323EC; + this->unk2AC &= ~4; + this->unk2B0 = &object_ge1_000228_Anim; + Animation_Change(&this->unk198, &object_ge1_000228_Anim, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ge1_000228_Anim), ANIMMODE_ONCE, -8.0f); + return 1; + } else { + this->actor.textId = arg2; + if (this->actor.xzDistToPlayer < arg3) { + Actor_OfferTalk(&this->actor, play, arg3); + } + return 0; } - - return false; } -void EnGe1_SetAnimationIdle(EnGe1* this) { - Animation_Change(&this->skelAnime, &gGerudoWhiteIdleAnim, -1.0f, Animation_GetLastFrame(&gGerudoWhiteIdleAnim), +void func_80A30D48(EnGe1* this) { + Animation_Change(&this->unk198, &object_ge1_000228_Anim, -1.0f, Animation_GetLastFrame(&object_ge1_000228_Anim), 0.0f, ANIMMODE_ONCE, 8.0f); - this->animation = &gGerudoWhiteIdleAnim; - this->animFunc = EnGe1_CueUpAnimation; + this->unk2B0 = &object_ge1_000228_Anim; + this->unk2B8 = func_80A323B0; } -s32 EnGe1_CheckAllCarpentersRescued(void) { +s32 func_80A30DCC(void) { if (!(GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_0_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_1_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_2_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_3_RESCUED))) { - return false; + return 0; + } else { + return 1; } - return true; } -/** - * Sends player to different places depending on if has hookshot, and if this is the first time captured - */ -void EnGe1_KickPlayer(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; - - if (this->cutsceneTimer > 0) { - this->cutsceneTimer--; +void func_80A30E08(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; + if (this->unk2AF > 0) { + this->unk2AF--; } else { Horse_ResetHorseData(play); - if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { play->nextEntranceIndex = ENTR_GERUDO_VALLEY_1; - } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { // Caught previously + } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_18; } else { play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_17; } - play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } } -void EnGe1_SpotPlayer(EnGe1* this, PlayState* play) { - this->cutsceneTimer = 30; - this->actionFunc = EnGe1_KickPlayer; +void func_80A30EE8(EnGe1* this, PlayState* play) { + this->unk2AF = 0x1E; + this->unk2B4 = func_80A30E08; Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_95); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); - Message_StartTextbox(play, 0x6000, &this->actor); + Message_StartTextbox(play, 0x6000U, &this->actor); } -void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play) { - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; +void func_80A30F48(EnGe1* this, PlayState* play) { + s16 temp_v0; - if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - EnGe1_SpotPlayer(this, play); + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 100.0f)) { + func_80A30EE8(this, play); } - - if (this->collider.base.acFlags & AC_HIT) { - EnGe1_SpotPlayer(this, play); + if (this->unk14C.base.acFlags & 2) { + func_80A30EE8(this, play); } - - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); } -void EnGe1_ChooseActionFromTextId(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; - +void func_80A31000(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.textId) { case 0x6001: - this->actionFunc = EnGe1_SetNormalText; + this->unk2B4 = func_80A31094; break; - case 0x601A: case 0x6019: - this->actionFunc = EnGe1_GetReaction_ValleyFloor; + case 0x601A: + this->unk2B4 = func_80A3118C; break; case 0x6018: - this->actionFunc = EnGe1_CheckGate_GateOp; + this->unk2B4 = func_80A317C0; break; default: - this->actionFunc = EnGe1_GetReaction_ValleyFloor; + this->unk2B4 = func_80A3118C; break; } } } -void EnGe1_SetNormalText(EnGe1* this, PlayState* play) { - EnGe1_SetTalkAction(this, play, 0x6001, 100.0f, EnGe1_ChooseActionFromTextId); +void func_80A31094(EnGe1* this, PlayState* play) { + func_80A30C70(this, play, 0x6001U, 100.0f, func_80A31000); } -void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play) { - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; +void func_80A310C4(EnGe1* this, PlayState* play) { + s16 temp_v0; - if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 400.0f))) { - EnGe1_SpotPlayer(this, play); + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 400.0f))) { + func_80A30EE8(this, play); } - - if (this->collider.base.acFlags & AC_HIT) { - EnGe1_SpotPlayer(this, play); + if (this->unk14C.base.acFlags & 2) { + func_80A30EE8(this, play); } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); } -void EnGe1_GetReaction_ValleyFloor(EnGe1* this, PlayState* play) { - u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); +void func_80A3118C(EnGe1* this, PlayState* play) { + u16 textId; + textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); if (textId == 0) { textId = 0x6019; } - - EnGe1_SetTalkAction(this, play, textId, 100.0f, EnGe1_ChooseActionFromTextId); + func_80A30C70(this, play, textId, 100.0f, func_80A31000); } -// Gerudo Training Ground Guard functions - -void EnGe1_WaitTillOpened_GTGGuard(EnGe1* this, PlayState* play) { - if (this->cutsceneTimer > 0) { - this->cutsceneTimer--; +void func_80A311E0(EnGe1* this, PlayState* play) { + if (this->unk2AF > 0) { + this->unk2AF--; } else { - EnGe1_SetAnimationIdle(this); - this->actionFunc = EnGe1_SetNormalText; + func_80A30D48(this); + this->unk2B4 = func_80A31094; } - - this->stateFlags |= GE1_STATE_STOP_FIDGET; + this->unk2AC |= 8; } -void EnGe1_Open_GTGGuard(EnGe1* this, PlayState* play) { - if (this->stateFlags & GE1_STATE_IDLE_ANIM) { - this->actionFunc = EnGe1_WaitTillOpened_GTGGuard; +void func_80A31234(EnGe1* this, PlayState* play) { + if (this->unk2AC & 4) { + this->unk2B4 = func_80A311E0; Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); - this->cutsceneTimer = 50; + this->unk2AF = 0x32; Message_CloseTextbox(play); - } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { - Actor_PlaySfx(&this->actor, NA_SE_IT_HAND_CLAP); + } else if ((this->unk198.curFrame == 15.0f) || (this->unk198.curFrame == 19.0f)) { + Actor_PlaySfx(&this->actor, 0x184DU); } } -void EnGe1_SetupOpen_GTGGuard(EnGe1* this, PlayState* play) { +void func_80A312E4(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->actionFunc = EnGe1_Open_GTGGuard; - Animation_Change(&this->skelAnime, &gGerudoWhiteClapAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoWhiteClapAnim), ANIMMODE_ONCE, -3.0f); - this->animation = &gGerudoWhiteClapAnim; - this->animFunc = EnGe1_StopFidget; - this->stateFlags &= ~GE1_STATE_IDLE_ANIM; + this->unk2B4 = func_80A31234; + Animation_Change(&this->unk198, &object_ge1_00A048_Anim, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ge1_00A048_Anim), ANIMMODE_ONCE, -3.0f); + this->unk2B0 = &object_ge1_00A048_Anim; + this->unk2B8 = func_80A323EC; + this->unk2AC &= 0xFFFB; } } -void EnGe1_RefuseEntryTooPoor_GTGGuard(EnGe1* this, PlayState* play) { +void func_80A313A0(EnGe1* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - this->actionFunc = EnGe1_CheckForCard_GTGGuard; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31514; + func_80A30D48(this); } } -void EnGe1_OfferOpen_GTGGuard(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; +void func_80A313E0(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.info.playerData.rupees < 10) { - Message_ContinueTextbox(play, 0x6016); - this->actionFunc = EnGe1_RefuseEntryTooPoor_GTGGuard; + Message_ContinueTextbox(play, 0x6016U); + this->unk2B4 = func_80A313A0; } else { Rupees_ChangeBy(-10); - Message_ContinueTextbox(play, 0x6015); - this->actionFunc = EnGe1_SetupOpen_GTGGuard; + Message_ContinueTextbox(play, 0x6015U); + this->unk2B4 = func_80A312E4; } break; + case 1: - this->actionFunc = EnGe1_CheckForCard_GTGGuard; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31514; + func_80A30D48(this); break; } } } -void EnGe1_RefuseOpenNoCard_GTGGuard(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; +void func_80A314D0(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->actionFunc = EnGe1_CheckForCard_GTGGuard; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31514; + func_80A30D48(this); } } -void EnGe1_CheckForCard_GTGGuard(EnGe1* this, PlayState* play) { - if (CHECK_QUEST_ITEM(QUEST_GERUDOS_CARD)) { - EnGe1_SetTalkAction(this, play, 0x6014, 100.0f, EnGe1_OfferOpen_GTGGuard); +void func_80A31514(EnGe1* this, PlayState* play) { + if (gBitFlags[0x16] & gSaveContext.save.info.inventory.questItems) { + func_80A30C70(this, play, 0x6014U, 100.0f, func_80A313E0); } else { - //! @bug This outcome is inaccessible in normal gameplay since this function it is unreachable without - //! obtaining the card in the first place. - EnGe1_SetTalkAction(this, play, 0x6013, 100.0f, EnGe1_RefuseOpenNoCard_GTGGuard); + func_80A30C70(this, play, 0x6013U, 100.0f, func_80A314D0); } } -// Gate Operator functions - -void EnGe1_WaitGateOpen_GateOp(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; - +void func_80A3157C(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->actionFunc = EnGe1_CheckGate_GateOp; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A317C0; + func_80A30D48(this); } } -void EnGe1_WaitUntilGateOpened_GateOp(EnGe1* this, PlayState* play) { - if (this->cutsceneTimer > 0) { - this->cutsceneTimer--; +void func_80A315F0(EnGe1* this, PlayState* play) { + if (this->unk2AF > 0) { + this->unk2AF--; } else { - EnGe1_SetAnimationIdle(this); - this->actionFunc = EnGe1_CheckGate_GateOp; + func_80A30D48(this); + this->unk2B4 = func_80A317C0; } - this->stateFlags |= GE1_STATE_STOP_FIDGET; + this->unk2AC |= 8; } -void EnGe1_OpenGate_GateOp(EnGe1* this, PlayState* play) { - if (this->stateFlags & GE1_STATE_IDLE_ANIM) { - this->actionFunc = EnGe1_WaitUntilGateOpened_GateOp; +void func_80A31644(EnGe1* this, PlayState* play) { + if (this->unk2AC & 4) { + this->unk2B4 = func_80A315F0; Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); - this->cutsceneTimer = 50; + this->unk2AF = 0x32; Message_CloseTextbox(play); - } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { + } else if ((this->unk198.curFrame == 15.0f) || (this->unk198.curFrame == 19.0f)) { Actor_PlaySfx(&this->actor, NA_SE_IT_HAND_CLAP); } } -void EnGe1_SetupOpenGate_GateOp(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; - +void func_80A316F4(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->actionFunc = EnGe1_OpenGate_GateOp; - Animation_Change(&this->skelAnime, &gGerudoWhiteClapAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoWhiteClapAnim), ANIMMODE_ONCE, -3.0f); - this->animation = &gGerudoWhiteClapAnim; - this->animFunc = EnGe1_StopFidget; - this->stateFlags &= ~GE1_STATE_IDLE_ANIM; + this->unk2B4 = func_80A31644; + Animation_Change(&this->unk198, &object_ge1_00A048_Anim, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ge1_00A048_Anim), ANIMMODE_ONCE, -3.0f); + this->unk2B0 = &object_ge1_00A048_Anim; + this->unk2B8 = func_80A323EC; + this->unk2AC &= ~4; } } -void EnGe1_CheckGate_GateOp(EnGe1* this, PlayState* play) { +void func_80A317C0(EnGe1* this, PlayState* play) { if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { - EnGe1_SetTalkAction(this, play, 0x6018, 100.0f, EnGe1_WaitGateOpen_GateOp); + func_80A30C70(this, play, 0x6018U, 100.0f, func_80A3157C); } else { - EnGe1_SetTalkAction(this, play, 0x6017, 100.0f, EnGe1_SetupOpenGate_GateOp); + func_80A30C70(this, play, 0x6017U, 100.0f, func_80A316F4); } } -// Gate guard functions - -void EnGe1_Talk_GateGuard(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; - +void func_80A3183C(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->actionFunc = EnGe1_GetReaction_GateGuard; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31880; + func_80A30D48(this); } } -void EnGe1_GetReaction_GateGuard(EnGe1* this, PlayState* play) { +void func_80A31880(EnGe1* this, PlayState* play) { u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); if (textId == 0) { textId = 0x6069; } - - if (EnGe1_SetTalkAction(this, play, textId, 100.0f, EnGe1_Talk_GateGuard)) { - this->animFunc = EnGe1_CueUpAnimation; - this->animation = &gGerudoWhiteDismissiveAnim; - Animation_Change(&this->skelAnime, &gGerudoWhiteDismissiveAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gGerudoWhiteDismissiveAnim), ANIMMODE_ONCE, -8.0f); + if (func_80A30C70(this, play, textId, 100.0f, func_80A3183C) != 0) { + this->unk2B8 = func_80A323B0; + this->unk2B0 = &object_ge1_00A498_Anim; + Animation_Change(&this->unk198, &object_ge1_00A498_Anim, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ge1_00A498_Anim), ANIMMODE_ONCE, -8.0f); } } -// Archery functions - -void EnGe1_SetupWait_Archery(EnGe1* this, PlayState* play) { +void func_80A31934(EnGe1* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - this->actionFunc = EnGe1_Wait_Archery; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31FE0; + func_80A30D48(this); } } -void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, PlayState* play) { - s32 getItemId; +void func_80A3196C(EnGe1* this, PlayState* play) { + s32 var_a2; - if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = EnGe1_SetupWait_Archery; - if (this->stateFlags & GE1_STATE_GIVE_QUIVER) { + if (Actor_HasParent(&this->actor, play) != 0) { + this->unk2B4 = func_80A31934; + if (this->unk2AC & 2) { SET_ITEMGETINF(ITEMGETINF_0F); + return; } else { SET_INFTABLE(INFTABLE_190); } - } else { - if (this->stateFlags & GE1_STATE_GIVE_QUIVER) { - switch (CUR_UPG_VALUE(UPG_QUIVER)) { - //! @bug Asschest. See next function for details - case 1: - getItemId = GI_QUIVER_40; - break; - case 2: - getItemId = GI_QUIVER_50; - break; - } - } else { - getItemId = GI_HEART_PIECE; + return; + } + if (this->unk2AC & 2) { + switch (CUR_UPG_VALUE(UPG_QUIVER)) { + case 1: + var_a2 = 0x30; + break; + case 2: + var_a2 = 0x31; + break; } - Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f); + } else { + var_a2 = 0x3E; } + //! @bug var_a2 may be used uninitialized + Actor_OfferGetItem(&this->actor, play, var_a2, 10000.0f, 50.0f); } -void EnGe1_BeginGiveItem_Archery(EnGe1* this, PlayState* play) { - s32 getItemId; +void func_80A31A5C(EnGe1* this, PlayState* play) { + s32 var_a2; if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - this->actionFunc = EnGe1_WaitTillItemGiven_Archery; + this->unk2B4 = func_80A3196C; } - - if (this->stateFlags & GE1_STATE_GIVE_QUIVER) { + if (this->unk2AC & 2) { switch (CUR_UPG_VALUE(UPG_QUIVER)) { - //! @bug Asschest: the compiler inserts a default assigning *(sp+0x24) to getItemId, which is junk data left - //! over from the previous function run in EnGe1_Update, namely EnGe1_CueUpAnimation. The top stack variable - //! in that function is &this->skelAnime = thisx + 198, and depending on where this loads in memory, the - //! getItemId changes. case 1: - getItemId = GI_QUIVER_40; + var_a2 = 0x30; break; case 2: - getItemId = GI_QUIVER_50; + var_a2 = 0x31; break; } } else { - getItemId = GI_HEART_PIECE; + var_a2 = 0x3E; } - - Actor_OfferGetItem(&this->actor, play, getItemId, 10000.0f, 50.0f); + //! @bug var_a2 may be used uninitialized + Actor_OfferGetItem(&this->actor, play, var_a2, 10000.0f, 50.0f); } -void EnGe1_TalkWinPrize_Archery(EnGe1* this, PlayState* play) { +void func_80A31B20(EnGe1* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnGe1_BeginGiveItem_Archery; + this->unk2B4 = func_80A31A5C; this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } else { Actor_OfferTalk(&this->actor, play, 200.0f); } } -void EnGe1_TalkTooPoor_Archery(EnGe1* this, PlayState* play) { +void func_80A31B7C(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->actionFunc = EnGe1_Wait_Archery; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31FE0; + func_80A30D48(this); } } -void EnGe1_WaitDoNothing(EnGe1* this, PlayState* play) { +void func_80A31BDC(EnGe1* this, PlayState* play) { } -void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { - Player* player = GET_PLAYER(play); - Actor* horse; +void func_80A31BE8(EnGe1* this, PlayState* play) { + Player* player; + Actor* temp_v0_2; + player = GET_PLAYER(play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.info.playerData.rupees < 20) { Message_ContinueTextbox(play, 0x85); - this->actionFunc = EnGe1_TalkTooPoor_Archery; + this->unk2B4 = func_80A31B7C; } else { Rupees_ChangeBy(-20); play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; @@ -598,135 +535,136 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_08); SET_EVENTCHKINF(EVENTCHKINF_68); - if (!(player->stateFlags1 & PLAYER_STATE1_23)) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); } else { - horse = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); - player->actor.freezeTimer = 1200; - - if (horse != NULL) { - horse->freezeTimer = 1200; + temp_v0_2 = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, 1U, 1200.0f); + player->actor.freezeTimer = 0x4B0; + if (temp_v0_2 != NULL) { + temp_v0_2->freezeTimer = 0x4B0; } } - - this->actionFunc = EnGe1_WaitDoNothing; + this->unk2B4 = func_80A31BDC; } break; case 1: - this->actionFunc = EnGe1_Wait_Archery; + this->unk2B4 = func_80A31FE0; Message_CloseTextbox(play); break; } } } -void EnGe1_TalkOfferPlay_Archery(EnGe1* this, PlayState* play) { +void func_80A31D88(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_ContinueTextbox(play, 0x6041); - this->actionFunc = EnGe1_BeginGame_Archery; + this->unk2B4 = func_80A31BE8; } } -void EnGe1_TalkNoPrize_Archery(EnGe1* this, PlayState* play) { +void func_80A31DE4(EnGe1* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnGe1_TalkOfferPlay_Archery; - } else { - Actor_OfferTalk(&this->actor, play, 300.0f); + this->unk2B4 = func_80A31D88; + return; } + Actor_OfferTalk(&this->actor, play, 300.0f); } -void EnGe1_TalkAfterGame_Archery(EnGe1* this, PlayState* play) { +void func_80A31E2C(EnGe1* this, PlayState* play) { CLEAR_EVENTINF(EVENTINF_HORSES_08); - LOG_NUM("z_common_data.yabusame_total", gSaveContext.minigameScore, "../z_en_ge1.c", 1110); +#if DEBUG_FEATURES + LogUtils_LogThreadId("../z_en_ge1.c", 0x456); + PRINTF("z_common_data.yabusame_total = %d\n", gSaveContext.minigameScore); + if (1) {} + if (1) {} + if (1) {} + LogUtils_LogThreadId("../z_en_ge1.c", 0x457); // With the current `SaveContext` struct definition, the expression in the debug string is an out-of-bounds read, // see the other occurrence of this for more details. - LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA), "../z_en_ge1.c", 1111); + PRINTF("z_common_data.memory.information.room_inf[127][ 0 ] = %d\n", gSaveContext.save.info.highScores[0]); +#endif this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - - if (HIGH_SCORE(HS_HBA) < gSaveContext.minigameScore) { - HIGH_SCORE(HS_HBA) = gSaveContext.minigameScore; + if (gSaveContext.save.info.highScores[0] < gSaveContext.minigameScore) { + gSaveContext.save.info.highScores[0] = gSaveContext.minigameScore; } - if (gSaveContext.minigameScore < 1000) { this->actor.textId = 0x6045; - this->actionFunc = EnGe1_TalkNoPrize_Archery; + this->unk2B4 = func_80A31DE4; } else if (!GET_INFTABLE(INFTABLE_190)) { this->actor.textId = 0x6046; - this->actionFunc = EnGe1_TalkWinPrize_Archery; - this->stateFlags &= ~GE1_STATE_GIVE_QUIVER; + this->unk2B4 = func_80A31B20; + this->unk2AC &= ~2; } else if (gSaveContext.minigameScore < 1500) { this->actor.textId = 0x6047; - this->actionFunc = EnGe1_TalkNoPrize_Archery; + this->unk2B4 = func_80A31DE4; } else if (GET_ITEMGETINF(ITEMGETINF_0F)) { this->actor.textId = 0x6047; - this->actionFunc = EnGe1_TalkNoPrize_Archery; + this->unk2B4 = func_80A31DE4; } else { this->actor.textId = 0x6044; - this->actionFunc = EnGe1_TalkWinPrize_Archery; - this->stateFlags |= GE1_STATE_GIVE_QUIVER; + this->unk2B4 = func_80A31B20; + this->unk2AC |= 2; } } -void EnGe1_TalkNoHorse_Archery(EnGe1* this, PlayState* play) { - this->stateFlags |= GE1_STATE_TALKING; +void func_80A31F9C(EnGe1* this, PlayState* play) { + this->unk2AC |= 1; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->actionFunc = EnGe1_Wait_Archery; - EnGe1_SetAnimationIdle(this); + this->unk2B4 = func_80A31FE0; + func_80A30D48(this); } } -void EnGe1_Wait_Archery(EnGe1* this, PlayState* play) { +void func_80A31FE0(EnGe1* this, PlayState* play) { Player* player = GET_PLAYER(play); - u16 textId; + u16 var_a2; if (!(player->stateFlags1 & PLAYER_STATE1_23)) { - EnGe1_SetTalkAction(this, play, 0x603F, 100.0f, EnGe1_TalkNoHorse_Archery); + func_80A30C70(this, play, 0x603FU, 100.0f, func_80A31F9C); } else { if (GET_EVENTCHKINF(EVENTCHKINF_68)) { if (GET_INFTABLE(INFTABLE_190)) { - textId = 0x6042; + var_a2 = 0x6042; } else { - textId = 0x6043; + var_a2 = 0x6043; } } else { - textId = 0x6040; + var_a2 = 0x6040; } - EnGe1_SetTalkAction(this, play, textId, 200.0f, EnGe1_TalkOfferPlay_Archery); + func_80A30C70(this, play, var_a2, 200.0f, func_80A31D88); } } -// General functions - -void EnGe1_TurnToFacePlayer(EnGe1* this, PlayState* play) { +void func_80A32078(EnGe1* this, PlayState* play) { s32 pad; - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + s16 temp_v0; - if (ABS(angleDiff) <= 0x4000) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100); + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (ABS(temp_v0) <= 0x4000) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk29C, &this->unk2A2, this->actor.focus.pos); } else { - if (angleDiff < 0) { - Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); + if (temp_v0 < 0) { + Math_SmoothStepToS(&this->unk29C.y, -0x2000, 6, 0x1838, 0x100); } else { - Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 6200, 0x100); + Math_SmoothStepToS(&this->unk29C.y, 0x2000, 6, 0x1838, 0x100); } - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 1000, 100); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xC, 0x3E8, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; } } -void EnGe1_LookAtPlayer(EnGe1* this, PlayState* play) { - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; +void func_80A32190(EnGe1* this, PlayState* play) { + s16 temp_v0; - if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos); + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(temp_v0) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { + Actor_TrackPlayer(play, &this->actor, &this->unk29C, &this->unk2A2, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->unk29C.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk29C.y, 0, 6, 0x1838, 0x64); } } @@ -734,95 +672,83 @@ void EnGe1_Update(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk14C); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->animFunc(this); - this->actionFunc(this, play); - - if (this->stateFlags & GE1_STATE_TALKING) { - EnGe1_TurnToFacePlayer(this, play); - this->stateFlags &= ~GE1_STATE_TALKING; + this->unk2B8(this); + this->unk2B4(this, play); + if (this->unk2AC & 1) { + func_80A32078(this, play); + this->unk2AC &= ~1; } else { - EnGe1_LookAtPlayer(this, play); + func_80A32190(this, play); } - this->unk_2A2.x = this->unk_2A2.y = this->unk_2A2.z = 0; - - if (DECR(this->blinkTimer) == 0) { - this->blinkTimer = Rand_S16Offset(60, 60); + this->unk2A2.x = this->unk2A2.y = this->unk2A2.z = 0; + if (DECR(this->unk2AA) == 0) { + this->unk2AA = Rand_S16Offset(0x3C, 0x3C); } - this->eyeIndex = this->blinkTimer; - - if (this->eyeIndex >= 3) { - this->eyeIndex = 0; + this->unk2A8 = this->unk2AA; + if (this->unk2A8 >= 3) { + this->unk2A8 = 0; } } -// Animation functions - -void EnGe1_CueUpAnimation(EnGe1* this) { - if (SkelAnime_Update(&this->skelAnime)) { - Animation_PlayOnce(&this->skelAnime, this->animation); +void func_80A323B0(EnGe1* this) { + if (SkelAnime_Update(&this->unk198) != 0) { + Animation_PlayOnce(&this->unk198, this->unk2B0); } } -void EnGe1_StopFidget(EnGe1* this) { - if (!(this->stateFlags & GE1_STATE_IDLE_ANIM)) { - if (SkelAnime_Update(&this->skelAnime)) { - this->stateFlags |= GE1_STATE_IDLE_ANIM; +void func_80A323EC(EnGe1* this) { + if (!(this->unk2AC & 4)) { + if (SkelAnime_Update(&this->unk198) != 0) { + this->unk2AC |= 4; } - this->stateFlags |= GE1_STATE_STOP_FIDGET; + this->unk2AC |= 8; } } -s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { + EnGe1* this = thisx; s32 pad; - EnGe1* this = (EnGe1*)thisx; - if (limbIndex == GERUDO_WHITE_LIMB_HEAD) { - rot->x += this->headRot.y; - rot->z += this->headRot.x; + if (arg1 == 15) { + arg4->x += this->unk29C.y; + arg4->z += this->unk29C.x; } - - if (this->stateFlags & GE1_STATE_STOP_FIDGET) { - this->stateFlags &= ~GE1_STATE_STOP_FIDGET; + if (this->unk2AC & 8) { + this->unk2AC &= ~8; return 0; } - - // The purpose of the state flag GE1_STATE_STOP_FIDGET is to skip this code, which this actor has in lieu of an idle - // animation. - if ((limbIndex == GERUDO_WHITE_LIMB_TORSO) || (limbIndex == GERUDO_WHITE_LIMB_L_FOREARM) || - (limbIndex == GERUDO_WHITE_LIMB_R_FOREARM)) { - rot->y += Math_SinS(play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE; - rot->z += Math_CosS(play->state.frames * (limbIndex * FIDGET_FREQ_LIMB + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE; + if ((arg1 == 8) || (arg1 == 10) || (arg1 == 13)) { + arg4->y += + (Math_SinS((s16)(play->state.frames * ((arg1 * FIDGET_FREQ_LIMB) + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE); + arg4->z += + (Math_CosS((s16)(play->state.frames * ((arg1 * FIDGET_FREQ_LIMB) + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE); } return 0; } -void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnGe1* this = (EnGe1*)thisx; +void EnGe1_PostLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { + EnGe1* this = thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1419); - - if (limbIndex == GERUDO_WHITE_LIMB_HEAD) { - gSPDisplayList(POLY_OPA_DISP++, sHairstyleDLists[this->hairstyle]); + if (arg1 == 15) { + gSPDisplayList(POLY_OPA_DISP++, D_80A3279C[this->unk2AE]); Matrix_MultVec3f(&D_80A327A8, &this->actor.focus.pos); } - CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1427); } void EnGe1_Draw(Actor* thisx, PlayState* play) { - s32 pad; EnGe1* this = (EnGe1*)thisx; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1442); - Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A327B4[this->unk2A8])); + SkelAnime_DrawFlexOpa(play, this->unk198.skeleton, this->unk198.jointTable, this->unk198.dListCount, EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, this); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1459); } 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 4566dacbbd5..752765e6683 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -4,38 +4,26 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_ge1/object_ge1.h" - struct EnGe1; -typedef void (*EnGe1AnimFunc)(struct EnGe1*); typedef void (*EnGe1ActionFunc)(struct EnGe1*, struct PlayState*); -typedef enum EnGe1Type { - /* 0x00 */ GE1_TYPE_GATE_GUARD, - /* 0x01 */ GE1_TYPE_GATE_OPERATOR, - /* 0x04 */ GE1_TYPE_NORMAL = 4, - /* 0x05 */ GE1_TYPE_VALLEY_FLOOR, - /* 0x45 */ GE1_TYPE_HORSEBACK_ARCHERY = 0x45, - /* 0x46 */ GE1_TYPE_TRAINING_GROUNDS_GUARD -} EnGe1Type; - typedef struct EnGe1 { - /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinder collider; - /* 0x0198 */ SkelAnime skelAnime; - /* 0x01DC */ Vec3s jointTable[GERUDO_WHITE_LIMB_MAX]; - /* 0x023C */ Vec3s morphTable[GERUDO_WHITE_LIMB_MAX]; - /* 0x029C */ Vec3s headRot; - /* 0x02A2 */ Vec3s unk_2A2; - /* 0x02A8 */ s16 eyeIndex; - /* 0x02AA */ s16 blinkTimer; - /* 0x02AC */ u16 stateFlags; - /* 0x02AE */ u8 hairstyle; - /* 0x02AF */ u8 cutsceneTimer; - /* 0x02B0 */ AnimationHeader* animation; - /* 0x02B4 */ EnGe1ActionFunc actionFunc; - /* 0x02B8 */ EnGe1AnimFunc animFunc; -} EnGe1; // size = 0x02BC + /* 0x000 */ Actor actor; + /* 0x14C */ ColliderCylinder unk14C; + /* 0x198 */ SkelAnime unk198; + /* 0x1DC */ Vec3s unk1DC[16]; + /* 0x23C */ Vec3s unk23C[16]; + /* 0x29C */ Vec3s unk29C; + /* 0x2A2 */ Vec3s unk2A2; + /* 0x2A8 */ s16 unk2A8; + /* 0x2AA */ s16 unk2AA; + /* 0x2AC */ u16 unk2AC; + /* 0x2AE */ u8 unk2AE; + /* 0x2AF */ u8 unk2AF; + /* 0x2B0 */ AnimationHeader* unk2B0; + /* 0x2B4 */ EnGe1ActionFunc unk2B4; + /* 0x2B8 */ void (*unk2B8)(struct EnGe1*); +} EnGe1; // size = 0x2BC #endif 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 900967f71ec..b3c8aeefbd5 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -1,9 +1,3 @@ -/* - * File: z_en_ge2.c - * Overlay: ovl_En_Ge2 - * Description: Purple-clothed Gerudo - */ - #include "z_en_ge2.h" #include "gfx.h" @@ -12,8 +6,6 @@ #include "segmented_address.h" #include "sfx.h" #include "sys_matrix.h" -#include "terminal.h" -#include "translation.h" #include "z_lib.h" #include "effect.h" #include "horse.h" @@ -25,50 +17,25 @@ #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) -#define GE2_STATE_ANIMCOMPLETE (1 << 1) -#define GE2_STATE_KO (1 << 2) -#define GE2_STATE_CAPTURING (1 << 3) -#define GE2_STATE_TALKED (1 << 4) - -typedef enum EnGe2Type { - /* 0 */ GE2_TYPE_PATROLLING, - /* 1 */ GE2_TYPE_STATIONARY, - /* 2 */ GE2_TYPE_GERUDO_CARD_GIVER -} EnGe2Type; - -typedef enum EnGe2Action { - /* 0 */ GE2_ACTION_WALK, - /* 1 */ GE2_ACTION_ABOUTTURN, - /* 2 */ GE2_ACTION_TURNPLAYERSPOTTED, - /* 3 */ GE2_ACTION_KNOCKEDOUT, - /* 4 */ GE2_ACTION_CAPTURETURN, - /* 5 */ GE2_ACTION_CAPTURECHARGE, - /* 6 */ GE2_ACTION_CAPTURECLOSE, - /* 7 */ GE2_ACTION_STAND, - /* 8 */ GE2_ACTION_WAITLOOKATPLAYER -} EnGe2Action; - void EnGe2_Init(Actor* thisx, PlayState* play); void EnGe2_Destroy(Actor* thisx, PlayState* play); void EnGe2_Update(Actor* thisx, PlayState* play); void EnGe2_Draw(Actor* thisx, PlayState* play); -s32 EnGe2_CheckAllCarpentersRescued(void); -void EnGe2_CaptureClose(EnGe2* this, PlayState* play); -void EnGe2_CaptureCharge(EnGe2* this, PlayState* play); -void EnGe2_CaptureTurn(EnGe2* this, PlayState* play); -void EnGe2_KnockedOut(EnGe2* this, PlayState* play); -void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play); -void EnGe2_AboutTurn(EnGe2* this, PlayState* play); -void EnGe2_Walk(EnGe2* this, PlayState* play); -void EnGe2_Stand(EnGe2* this, PlayState* play); -void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play); -void EnGe2_ForceTalk(EnGe2* this, PlayState* play); - -// Update functions -void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play); -void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play); -void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2); +s32 func_80A330A0(void); +void func_80A330CC(EnGe2* this, PlayState* play); +void func_80A331A0(EnGe2* this, PlayState* play); +void func_80A332D4(EnGe2* this, PlayState* play); +void func_80A3334C(EnGe2* this, PlayState* play); +void func_80A33444(EnGe2* this, PlayState* play); +void func_80A3354C(EnGe2* this, PlayState* play); +void func_80A33600(EnGe2* this, PlayState* play); +void func_80A336C4(EnGe2* this, PlayState* play); +void func_80A339EC(EnGe2* this, PlayState* play); +void func_80A33AFC(EnGe2* this, PlayState* play); +void func_80A33D10(Actor* thisx, PlayState* play); +void func_80A33DE0(Actor* thisx, PlayState* play); +void func_80A3402C(Actor* thisx, PlayState* play2); ActorProfile En_Ge2_Profile = { /**/ ACTOR_EN_GE2, @@ -82,7 +49,7 @@ ActorProfile En_Ge2_Profile = { /**/ EnGe2_Draw, }; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_80A34310 = { { COL_MATERIAL_NONE, AT_NONE, @@ -102,157 +69,161 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -static EnGe2ActionFunc sActionFuncs[] = { - EnGe2_Walk, EnGe2_AboutTurn, EnGe2_TurnPlayerSpotted, - EnGe2_KnockedOut, EnGe2_CaptureTurn, EnGe2_CaptureCharge, - EnGe2_CaptureClose, EnGe2_Stand, EnGe2_WaitLookAtPlayer, +static void (*D_80A3433C[9])(EnGe2*, PlayState*) = { + func_80A33600, func_80A3354C, func_80A33444, func_80A3334C, func_80A332D4, + func_80A331A0, func_80A330CC, func_80A336C4, func_80A339EC, }; - -static AnimationHeader* sAnimations[] = { - &gGerudoPurpleWalkingAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, - &gGerudoPurpleFallingToGroundAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleChargingAnim, - &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, &gGerudoPurpleLookingAboutAnim, +static AnimationHeader* D_80A34360[9] = { + &object_gla_009ED4_Anim, &object_gla_0098AC_Anim, &object_gla_0098AC_Anim, + &object_gla_0011F4_Anim, &object_gla_0098AC_Anim, &object_gla_008D60_Anim, + &object_gla_0098AC_Anim, &object_gla_0098AC_Anim, &object_gla_0098AC_Anim, }; - -static u8 sAnimModes[] = { +static u8 D_80A34384[9] = { ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, }; +static Vec3f D_80A34390 = { 0.0f, -0.05f, 0.0f }; +static Vec3f D_80A3439C = { 0.0f, -0.025f, 0.0f }; +static Color_RGBA8 D_80A343A8 = { 0xFF, 0xFF, 0xFF, 0 }; +static Color_RGBA8 D_80A343AC = { 0xFF, 0x96, 0, 0 }; +static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f }; +static s32 D_80A343BC[3] = { + 0x06004F78, + 0x06005578, + 0x06005BF8, +}; -void EnGe2_ChangeAction(EnGe2* this, s32 i) { - this->actionFunc = sActionFuncs[i]; - Animation_Change(&this->skelAnime, sAnimations[i], 1.0f, 0.0f, Animation_GetLastFrame(sAnimations[i]), - sAnimModes[i], -8.0f); - this->stateFlags &= ~GE2_STATE_ANIMCOMPLETE; +void func_80A32BD0(EnGe2* this, s32 arg1) { + this->unk308 = D_80A3433C[arg1]; + Animation_Change(&this->unk198, D_80A34360[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A34360[arg1]), + D_80A34384[arg1], -8.0f); + this->unk2F4 &= ~2; } void EnGe2_Init(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - s16 params = this->actor.params; + s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoPurpleSkel, NULL, this->jointTable, this->morphTable, 22); - Animation_PlayLoop(&this->skelAnime, &gGerudoPurpleWalkingAnim); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->unk198, &object_gla_008968_Skel, NULL, this->unk1DC, this->unk260, 22); + Animation_PlayLoop(&this->unk198, &object_gla_009ED4_Anim); + Collider_InitCylinder(play, &this->unk14C); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A34310); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); - if (play->sceneId == SCENE_GERUDO_VALLEY) { this->actor.cullingVolumeDistance = 1000.0f; } else { this->actor.cullingVolumeDistance = 1200.0f; } - - this->yDetectRange = (this->actor.world.rot.z + 1) * 40.0f; + this->unk2FC = (this->actor.world.rot.z + 1) * 40.0f; this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; - switch (PARAMS_GET_S(thisx->params, 0, 8)) { - case GE2_TYPE_PATROLLING: - EnGe2_ChangeAction(this, GE2_ACTION_WALK); - if (EnGe2_CheckAllCarpentersRescued()) { - this->actor.update = EnGe2_UpdateFriendly; + case 0: + func_80A32BD0(this, 0); + if (func_80A330A0() != 0) { + this->actor.update = func_80A33D10; this->actor.attentionRangeType = ATTENTION_RANGE_6; } break; - case GE2_TYPE_STATIONARY: - EnGe2_ChangeAction(this, GE2_ACTION_STAND); - if (EnGe2_CheckAllCarpentersRescued()) { - this->actor.update = EnGe2_UpdateFriendly; + + case 1: + func_80A32BD0(this, 7); + if (func_80A330A0() != 0) { + this->actor.update = func_80A33D10; this->actor.attentionRangeType = ATTENTION_RANGE_6; } break; - case GE2_TYPE_GERUDO_CARD_GIVER: - EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER); - this->actor.update = EnGe2_UpdateAfterTalk; - this->actionFunc = EnGe2_ForceTalk; + + case 2: + func_80A32BD0(this, 8); + this->actor.update = func_80A33DE0; + this->unk308 = func_80A33AFC; this->actor.attentionRangeType = ATTENTION_RANGE_6; break; + default: - ASSERT(0, "0", "../z_en_ge2.c", 418); + ASSERT(0, "0", "../z_en_ge2.c", 0x1A2); break; } - - this->stateFlags = 0; - this->unk_304 = 0; // Set and not used - this->walkTimer = 0; - this->playerSpottedParam = 0; + this->unk2F4 = 0; + this->unk304 = 0; + this->unk302 = 0; + this->unk306 = 0; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; - this->walkDirection = this->actor.world.rot.y; - this->walkDuration = PARAMS_GET_S(thisx->params, 8, 8) * 10; + this->unk2F6 = this->actor.world.rot.y; + this->unk300 = PARAMS_GET_S(thisx->params, 8, 8) * 0xA; } void EnGe2_Destroy(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk14C); } -// Detection/check functions - -s32 Ge2_DetectPlayerInAction(PlayState* play, EnGe2* this) { - f32 visionScale; - - visionScale = (!IS_DAY ? 0.75f : 1.5f); +s32 func_80A32ECC(PlayState* play, EnGe2* this) { + f32 var_fv0; - if ((250.0f * visionScale) < this->actor.xzDistToPlayer) { + if (!IS_DAY) { + var_fv0 = 0.75f; + } else { + var_fv0 = 1.5f; + } + if ((250.0f * var_fv0) < this->actor.xzDistToPlayer) { return 0; } - if (this->actor.xzDistToPlayer < 50.0f) { return 2; } - - if (func_8002DDE4(play)) { + if (func_8002DDE4(play) != 0) { return 1; } return 0; } -s32 Ge2_DetectPlayerInUpdate(PlayState* play, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) { +s32 func_80A32F74(PlayState* play, EnGe2* this, Vec3f* arg2, s16 arg3, f32 arg4) { Player* player = GET_PLAYER(play); - Vec3f posResult; - CollisionPoly* outPoly; - f32 visionScale; - - visionScale = (!IS_DAY ? 0.75f : 1.5f); + Vec3f sp38; + CollisionPoly* sp34; + f32 var_fv0; + s16 temp_v0; - if ((250.0f * visionScale) < this->actor.xzDistToPlayer) { + if (!IS_DAY) { + var_fv0 = 0.75f; + } else { + var_fv0 = 1.5f; + } + if ((250.0f * var_fv0) < this->actor.xzDistToPlayer) { return 0; } - - if (yDetectRange < ABS(this->actor.yDistToPlayer)) { + if (arg4 < ABS(this->actor.yDistToPlayer)) { return 0; } - - if (ABS((s16)(this->actor.yawTowardsPlayer - yRot)) > 0x2000) { + temp_v0 = this->actor.yawTowardsPlayer - arg3; + if (ABS(temp_v0) > 0x2000) { return 0; } - - if (BgCheck_AnyLineTest1(&play->colCtx, pos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &posResult, &outPoly, - 0)) { + if (BgCheck_AnyLineTest1(&play->colCtx, arg2, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &sp38, &sp34, 0)) { return 0; } return 1; } -s32 EnGe2_CheckAllCarpentersRescued(void) { +s32 func_80A330A0(void) { if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2()) { - return true; + return 1; + } else { + return 0; } - return false; } -// Actions - -void EnGe2_CaptureClose(EnGe2* this, PlayState* play) { - if (this->timer > 0) { - this->timer--; +void func_80A330CC(EnGe2* this, PlayState* play) { + if (this->unk305 > 0) { + this->unk305--; } else { Horse_ResetHorseData(play); - if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { play->nextEntranceIndex = ENTR_GERUDO_VALLEY_1; } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { @@ -260,25 +231,22 @@ void EnGe2_CaptureClose(EnGe2* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_17; } - play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } } -void EnGe2_CaptureCharge(EnGe2* this, PlayState* play) { +void func_80A331A0(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.xzDistToPlayer < 50.0f) { - EnGe2_ChangeAction(this, GE2_ACTION_CAPTURECLOSE); + func_80A32BD0(this, 6); this->actor.speed = 0.0f; } - - if (this->timer > 0) { - this->timer--; + if (this->unk305 > 0) { + this->unk305--; } else { Horse_ResetHorseData(play); - if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { play->nextEntranceIndex = ENTR_GERUDO_VALLEY_1; } else if (GET_EVENTCHKINF(EVENTCHKINF_C7)) { @@ -286,352 +254,324 @@ void EnGe2_CaptureCharge(EnGe2* this, PlayState* play) { } else { play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_17; } - play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; } } -void EnGe2_CaptureTurn(EnGe2* this, PlayState* play) { +void func_80A332D4(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; - if (this->actor.world.rot.y == this->actor.yawTowardsPlayer) { - EnGe2_ChangeAction(this, GE2_ACTION_CAPTURECHARGE); - this->timer = 50; + func_80A32BD0(this, 5); + this->unk305 = 0x32; this->actor.speed = 4.0f; } } -void EnGe2_KnockedOut(EnGe2* this, PlayState* play) { - static Vec3f effectVelocity = { 0.0f, -0.05f, 0.0f }; - static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f }; - static Color_RGBA8 effectPrimColor = { 255, 255, 255, 0 }; - static Color_RGBA8 effectEnvColor = { 255, 150, 0, 0 }; - s32 effectAngle; - Vec3f effectPos; +void func_80A3334C(EnGe2* this, PlayState* play) { + s32 temp_v0; + Vec3f sp38; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) { - effectAngle = (play->state.frames) * 0x2800; - effectPos.x = this->actor.focus.pos.x + (Math_CosS(effectAngle) * 5.0f); - effectPos.y = this->actor.focus.pos.y + 10.0f; - effectPos.z = this->actor.focus.pos.z + (Math_SinS(effectAngle) * 5.0f); - EffectSsKiraKira_SpawnDispersed(play, &effectPos, &effectVelocity, &effectAccel, &effectPrimColor, - &effectEnvColor, 1000, 16); + if (this->unk2F4 & 2) { + temp_v0 = play->state.frames * 0x2800; + sp38.x = this->actor.focus.pos.x + (Math_CosS(temp_v0) * 5.0f); + sp38.y = this->actor.focus.pos.y + 10.0f; + sp38.z = this->actor.focus.pos.z + (Math_SinS(temp_v0) * 5.0f); + EffectSsKiraKira_SpawnDispersed(play, &sp38, &D_80A34390, &D_80A3439C, &D_80A343A8, &D_80A343AC, 0x3E8, 0x10); } } -void EnGe2_TurnPlayerSpotted(EnGe2* this, PlayState* play) { - s32 playerSpotted; +void func_80A33444(EnGe2* this, PlayState* play) { + s32 temp_v0_2; this->actor.speed = 0.0f; - - if (this->stateFlags & GE2_STATE_TALKED) { - this->stateFlags &= ~GE2_STATE_TALKED; + if (this->unk2F4 & 0x10) { + this->unk2F4 &= ~0x10; } else { - playerSpotted = Ge2_DetectPlayerInAction(play, this); - - if (playerSpotted != 0) { - this->timer = 100; - this->yawTowardsPlayer = this->actor.yawTowardsPlayer; - - if (this->playerSpottedParam < playerSpotted) { - this->playerSpottedParam = playerSpotted; + temp_v0_2 = func_80A32ECC(play, this); + if (temp_v0_2 != 0) { + this->unk305 = 0x64; + this->unk2F8 = this->actor.yawTowardsPlayer; + if (this->unk306 < temp_v0_2) { + this->unk306 = temp_v0_2; } - } else if (this->actor.world.rot.y == this->yawTowardsPlayer) { - this->playerSpottedParam = 0; - EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN); + } else if (this->actor.world.rot.y == this->unk2F8) { + this->unk306 = 0; + func_80A32BD0(this, 1); return; } } - - switch (this->playerSpottedParam) { + switch (this->unk306) { case 1: - Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsPlayer, 2, 0x200, 0x100); + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F8, 2, 0x200, 0x100); break; + case 2: - Math_SmoothStepToS(&this->actor.world.rot.y, this->yawTowardsPlayer, 2, 0x600, 0x180); + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F8, 2, 0x600, 0x180); break; } - this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnGe2_AboutTurn(EnGe2* this, PlayState* play) { - s32 playerSpotted; +void func_80A3354C(EnGe2* this, PlayState* play) { + s32 temp_v0; this->actor.speed = 0.0f; - playerSpotted = Ge2_DetectPlayerInAction(play, this); - - if (playerSpotted != 0) { - EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED); - this->timer = 100; - this->playerSpottedParam = playerSpotted; - this->yawTowardsPlayer = this->actor.yawTowardsPlayer; - } else if (this->stateFlags & GE2_STATE_ANIMCOMPLETE) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200); + temp_v0 = func_80A32ECC(play, this); + if (temp_v0 != 0) { + func_80A32BD0(this, 2); + this->unk305 = 0x64; + this->unk306 = temp_v0; + this->unk2F8 = this->actor.yawTowardsPlayer; + } else if (this->unk2F4 & 2) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F6, 2, 0x400, 0x200); this->actor.shape.rot.y = this->actor.world.rot.y; } - - if (this->actor.shape.rot.y == this->walkDirection) { - EnGe2_ChangeAction(this, GE2_ACTION_WALK); + if (this->actor.shape.rot.y == this->unk2F6) { + func_80A32BD0(this, 0); } } -void EnGe2_Walk(EnGe2* this, PlayState* play) { - u8 playerSpotted; +void func_80A33600(EnGe2* this, PlayState* play) { + u8 temp_v0; - playerSpotted = Ge2_DetectPlayerInAction(play, this); - if (playerSpotted != 0) { + temp_v0 = func_80A32ECC(play, this); + if (temp_v0 != 0) { this->actor.speed = 0.0f; - EnGe2_ChangeAction(this, GE2_ACTION_TURNPLAYERSPOTTED); - this->timer = 100; - this->playerSpottedParam = playerSpotted; - this->yawTowardsPlayer = this->actor.yawTowardsPlayer; - } else if (this->walkTimer >= this->walkDuration) { - this->walkTimer = 0; - this->walkDirection += 0x8000; - EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN); + func_80A32BD0(this, 2); + this->unk305 = 0x64; + this->unk306 = temp_v0; + this->unk2F8 = this->actor.yawTowardsPlayer; + } else if (this->unk302 >= this->unk300) { + this->unk302 = 0; + this->unk2F6 += 0x8000; + func_80A32BD0(this, 1); this->actor.speed = 0.0f; } else { - this->walkTimer++; + this->unk302 += 1; this->actor.speed = 2.0f; } } -void EnGe2_Stand(EnGe2* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->walkDirection, 2, 0x400, 0x200); +void func_80A336C4(EnGe2* this, PlayState* play) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F6, 2, 0x400, 0x200); } -void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) { +void func_80A33704(EnGe2* this, PlayState* play) { + s16 temp_v0; s32 pad; - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (ABS(angleDiff) <= 0x4000) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100); + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (ABS(temp_v0) <= 0x4000) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk2E8, &this->unk2EE, this->actor.focus.pos); + return; + } + if (temp_v0 < 0) { + Math_SmoothStepToS(&this->unk2E8.y, -0x2000, 6, 0x1838, 0x100); } else { - if (angleDiff < 0) { - Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); - } else { - Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 6200, 0x100); - } - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 1000, 100); - this->actor.world.rot.y = this->actor.shape.rot.y; + Math_SmoothStepToS(&this->unk2E8.y, 0x2000, 6, 0x1838, 0x100); } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xC, 0x3E8, 0x64); + this->actor.world.rot.y = this->actor.shape.rot.y; } -void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) { - if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) && - (this->actor.xzDistToPlayer < 200.0f)) { - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos); +void func_80A3381C(EnGe2* this, PlayState* play) { + s16 temp_v0; + + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 200.0f)) { + Actor_TrackPlayer(play, &this->actor, &this->unk2E8, &this->unk2EE, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_2EE.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_2EE.y, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->unk2E8.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk2E8.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk2EE.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk2EE.y, 0, 6, 0x1838, 0x64); } } -void EnGe2_SetActionAfterTalk(EnGe2* this, PlayState* play) { +void func_80A33930(EnGe2* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - switch (PARAMS_GET_S(this->actor.params, 0, 8)) { - case GE2_TYPE_PATROLLING: - EnGe2_ChangeAction(this, GE2_ACTION_ABOUTTURN); + case 0: + func_80A32BD0(this, 1); break; - case GE2_TYPE_STATIONARY: - EnGe2_ChangeAction(this, GE2_ACTION_STAND); + + case 1: + func_80A32BD0(this, 7); break; - case GE2_TYPE_GERUDO_CARD_GIVER: - this->actionFunc = EnGe2_WaitLookAtPlayer; + + case 2: + this->unk308 = func_80A339EC; break; } - this->actor.update = EnGe2_UpdateFriendly; + this->actor.update = func_80A33D10; this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } - EnGe2_TurnToFacePlayer(this, play); + func_80A33704(this, play); } -void EnGe2_WaitLookAtPlayer(EnGe2* this, PlayState* play) { - EnGe2_LookAtPlayer(this, play); +void func_80A339EC(EnGe2* this, PlayState* play) { + func_80A3381C(this, play); } -void EnGe2_WaitTillCardGiven(EnGe2* this, PlayState* play) { - if (Actor_HasParent(&this->actor, play)) { +void func_80A33A0C(EnGe2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play) != 0) { this->actor.parent = NULL; - this->actionFunc = EnGe2_SetActionAfterTalk; + this->unk308 = func_80A33930; } else { Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void EnGe2_GiveCard(EnGe2* this, PlayState* play) { +void func_80A33A6C(EnGe2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - this->actionFunc = EnGe2_WaitTillCardGiven; + this->unk308 = func_80A33A0C; Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void EnGe2_ForceTalk(EnGe2* this, PlayState* play) { - +void func_80A33AFC(EnGe2* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnGe2_GiveCard; + this->unk308 = func_80A33A6C; } else { this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; Actor_OfferTalkExchange(&this->actor, play, 300.0f, 300.0f, EXCH_ITEM_NONE); } - EnGe2_LookAtPlayer(this, play); + func_80A3381C(this, play); } -void EnGe2_SetupCapturePlayer(EnGe2* this, PlayState* play) { - this->stateFlags |= GE2_STATE_CAPTURING; +void func_80A33B7C(EnGe2* this, PlayState* play) { + this->unk2F4 |= 8; this->actor.speed = 0.0f; - EnGe2_ChangeAction(this, GE2_ACTION_CAPTURETURN); + func_80A32BD0(this, 4); Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_95); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x6000, &this->actor); } -void EnGe2_MaintainColliderAndSetAnimState(EnGe2* this, PlayState* play) { - s32 pad; - s32 pad2; +void func_80A33BE8(EnGe2* this, PlayState* play) { + s32 pad[2]; - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk14C); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - - if (!(this->stateFlags & GE2_STATE_ANIMCOMPLETE) && SkelAnime_Update(&this->skelAnime)) { - this->stateFlags |= GE2_STATE_ANIMCOMPLETE; + if (!(this->unk2F4 & 2) && SkelAnime_Update(&this->unk198)) { + this->unk2F4 |= 2; } } -void EnGe2_MoveAndBlink(EnGe2* this, PlayState* play) { +void func_80A33C8C(EnGe2* this, PlayState* play) { Actor_MoveXZGravity(&this->actor); - - if (DECR(this->blinkTimer) == 0) { - this->blinkTimer = Rand_S16Offset(60, 60); + if (DECR(this->unk2E6) == 0) { + this->unk2E6 = Rand_S16Offset(0x3C, 0x3C); } - this->eyeIndex = this->blinkTimer; - - if (this->eyeIndex >= 3) { - this->eyeIndex = 0; + this->unk2E4 = this->unk2E6; + if (this->unk2E4 >= 3) { + this->unk2E4 = 0; } } -// Update functions - -void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) { +void func_80A33D10(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - EnGe2_MaintainColliderAndSetAnimState(this, play); - this->actionFunc(this, play); - - if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (PARAMS_GET_S(this->actor.params, 0, 8) == GE2_TYPE_PATROLLING) { - this->actor.speed = 0.0f; - EnGe2_ChangeAction(this, GE2_ACTION_WAITLOOKATPLAYER); + func_80A33BE8(this, play); + this->unk308(this, play); + if (Actor_TalkOfferAccepted(thisx, play)) { + if (PARAMS_GET_S(thisx->params, 0, 8) == 0) { + thisx->speed = 0.0f; + func_80A32BD0(this, 8); } - this->actionFunc = EnGe2_SetActionAfterTalk; - this->actor.update = EnGe2_UpdateAfterTalk; + this->unk308 = func_80A33930; + thisx->update = func_80A33DE0; } else { - this->actor.textId = 0x6005; - - if (this->actor.xzDistToPlayer < 100.0f) { - Actor_OfferTalk(&this->actor, play, 100.0f); + thisx->textId = 0x6005; + if (thisx->xzDistToPlayer < 100.0f) { + Actor_OfferTalk(thisx, play, 100.0f); } } - EnGe2_MoveAndBlink(this, play); + func_80A33C8C(this, play); } -void EnGe2_UpdateAfterTalk(Actor* thisx, PlayState* play) { +void func_80A33DE0(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - this->stateFlags |= GE2_STATE_TALKED; - EnGe2_MaintainColliderAndSetAnimState(this, play); - this->actionFunc(this, play); - EnGe2_MoveAndBlink(this, play); + this->unk2F4 |= 0x10; + func_80A33BE8(this, play); + this->unk308(this, play); + func_80A33C8C(this, play); } void EnGe2_Update(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - s32 paramsType; - - EnGe2_MaintainColliderAndSetAnimState(this, play); - - if ((this->stateFlags & GE2_STATE_KO) || (this->stateFlags & GE2_STATE_CAPTURING)) { - this->actionFunc(this, play); - } else if (this->collider.base.acFlags & AC_HIT) { - if ((this->collider.elem.acHitElem != NULL) && - (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { - //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the colorfilter. - //! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144 - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 400); - this->actor.update = EnGe2_UpdateStunned; - return; - } - EnGe2_ChangeAction(this, GE2_ACTION_KNOCKEDOUT); - this->timer = 100; - this->stateFlags |= GE2_STATE_KO; - this->actor.speed = 0.0f; - Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); + func_80A33BE8(this, play); + if ((this->unk2F4 & 4) || (this->unk2F4 & 8)) { + this->unk308(this, play); } else { - this->actionFunc(this, play); - - if (Ge2_DetectPlayerInUpdate(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->yDetectRange)) { - PRINTF(VT_FGCOL(GREEN) T("発見!!!!!!!!!!!!\n", "Discovered!!!!!!!!!!!!\n") VT_RST); - EnGe2_SetupCapturePlayer(this, play); - } - - if ((PARAMS_GET_S(this->actor.params, 0, 8) == GE2_TYPE_STATIONARY) && (this->actor.xzDistToPlayer < 100.0f)) { - PRINTF(VT_FGCOL(GREEN) T("発見!!!!!!!!!!!!\n", "Discovered!!!!!!!!!!!!\n") VT_RST); - EnGe2_SetupCapturePlayer(this, play); + if (this->unk14C.base.acFlags & AC_HIT) { + if ((this->unk14C.elem.acHitElem != NULL) && + (this->unk14C.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { + //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the + //! colorfilter. + //! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144 + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 400); + this->actor.update = func_80A3402C; + return; + } + func_80A32BD0(this, 3); + this->unk305 = 0x64; + this->unk2F4 |= 4; + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); + } else { + this->unk308(this, play); + if (func_80A32F74(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->unk2FC) != 0) { + PRINTF("\x1b[32m発見!!!!!!!!!!!!\n\x1b[m"); + func_80A33B7C(this, play); + } + if ((PARAMS_GET_S(this->actor.params, 0, 8) == 1) && (this->actor.xzDistToPlayer < 100.0f)) { + PRINTF("\x1b[32m発見!!!!!!!!!!!!\n\x1b[m"); + func_80A33B7C(this, play); + } } } - - if (!(this->stateFlags & GE2_STATE_KO)) { - 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); - } + if (!(this->unk2F4 & 4) && + ((PARAMS_GET_S(this->actor.params, 0, 8) == 0) || (PARAMS_GET_S(this->actor.params, 0, 8) == 1))) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); } - EnGe2_MoveAndBlink(this, play); - - if (EnGe2_CheckAllCarpentersRescued() && !(this->stateFlags & GE2_STATE_KO)) { - this->actor.update = EnGe2_UpdateFriendly; + func_80A33C8C(this, play); + if ((func_80A330A0() != 0) && !(this->unk2F4 & 4)) { + this->actor.update = func_80A33D10; this->actor.attentionRangeType = ATTENTION_RANGE_6; } } -void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { +void func_80A3402C(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnGe2* this = (EnGe2*)thisx; - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk14C); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - - if ((this->collider.base.acFlags & AC_HIT) && - ((this->collider.elem.acHitElem == NULL) || - !(this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) { + if ((this->unk14C.base.acFlags & AC_HIT) && (((this->unk14C.elem.acHitElem == NULL)) || + !(this->unk14C.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) { this->actor.colorFilterTimer = 0; - EnGe2_ChangeAction(this, GE2_ACTION_KNOCKEDOUT); - this->timer = 100; - this->stateFlags |= GE2_STATE_KO; + func_80A32BD0(this, 3); + this->unk305 = 0x64; + this->unk2F4 = (u16)(this->unk2F4 | 4); this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - - if (EnGe2_CheckAllCarpentersRescued()) { - this->actor.update = EnGe2_UpdateFriendly; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); + if (func_80A330A0() != 0) { + this->actor.update = func_80A33D10; this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.colorFilterTimer = 0; } else if (this->actor.colorFilterTimer == 0) { @@ -639,37 +579,33 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { } } -s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnGe2* this = (EnGe2*)thisx; +s32 func_80A3415C(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { + EnGe2* this = thisx; - if (limbIndex == 3) { - rot->x += this->headRot.y; - rot->z += this->headRot.x; + if (arg1 == 3) { + arg4->x += this->unk2E8.y; + arg4->z += this->unk2E8.x; } return 0; } -void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f }; - EnGe2* this = (EnGe2*)thisx; +void func_80A341A0(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { + EnGe2* this = thisx; - if (limbIndex == 6) { + if (arg1 == 6) { Matrix_MultVec3f(&D_80A343B0, &this->actor.focus.pos); } } void EnGe2_Draw(Actor* thisx, PlayState* play) { - static void* eyeTextures[] = { gGerudoPurpleEyeOpenTex, gGerudoPurpleEyeHalfTex, gGerudoPurpleEyeClosedTex }; - s32 pad; EnGe2* this = (EnGe2*)thisx; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1274); - Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A343BC[this->unk2E4])); func_8002EBCC(&this->actor, play, 0); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, this); - + SkelAnime_DrawFlexOpa(play, this->unk198.skeleton, this->unk198.jointTable, this->unk198.dListCount, func_80A3415C, + func_80A341A0, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1291); } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 27094a58332..ad9f3b1b05c 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -6,28 +6,28 @@ struct EnGe2; -typedef void (*EnGe2ActionFunc)(struct EnGe2*, struct PlayState*); - typedef struct EnGe2 { - /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinder collider; - /* 0x0198 */ SkelAnime skelAnime; - /* 0x01DC */ Vec3s jointTable[22]; - /* 0x0260 */ Vec3s morphTable[22]; - /* 0x02E4 */ s16 eyeIndex; - /* 0x02E6 */ s16 blinkTimer; - /* 0x02E8 */ Vec3s headRot; - /* 0x02EE */ Vec3s unk_2EE; - /* 0x02F4 */ u16 stateFlags; - /* 0x02F6 */ s16 walkDirection; - /* 0x02F8 */ s16 yawTowardsPlayer; - /* 0x02FC */ f32 yDetectRange; - /* 0x0300 */ u16 walkDuration; - /* 0x0302 */ u16 walkTimer; - /* 0x0304 */ u8 unk_304; - /* 0x0305 */ u8 timer; - /* 0x0306 */ u8 playerSpottedParam; - /* 0x0308 */ EnGe2ActionFunc actionFunc; -} EnGe2; // size = 0x030C + /* 0x000 */ Actor actor; + /* 0x14C */ ColliderCylinder unk14C; + /* 0x198 */ SkelAnime unk198; + /* 0x1DC */ Vec3s unk1DC[22]; + /* 0x260 */ Vec3s unk260[22]; + /* 0x2E4 */ s16 unk2E4; + /* 0x2E6 */ s16 unk2E6; + /* 0x2E8 */ Vec3s unk2E8; + /* 0x2EE */ Vec3s unk2EE; + /* 0x2F4 */ u16 unk2F4; + /* 0x2F6 */ s16 unk2F6; + /* 0x2F8 */ s16 unk2F8; + /* 0x2FA */ char pad2FA[2]; + /* 0x2FC */ f32 unk2FC; + /* 0x300 */ u16 unk300; + /* 0x302 */ u16 unk302; + /* 0x304 */ s8 unk304; + /* 0x305 */ u8 unk305; + /* 0x306 */ u8 unk306; + /* 0x307 */ char pad307[1]; + /* 0x308 */ void (*unk308)(struct EnGe2*, struct PlayState*); +} EnGe2; // size = 0x30C #endif diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index f832f4b4e37..22a40dd7ca2 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -21,14 +21,17 @@ #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) -void EnGe3_Init(Actor* thisx, PlayState* play2); +void EnGe3_Init(Actor* thisx, PlayState* play); void EnGe3_Destroy(Actor* thisx, PlayState* play); void EnGe3_Update(Actor* thisx, PlayState* play); -void EnGe3_Draw(Actor* thisx, PlayState* play2); +void EnGe3_Draw(Actor* thisx, PlayState* play); -void EnGe3_WaitLookAtPlayer(EnGe3* this, PlayState* play); -void EnGe3_ForceTalk(EnGe3* this, PlayState* play); -void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play); +void func_80A34A80(EnGe3* this, PlayState* play); +void func_80A34B90(EnGe3* this, PlayState* play); +void func_80A34D68(Actor* thisx, PlayState* play); + +extern FlexSkeletonHeader D_600A458; +extern AnimationHeader D_600B07C; ActorProfile En_Ge3_Profile = { /**/ ACTOR_EN_GE3, @@ -42,7 +45,7 @@ ActorProfile En_Ge3_Profile = { /**/ EnGe3_Draw, }; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_80A35190 = { { COL_MATERIAL_NONE, AT_NONE, @@ -62,36 +65,35 @@ static ColliderCylinderInit sCylinderInit = { { 20, 50, 0, { 0, 0, 0 } }, }; -static EnGe3ActionFunc sActionFuncs[] = { EnGe3_WaitLookAtPlayer }; -static AnimationHeader* sAnimations[] = { &gGerudoRedStandAnim }; // Idle with right hand on hip and left over mouth -static u8 sAnimationModes[] = { ANIMMODE_LOOP }; - -void EnGe3_ChangeAction(EnGe3* this, s32 i) { - this->actionFunc = sActionFuncs[i]; - - Animation_Change(&this->skelAnime, sAnimations[i], 1.0f, 0.0f, (f32)Animation_GetLastFrame(sAnimations[i]), - sAnimationModes[i], -8.0f); - - this->unk_30C &= ~2; +static void (*D_80A351BC[1])(EnGe3*, PlayState*) = { func_80A34A80 }; +static AnimationHeader* D_80A351C0[1] = { &D_600B07C }; +static u8 D_80A351C4[1] = { ANIMMODE_LOOP }; +static Vec3f D_80A351C8 = { 600.0f, 700.0f, 0.0f }; +static s32 D_80A351D4[3] = { 0x06005FE8, 0x060065A8, 0x06006D28 }; + +void func_80A34620(EnGe3* this, s32 arg1) { + this->unk310 = D_80A351BC[arg1]; + Animation_Change(&this->unk198, D_80A351C0[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A351C0[arg1]), + D_80A351C4[arg1], -8.0f); + this->unk30C &= ~2; } -void EnGe3_Init(Actor* thisx, PlayState* play2) { +void EnGe3_Init(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - PlayState* play = play2; + s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, - GERUDO_RED_LIMB_MAX); - Animation_PlayLoop(&this->skelAnime, &gGerudoRedStandAnim); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + SkelAnime_InitFlex(play, &this->unk198, &D_600A458, NULL, this->unk1DC, this->unk26C, 24); + Animation_PlayLoop(&this->unk198, &D_600B07C); + Collider_InitCylinder(play, &this->unk14C); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A35190); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; - EnGe3_ChangeAction(this, 0); - this->actionFunc = EnGe3_ForceTalk; - this->unk_30C = 0; + func_80A34620(this, 0); + this->unk310 = func_80A34B90; + this->unk30C = 0; this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; @@ -100,123 +102,118 @@ void EnGe3_Init(Actor* thisx, PlayState* play2) { void EnGe3_Destroy(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk14C); } -void EnGe3_TurnToFacePlayer(EnGe3* this, PlayState* play) { +void func_80A347F4(EnGe3* this, PlayState* play) { + s16 temp_v0; s32 pad; - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (ABS(angleDiff) <= 0x4000) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100); + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (ABS(temp_v0) < 0x4001) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->unk300, &this->unk306, this->actor.focus.pos); } else { - if (angleDiff < 0) { - Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100); + if (temp_v0 < 0) { + Math_SmoothStepToS(&this->unk300.y, -0x2000, 6, 0x1838, 0x100); } else { - Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 6200, 0x100); + Math_SmoothStepToS(&this->unk300.y, 0x2000, 6, 0x1838, 0x100); } - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 1000, 100); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xC, 0x3E8, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; } } -void EnGe3_LookAtPlayer(EnGe3* this, PlayState* play) { - if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x2300) && - (this->actor.xzDistToPlayer < 100.0f)) { - Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos); +void func_80A3490C(EnGe3* this, PlayState* play) { + s16 temp_v0; + + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(temp_v0) < 0x2301) && (this->actor.xzDistToPlayer < 100.0f)) { + Actor_TrackPlayer(play, &this->actor, &this->unk300, &this->unk306, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_306.x, 0, 6, 6200, 100); - Math_SmoothStepToS(&this->unk_306.y, 0, 6, 6200, 100); + Math_SmoothStepToS(&this->unk300.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk300.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk306.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->unk306.y, 0, 6, 0x1838, 0x64); } } -void EnGe3_Wait(EnGe3* this, PlayState* play) { +void func_80A34A20(EnGe3* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - this->actionFunc = EnGe3_WaitLookAtPlayer; - this->actor.update = EnGe3_UpdateWhenNotTalking; + this->unk310 = func_80A34A80; + this->actor.update = func_80A34D68; this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } - EnGe3_TurnToFacePlayer(this, play); + func_80A347F4(this, play); } -void EnGe3_WaitLookAtPlayer(EnGe3* this, PlayState* play) { - EnGe3_LookAtPlayer(this, play); +void func_80A34A80(EnGe3* this, PlayState* play) { + func_80A3490C(this, play); } -void EnGe3_WaitTillCardGiven(EnGe3* this, PlayState* play) { - if (Actor_HasParent(&this->actor, play)) { +void func_80A34AA0(EnGe3* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play) != 0) { this->actor.parent = NULL; - this->actionFunc = EnGe3_Wait; + this->unk310 = func_80A34A20; } else { Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void EnGe3_GiveCard(EnGe3* this, PlayState* play) { +void func_80A34B00(EnGe3* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - this->actionFunc = EnGe3_WaitTillCardGiven; + this->unk310 = func_80A34AA0; Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void EnGe3_ForceTalk(EnGe3* this, PlayState* play) { +void func_80A34B90(EnGe3* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnGe3_GiveCard; + this->unk310 = func_80A34B00; } else { - if (!(this->unk_30C & 4)) { + if (!(this->unk30C & 4)) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); - this->unk_30C |= 4; + this->unk30C |= 4; } this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; Actor_OfferTalkExchange(&this->actor, play, 300.0f, 300.0f, EXCH_ITEM_NONE); } - EnGe3_LookAtPlayer(this, play); + func_80A3490C(this, play); } -void EnGe3_UpdateCollision(EnGe3* this, PlayState* play) { - s32 pad; - s32 pad2; +void func_80A34C40(EnGe3* this, PlayState* play) { + s32 pad[2]; - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk14C); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - - if (!(this->unk_30C & 2) && SkelAnime_Update(&this->skelAnime)) { - this->unk_30C |= 2; + if (!(this->unk30C & 2) && SkelAnime_Update(&this->unk198)) { + this->unk30C |= 2; } } -void EnGe3_MoveAndBlink(EnGe3* this, PlayState* play) { - +void func_80A34CE4(EnGe3* this, PlayState* play) { Actor_MoveXZGravity(&this->actor); - - if (DECR(this->blinkTimer) == 0) { - this->blinkTimer = Rand_S16Offset(60, 60); + if (DECR(this->unk2FE) == 0) { + this->unk2FE = Rand_S16Offset(0x3C, 0x3C); } - - this->eyeIndex = this->blinkTimer; - - if (this->eyeIndex >= 3) { - this->eyeIndex = 0; + this->unk2FC = this->unk2FE; + if (this->unk2FC >= 3) { + this->unk2FC = 0; } } -void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play) { +void func_80A34D68(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - EnGe3_UpdateCollision(this, play); - this->actionFunc(this, play); - + func_80A34C40(this, play); + this->unk310(this, play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = EnGe3_Wait; + this->unk310 = func_80A34A20; this->actor.update = EnGe3_Update; } else { this->actor.textId = 0x6005; @@ -224,50 +221,51 @@ void EnGe3_UpdateWhenNotTalking(Actor* thisx, PlayState* play) { Actor_OfferTalk(&this->actor, play, 100.0f); } } - - EnGe3_MoveAndBlink(this, play); + func_80A34CE4(this, play); } void EnGe3_Update(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - EnGe3_UpdateCollision(this, play); - this->actionFunc(this, play); - EnGe3_MoveAndBlink(this, play); + func_80A34C40(this, play); + this->unk310(this, play); + func_80A34CE4(this, play); } -s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnGe3* this = (EnGe3*)thisx; +s32 func_80A34E58(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { + EnGe3* this = thisx; + + switch (arg1) { + case 5: + case 0xB: + case 0x10: + *arg2 = NULL; + return 0; - switch (limbIndex) { - // Hide swords and veil from object_geldb - case GERUDO_RED_LIMB_VEIL: - case GERUDO_RED_LIMB_R_SWORD: - case GERUDO_RED_LIMB_L_SWORD: - *dList = NULL; - return false; - // Turn head - case GERUDO_RED_LIMB_HEAD: - rot->x += this->headRot.y; + case 6: + arg4->x += this->unk300.y; #if OOT_VERSION >= PAL_1_1 FALLTHROUGH; default: // This is a hack to fix a bug present before PAL 1.1, where the actor's clothes can change color // depending on what was drawn earlier in the frame. OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 547); - switch (limbIndex) { - case GERUDO_RED_LIMB_NECK: + switch (arg1) { + case 3: break; - case GERUDO_RED_LIMB_HEAD: + + case 6: gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 80, 60, 10, 255); break; - case GERUDO_RED_LIMB_R_SWORD: - case GERUDO_RED_LIMB_L_SWORD: + + case 11: + case 16: gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 170, 230, 255); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); + gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 255, 255, 255, 255); break; + default: gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 0, 0, 255); @@ -277,34 +275,27 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p #endif break; } - return false; + return 0; } -void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnGe3* this = (EnGe3*)thisx; - Vec3f D_80A351C8 = { 600.0f, 700.0f, 0.0f }; +void func_80A35004(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { + EnGe3* this = thisx; + Vec3f sp18 = D_80A351C8; - if (limbIndex == GERUDO_RED_LIMB_HEAD) { - Matrix_MultVec3f(&D_80A351C8, &this->actor.focus.pos); + if (arg1 == 6) { + Matrix_MultVec3f(&sp18, &this->actor.focus.pos); } } -void EnGe3_Draw(Actor* thisx, PlayState* play2) { - static void* eyeTextures[] = { - gGerudoRedEyeOpenTex, - gGerudoRedEyeHalfTex, - gGerudoRedEyeShutTex, - }; +void EnGe3_Draw(Actor* thisx, PlayState* play) { + s32 temp_a0; EnGe3* this = (EnGe3*)thisx; - PlayState* play = play2; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 614); - Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A351D4[this->unk2FC])); func_8002EBCC(&this->actor, play, 0); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnGe3_OverrideLimbDraw, EnGe3_PostLimbDraw, this); - + SkelAnime_DrawFlexOpa(play, this->unk198.skeleton, this->unk198.jointTable, this->unk198.dListCount, func_80A34E58, + func_80A35004, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 631); } diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index 297129e439d..ecdebd30bbb 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -4,24 +4,21 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_geldb/object_geldb.h" - struct EnGe3; -typedef void (*EnGe3ActionFunc)(struct EnGe3*, struct PlayState*); - typedef struct EnGe3 { - /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinder collider; - /* 0x0198 */ SkelAnime skelAnime; - /* 0x01DC */ Vec3s jointTable[GERUDO_RED_LIMB_MAX]; - /* 0x026C */ Vec3s morphTable[GERUDO_RED_LIMB_MAX]; - /* 0x02FC */ s16 eyeIndex; - /* 0x02FE */ s16 blinkTimer; - /* 0x0300 */ Vec3s headRot; - /* 0x0306 */ Vec3s unk_306; - /* 0x030C */ u16 unk_30C; - /* 0x0310 */ EnGe3ActionFunc actionFunc; -} EnGe3; // size = 0x0314 + /* 0x000 */ Actor actor; + /* 0x14C */ ColliderCylinder unk14C; + /* 0x198 */ SkelAnime unk198; + /* 0x1DC */ Vec3s unk1DC[24]; + /* 0x26C */ Vec3s unk26C[24]; + /* 0x2FC */ s16 unk2FC; + /* 0x2FE */ s16 unk2FE; + /* 0x300 */ Vec3s unk300; + /* 0x306 */ Vec3s unk306; + /* 0x30C */ u16 unk30C; + /* 0x30E */ char pad30E[2]; + /* 0x310 */ void (*unk310)(struct EnGe3*, struct PlayState*); +} EnGe3; // size = 0x314 #endif 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 e8938ac97e4..6800b08fceb 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -1,9 +1,3 @@ -/* - * File: z_en_geldb.c - * Overlay: ovl_En_GeldB - * Description: Gerudo fighter - */ - #include "z_en_geldb.h" #include "libc64/qrand.h" @@ -252,7 +246,7 @@ void EnGeldB_Init(Actor* thisx, PlayState* play) { this->blinkState = 0; this->unkFloat = 10.0f; SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable, - this->morphTable, GERUDO_RED_LIMB_MAX); + this->morphTable, 24); Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylinderInit); Collider_InitTris(play, &this->blockCollider); @@ -395,8 +389,8 @@ void EnGeldB_Wait(EnGeldB* this, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { EnGeldB_SetupReady(this); @@ -420,8 +414,8 @@ void EnGeldB_Flee(EnGeldB* this, PlayState* play) { } if (this->skelAnime.curFrame == 2.0f) { this->actor.gravity = 0.0f; - Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 300.0f, 1.0f, 20.5f, 0.0f); @@ -507,9 +501,12 @@ void EnGeldB_SetupAdvance(EnGeldB* this, PlayState* play) { void EnGeldB_Advance(EnGeldB* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; - s32 absPlaySpeed; + s32 pad3C; s16 facingAngletoLink; Player* player = GET_PLAYER(play); + s32 pad30; + s32 pad2C; + f32 absPlaySpeed; if (!EnGeldB_DodgeRanged(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); @@ -534,9 +531,9 @@ void EnGeldB_Advance(EnGeldB* this, PlayState* play) { prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - + absPlaySpeed = ABS(this->skelAnime.playSpeed); + beforeCurFrame = (s32)(this->skelAnime.curFrame - absPlaySpeed); + absPlaySpeed = ABS(this->skelAnime.playSpeed); // yes it does this twice. if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { EnGeldB_SetupCircle(this); @@ -570,12 +567,10 @@ void EnGeldB_Advance(EnGeldB* this, PlayState* play) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_BREATH); } - if (prevFrame != (s32)this->skelAnime.curFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; - - if (((beforeCurFrame < 0) && (afterPrevFrame > 0)) || ((beforeCurFrame < 4) && (afterPrevFrame > 4))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_MUSI_LAND); - } + if ((prevFrame != (s32)this->skelAnime.curFrame) && + ((beforeCurFrame < 0 && (s32)absPlaySpeed + prevFrame > 0) || + (beforeCurFrame < 4 && (s32)absPlaySpeed + prevFrame > 4))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_MUSI_LAND); } } } @@ -956,8 +951,8 @@ void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play) { if ((s32)this->skelAnime.curFrame < 9) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else if ((s32)this->skelAnime.curFrame == 13) { - Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); this->swordState = 1; this->actor.speed = 10.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_GERUDOFT_ATTACK); @@ -1123,8 +1118,8 @@ void EnGeldB_SetupJump(EnGeldB* this) { void EnGeldB_Jump(EnGeldB* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(play, &this->leftFootPos); func_800355B8(play, &this->rightFootPos); + func_800355B8(play, &this->leftFootPos); } if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { @@ -1463,14 +1458,14 @@ s32 EnGeldB_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* EnGeldB* this = (EnGeldB*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2507); - if (limbIndex == GERUDO_RED_LIMB_NECK) { + if (limbIndex == 3) { rot->z += this->headRot.x; rot->x += this->headRot.y; rot->y += this->headRot.z; - } else if (limbIndex == GERUDO_RED_LIMB_HEAD) { + } else if (limbIndex == 6) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 80, 60, 10, 255); - } else if ((limbIndex == GERUDO_RED_LIMB_R_SWORD) || (limbIndex == GERUDO_RED_LIMB_L_SWORD)) { + } else if ((limbIndex == 11) || (limbIndex == 16)) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 170, 230, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -1496,7 +1491,7 @@ void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro EnGeldB* this = (EnGeldB*)thisx; s32 bodyPart = -1; - if (limbIndex == GERUDO_RED_LIMB_R_SWORD) { + if (limbIndex == 11) { Matrix_MultVec3f(&swordQuadOffset1, &this->swordCollider.dim.quad[1]); Matrix_MultVec3f(&swordQuadOffset0, &this->swordCollider.dim.quad[0]); Matrix_MultVec3f(&swordQuadOffset3, &this->swordCollider.dim.quad[3]); @@ -1514,49 +1509,45 @@ void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &swordTip, &swordHilt); } } else { - Actor_SetFeetPos(&this->actor, limbIndex, GERUDO_RED_LIMB_L_FOOT, &footOffset, GERUDO_RED_LIMB_R_FOOT, - &footOffset); + Actor_SetFeetPos(&this->actor, limbIndex, 19, &footOffset, 22, &footOffset); } - - if (limbIndex == GERUDO_RED_LIMB_L_FOOT) { - Matrix_MultVec3f(&footOffset, &this->leftFootPos); - } else if (limbIndex == GERUDO_RED_LIMB_R_FOOT) { + if (limbIndex == 19) { Matrix_MultVec3f(&footOffset, &this->rightFootPos); + } else if (limbIndex == 22) { + Matrix_MultVec3f(&footOffset, &this->leftFootPos); } - if (this->iceTimer != 0) { switch (limbIndex) { - case GERUDO_RED_LIMB_NECK: + case 3: bodyPart = 0; break; - case GERUDO_RED_LIMB_L_SWORD: + case 16: bodyPart = 1; break; - case GERUDO_RED_LIMB_R_SWORD: + case 11: bodyPart = 2; break; - case GERUDO_RED_LIMB_L_UPPER_ARM: + case 12: bodyPart = 3; break; - case GERUDO_RED_LIMB_R_UPPER_ARM: + case 7: bodyPart = 4; break; - case GERUDO_RED_LIMB_TORSO: + case 2: bodyPart = 5; break; - case GERUDO_RED_LIMB_WAIST: + case 23: bodyPart = 6; break; - case GERUDO_RED_LIMB_L_FOOT: + case 19: bodyPart = 7; break; - case GERUDO_RED_LIMB_R_FOOT: + case 22: bodyPart = 8; break; default: break; } - if (bodyPart >= 0) { Vec3f limbPos; 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 003a6dc5a5c..29322370ebb 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -4,8 +4,6 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_geldb/object_geldb.h" - struct EnGeldB; typedef void (*EnGeldBActionFunc)(struct EnGeldB*, struct PlayState*); @@ -14,8 +12,8 @@ typedef struct EnGeldB { /* 0x0000 */ Actor actor; /* 0x014C */ Vec3s bodyPartsPos[10]; /* 0x0188 */ SkelAnime skelAnime; - /* 0x01CC */ Vec3s jointTable[GERUDO_RED_LIMB_MAX]; - /* 0x025C */ Vec3s morphTable[GERUDO_RED_LIMB_MAX]; + /* 0x01CC */ Vec3s jointTable[24]; + /* 0x025C */ Vec3s morphTable[24]; /* 0x02EC */ s32 action; /* 0x02F0 */ char unk_2F0[4]; /* 0x02F4 */ EnGeldBActionFunc actionFunc; @@ -38,8 +36,8 @@ typedef struct EnGeldB { /* 0x036C */ ColliderQuad swordCollider; /* 0x03EC */ ColliderTris blockCollider; /* 0x040C */ ColliderTrisElement blockElements[2]; - /* 0x04C4 */ Vec3f rightFootPos; - /* 0x04D0 */ Vec3f leftFootPos; + /* 0x04C4 */ Vec3f leftFootPos; + /* 0x04D0 */ Vec3f rightFootPos; /* 0x04DC */ Vec3s headRot; } EnGeldB; // size = 0x04E4 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 b4d86799d9b..77d9cffd37e 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -214,12 +214,13 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { s16 talkState = NPC_TALK_STATE_TALKING; f32 xzRange; f32 yRange = fabsf(thisx->yDistToPlayer) + 1.0f; + EnGo* this = (EnGo*)thisx; - xzRange = thisx->xzDistToPlayer + 1.0f; + xzRange = this->actor.xzDistToPlayer + 1.0f; switch (Message_GetState(&play->msgCtx)) { if (play) {} case TEXT_STATE_CLOSING: - switch (thisx->textId) { + switch (this->actor.textId) { case 0x3008: SET_INFTABLE(INFTABLE_E0); talkState = NPC_TALK_STATE_IDLE; @@ -241,7 +242,7 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { talkState = NPC_TALK_STATE_IDLE; break; case 0x3036: - Actor_OfferGetItem(thisx, play, GI_TUNIC_GORON, xzRange, yRange); + Actor_OfferGetItem(&this->actor, play, GI_TUNIC_GORON, xzRange, yRange); SET_INFTABLE(INFTABLE_10D); // EnGo exclusive flag talkState = NPC_TALK_STATE_ACTION; break; @@ -272,33 +273,33 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { break; case TEXT_STATE_CHOICE: if (Message_ShouldAdvance(play)) { - switch (thisx->textId) { + switch (this->actor.textId) { case 0x300A: if (play->msgCtx.choiceIndex == 0) { if (CUR_UPG_VALUE(UPG_STRENGTH) != 0 || GET_INFTABLE(INFTABLE_EB)) { - thisx->textId = 0x300B; + this->actor.textId = 0x300B; } else { - thisx->textId = 0x300C; + this->actor.textId = 0x300C; } } else { - thisx->textId = 0x300D; + this->actor.textId = 0x300D; } - Message_ContinueTextbox(play, thisx->textId); + Message_ContinueTextbox(play, this->actor.textId); talkState = NPC_TALK_STATE_TALKING; break; case 0x3034: if (play->msgCtx.choiceIndex == 0) { if (GET_INFTABLE(INFTABLE_10B)) { - thisx->textId = 0x3033; + this->actor.textId = 0x3033; } else { - thisx->textId = 0x3035; + this->actor.textId = 0x3035; } } else if (GET_INFTABLE(INFTABLE_10B)) { - thisx->textId = 0x3036; + this->actor.textId = 0x3036; } else { - thisx->textId = 0x3033; + this->actor.textId = 0x3033; } - Message_ContinueTextbox(play, thisx->textId); + Message_ContinueTextbox(play, this->actor.textId); talkState = NPC_TALK_STATE_TALKING; break; case 0x3054: @@ -306,8 +307,8 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { if (play->msgCtx.choiceIndex == 0) { talkState = NPC_TALK_STATE_ACTION; } else { - thisx->textId = 0x3056; - Message_ContinueTextbox(play, thisx->textId); + this->actor.textId = 0x3056; + Message_ContinueTextbox(play, this->actor.textId); talkState = NPC_TALK_STATE_TALKING; } SET_INFTABLE(INFTABLE_B4); @@ -317,14 +318,14 @@ s16 EnGo_UpdateTalkState(PlayState* play, Actor* thisx) { break; case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { - switch (thisx->textId) { + switch (this->actor.textId) { case 0x3035: SET_INFTABLE(INFTABLE_10B); FALLTHROUGH; case 0x3032: case 0x3033: - thisx->textId = 0x3034; - Message_ContinueTextbox(play, thisx->textId); + this->actor.textId = 0x3034; + Message_ContinueTextbox(play, this->actor.textId); talkState = NPC_TALK_STATE_TALKING; break; default: @@ -965,7 +966,7 @@ void func_80A40B1C(EnGo* this, PlayState* play) { void EnGo_GetItem(EnGo* this, PlayState* play) { f32 xzDist; f32 yDist; - s32 getItemId; + s32 getItem; if (Actor_HasParent(&this->actor, play)) { this->interactInfo.talkState = NPC_TALK_STATE_ACTION; @@ -975,24 +976,24 @@ void EnGo_GetItem(EnGo* this, PlayState* play) { this->unk_20C = 0; if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0x90) { if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_CLAIM_CHECK) { - getItemId = GI_SWORD_BIGGORON; + getItem = GI_SWORD_BIGGORON; this->unk_20C = 1; } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_EYE_DROPS) { - getItemId = GI_CLAIM_CHECK; + getItem = GI_CLAIM_CHECK; } if (INV_CONTENT(ITEM_TRADE_ADULT) == ITEM_BROKEN_GORONS_SWORD) { - getItemId = GI_PRESCRIPTION; + getItem = GI_PRESCRIPTION; } } if (PARAMS_GET_NOSHIFT(this->actor.params, 4, 4) == 0) { - getItemId = GI_TUNIC_GORON; + getItem = GI_TUNIC_GORON; } yDist = fabsf(this->actor.yDistToPlayer) + 1.0f; xzDist = this->actor.xzDistToPlayer + 1.0f; - Actor_OfferGetItem(&this->actor, play, getItemId, xzDist, yDist); + Actor_OfferGetItem(&this->actor, play, getItem, xzDist, yDist); } } 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 dbf8e2b5502..7f535e7d98f 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -793,6 +793,7 @@ u16 EnGo2_GetTextId(PlayState* play, Actor* thisx) { s16 EnGo2_UpdateTalkState(PlayState* play, Actor* thisx) { EnGo2* this = (EnGo2*)thisx; + switch (PARAMS_GET_S(this->actor.params, 0, 5)) { case GORON_CITY_ROLLING_BIG: return EnGo2_UpdateTalkStateGoronCityRollingBig(play, this); diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/src/overlays/actors/ovl_En_Hata/z_en_hata.c index 86a98fd1887..d7f017d9d41 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -35,40 +35,26 @@ ActorProfile En_Hata_Profile = { /**/ EnHata_Draw, }; -// Unused Collider and CollisionCheck data -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_NONE, - AT_NONE, - AC_ON | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x00000080, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON | ACELEM_HOOKABLE, - OCELEM_ON, - }, - { 16, 246, 0, { 0, 0, 0 } }, +static UNK_TYPE sUnusedData[] = { + 0x0A000939, 0x20010000, 0x00000000, 0x00000000, 0x00000000, 0x00000080, 0x00000000, + 0x00050100, 0x001000F6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xFF000000, }; -static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static Vec3f sVec = { 0, 0, 0 }; void EnHata_Init(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; s32 pad; - CollisionHeader* colHeader = NULL; - f32 frameCount = Animation_GetLastFrame(&gFlagpoleFlapAnim); + CollisionHeader* colHeader; + f32 frameCount; + colHeader = NULL; + frameCount = Animation_GetLastFrame(&object_hata_000444_Anim); Actor_SetScale(&this->dyna.actor, 1.0f / 75.0f); - SkelAnime_Init(play, &this->skelAnime, &gFlagpoleSkel, &gFlagpoleFlapAnim, NULL, NULL, 0); - Animation_Change(&this->skelAnime, &gFlagpoleFlapAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); + SkelAnime_Init(play, &this->skelAnime, &object_hata_002FD0_Skel, &object_hata_000444_Anim, NULL, NULL, 0); + Animation_Change(&this->skelAnime, &object_hata_000444_Anim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gFlagpoleCol, &colHeader); + CollisionHeader_GetVirtual(&object_hata_0000C0_Col, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.cullingVolumeScale = 500.0f; this->dyna.actor.cullingVolumeDownward = 550.0f; @@ -76,12 +62,11 @@ void EnHata_Init(Actor* thisx, PlayState* play) { this->invScale = 6; this->maxStep = 1000; this->minStep = 1; - this->unk_278 = Rand_ZeroOne() * 0xFFFF; + this->unk_278 = Rand_ZeroOne() * 65535.0f; } void EnHata_Destroy(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; - SkelAnime_Free(&this->skelAnime, play); DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } @@ -90,40 +75,33 @@ void EnHata_Update(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnHata* this = (EnHata*)thisx; s32 pitch; - Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - Vec3f windVec; + Vec3f sp48 = sVec; + Vec3f sp3C; f32 sin; SkelAnime_Update(&this->skelAnime); - // Rotate to hang down by default - this->limbs[FLAGPOLE_LIMB_FLAG_1_BASE].y = this->limbs[FLAGPOLE_LIMB_FLAG_2_BASE].y = -0x4000; - windVec.x = play->envCtx.windDirection.x; - windVec.y = play->envCtx.windDirection.y; - windVec.z = play->envCtx.windDirection.z; - + this->limbs[3].y = this->limbs[12].y = -0x4000; + sp3C.x = play->envCtx.windDirection.x; + sp3C.y = play->envCtx.windDirection.y; + sp3C.z = play->envCtx.windDirection.z; if (play->envCtx.windSpeed > 255.0f) { play->envCtx.windSpeed = 255.0f; } - if (play->envCtx.windSpeed < 0.0f) { play->envCtx.windSpeed = 0.0f; } - if (Rand_ZeroOne() > 0.5f) { this->unk_278 += 6000; } else { this->unk_278 += 3000; } - - // Mimic varying wind gusts sin = Math_SinS(this->unk_278) * 80.0f; - pitch = -Math_Vec3f_Pitch(&zeroVec, &windVec); - pitch = ((s32)((15000 - pitch) * (1.0f - (play->envCtx.windSpeed / (255.0f - sin))))) + pitch; - Math_SmoothStepToS(&this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].y, pitch, this->invScale, this->maxStep, - this->minStep); - this->limbs[FLAGPOLE_LIMB_FLAG_2_HOIST_END_BASE].y = this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].y; - this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].z = -Math_Vec3f_Yaw(&zeroVec, &windVec); - this->limbs[FLAGPOLE_LIMB_FLAG_2_HOIST_END_BASE].z = this->limbs[FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE].z; + pitch = -Math_Vec3f_Pitch(&sp48, &sp3C); + pitch = ((s32)((0x3A98 - pitch) * (1.0f - (play->envCtx.windSpeed / (255.0f - sin))))) + pitch; + Math_SmoothStepToS(&this->limbs[4].y, pitch, this->invScale, this->maxStep, this->minStep); + this->limbs[13].y = this->limbs[4].y; + this->limbs[4].z = -Math_Vec3f_Yaw(&sp48, &sp3C); + this->limbs[13].z = this->limbs[4].z; this->skelAnime.playSpeed = (Rand_ZeroFloat(1.25f) + 2.75f) * (play->envCtx.windSpeed / 255.0f); } @@ -131,8 +109,7 @@ s32 EnHata_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* EnHata* this = (EnHata*)thisx; Vec3s* limbs; - if (limbIndex == FLAGPOLE_LIMB_FLAG_2_BASE || limbIndex == FLAGPOLE_LIMB_FLAG_1_BASE || - limbIndex == FLAGPOLE_LIMB_FLAG_2_HOIST_END_BASE || limbIndex == FLAGPOLE_LIMB_FLAG_1_HOIST_END_BASE) { + if (limbIndex == 12 || limbIndex == 3 || limbIndex == 13 || limbIndex == 4) { limbs = this->limbs; rot->x += limbs[limbIndex].x; rot->y += limbs[limbIndex].y; @@ -146,7 +123,6 @@ void EnHata_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot void EnHata_Draw(Actor* thisx, PlayState* play) { EnHata* this = (EnHata*)thisx; - Gfx_SetupDL_37Opa(play->state.gfxCtx); Matrix_Scale(1.0f, 1.1f, 1.0f, MTXMODE_APPLY); SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHata_OverrideLimbDraw, 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 38c85e6349c..65823ef2974 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.h +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.h @@ -4,13 +4,11 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_hata/object_hata.h" - typedef struct EnHata { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ SkelAnime skelAnime; - /* 0x01A8 */ ColliderCylinder collider; // Unused, but indicated by the form of the unused data - /* 0x01F4 */ Vec3s limbs[FLAGPOLE_LIMB_MAX]; + /* 0x01A8 */ char unk_1A8[0x4C]; + /* 0x01F4 */ Vec3s limbs[0x15]; /* 0x0272 */ s16 invScale; /* 0x0274 */ s16 maxStep; /* 0x0276 */ s16 minStep; 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 b193f534c26..7bbf9a5a012 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -291,29 +291,31 @@ void func_80A535BC(EnHeishi2* this, PlayState* play) { } void func_80A53638(EnHeishi2* this, PlayState* play) { - s32 pad; - f32 frameCount = this->skelAnime.curFrame; - - BgSpot15Saku* actor = (BgSpot15Saku*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + Actor* thisx; + f32 frameCount; + Actor* actor; + frameCount = this->skelAnime.curFrame; + thisx = &this->actor; + actor = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; SkelAnime_Update(&this->skelAnime); if ((frameCount >= 12.0f) && (!this->audioFlag)) { - Actor_PlaySfx(&this->actor, NA_SE_EV_SPEAR_HIT); + Actor_PlaySfx(thisx, NA_SE_EV_SPEAR_HIT); this->audioFlag = 1; } if (this->unk_2EC <= frameCount) { while (actor != NULL) { - if (actor->dyna.actor.id != ACTOR_BG_SPOT15_SAKU) { - actor = (BgSpot15Saku*)(actor->dyna.actor.next); + if (ACTOR_BG_SPOT15_SAKU != actor->id) { + actor = actor->next; } else { - this->gate = &actor->dyna.actor; - actor->unk_168 = 1; + this->gate = actor; + ((BgSpot15Saku*)actor)->unk_168 = 1; break; } } PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆ きたきたきたぁ! ☆☆☆ %x\n", "☆☆☆ It's here, it's here, it's here! ☆☆☆ %x\n") VT_RST, - actor->dyna.actor.next); + actor->next); this->actionFunc = func_80A5372C; } } @@ -458,10 +460,10 @@ void func_80A53C90(EnHeishi2* this, PlayState* play) { void func_80A53D0C(EnHeishi2* this, PlayState* play) { s32 pad; f32 frameCount; - BgGateShutter* gate; + Actor* gate; frameCount = this->skelAnime.curFrame; - gate = (BgGateShutter*)play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + gate = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; SkelAnime_Update(&this->skelAnime); if (12.0f <= frameCount) { if (this->audioFlag == 0) { @@ -471,17 +473,17 @@ void func_80A53D0C(EnHeishi2* this, PlayState* play) { } if (this->unk_2EC <= frameCount) { while (gate != NULL) { - if (gate->dyna.actor.id != ACTOR_BG_GATE_SHUTTER) { - gate = (BgGateShutter*)gate->dyna.actor.next; + if (gate->id != ACTOR_BG_GATE_SHUTTER) { + gate = gate->next; } else { - this->gate = &gate->dyna.actor; - gate->openingState = 1; + this->gate = gate; + ((BgGateShutter*)gate)->openingState = 1; break; } } PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆ きたきたきたぁ! ☆☆☆ %x\n", "☆☆☆ It's here, it's here, it's here! ☆☆☆ %x\n") VT_RST, - gate->dyna.actor.next); + gate->next); this->actionFunc = func_80A53DF8; } } @@ -618,27 +620,29 @@ void func_80A54320(EnHeishi2* this, PlayState* play) { } void func_80A543A0(EnHeishi2* this, PlayState* play) { - s32 pad; - f32 frameCount = this->skelAnime.curFrame; - BgGateShutter* gate = (BgGateShutter*)(play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head); - SkelAnime_Update(&this->skelAnime); + Actor* thisx; + f32 frameCount; + Actor* gate; + frameCount = this->skelAnime.curFrame; + thisx = &this->actor; + gate = play->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + SkelAnime_Update(&this->skelAnime); if ((frameCount >= 12.0f) && (!this->audioFlag)) { - Actor_PlaySfx(&this->actor, NA_SE_EV_SPEAR_HIT); + Actor_PlaySfx(thisx, NA_SE_EV_SPEAR_HIT); this->audioFlag = 1; } - if (this->unk_2EC <= frameCount) { while (gate != NULL) { - if (ACTOR_BG_GATE_SHUTTER != gate->dyna.actor.id) { - gate = (BgGateShutter*)(gate->dyna.actor.next); + if (ACTOR_BG_GATE_SHUTTER != gate->id) { + gate = gate->next; } else { - this->gate = &gate->dyna.actor; + this->gate = gate; if (this->unk_30A != 2) { - gate->openingState = -1; + ((BgGateShutter*)gate)->openingState = -1; break; } else { - gate->openingState = 2; + ((BgGateShutter*)gate)->openingState = 2; break; } } @@ -649,7 +653,6 @@ void func_80A543A0(EnHeishi2* this, PlayState* play) { this->actionFunc = func_80A53DF8; } } - void func_80A544AC(EnHeishi2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.z, -6100, 5, this->unk_2E4, 0); Math_ApproachF(&this->unk_2E4, 3000.0f, 1.0f, 500.0f); @@ -663,7 +666,7 @@ void func_80A544AC(EnHeishi2* this, PlayState* play) { } void func_80A5455C(EnHeishi2* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->actor; Vec3f pos; f32 rotY; EnBom* bomb; @@ -675,7 +678,7 @@ void func_80A5455C(EnHeishi2* this, PlayState* play) { pos.x = Rand_CenteredFloat(20.0f) + this->unk_274.x; pos.y = Rand_CenteredFloat(20.0f) + (this->unk_274.y - 40.0f); pos.z = Rand_CenteredFloat(20.0f) + (this->unk_274.z - 20.0f); - rotY = Rand_CenteredFloat(7000.0f) + this->actor.yawTowardsPlayer; + rotY = Rand_CenteredFloat(7000.0f) + thisx->yawTowardsPlayer; bomb = (EnBom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOM, pos.x, pos.y, pos.z, 0, rotY, 0, 0); if (bomb != NULL) { bomb->actor.speed = Rand_CenteredFloat(5.0f) + 10.0f; @@ -837,7 +840,6 @@ s32 EnHeishi2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 void EnHeishi2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnHeishi2* this = (EnHeishi2*)thisx; - if (limbIndex == 16) { Matrix_Get(&this->mtxf_330); } 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 f77484dca83..ffab45b2b53 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -282,11 +282,13 @@ void func_80A56900(EnHeishi4* this, PlayState* play) { void func_80A56994(EnHeishi4* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); - if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { - Message_CloseTextbox(play); - SET_INFTABLE(INFTABLE_6C); - Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_80A56A50; + if (this->unk_282 == Message_GetState(&play->msgCtx)) { + if (Message_ShouldAdvance(play)) { + Message_CloseTextbox(play); + SET_INFTABLE(INFTABLE_6C); + Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); + this->actionFunc = func_80A56A50; + } } } 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 4dbf4ada35f..9d26b06bf62 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -351,7 +351,7 @@ static EnHorseSpawnpoint sHorseSpawns[] = { { SCENE_LON_LON_RANCH, 882, 0, -2256, 0 }, { SCENE_LON_LON_RANCH, -1003, 0, -755, 0 }, // Hardcoded to always load in lon lon { SCENE_LON_LON_RANCH, -2254, 0, -629, 0 }, - { SCENE_LON_LON_RANCH, 907, 0, -2336, 0 }, + { SCENE_LON_LON_RANCH, 907, 0, -2336, 0 } }; typedef struct BridgeJumpPoint { @@ -3232,7 +3232,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { obstaclePos.z += intersectDist * Math_CosS(this->actor.world.rot.y); obstacleTop = obstaclePos; obstacleTop.y = BgCheck_EntityRaycastDown3(&play->colCtx, &obstacleFloor, &bgId, &obstaclePos); - if (obstacleTop.y == BGCHECK_Y_MIN) { + if (obstacleTop.y == -32000.0f) { return; } obstacleHeight = obstacleTop.y - this->actor.world.pos.y; @@ -3281,7 +3281,7 @@ void EnHorse_UpdateBgCheckInfo(EnHorse* this, PlayState* play) { obstacleTop = obstaclePos; obstacleTop.y = BgCheck_EntityRaycastDown3(&play->colCtx, &obstacleFloor, &bgId, &obstaclePos); - if (obstacleTop.y == BGCHECK_Y_MIN) { + if (obstacleTop.y == -32000.0f) { return; } diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index d789b8b9806..a1c5f5f1cd0 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -1,9 +1,3 @@ -/* - * File: z_en_ice_hono.c - * Overlay: ovl_En_Ice_Hono - * Description: The various types of Blue Fire - */ - #include "z_en_ice_hono.h" #include "libc64/qrand.h" @@ -111,8 +105,11 @@ static InitChainEntry sInitChainSmallFlame[] = { ICHAIN_F32(cullingVolumeDownward, 1000, ICHAIN_STOP), }; -f32 EnIceHono_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { - return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); +f32 EnIceHono_SquareDist(Vec3f* pos1, Vec3f* pos2) { + f32 dx = pos1->x - pos2->x; + f32 dz = pos1->z - pos2->z; + + return SQ(dx) + SQ(dz); } void EnIceHono_InitCapturableFlame(Actor* thisx, PlayState* play) { @@ -200,7 +197,7 @@ void EnIceHono_Destroy(Actor* thisx, PlayState* play) { } } -u32 EnIceHono_InBottleRange(EnIceHono* this, PlayState* play) { +u32 EnIceHono_LinkCloseAndFacing(EnIceHono* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 60.0f) { @@ -208,15 +205,11 @@ u32 EnIceHono_InBottleRange(EnIceHono* this, PlayState* play) { tempPos.x = Math_SinS(this->actor.yawTowardsPlayer + 0x8000) * 40.0f + player->actor.world.pos.x; tempPos.y = player->actor.world.pos.y; tempPos.z = Math_CosS(this->actor.yawTowardsPlayer + 0x8000) * 40.0f + player->actor.world.pos.z; - - //! @bug: this check is superfluous: it is automatically satisfied if the coarse check is satisfied. It may have - //! been intended to check the actor is in front of Player, but yawTowardsPlayer does not depend on Player's - //! world rotation. - if (EnIceHono_XZDistanceSquared(&tempPos, &this->actor.world.pos) <= SQ(40.0f)) { - return true; + if (EnIceHono_SquareDist(&tempPos, &this->actor.world.pos) <= SQ(40.0f)) { + return 1; } } - return false; + return 0; } void EnIceHono_SetupActionCapturableFlame(EnIceHono* this) { @@ -228,8 +221,7 @@ void EnIceHono_SetupActionCapturableFlame(EnIceHono* this) { void EnIceHono_CapturableFlame(EnIceHono* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - } else if (EnIceHono_InBottleRange(this, play)) { - // GI_MAX in this case allows the player to catch the actor in a bottle + } else if (EnIceHono_LinkCloseAndFacing(this, play)) { Actor_OfferGetItem(&this->actor, play, GI_MAX, 60.0f, 100.0f); } 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 40ef9a24f0e..8e183047d5a 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -16,7 +16,6 @@ #include "sfx.h" #include "sequence.h" #include "sys_matrix.h" -#include "terminal.h" #include "translation.h" #include "versions.h" #include "z_en_item00.h" @@ -35,57 +34,44 @@ typedef void (*EnIkDrawFunc)(struct EnIk*, PlayState*); -#define ARMOR_BROKEN (1 << 0) - -typedef enum EnIkCsAction { - /* 0x00 */ IK_CS_ACTION_0, - /* 0x01 */ IK_CS_ACTION_1, - /* 0x02 */ IK_CS_ACTION_2, - /* 0x03 */ IK_CS_ACTION_3, - /* 0x04 */ IK_CS_ACTION_4, - /* 0x05 */ IK_CS_ACTION_5 -} EnIkCsAction; - -typedef enum EnIkCsDrawMode { - /* 0x00 */ IK_CS_DRAW_NOTHING, - /* 0x01 */ IK_CS_DRAW_INTRO, - /* 0x02 */ IK_CS_DRAW_DEFEAT -} EnIkCsDrawMode; - -typedef enum EnIkDamageReaction { - /* 0x0 */ EN_IK_DMG_REACT_NONE, - /* 0x6 */ EN_IK_DMG_REACT_ELEMENTAL_MAGIC = 0x6, - /* 0xD */ EN_IK_DMG_REACT_SPARKS_NO_DMG = 0xD, - /* 0xE */ EN_IK_DMG_REACT_PROJECTILE, - /* 0xF */ EN_IK_DMG_REACT_DAMAGE -} EnIkDamageReaction; - -void EnIk_UpdateEnemy(Actor* thisx, PlayState* play); -void EnIk_DrawEnemy(Actor* thisx, PlayState* play); - -void EnIk_SetupStandUp(EnIk* this); -void EnIk_StandUp(EnIk* this, PlayState* play); -void EnIk_Idle(EnIk* this, PlayState* play); -void EnIk_SetupWalkOrRun(EnIk* this); -void EnIk_WalkOrRun(EnIk* this, PlayState* play); -void EnIk_SetupVerticalAttack(EnIk* this); -void EnIk_VerticalAttack(EnIk* this, PlayState* play); -void EnIk_SetupPullOutAxe(EnIk* this); -void EnIk_PullOutAxe(EnIk* this, PlayState* play); -void EnIk_SetupDoubleHorizontalAttack(EnIk* this); -void EnIk_DoubleHorizontalAttack(EnIk* this, PlayState* play); -void EnIk_SetupRecoverFromHorizontalAttack(EnIk* this); -void EnIk_RecoverFromHorizontalAttack(EnIk* this, PlayState* play); -void EnIk_SetupSingleHorizontalAttack(EnIk* this); -void EnIk_SingleHorizontalAttack(EnIk* this, PlayState* play); -void EnIk_SetupStopAndBlock(EnIk* this); -void EnIk_StopAndBlock(EnIk* this, PlayState* play); -void EnIk_ReactToAttack(EnIk* this, PlayState* play); -void EnIk_Die(EnIk* this, PlayState* play); - -void EnIk_HandleCsCues(EnIk* this, PlayState* play); -void EnIk_ChangeToEnemy(EnIk* this, PlayState* play); -void EnIk_StartDefeatCutscene(Actor* thisx, PlayState* play); +void EnIk_Init(Actor* thisx, PlayState* play); +void EnIk_Destroy(Actor* thisx, PlayState* play); +void EnIk_Update(Actor* thisx, PlayState* play); +void EnIk_Draw(Actor* thisx, PlayState* play); + +void func_80A74714(EnIk* this); +void func_80A747C0(EnIk* this, PlayState* play); +void func_80A7492C(EnIk* this, PlayState* play); +void func_80A74AAC(EnIk* this); +void func_80A74BA4(EnIk* this, PlayState* play); +void func_80A74E2C(EnIk* this); +void func_80A74EBC(EnIk* this, PlayState* play); +void func_80A7506C(EnIk* this); +void func_80A7510C(EnIk* this, PlayState* play); +void func_80A751C8(EnIk* this); +void func_80A75260(EnIk* this, PlayState* play); +void func_80A753D0(EnIk* this); +void func_80A7545C(EnIk* this, PlayState* play); +void func_80A754A0(EnIk* this); +void func_80A75530(EnIk* this, PlayState* play); +void func_80A755F0(EnIk* this); +void func_80A7567C(EnIk* this, PlayState* play); +void func_80A758B0(EnIk* this, PlayState* play); +void func_80A75A38(EnIk* this, PlayState* play); +void func_80A75FA0(Actor* thisx, PlayState* play); +void func_80A76798(Actor* thisx, PlayState* play); +void func_80A7748C(EnIk* this, PlayState* play); +void func_80A774BC(EnIk* this, PlayState* play); +void func_80A774F8(EnIk* this, PlayState* play); +void func_80A77844(EnIk* this, PlayState* play); +void func_80A779DC(EnIk* this, PlayState* play); +void func_80A77AEC(EnIk* this, PlayState* play); +void func_80A77B0C(EnIk* this, PlayState* play); +void func_80A77B3C(EnIk* this, PlayState* play); +void func_80A77ED0(EnIk* this, PlayState* play); +void func_80A77EDC(EnIk* this, PlayState* play); +void func_80A78160(EnIk* this, PlayState* play); +void func_80A781CC(Actor* thisx, PlayState* play); static ColliderCylinderInit sCylinderInit = { { @@ -166,38 +152,38 @@ static ColliderQuadInit sQuadInit = { }; static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, EN_IK_DMG_REACT_SPARKS_NO_DMG), - /* Deku stick */ DMG_ENTRY(2, EN_IK_DMG_REACT_DAMAGE), - /* Slingshot */ DMG_ENTRY(1, EN_IK_DMG_REACT_PROJECTILE), - /* Explosive */ DMG_ENTRY(2, EN_IK_DMG_REACT_DAMAGE), - /* Boomerang */ DMG_ENTRY(0, EN_IK_DMG_REACT_SPARKS_NO_DMG), - /* Normal arrow */ DMG_ENTRY(2, EN_IK_DMG_REACT_PROJECTILE), - /* Hammer swing */ DMG_ENTRY(2, EN_IK_DMG_REACT_DAMAGE), - /* Hookshot */ DMG_ENTRY(0, EN_IK_DMG_REACT_SPARKS_NO_DMG), - /* Kokiri sword */ DMG_ENTRY(1, EN_IK_DMG_REACT_DAMAGE), - /* Master sword */ DMG_ENTRY(2, EN_IK_DMG_REACT_DAMAGE), - /* Giant's Knife */ DMG_ENTRY(4, EN_IK_DMG_REACT_DAMAGE), - /* Fire arrow */ DMG_ENTRY(2, EN_IK_DMG_REACT_PROJECTILE), - /* Ice arrow */ DMG_ENTRY(2, EN_IK_DMG_REACT_PROJECTILE), - /* Light arrow */ DMG_ENTRY(2, EN_IK_DMG_REACT_PROJECTILE), - /* Unk arrow 1 */ DMG_ENTRY(2, EN_IK_DMG_REACT_PROJECTILE), - /* Unk arrow 2 */ DMG_ENTRY(2, EN_IK_DMG_REACT_PROJECTILE), - /* Unk arrow 3 */ DMG_ENTRY(15, EN_IK_DMG_REACT_PROJECTILE), - /* Fire magic */ DMG_ENTRY(0, EN_IK_DMG_REACT_ELEMENTAL_MAGIC), - /* Ice magic */ DMG_ENTRY(0, EN_IK_DMG_REACT_ELEMENTAL_MAGIC), - /* Light magic */ DMG_ENTRY(0, EN_IK_DMG_REACT_ELEMENTAL_MAGIC), - /* Shield */ DMG_ENTRY(0, EN_IK_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, EN_IK_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, EN_IK_DMG_REACT_DAMAGE), - /* Giant spin */ DMG_ENTRY(4, EN_IK_DMG_REACT_DAMAGE), - /* Master spin */ DMG_ENTRY(2, EN_IK_DMG_REACT_DAMAGE), - /* Kokiri jump */ DMG_ENTRY(2, EN_IK_DMG_REACT_DAMAGE), - /* Giant jump */ DMG_ENTRY(8, EN_IK_DMG_REACT_DAMAGE), - /* Master jump */ DMG_ENTRY(4, EN_IK_DMG_REACT_DAMAGE), - /* Unknown 1 */ DMG_ENTRY(10, EN_IK_DMG_REACT_DAMAGE), - /* Unblockable */ DMG_ENTRY(0, EN_IK_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, EN_IK_DMG_REACT_DAMAGE), - /* Unknown 2 */ DMG_ENTRY(0, EN_IK_DMG_REACT_NONE), + /* Deku nut */ DMG_ENTRY(0, 0xD), + /* Deku stick */ DMG_ENTRY(2, 0xF), + /* Slingshot */ DMG_ENTRY(1, 0xE), + /* Explosive */ DMG_ENTRY(2, 0xF), + /* Boomerang */ DMG_ENTRY(0, 0xD), + /* Normal arrow */ DMG_ENTRY(2, 0xE), + /* Hammer swing */ DMG_ENTRY(2, 0xF), + /* Hookshot */ DMG_ENTRY(0, 0xD), + /* Kokiri sword */ DMG_ENTRY(1, 0xF), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(4, 0xF), + /* Fire arrow */ DMG_ENTRY(2, 0xE), + /* Ice arrow */ DMG_ENTRY(2, 0xE), + /* Light arrow */ DMG_ENTRY(2, 0xE), + /* Unk arrow 1 */ DMG_ENTRY(2, 0xE), + /* Unk arrow 2 */ DMG_ENTRY(2, 0xE), + /* Unk arrow 3 */ DMG_ENTRY(15, 0xE), + /* Fire magic */ DMG_ENTRY(0, 0x6), + /* Ice magic */ DMG_ENTRY(0, 0x6), + /* Light magic */ DMG_ENTRY(0, 0x6), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0xF), + /* Giant spin */ DMG_ENTRY(4, 0xF), + /* Master spin */ DMG_ENTRY(2, 0xF), + /* Kokiri jump */ DMG_ENTRY(2, 0xF), + /* Giant jump */ DMG_ENTRY(8, 0xF), + /* Master jump */ DMG_ENTRY(4, 0xF), + /* Unknown 1 */ DMG_ENTRY(10, 0xF), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0xF), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; void EnIk_Destroy(Actor* thisx, PlayState* play) { @@ -216,13 +202,13 @@ void EnIk_SetupAction(EnIk* this, EnIkActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnIk_InitImpl(Actor* thisx, PlayState* play) { +void func_80A74398(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 pad; EffectBlureInit1 blureInit; - thisx->update = EnIk_UpdateEnemy; - thisx->draw = EnIk_DrawEnemy; + thisx->update = func_80A75FA0; + thisx->draw = func_80A76798; thisx->flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; Collider_InitCylinder(play, &this->bodyCollider); @@ -234,13 +220,13 @@ void EnIk_InitImpl(Actor* thisx, PlayState* play) { thisx->colChkInfo.damageTable = &sDamageTable; thisx->colChkInfo.mass = MASS_HEAVY; - this->isBreakingProp = false; + this->unk_2FC = 0; thisx->colChkInfo.health = 30; thisx->gravity = -1.0f; - this->switchFlag = IK_GET_SWITCH_FLAG(thisx); - thisx->params = IK_GET_ARMOR_TYPE(thisx); + this->switchFlags = PARAMS_GET_U(thisx->params, 8, 8); + thisx->params &= 0xFF; - if (thisx->params == IK_TYPE_NABOORU) { + if (thisx->params == 0) { thisx->colChkInfo.health += 20; thisx->naviEnemyId = NAVI_ENEMY_IRON_KNUCKLE_NABOORU; } else { @@ -263,10 +249,10 @@ void EnIk_InitImpl(Actor* thisx, PlayState* play) { blureInit.calcMode = 2; Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); - EnIk_SetupStandUp(this); + func_80A74714(this); - if (this->switchFlag != 0xFF) { - if (Flags_GetSwitch(play, this->switchFlag)) { + if (this->switchFlags != 0xFF) { + if (Flags_GetSwitch(play, this->switchFlags)) { Actor_Kill(thisx); } } else if (thisx->params != 0 && Flags_GetClear(play, play->roomCtx.curRoom.num)) { @@ -274,18 +260,18 @@ void EnIk_InitImpl(Actor* thisx, PlayState* play) { } } -s32 EnIk_HandleBlocking(EnIk* this, PlayState* play) { - if (((this->armorStatusFlag != 0) || (this->actor.params == IK_TYPE_NABOORU)) && +s32 func_80A745E4(EnIk* this, PlayState* play) { + if (((this->unk_2FB != 0) || (this->actor.params == 0)) && (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) && (play->gameplayFrames & 1)) { - EnIk_SetupStopAndBlock(this); + func_80A755F0(this); return true; } else { return false; } } -Actor* EnIk_FindBreakableProp(PlayState* play, Actor* actor) { +Actor* func_80A74674(PlayState* play, Actor* actor) { Actor* prop = play->actorCtx.actorLists[ACTORCAT_PROP].head; while (prop != NULL) { @@ -302,190 +288,175 @@ Actor* EnIk_FindBreakableProp(PlayState* play, Actor* actor) { return NULL; } -void EnIk_SetupStandUp(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleStandUpAnim); - f32 startFrame; +void func_80A74714(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_00CD70); + f32 frame; - if (this->actor.params >= IK_TYPE_BLACK) { - startFrame = endFrame - 1.0f; + if (this->actor.params >= 2) { + frame = frames - 1.0f; } else { - startFrame = 0.0f; + frame = 0.0f; } - Animation_Change(&this->skelAnime, &gIronKnuckleStandUpAnim, 0.0f, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &object_ik_Anim_00CD70, 0.0f, frame, frames, ANIMMODE_ONCE, 0.0f); this->unk_2F8 = 3; this->actor.speed = 0.0f; - EnIk_SetupAction(this, EnIk_StandUp); + EnIk_SetupAction(this, func_80A747C0); } -void EnIk_StandUp(EnIk* this, PlayState* play) { - Vec3f sparksPos; +void func_80A747C0(EnIk* this, PlayState* play) { + Vec3f sp24; if (this->bodyCollider.base.acFlags & AC_HIT) { - sparksPos = this->actor.world.pos; + sp24 = this->actor.world.pos; Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); - sparksPos.y += 30.0f; - func_8003424C(play, &sparksPos); + sp24.y += 30.0f; + func_8003424C(play, &sp24); this->skelAnime.playSpeed = 1.0f; func_800F5ACC(NA_BGM_MINI_BOSS); } - if (this->skelAnime.curFrame == 5.0f) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_WAKEUP); } - if (SkelAnime_Update(&this->skelAnime)) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE; - EnIk_SetupWalkOrRun(this); + func_80A74AAC(this); } } -void EnIk_SetupIdle(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&object_ik_Anim_00DD50); +void func_80A7489C(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_00DD50); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE; this->unk_2F8 = 4; this->actor.speed = 0.0f; - Animation_Change(&this->skelAnime, &object_ik_Anim_00DD50, 0.0f, 0.0f, endFrame, ANIMMODE_LOOP, 4.0f); - EnIk_SetupAction(this, EnIk_Idle); + Animation_Change(&this->skelAnime, &object_ik_Anim_00DD50, 0.0f, 0.0f, frames, ANIMMODE_LOOP, 4.0f); + EnIk_SetupAction(this, func_80A7492C); } -void EnIk_Idle(EnIk* this, PlayState* play) { - s32 detectionThreshold = (this->armorStatusFlag == 0) ? 0xAAA : 0x3FFC; +void func_80A7492C(EnIk* this, PlayState* play) { + s32 phi_a0 = (this->unk_2FB == 0) ? 0xAAA : 0x3FFC; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(yawDiff) <= detectionThreshold) && (this->actor.xzDistToPlayer < 100.0f) && + if ((ABS(yawDiff) <= phi_a0) && (this->actor.xzDistToPlayer < 100.0f) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { if ((play->gameplayFrames & 1)) { - EnIk_SetupVerticalAttack(this); + func_80A74E2C(this); } else { - EnIk_SetupDoubleHorizontalAttack(this); + func_80A751C8(this); } } else if ((ABS(yawDiff) <= 0x4000) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { - EnIk_SetupWalkOrRun(this); + func_80A74AAC(this); } else { - EnIk_SetupWalkOrRun(this); + func_80A74AAC(this); } - - EnIk_HandleBlocking(this, play); + func_80A745E4(this, play); SkelAnime_Update(&this->skelAnime); } -void EnIk_SetupWalkOrRun(EnIk* this) { +void func_80A74AAC(EnIk* this) { this->unk_2F8 = 5; - - if (this->armorStatusFlag == 0) { - Animation_Change(&this->skelAnime, &gIronKnuckleWalkAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gIronKnuckleWalkAnim), ANIMMODE_LOOP, -4.0f); + if (this->unk_2FB == 0) { + Animation_Change(&this->skelAnime, &object_ik_Anim_00ED24, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ik_Anim_00ED24), ANIMMODE_LOOP, -4.0f); this->actor.speed = 0.9f; } else { - Animation_Change(&this->skelAnime, &gIronKnuckleRunAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gIronKnuckleRunAnim), ANIMMODE_LOOP, -4.0f); + Animation_Change(&this->skelAnime, &object_ik_Anim_006734, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ik_Anim_006734), ANIMMODE_LOOP, -4.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DASH); this->actor.speed = 2.5f; } - this->actor.world.rot.y = this->actor.shape.rot.y; - EnIk_SetupAction(this, EnIk_WalkOrRun); + EnIk_SetupAction(this, func_80A74BA4); } -void EnIk_WalkOrRun(EnIk* this, PlayState* play) { +void func_80A74BA4(EnIk* this, PlayState* play) { s16 temp_t0; - s16 targetYaw; + s16 temp_a1; s16 yawDiff; - s16 footstepFrame1; - s16 footstepFrame2; - s16 stepVal; + s16 sp30; + s16 sp2E; + s16 phi_a3; - if (this->armorStatusFlag == 0) { + if (this->unk_2FB == 0) { temp_t0 = 0xAAA; - stepVal = 0x320; - footstepFrame1 = 0; - footstepFrame2 = 16; + phi_a3 = 0x320; + sp30 = 0; + sp2E = 0x10; } else { temp_t0 = 0x3FFC; - stepVal = 0x4B0; - footstepFrame1 = 2; - footstepFrame2 = 9; + phi_a3 = 0x4B0; + sp30 = 2; + sp2E = 9; } - - targetYaw = this->actor.wallYaw - this->actor.shape.rot.y; - - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(targetYaw) >= 0x4000)) { - targetYaw = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; - Math_SmoothStepToS(&this->actor.world.rot.y, targetYaw, 1, stepVal, 0); + temp_a1 = this->actor.wallYaw - this->actor.shape.rot.y; + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(temp_a1) >= 0x4000)) { + temp_a1 = (this->actor.yawTowardsPlayer > 0) ? this->actor.wallYaw - 0x4000 : this->actor.wallYaw + 0x4000; + Math_SmoothStepToS(&this->actor.world.rot.y, temp_a1, 1, phi_a3, 0); } else { - Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, stepVal, 0); + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, phi_a3, 0); } - this->actor.shape.rot.y = this->actor.world.rot.y; yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(yawDiff) <= temp_t0) && (this->actor.xzDistToPlayer < 100.0f)) { if (ABS(this->actor.yDistToPlayer) < 150.0f) { - if (play->gameplayFrames & 1) { - EnIk_SetupVerticalAttack(this); + if ((play->gameplayFrames & 1)) { + func_80A74E2C(this); } else { - EnIk_SetupDoubleHorizontalAttack(this); + func_80A751C8(this); } } } - - if (EnIk_FindBreakableProp(play, &this->actor) != NULL) { - EnIk_SetupDoubleHorizontalAttack(this); - this->isBreakingProp = true; + if (func_80A74674(play, &this->actor) != NULL) { + func_80A751C8(this); + this->unk_2FC = 1; } else { temp_t0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (ABS(temp_t0) > 0x4000) { this->unk_300--; - if (this->unk_300 == 0) { - EnIk_SetupSingleHorizontalAttack(this); + func_80A754A0(this); } } else { - this->unk_300 = 40; + this->unk_300 = 0x28; } } - - EnIk_HandleBlocking(this, play); + func_80A745E4(this, play); SkelAnime_Update(&this->skelAnime); - - if (((s16)this->skelAnime.curFrame == footstepFrame1) || ((s16)this->skelAnime.curFrame == footstepFrame2)) { + if ((sp30 == (s16)this->skelAnime.curFrame) || (sp2E == (s16)this->skelAnime.curFrame)) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_WALK); } } -void EnIk_SetupVerticalAttack(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleVerticalAttackAnim); +void func_80A74E2C(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_001C28); this->unk_2FF = 1; this->unk_2F8 = 6; this->actor.speed = 0.0f; - Animation_Change(&this->skelAnime, &gIronKnuckleVerticalAttackAnim, 1.5f, 0.0f, endFrame, ANIMMODE_ONCE, -4.0f); - EnIk_SetupAction(this, EnIk_VerticalAttack); + Animation_Change(&this->skelAnime, &object_ik_Anim_001C28, 1.5f, 0.0f, frames, ANIMMODE_ONCE, -4.0f); + EnIk_SetupAction(this, func_80A74EBC); } -void EnIk_VerticalAttack(EnIk* this, PlayState* play) { - Vec3f sparksPos; +void func_80A74EBC(EnIk* this, PlayState* play) { + Vec3f sp2C; if (this->skelAnime.curFrame == 15.0f) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); } else if (this->skelAnime.curFrame == 21.0f) { - sparksPos.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y + 0x6A4) * 70.0f; - sparksPos.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y + 0x6A4) * 70.0f; - sparksPos.y = this->actor.world.pos.y; - + sp2C.x = this->actor.world.pos.x + Math_SinS(this->actor.shape.rot.y + 0x6A4) * 70.0f; + sp2C.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y + 0x6A4) * 70.0f; + sp2C.y = this->actor.world.pos.y; Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_HIT_GND); Camera_RequestQuake(&play->mainCamera, 2, 25, 5); Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150); - CollisionCheck_SpawnShieldParticles(play, &sparksPos); + CollisionCheck_SpawnShieldParticles(play, &sp2C); } if ((this->skelAnime.curFrame > 17.0f) && (this->skelAnime.curFrame < 23.0f)) { this->unk_2FE = 1; } else { - if ((this->armorStatusFlag != 0) && (this->skelAnime.curFrame < 10.0f)) { + if ((this->unk_2FB != 0) && (this->skelAnime.curFrame < 10.0f)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x5DC, 0); this->actor.shape.rot.y = this->actor.world.rot.y; } @@ -493,116 +464,105 @@ void EnIk_VerticalAttack(EnIk* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { - EnIk_SetupPullOutAxe(this); + func_80A7506C(this); } } -void EnIk_SetupPullOutAxe(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleAxeStuckAnim); +void func_80A7506C(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_0029FC); this->unk_2FE = 0; - this->animationTimer = (s8)endFrame; + this->unk_2F9 = (s8)frames; this->unk_2F8 = 7; this->unk_2FF = this->unk_2FE; - Animation_Change(&this->skelAnime, &gIronKnuckleAxeStuckAnim, 1.0f, 0.0f, endFrame, ANIMMODE_LOOP, -4.0f); + Animation_Change(&this->skelAnime, &object_ik_Anim_0029FC, 1.0f, 0.0f, frames, ANIMMODE_LOOP, -4.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_PULLOUT); - EnIk_SetupAction(this, EnIk_PullOutAxe); + EnIk_SetupAction(this, func_80A7510C); } -void EnIk_PullOutAxe(EnIk* this, PlayState* play) { - f32 endFrame; +void func_80A7510C(EnIk* this, PlayState* play) { + f32 frames; - if (SkelAnime_Update(&this->skelAnime) || (--this->animationTimer == 0)) { + if (SkelAnime_Update(&this->skelAnime) || (--this->unk_2F9 == 0)) { if (this->unk_2F8 == 8) { - EnIk_SetupIdle(this); + func_80A7489C(this); } else { - endFrame = Animation_GetLastFrame(&gIronKnuckleRecoverFromVerticalAttackAnim); + frames = Animation_GetLastFrame(&object_ik_Anim_002538); this->unk_2F8 = 8; - Animation_Change(&this->skelAnime, &gIronKnuckleRecoverFromVerticalAttackAnim, 1.5f, 0.0f, endFrame, - ANIMMODE_ONCE_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &object_ik_Anim_002538, 1.5f, 0.0f, frames, ANIMMODE_ONCE_INTERP, -4.0f); } } } -// Happens when Player is in front of Iron Knuckle or when Iron Knuckle encounters ACTOR_BG_JYA_IRONOBJ -void EnIk_SetupDoubleHorizontalAttack(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim); +void func_80A751C8(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_0033C4); this->unk_2FF = 2; this->unk_300 = 0; this->unk_2F8 = 6; this->actor.speed = 0.0f; - Animation_Change(&this->skelAnime, &gIronKnuckleHorizontalAttackAnim, 0.0f, 0.0f, endFrame, ANIMMODE_ONCE_INTERP, - -6.0f); - this->isBreakingProp = false; - EnIk_SetupAction(this, EnIk_DoubleHorizontalAttack); + Animation_Change(&this->skelAnime, &object_ik_Anim_0033C4, 0.0f, 0.0f, frames, ANIMMODE_ONCE_INTERP, -6.0f); + this->unk_2FC = 0; + EnIk_SetupAction(this, func_80A75260); } -void EnIk_DoubleHorizontalAttack(EnIk* this, PlayState* play) { - f32 playSpeed; +void func_80A75260(EnIk* this, PlayState* play) { + f32 temp_f0; this->unk_300 += 0x1C2; - playSpeed = Math_SinS(this->unk_300); - this->skelAnime.playSpeed = ABS(playSpeed); + temp_f0 = Math_SinS(this->unk_300); + this->skelAnime.playSpeed = ABS(temp_f0); if (this->skelAnime.curFrame > 11.0f) { this->unk_2FF = 3; } - if (((this->skelAnime.curFrame > 1.0f) && (this->skelAnime.curFrame < 9.0f)) || ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 18.0f))) { - if (!this->isBreakingProp && (this->armorStatusFlag != 0) && (this->skelAnime.curFrame < 10.0f)) { + if ((this->unk_2FC == 0) && (this->unk_2FB != 0) && (this->skelAnime.curFrame < 10.0f)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x5DC, 0); this->actor.shape.rot.y = this->actor.world.rot.y; } - if (this->unk_2FE < 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); } - this->unk_2FE = 1; } else { this->unk_2FE = 0; } - if (SkelAnime_Update(&this->skelAnime)) { - EnIk_SetupRecoverFromHorizontalAttack(this); + func_80A753D0(this); } } -void EnIk_SetupRecoverFromHorizontalAttack(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleRecoverFromHorizontalAttackAnim); +void func_80A753D0(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_003DBC); this->unk_2FF = this->unk_2FE = 0; this->unk_2F8 = 8; - Animation_Change(&this->skelAnime, &gIronKnuckleRecoverFromHorizontalAttackAnim, 1.5f, 0.0f, endFrame, - ANIMMODE_ONCE_INTERP, -4.0f); - EnIk_SetupAction(this, EnIk_RecoverFromHorizontalAttack); + Animation_Change(&this->skelAnime, &object_ik_Anim_003DBC, 1.5f, 0.0f, frames, ANIMMODE_ONCE_INTERP, -4.0f); + EnIk_SetupAction(this, func_80A7545C); } -void EnIk_RecoverFromHorizontalAttack(EnIk* this, PlayState* play) { +void func_80A7545C(EnIk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - EnIk_SetupIdle(this); - EnIk_HandleBlocking(this, play); + func_80A7489C(this); + func_80A745E4(this, play); } } -// Attack pattern when player is behind Iron Knuckle or attacks Iron Knuckle from behind -void EnIk_SetupSingleHorizontalAttack(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleHorizontalAttackAnim); +void func_80A754A0(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_0033C4); this->unk_2F8 = 1; this->unk_2FF = 3; this->actor.speed = 0.0f; - Animation_Change(&this->skelAnime, &gIronKnuckleHorizontalAttackAnim, 0.5f, 13.0f, endFrame, ANIMMODE_ONCE_INTERP, - -4.0f); - EnIk_SetupAction(this, EnIk_SingleHorizontalAttack); + Animation_Change(&this->skelAnime, &object_ik_Anim_0033C4, 0.5f, 13.0f, frames, ANIMMODE_ONCE_INTERP, -4.0f); + EnIk_SetupAction(this, func_80A75530); } -void EnIk_SingleHorizontalAttack(EnIk* this, PlayState* play) { +void func_80A75530(EnIk* this, PlayState* play) { Math_StepUntilS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 0x7D0); this->actor.shape.rot.y = this->actor.world.rot.y; - if ((this->skelAnime.curFrame > 13.0f) && (this->skelAnime.curFrame < 18.0f)) { if (this->unk_2FE < 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_SWING_AXE); @@ -611,117 +571,107 @@ void EnIk_SingleHorizontalAttack(EnIk* this, PlayState* play) { } else { this->unk_2FE = 0; } - if (SkelAnime_Update(&this->skelAnime)) { - EnIk_SetupRecoverFromHorizontalAttack(this); - EnIk_HandleBlocking(this, play); + func_80A753D0(this); + func_80A745E4(this, play); } } -void EnIk_SetupStopAndBlock(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleBlockAnim); +void func_80A755F0(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_00485C); this->unk_2FE = 0; this->unk_2F8 = 9; this->actor.speed = 0.0f; - Animation_Change(&this->skelAnime, &gIronKnuckleBlockAnim, 1.0f, 0.0f, endFrame, ANIMMODE_ONCE_INTERP, -4.0f); - EnIk_SetupAction(this, EnIk_StopAndBlock); + Animation_Change(&this->skelAnime, &object_ik_Anim_00485C, 1.0f, 0.0f, frames, ANIMMODE_ONCE_INTERP, -4.0f); + EnIk_SetupAction(this, func_80A7567C); } -void EnIk_StopAndBlock(EnIk* this, PlayState* play) { +void func_80A7567C(EnIk* this, PlayState* play) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); - if (SkelAnime_Update(&this->skelAnime)) { if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4000) && (this->actor.xzDistToPlayer < 100.0f) && (ABS(this->actor.yDistToPlayer) < 150.0f)) { if ((play->gameplayFrames & 1)) { - EnIk_SetupVerticalAttack(this); + func_80A74E2C(this); } else { - EnIk_SetupDoubleHorizontalAttack(this); + func_80A751C8(this); } } else { - EnIk_SetupIdle(this); + func_80A7489C(this); } } } -void EnIk_SetupReactToAttack(EnIk* this) { +void func_80A75790(EnIk* this) { s16 yaw; s16 yawDiff; yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->bodyCollider.base.ac->world.pos); this->unk_2F8 = 0; yawDiff = yaw - this->actor.shape.rot.y; - if (ABS(yawDiff) <= 0x4000) { - Animation_Change(&this->skelAnime, &gIronKnuckleFrontHitAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gIronKnuckleFrontHitAnim), ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &object_ik_Anim_006194, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ik_Anim_006194), ANIMMODE_ONCE, -4.0f); this->actor.speed = -6.0f; } else { - Animation_Change(&this->skelAnime, &gIronKnuckleBackHitAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gIronKnuckleBackHitAnim), ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &object_ik_Anim_0045BC, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ik_Anim_0045BC), ANIMMODE_ONCE, -4.0f); this->actor.speed = 6.0f; } - this->unk_2FE = 0; - EnIk_SetupAction(this, EnIk_ReactToAttack); + EnIk_SetupAction(this, func_80A758B0); } -void EnIk_ReactToAttack(EnIk* this, PlayState* play) { +void func_80A758B0(EnIk* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 1.0f, 0.0f); - if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, this->actor.params + 4)) { this->bodyBreak.val = BODYBREAK_STATUS_FINISHED; } - if (SkelAnime_Update(&this->skelAnime)) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4000) { - EnIk_SetupIdle(this); - EnIk_HandleBlocking(this, play); + func_80A7489C(this); + func_80A745E4(this, play); } else { - EnIk_SetupSingleHorizontalAttack(this); + func_80A754A0(this); } } } -void EnIk_SetupDie(EnIk* this) { - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleDeathAnim); +void func_80A7598C(EnIk* this) { + f32 frames = Animation_GetLastFrame(&object_ik_Anim_005944); this->unk_2FE = 0; this->unk_2F8 = 2; this->actor.speed = 0.0f; - Animation_Change(&this->skelAnime, &gIronKnuckleDeathAnim, 1.0f, 0.0f, endFrame, ANIMMODE_ONCE, -4.0f); - this->animationTimer = 24; + Animation_Change(&this->skelAnime, &object_ik_Anim_005944, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -4.0f); + this->unk_2F9 = 0x18; Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DEAD); Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_CUTBODY); - EnIk_SetupAction(this, EnIk_Die); + EnIk_SetupAction(this, func_80A75A38); } -void EnIk_Die(EnIk* this, PlayState* play) { +void func_80A75A38(EnIk* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - if ((this->actor.colChkInfo.health == 0) && (this->animationTimer != 0)) { + if ((this->actor.colChkInfo.health == 0) && (this->unk_2F9 != 0)) { s32 i; Vec3f pos; Vec3f sp7C = { 0.0f, 0.5f, 0.0f }; - this->animationTimer--; + this->unk_2F9--; - for (i = 0xC - (this->animationTimer >> 1); i >= 0; i--) { + for (i = 0xC - (this->unk_2F9 >> 1); i >= 0; i--) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(120.0f); pos.z = this->actor.world.pos.z + Rand_CenteredFloat(120.0f); pos.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); - EffectSsDeadDb_Spawn(play, &pos, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); } - - if (this->animationTimer == 0) { + if (this->unk_2F9 == 0) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_11, false)); - - if (this->switchFlag != 0xFF) { - Flags_SetSwitch(play, this->switchFlag); + if (this->switchFlags != 0xFF) { + Flags_SetSwitch(play, this->switchFlags); } - Actor_Kill(&this->actor); } } @@ -730,59 +680,53 @@ void EnIk_Die(EnIk* this, PlayState* play) { } } -void EnIk_UpdateDamage(EnIk* this, PlayState* play) { +void func_80A75C38(EnIk* this, PlayState* play) { if ((this->unk_2F8 == 3) || (this->unk_2F8 == 2)) { return; } - if (this->shieldCollider.base.acFlags & AC_BOUNCED) { - f32 frames = Animation_GetLastFrame(&gIronKnuckleBlockAnim) - 2.0f; + f32 temp_f0; - if (this->skelAnime.curFrame < frames) { - this->skelAnime.curFrame = frames; + temp_f0 = Animation_GetLastFrame(&object_ik_Anim_00485C) - 2.0f; + if (this->skelAnime.curFrame < temp_f0) { + this->skelAnime.curFrame = temp_f0; } - this->shieldCollider.base.acFlags &= ~AC_BOUNCED; this->bodyCollider.base.acFlags &= ~AC_HIT; } else if (this->bodyCollider.base.acFlags & AC_HIT) { - s16 pad; + u8 pad; + u8 pad2; u8 prevHealth; - s32 damageReaction; - Vec3f sparksPos = this->actor.world.pos; - - sparksPos.y += 50.0f; + s32 pad3; + Vec3f sp38; + sp38 = this->actor.world.pos; + sp38.y += 50.0f; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); - - this->damageReaction = this->actor.colChkInfo.damageReaction; + this->unk_2FD = this->actor.colChkInfo.damageReaction; this->bodyCollider.base.acFlags &= ~AC_HIT; - if ((this->damageReaction == EN_IK_DMG_REACT_NONE) || (this->damageReaction == EN_IK_DMG_REACT_SPARKS_NO_DMG) || - ((this->armorStatusFlag == 0) && (this->damageReaction == EN_IK_DMG_REACT_PROJECTILE))) { - if (this->damageReaction != EN_IK_DMG_REACT_NONE) { - // spawn sparks and don't damage - CollisionCheck_SpawnShieldParticlesMetal(play, &sparksPos); + if ((this->unk_2FD == 0) || (this->unk_2FD == 0xD) || ((this->unk_2FB == 0) && (this->unk_2FD == 0xE))) { + if (this->unk_2FD != 0) { + CollisionCheck_SpawnShieldParticlesMetal(play, &sp38); } return; } - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 12); - prevHealth = this->actor.colChkInfo.health; Actor_ApplyDamage(&this->actor); - - if (this->actor.params != IK_TYPE_NABOORU) { + if (this->actor.params != 0) { if ((prevHealth > 10) && (this->actor.colChkInfo.health <= 10)) { - this->armorStatusFlag = ARMOR_BROKEN; + this->unk_2FB = 1; BodyBreak_Alloc(&this->bodyBreak, 3, play); } } else if (this->actor.colChkInfo.health <= 10) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_BOSS); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EN_LAST_DAMAGE); #if !OOT_PAL_N64 - if (this->switchFlag != 0xFF) { - Flags_SetSwitch(play, this->switchFlag); + if (this->switchFlags != 0xFF) { + Flags_SetSwitch(play, this->switchFlags); } #endif return; @@ -791,97 +735,82 @@ void EnIk_UpdateDamage(EnIk* this, PlayState* play) { } if (this->actor.colChkInfo.health == 0) { - EnIk_SetupDie(this); + func_80A7598C(this); Enemy_StartFinishingBlow(play, &this->actor); return; } - Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0); - - if ((this->actor.params == IK_TYPE_NABOORU) && (Rand_ZeroOne() < 0.5f)) { + if ((this->actor.params == 0) && (Rand_ZeroOne() < 0.5f)) { if (ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) > 0x4000) { - EnIk_SetupSingleHorizontalAttack(this); + func_80A754A0(this); } } - - if ((this->actor.params != IK_TYPE_NABOORU) && (this->armorStatusFlag != 0)) { + if ((this->actor.params != 0) && (this->unk_2FB != 0)) { if ((prevHealth > 10) && (this->actor.colChkInfo.health <= 10)) { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_OFF_DEMO); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); Actor_PlaySfx(&this->actor, NA_SE_EN_NUTS_CUTBODY); } - - EnIk_SetupReactToAttack(this); - } else { - Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); - Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); - CollisionCheck_SpawnShieldParticles(play, &sparksPos); + func_80A75790(this); + return; } + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_ARMOR_HIT); + Actor_PlaySfx(&this->actor, NA_SE_EN_IRONNACK_DAMAGE); + CollisionCheck_SpawnShieldParticles(play, &sp38); } } -void EnIk_UpdateEnemy(Actor* thisx, PlayState* play) { +void func_80A75FA0(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; s32 pad; Player* player = GET_PLAYER(play); u8 prevInvincibilityTimer; - this->drawArmorFlag = this->armorStatusFlag; - EnIk_UpdateDamage(this, play); - - if ((this->actor.params == IK_TYPE_NABOORU) && (this->actor.colChkInfo.health <= 10)) { - EnIk_StartDefeatCutscene(&this->actor, play); - } else { - this->actionFunc(this, play); - - if (this->axeCollider.base.atFlags & AT_HIT) { - this->axeCollider.base.atFlags &= ~AT_HIT; - - if (this->axeCollider.base.at == &player->actor) { - prevInvincibilityTimer = player->invincibilityTimer; - - if (player->invincibilityTimer <= 0) { - if (player->invincibilityTimer <= -40) { - player->invincibilityTimer = 0; - } else { - player->invincibilityTimer = 0; - play->damagePlayer(play, -64); - this->unk_2FE = 0; - } + this->unk_2FA = this->unk_2FB; + func_80A75C38(this, play); + if ((this->actor.params == 0) && (this->actor.colChkInfo.health <= 10)) { + func_80A781CC(&this->actor, play); + return; + } + this->actionFunc(this, play); + if (this->axeCollider.base.atFlags & AT_HIT) { + this->axeCollider.base.atFlags &= ~AT_HIT; + if (&player->actor == this->axeCollider.base.at) { + prevInvincibilityTimer = player->invincibilityTimer; + if (player->invincibilityTimer <= 0) { + if (player->invincibilityTimer < -39) { + player->invincibilityTimer = 0; + } else { + player->invincibilityTimer = 0; + play->damagePlayer(play, -64); + this->unk_2FE = 0; } - - Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); - player->invincibilityTimer = prevInvincibilityTimer; } + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + player->invincibilityTimer = prevInvincibilityTimer; } - - Actor_MoveXZGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, - UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | - UPDBGCHECKINFO_FLAG_4); - - this->actor.focus.pos = this->actor.world.pos; - this->actor.focus.pos.y += 45.0f; - - Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); - - if ((this->actor.colChkInfo.health > 0) && (this->actor.colorFilterTimer == 0) && (this->unk_2F8 >= 2)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); - } - - if (this->unk_2FE > 0) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->axeCollider.base); - } - - if (this->unk_2F8 == 9) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); - } + } + Actor_MoveXZGravity(&this->actor); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, + UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | + UPDBGCHECKINFO_FLAG_4); + this->actor.focus.pos = this->actor.world.pos; + this->actor.focus.pos.y += 45.0f; + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); + if ((this->actor.colChkInfo.health > 0) && (this->actor.colorFilterTimer == 0) && (this->unk_2F8 >= 2)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + } + if (this->unk_2FE > 0) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->axeCollider.base); + } + if (this->unk_2F8 == 9) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->shieldCollider.base); } } -Gfx* EnIk_SetPrimEnvColors(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { +Gfx* func_80A761B0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 envR, u8 envG, u8 envB) { Gfx* displayList; Gfx* displayListHead; @@ -896,28 +825,26 @@ Gfx* EnIk_SetPrimEnvColors(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB return displayList; } -s32 EnIk_OverrideLimbDrawEnemy(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIk_OverrideLimbDraw3(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIk* this = (EnIk*)thisx; - if (limbIndex == IRON_KNUCKLE_LIMB_HELMET_ARMOR) { - if (this->actor.params != IK_TYPE_NABOORU) { - *dList = gIronKnuckleHelmetDL; + if (limbIndex == 12) { + if (this->actor.params != 0) { + *dList = object_ik_DL_018E78; } - } else if (limbIndex == IRON_KNUCKLE_LIMB_HEAD) { - if (this->actor.params != IK_TYPE_NABOORU) { - *dList = gIronKnuckleGerudoHeadDL; + } else if (limbIndex == 13) { + if (this->actor.params != 0) { + *dList = object_ik_DL_019100; } - } else if ((limbIndex == IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT) || - (limbIndex == IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK)) { - if (this->drawArmorFlag & ARMOR_BROKEN) { + } else if ((limbIndex == 26) || (limbIndex == 27)) { + if ((this->unk_2FA & 1)) { *dList = NULL; } - } else if ((limbIndex == IRON_KNUCKLE_LIMB_TORSO) || (limbIndex == IRON_KNUCKLE_LIMB_WAIST)) { - if (!(this->drawArmorFlag & ARMOR_BROKEN)) { + } else if ((limbIndex == 28) || (limbIndex == 29)) { + if (!(this->unk_2FA & 1)) { *dList = NULL; } } - return false; } @@ -943,26 +870,24 @@ static Vec3f D_80A784D0[] = { { -3000.0, -700.0, -5000.0 }, }; -void EnIk_PostLimbDrawEnemy(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnIk_PostLimbDraw3(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f spF4; Vec3f spE8; EnIk* this = (EnIk*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1201); - if (this->armorStatusFlag & ARMOR_BROKEN) { - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT, - IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK, IRON_KNUCKLE_LIMB_TORSO, dList, - BODYBREAK_OBJECT_SLOT_DEFAULT); + if (this->unk_2FB & 1) { + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 26, 27, 28, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); } - if (limbIndex == IRON_KNUCKLE_LIMB_HELMET_ARMOR) { + if (limbIndex == 12) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_ik_inFight.c", 1217); - if (this->actor.params != IK_TYPE_NABOORU) { - gSPDisplayList(POLY_XLU_DISP++, gIronKnuckleHelmetMarkingDL); + if (this->actor.params != 0) { + gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_019E08); } else { gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016D88); } - } else if (limbIndex == IRON_KNUCKLE_LIMB_AXE) { + } else if (limbIndex == 17) { s32 i; Vec3f sp9C[3]; Vec3f sp78[3]; @@ -993,25 +918,22 @@ void EnIk_PostLimbDrawEnemy(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } switch (limbIndex) { - case IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON: + case 22: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_ik_inFight.c", 1270); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016F88); break; - - case IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON: + case 24: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_ik_inFight.c", 1275); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016EE8); break; - - case IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT: - if (!(this->drawArmorFlag & ARMOR_BROKEN)) { + case 26: + if (!(this->unk_2FA & 1)) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_ik_inFight.c", 1281); - gSPDisplayList(POLY_XLU_DISP++, gIronKnuckleArmorRivetAndSymbolDL); + gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); } break; - - case IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK: - if (!(this->drawArmorFlag & ARMOR_BROKEN)) { + case 27: + if (!(this->unk_2FA & 1)) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_ik_inFight.c", 1288); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016CD8); } @@ -1021,7 +943,7 @@ void EnIk_PostLimbDrawEnemy(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* CLOSE_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1294); } -void EnIk_DrawEnemy(Actor* thisx, PlayState* play) { +void func_80A76798(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1309); @@ -1029,36 +951,34 @@ void EnIk_DrawEnemy(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (this->actor.params == IK_TYPE_NABOORU) { - gSPSegment(POLY_OPA_DISP++, 0x08, EnIk_SetPrimEnvColors(play->state.gfxCtx, 245, 225, 155, 30, 30, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnIk_SetPrimEnvColors(play->state.gfxCtx, 255, 40, 0, 40, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, EnIk_SetPrimEnvColors(play->state.gfxCtx, 255, 255, 255, 20, 40, 30)); - } else if (this->actor.params == IK_TYPE_SILVER) { - gSPSegment(POLY_OPA_DISP++, 0x08, EnIk_SetPrimEnvColors(play->state.gfxCtx, 245, 255, 205, 30, 35, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnIk_SetPrimEnvColors(play->state.gfxCtx, 185, 135, 25, 20, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, EnIk_SetPrimEnvColors(play->state.gfxCtx, 255, 255, 255, 30, 40, 20)); - } else if (this->actor.params == IK_TYPE_BLACK) { - gSPSegment(POLY_OPA_DISP++, 0x08, EnIk_SetPrimEnvColors(play->state.gfxCtx, 55, 65, 55, 0, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnIk_SetPrimEnvColors(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, EnIk_SetPrimEnvColors(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + if (this->actor.params == 0) { + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 245, 225, 155, 30, 30, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 255, 40, 0, 40, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 255, 255, 255, 20, 40, 30)); + } else if (this->actor.params == 1) { + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 245, 255, 205, 30, 35, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 185, 135, 25, 20, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 255, 255, 255, 30, 40, 20)); + } else if (this->actor.params == 2) { + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 55, 65, 55, 0, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 205, 165, 75, 25, 20, 0)); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, EnIk_SetPrimEnvColors(play->state.gfxCtx, 255, 255, 255, 180, 180, 180)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnIk_SetPrimEnvColors(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, EnIk_SetPrimEnvColors(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(play->state.gfxCtx, 255, 255, 255, 180, 180, 180)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(play->state.gfxCtx, 225, 205, 115, 25, 20, 0)); } - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnIk_OverrideLimbDrawEnemy, EnIk_PostLimbDrawEnemy, this); + EnIk_OverrideLimbDraw3, EnIk_PostLimbDraw3, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ik_inFight.c", 1351); } -void EnIk_StartMinibossBgm(void) { +void EnIk_StartMusic(void) { func_800F5ACC(NA_BGM_MINI_BOSS); } -// Cutscene: Nabooru Knuckle Wakes up -void EnIk_UpdateAction2Sfx(EnIk* this) { +void func_80A76C14(EnIk* this) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_IRONNACK_WAKEUP); } else if (Animation_OnFrame(&this->skelAnime, 33.0f)) { @@ -1074,13 +994,12 @@ void EnIk_UpdateAction2Sfx(EnIk* this) { } } -// Cutscene: Summons Axe for Nabooru Knuckle -void EnIk_PlayAxeSpawnSfx(EnIk* this, PlayState* play, Vec3f* pos) { +void func_80A76DDC(EnIk* this, PlayState* play, Vec3f* pos) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TWINROBA_TRANSFORM); } -void EnIk_SpawnAxeSmoke(EnIk* this, PlayState* play, Vec3f* pos) { - static Vec3f sAxeSmokeEffectData[] = { +void func_80A76E2C(EnIk* this, PlayState* play, Vec3f* pos) { + static Vec3f D_80A78514[] = { { 1000.0, -1000.0, 1000.0 }, { 0.0, -1000.0, 0.0 }, { -1000.0, -5000.0, -4000.0 }, { 1000.0, -5000.0, -3000.0 }, { -1000.0, 1000.0, -6000.0 }, { -1000.0, 3000.0, -5000.0 }, { -800.0, 1000.0, -3000.0 }, { 0.0, -4000.0, -2000.0 }, { -1000.0, -2000.0, -6000.0 }, @@ -1090,43 +1009,40 @@ void EnIk_SpawnAxeSmoke(EnIk* this, PlayState* play, Vec3f* pos) { { 900.0, -800.0, 2700.0 }, { 720.0f, 900.0f, 2500.0f }, }; - if (!this->isAxeSummoned) { + if (this->unk_4D4 == 0) { s32 pad; Vec3f effectVelocity = { 0.0f, 0.0f, 0.0f }; Vec3f effectAccel = { 0.0f, 0.3f, 0.0f }; s32 i; - for (i = ARRAY_COUNT(sAxeSmokeEffectData) - 1; i >= 0; i--) { + for (i = ARRAY_COUNT(D_80A78514) - 1; i >= 0; i--) { Color_RGBA8 primColor = { 200, 200, 200, 255 }; Color_RGBA8 envColor = { 150, 150, 150, 0 }; - s32 randColorOffset; + s32 temp_v0; Vec3f effectPos; - Matrix_MultVec3f(&sAxeSmokeEffectData[i], &effectPos); - randColorOffset = (Rand_ZeroOne() * 20.0f) - 10.0f; - - primColor.r += randColorOffset; - primColor.g += randColorOffset; - primColor.b += randColorOffset; - - envColor.r += randColorOffset; - envColor.g += randColorOffset; - envColor.b += randColorOffset; - + Matrix_MultVec3f(&D_80A78514[i], &effectPos); + temp_v0 = (Rand_ZeroOne() * 20.0f) - 10.0f; + primColor.r += temp_v0; + primColor.g += temp_v0; + primColor.b += temp_v0; + envColor.r += temp_v0; + envColor.g += temp_v0; + envColor.b += temp_v0; func_8002829C(play, &effectPos, &effectVelocity, &effectAccel, &primColor, &envColor, (Rand_ZeroOne() * 60.0f) + 300.0f, 0); } - this->isAxeSummoned = true; - EnIk_PlayAxeSpawnSfx(this, play, pos); + this->unk_4D4 = 1; + func_80A76DDC(this, play, pos); } } -void EnIk_UpdateBgCheckInfo(EnIk* this, PlayState* play) { +void func_80A77034(EnIk* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } -s32 EnIk_UpdateSkelAnime(EnIk* this) { +s32 func_80A7707C(EnIk* this) { return SkelAnime_Update(&this->skelAnime); } @@ -1152,50 +1068,47 @@ void EnIk_SetStartPosRotFromCue(EnIk* this, PlayState* play, s32 cueChannel) { } } -f32 EnIk_GetAnimCurFrame(Actor* thisx) { +f32 EnIk_curFrame(Actor* thisx) { EnIk* this = (EnIk*)thisx; return this->skelAnime.curFrame; } -// unused -void EnIk_SetupCsAction0(EnIk* this) { - this->csAction = IK_CS_ACTION_0; - this->csDrawMode = IK_CS_DRAW_NOTHING; +void func_80A77148(EnIk* this) { + this->action = 0; + this->drawMode = 0; this->actor.shape.shadowAlpha = 0; } -// Cutscene: Nabooru sitting and Kotake and Koume looking at her -void EnIk_SetupCsAction1(EnIk* this, PlayState* play) { - Animation_Change(&this->skelAnime, &gIronKnuckleNabooruSummonAxeAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gIronKnuckleNabooruSummonAxeAnim), ANIMMODE_ONCE, 0.0f); +void func_80A77158(EnIk* this, PlayState* play) { + Animation_Change(&this->skelAnime, &object_ik_Anim_00C114, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ik_Anim_00C114), ANIMMODE_ONCE, 0.0f); EnIk_SetStartPosRotFromCue(this, play, 4); - this->csAction = IK_CS_ACTION_1; - this->csDrawMode = IK_CS_DRAW_INTRO; - this->actor.shape.shadowAlpha = 255; + this->action = 1; + this->drawMode = 1; + this->actor.shape.shadowAlpha = 0xFF; } -// Cutscene: Nabooru Knuckle starts to stand up -void EnIk_SetupCsAction2(EnIk* this) { - Animation_Change(&this->skelAnime, &gIronKnuckleNabooruSummonAxeAnim, 1.0f, 0.0f, - Animation_GetLastFrame(&gIronKnuckleNabooruSummonAxeAnim), ANIMMODE_ONCE, 0.0f); - this->csAction = IK_CS_ACTION_2; - this->csDrawMode = IK_CS_DRAW_INTRO; - this->isAxeSummoned = false; - this->actor.shape.shadowAlpha = 255; +void func_80A771E4(EnIk* this) { + Animation_Change(&this->skelAnime, &object_ik_Anim_00C114, 1.0f, 0.0f, + Animation_GetLastFrame(&object_ik_Anim_00C114), ANIMMODE_ONCE, 0.0f); + this->action = 2; + this->drawMode = 1; + this->unk_4D4 = 0; + this->actor.shape.shadowAlpha = 0xFF; } -void EnIk_HandleEnemyChange(EnIk* this, PlayState* play, s32 animFinished) { - if (animFinished && (EnIk_GetCue(play, 4) != NULL)) { - EnIk_ChangeToEnemy(this, play); +void func_80A77264(EnIk* this, PlayState* play, s32 arg2) { + if ((arg2 != 0) && (EnIk_GetCue(play, 4) != NULL)) { + func_80A78160(this, play); } } -void EnIk_PlayArmorFallSfx(EnIk* this) { +void func_80A772A4(EnIk* this) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_IRONNACK_STAGGER_DEMO); } -void EnIk_PlayDeathSfx(EnIk* this, PlayState* play) { +void func_80A772EC(EnIk* this, PlayState* play) { static Vec3f D_80A78FA0; s32 pad[2]; f32 wDest; @@ -1204,116 +1117,107 @@ void EnIk_PlayDeathSfx(EnIk* this, PlayState* play) { SFX_PLAY_AT_POS(&D_80A78FA0, NA_SE_EN_IRONNACK_DEAD); } -// Cutscene: starts after final hit to Nabooru -void EnIk_SetupCsAction3(EnIk* this, PlayState* play) { +void func_80A7735C(EnIk* this, PlayState* play) { s32 pad[3]; - f32 endFrame = Animation_GetLastFrame(&gIronKnuckleNabooruDeathAnim); + f32 frames = Animation_GetLastFrame(&object_ik_Anim_0203D8); - SkelAnime_InitFlex(play, &this->skelAnime, &gIronKnuckleDefeatSkel, NULL, this->jointTable, this->morphTable, - IRON_KNUCKLE_LIMB_MAX); - Animation_Change(&this->skelAnime, &gIronKnuckleNabooruDeathAnim, 1.0f, 0.0f, endFrame, ANIMMODE_ONCE, 0.0f); - this->csAction = IK_CS_ACTION_3; - this->csDrawMode = IK_CS_DRAW_DEFEAT; + SkelAnime_InitFlex(play, &this->skelAnime, &object_ik_Skel_0205C0, NULL, this->jointTable, this->morphTable, 30); + Animation_Change(&this->skelAnime, &object_ik_Anim_0203D8, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); + this->action = 3; + this->drawMode = 2; EnIk_SetStartPosRotFromCue(this, play, 4); - EnIk_PlayDeathSfx(this, play); - this->actor.shape.shadowAlpha = 255; + func_80A772EC(this, play); + this->actor.shape.shadowAlpha = 0xFF; } -// Cutscene: Armor falling off revealing Nabooru underneath -void EnIk_SetupCsAction4(EnIk* this, PlayState* play) { - this->csAction = IK_CS_ACTION_4; - this->csDrawMode = IK_CS_DRAW_DEFEAT; - EnIk_PlayArmorFallSfx(this); - this->actor.shape.shadowAlpha = 255; +void func_80A77434(EnIk* this, PlayState* play) { + this->action = 4; + this->drawMode = 2; + func_80A772A4(this); + this->actor.shape.shadowAlpha = 0xFF; } -// Cutscene: all the armor has fallen off -void EnIk_SetupCsAction5(EnIk* this, PlayState* play) { - this->csAction = IK_CS_ACTION_5; - this->csDrawMode = IK_CS_DRAW_NOTHING; +void func_80A77474(EnIk* this, PlayState* play) { + this->action = 5; + this->drawMode = 0; this->actor.shape.shadowAlpha = 0; } -void EnIk_CsAction3(EnIk* this, PlayState* play) { - EnIk_UpdateBgCheckInfo(this, play); - EnIk_HandleCsCues(this, play); +void func_80A7748C(EnIk* this, PlayState* play) { + func_80A77034(this, play); + func_80A779DC(this, play); } -void EnIk_CsAction4(EnIk* this, PlayState* play) { - EnIk_UpdateSkelAnime(this); - EnIk_UpdateBgCheckInfo(this, play); - EnIk_HandleCsCues(this, play); +void func_80A774BC(EnIk* this, PlayState* play) { + func_80A7707C(this); + func_80A77034(this, play); + func_80A779DC(this, play); } -void EnIk_CsAction5(EnIk* this, PlayState* play) { +void func_80A774F8(EnIk* this, PlayState* play) { if (EnIk_GetCue(play, 4) == NULL) { #if OOT_PAL_N64 - Flags_SetSwitch(play, this->switchFlag); + Flags_SetSwitch(play, this->switchFlags); #endif Actor_Kill(&this->actor); } } -s32 EnIk_OverrideLimbDrawDefeat(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - if ((limbIndex == IRON_KNUCKLE_DEFEAT_LIMB_HELMET_ARMOR) || - (limbIndex == IRON_KNUCKLE_DEFEAT_LIMB_CHEST_ARMOR_FRONT) || - (limbIndex == IRON_KNUCKLE_DEFEAT_LIMB_CHEST_ARMOR_BACK)) { - if (EnIk_GetAnimCurFrame(thisx) >= 30.0f) { +s32 EnIk_OverrideLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { + EnIk* this = (EnIk*)thisx; + + if ((limbIndex == 13) || (limbIndex == 26) || (limbIndex == 27)) { + if (EnIk_curFrame(&this->actor) >= 30.0f) { *dList = NULL; } } - return false; + return 0; } -void EnIk_PostLimbDrawDefeat(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnIk_PostLimbDraw2(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_en_ik_inAwake.c", 207); switch (limbIndex) { - case IRON_KNUCKLE_DEFEAT_LIMB_HELMET_ARMOR: { + case 13: { EnIk* this = (EnIk*)thisx; - if (EnIk_GetAnimCurFrame(&this->actor) < 30.0f) { + if (EnIk_curFrame(&this->actor) < 30.0f) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inAwake.c", 267); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016D88); } } break; - - case IRON_KNUCKLE_DEFEAT_LIMB_UPPER_LEFT_PAULDRON: + case 22: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inAwake.c", 274); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016F88); break; - - case IRON_KNUCKLE_DEFEAT_LIMB_UPPER_RIGHT_PAULDRON: + case 24: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inAwake.c", 280); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016EE8); break; - - case IRON_KNUCKLE_DEFEAT_LIMB_CHEST_ARMOR_FRONT: { + case 26: { EnIk* this = (EnIk*)thisx; - if (EnIk_GetAnimCurFrame(&this->actor) < 30.0f) { + if (EnIk_curFrame(&this->actor) < 30.0f) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inAwake.c", 288); - gSPDisplayList(POLY_XLU_DISP++, gIronKnuckleArmorRivetAndSymbolDL); + gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); } } break; - - case IRON_KNUCKLE_DEFEAT_LIMB_CHEST_ARMOR_BACK: { + case 27: { EnIk* this = (EnIk*)thisx; - if (EnIk_GetAnimCurFrame(&this->actor) < 30.0f) { + if (EnIk_curFrame(&this->actor) < 30.0f) { MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inAwake.c", 297); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016CD8); } } break; } - CLOSE_DISPS(gfxCtx, "../z_en_ik_inAwake.c", 304); } -void EnIk_CsDrawDefeat(EnIk* this, PlayState* play) { +void func_80A77844(EnIk* this, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad[2]; @@ -1323,16 +1227,16 @@ void EnIk_CsDrawDefeat(EnIk* this, PlayState* play) { func_8002EBCC(&this->actor, play, 0); Gfx_SetupDL_25Opa(gfxCtx); Gfx_SetupDL_25Xlu(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, EnIk_SetPrimEnvColors(gfxCtx, 245, 225, 155, 30, 30, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnIk_SetPrimEnvColors(gfxCtx, 255, 40, 0, 40, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, EnIk_SetPrimEnvColors(gfxCtx, 255, 255, 255, 20, 40, 30)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(gfxCtx, 245, 225, 155, 30, 30, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(gfxCtx, 255, 40, 0, 40, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(gfxCtx, 255, 255, 255, 20, 40, 30)); SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - EnIk_OverrideLimbDrawDefeat, EnIk_PostLimbDrawDefeat, this); + EnIk_OverrideLimbDraw2, EnIk_PostLimbDraw2, this); CLOSE_DISPS(gfxCtx, "../z_en_ik_inAwake.c", 345); } -void EnIk_HandleCsCues(EnIk* this, PlayState* play) { +void func_80A779DC(EnIk* this, PlayState* play) { CsCmdActorCue* cue = EnIk_GetCue(play, 4); u32 nextCueId; u32 currentCueId; @@ -1340,37 +1244,29 @@ void EnIk_HandleCsCues(EnIk* this, PlayState* play) { if (cue != NULL) { nextCueId = cue->id; currentCueId = this->cueId; - if (nextCueId != currentCueId) { switch (nextCueId) { case 1: - EnIk_SetupCsAction0(this); + func_80A77148(this); break; - case 2: - EnIk_SetupCsAction1(this, play); + func_80A77158(this, play); break; - case 3: - EnIk_SetupCsAction2(this); + func_80A771E4(this); break; - case 4: - EnIk_ChangeToEnemy(this, play); + func_80A78160(this, play); break; - case 5: - EnIk_SetupCsAction3(this, play); + func_80A7735C(this, play); break; - case 6: - EnIk_SetupCsAction4(this, play); + func_80A77434(this, play); break; - case 7: - EnIk_SetupCsAction5(this, play); + func_80A77474(this, play); break; - default: PRINTF(T("En_Ik_inConfrontion_Check_DemoMode:そんな動作は無い!!!!!!!!\n", "En_Ik_inConfrontion_Check_DemoMode: There is no such action!!!!!!!!\n")); @@ -1381,91 +1277,86 @@ void EnIk_HandleCsCues(EnIk* this, PlayState* play) { } } -void EnIk_CsAction0(EnIk* this, PlayState* play) { - EnIk_HandleCsCues(this, play); +void func_80A77AEC(EnIk* this, PlayState* play) { + func_80A779DC(this, play); } -void EnIk_CsAction1(EnIk* this, PlayState* play) { - EnIk_UpdateBgCheckInfo(this, play); - EnIk_HandleCsCues(this, play); +void func_80A77B0C(EnIk* this, PlayState* play) { + func_80A77034(this, play); + func_80A779DC(this, play); } -void EnIk_CsAction2(EnIk* this, PlayState* play) { - s32 animFinished; +void func_80A77B3C(EnIk* this, PlayState* play) { + s32 sp24; - animFinished = EnIk_UpdateSkelAnime(this); - EnIk_UpdateAction2Sfx(this); - EnIk_UpdateBgCheckInfo(this, play); - EnIk_HandleCsCues(this, play); - EnIk_HandleEnemyChange(this, play, animFinished); + sp24 = func_80A7707C(this); + func_80A76C14(this); + func_80A77034(this, play); + func_80A779DC(this, play); + func_80A77264(this, play, sp24); } -static EnIkActionFunc sCsActionFuncs[] = { - EnIk_CsAction0, EnIk_CsAction1, EnIk_CsAction2, EnIk_CsAction3, EnIk_CsAction4, EnIk_CsAction5, +static EnIkActionFunc sActionFuncs[] = { + func_80A77AEC, func_80A77B0C, func_80A77B3C, func_80A7748C, func_80A774BC, func_80A774F8, }; -void EnIk_UpdateCutscene(Actor* thisx, PlayState* play) { +void EnIk_Update(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - if (this->csAction < 0 || this->csAction >= ARRAY_COUNT(sCsActionFuncs) || sCsActionFuncs[this->csAction] == NULL) { + if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } - sCsActionFuncs[this->csAction](this, play); + sActionFuncs[this->action](this, play); } -s32 EnIk_OverrideLimbDrawIntro(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 EnIk_OverrideLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnIk* this = (EnIk*)thisx; f32 curFrame; switch (limbIndex) { - case IRON_KNUCKLE_LIMB_AXE: + case 17: curFrame = this->skelAnime.curFrame; if (curFrame < 120.0f) { *dList = NULL; } else { - EnIk_SpawnAxeSmoke(this, play, pos); + func_80A76E2C(this, play, pos); } break; - - case IRON_KNUCKLE_LIMB_WAIST: - case IRON_KNUCKLE_LIMB_MAX: + case 29: + case 30: *dList = NULL; break; } - return false; + return 0; } -void EnIk_PostLimbDrawIntro(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void EnIk_PostLimbDraw1(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_en_ik_inConfrontion.c", 571); switch (limbIndex) { - case IRON_KNUCKLE_LIMB_HELMET_ARMOR: + case 12: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inConfrontion.c", 575); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016D88); break; - - case IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON: + case 22: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inConfrontion.c", 581); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016F88); break; - - case IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON: + case 24: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inConfrontion.c", 587); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016EE8); break; - - case IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT: + case 26: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inConfrontion.c", 593); - gSPDisplayList(POLY_XLU_DISP++, gIronKnuckleArmorRivetAndSymbolDL); + gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016BE0); break; - - case IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK: + case 27: MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_ik_inConfrontion.c", 599); gSPDisplayList(POLY_XLU_DISP++, object_ik_DL_016CD8); break; @@ -1474,10 +1365,10 @@ void EnIk_PostLimbDrawIntro(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* CLOSE_DISPS(gfxCtx, "../z_en_ik_inConfrontion.c", 604); } -void EnIk_CsDrawNothing(EnIk* this, PlayState* play) { +void func_80A77ED0(EnIk* this, PlayState* play) { } -void EnIk_CsDrawIntro(EnIk* this, PlayState* play) { +void func_80A77EDC(EnIk* this, PlayState* play) { GraphicsContext* gfxCtx = play->state.gfxCtx; SkelAnime* skelAnime = &this->skelAnime; s32 pad[2]; @@ -1487,82 +1378,79 @@ void EnIk_CsDrawIntro(EnIk* this, PlayState* play) { func_8002EBCC(&this->actor, play, 0); Gfx_SetupDL_25Opa(gfxCtx); Gfx_SetupDL_25Xlu(gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, EnIk_SetPrimEnvColors(gfxCtx, 245, 225, 155, 30, 30, 0)); - gSPSegment(POLY_OPA_DISP++, 0x09, EnIk_SetPrimEnvColors(gfxCtx, 255, 40, 0, 40, 0, 0)); - gSPSegment(POLY_OPA_DISP++, 0x0A, EnIk_SetPrimEnvColors(gfxCtx, 255, 255, 255, 20, 40, 30)); + gSPSegment(POLY_OPA_DISP++, 0x08, func_80A761B0(gfxCtx, 245, 225, 155, 30, 30, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, func_80A761B0(gfxCtx, 255, 40, 0, 40, 0, 0)); + gSPSegment(POLY_OPA_DISP++, 0x0A, func_80A761B0(gfxCtx, 255, 255, 255, 20, 40, 30)); SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, - EnIk_OverrideLimbDrawIntro, EnIk_PostLimbDrawIntro, this); + EnIk_OverrideLimbDraw1, EnIk_PostLimbDraw1, this); CLOSE_DISPS(gfxCtx, "../z_en_ik_inConfrontion.c", 653); } -static EnIkDrawFunc sCsDrawFuncs[] = { EnIk_CsDrawNothing, EnIk_CsDrawIntro, EnIk_CsDrawDefeat }; +static EnIkDrawFunc sDrawFuncs[] = { func_80A77ED0, func_80A77EDC, func_80A77844 }; -void EnIk_DrawCutscene(Actor* thisx, PlayState* play) { +void EnIk_Draw(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - if (this->csDrawMode < 0 || this->csDrawMode >= ARRAY_COUNT(sCsDrawFuncs) || - sCsDrawFuncs[this->csDrawMode] == NULL) { + if (this->drawMode < 0 || this->drawMode >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawMode] == NULL) { PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; } - sCsDrawFuncs[this->csDrawMode](this, play); + sDrawFuncs[this->drawMode](this, play); } -void EnIk_CsInit(EnIk* this, PlayState* play) { - if (this->actor.params == IK_TYPE_NABOORU) { +void func_80A780D0(EnIk* this, PlayState* play) { + if (this->actor.params == 0) { if (!GET_EVENTCHKINF(EVENTCHKINF_3B)) { - this->actor.update = EnIk_UpdateCutscene; - this->actor.draw = EnIk_DrawCutscene; + this->actor.update = EnIk_Update; + this->actor.draw = EnIk_Draw; Actor_SetScale(&this->actor, 0.01f); } else { - EnIk_ChangeToEnemy(this, play); - EnIk_StartMinibossBgm(); + func_80A78160(this, play); + EnIk_StartMusic(); } } - PRINTF("En_Ik_inConfrontion_Init : %d !!!!!!!!!!!!!!!!\n", this->actor.params); } -void EnIk_ChangeToEnemy(EnIk* this, PlayState* play) { - this->actor.update = EnIk_UpdateEnemy; - this->actor.draw = EnIk_DrawEnemy; +void func_80A78160(EnIk* this, PlayState* play) { + this->actor.update = func_80A75FA0; + this->actor.draw = func_80A76798; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE; SET_EVENTCHKINF(EVENTCHKINF_3B); Actor_SetScale(&this->actor, 0.012f); - EnIk_SetupIdle(this); + func_80A7489C(this); } -void EnIk_StartDefeatCutscene(Actor* thisx, PlayState* play) { +void func_80A781CC(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; if (!Play_InCsMode(play)) { - this->actor.update = EnIk_UpdateCutscene; - this->actor.draw = EnIk_DrawCutscene; + this->actor.update = EnIk_Update; + this->actor.draw = EnIk_Draw; Cutscene_SetScript(play, gSpiritBossNabooruKnuckleDefeatCs); gSaveContext.cutsceneTrigger = 1; Actor_SetScale(&this->actor, 0.01f); SET_EVENTCHKINF(EVENTCHKINF_DEFEATED_NABOORU_KNUCKLE); - EnIk_SetupCsAction3(this, play); + func_80A7735C(this, play); } } void EnIk_Init(Actor* thisx, PlayState* play) { EnIk* this = (EnIk*)thisx; - s32 upperParams = IK_GET_UPPER_PARAMS(&this->actor); + s32 flag = this->actor.params & 0xFF00; - if (((IK_GET_ARMOR_TYPE(&this->actor) == IK_TYPE_NABOORU) && - GET_EVENTCHKINF(EVENTCHKINF_DEFEATED_NABOORU_KNUCKLE)) || - (upperParams != 0 && Flags_GetSwitch(play, upperParams >> 8))) { + if (((this->actor.params & 0xFF) == 0 && GET_EVENTCHKINF(EVENTCHKINF_DEFEATED_NABOORU_KNUCKLE)) || + (flag != 0 && Flags_GetSwitch(play, flag >> 8))) { Actor_Kill(&this->actor); } else { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gIronKnuckleSkel, &gIronKnuckleNabooruSummonAxeAnim, - this->jointTable, this->morphTable, IRON_KNUCKLE_LIMB_MAX); - EnIk_InitImpl(&this->actor, play); - EnIk_CsInit(this, play); + SkelAnime_InitFlex(play, &this->skelAnime, &object_ik_Skel_01E178, &object_ik_Anim_00C114, this->jointTable, + this->morphTable, 30); + func_80A74398(&this->actor, play); + func_80A780D0(this, play); } } @@ -1574,6 +1462,6 @@ ActorProfile En_Ik_Profile = { /**/ sizeof(EnIk), /**/ EnIk_Init, /**/ EnIk_Destroy, - /**/ EnIk_UpdateCutscene, - /**/ EnIk_DrawCutscene, + /**/ EnIk_Update, + /**/ EnIk_Draw, }; 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 9ae2a9cee4a..fb0bb5d8e25 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.h +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.h @@ -8,102 +8,21 @@ struct EnIk; typedef void (*EnIkActionFunc)(struct EnIk*, struct PlayState*); -#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, - /* 1 */ IK_TYPE_SILVER, - /* 2 */ IK_TYPE_BLACK, - /* 3 */ IK_TYPE_WHITE -} EnIkType; - -typedef enum IronKnuckleLimb { - /* 0x00 */ IRON_KNUCKLE_LIMB_NONE, - /* 0x01 */ IRON_KNUCKLE_LIMB_ROOT, - /* 0x02 */ IRON_KNUCKLE_LIMB_LOWER_BODY, - /* 0x03 */ IRON_KNUCKLE_LIMB_RIGHT_THIGH, - /* 0x04 */ IRON_KNUCKLE_LIMB_RIGHT_SHIN, - /* 0x05 */ IRON_KNUCKLE_LIMB_RIGHT_FOOT, - /* 0x06 */ IRON_KNUCKLE_LIMB_LEFT_THIGH, - /* 0x07 */ IRON_KNUCKLE_LIMB_LEFT_SHIN, - /* 0x08 */ IRON_KNUCKLE_LIMB_LEFT_FOOT, - /* 0x09 */ IRON_KNUCKLE_LIMB_UPPER_BODY_ROOT, - /* 0x0A */ IRON_KNUCKLE_LIMB_UPPER_BODY, - /* 0x0B */ IRON_KNUCKLE_LIMB_HEAD_ROOT, - /* 0x0C */ IRON_KNUCKLE_LIMB_HELMET_ARMOR, - /* 0x0D */ IRON_KNUCKLE_LIMB_HEAD, - /* 0x0E */ IRON_KNUCKLE_LIMB_RIGHT_UPPER_ARM, - /* 0x0F */ IRON_KNUCKLE_LIMB_RIGHT_FOREARM, - /* 0x10 */ IRON_KNUCKLE_LIMB_RIGHT_HAND_ROOT, - /* 0x11 */ IRON_KNUCKLE_LIMB_AXE, - /* 0x12 */ IRON_KNUCKLE_LIMB_RIGHT_HAND, - /* 0x13 */ IRON_KNUCKLE_LIMB_LEFT_UPPER_ARM, - /* 0x14 */ IRON_KNUCKLE_LIMB_LEFT_FOREARM, - /* 0x15 */ IRON_KNUCKLE_LIMB_LEFT_HAND, - /* 0x16 */ IRON_KNUCKLE_LIMB_UPPER_LEFT_PAULDRON, - /* 0x17 */ IRON_KNUCKLE_LIMB_LOWER_LEFT_PAULDRON, - /* 0x18 */ IRON_KNUCKLE_LIMB_UPPER_RIGHT_PAULDRON, - /* 0x19 */ IRON_KNUCKLE_LIMB_LOWER_RIGHT_PAULDRON, - /* 0x1A */ IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT, - /* 0x1B */ IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK, - /* 0x1C */ IRON_KNUCKLE_LIMB_TORSO, - /* 0x1D */ IRON_KNUCKLE_LIMB_WAIST, - /* 0x1E */ IRON_KNUCKLE_LIMB_MAX -} IronKnuckleLimb; - -// 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 IronKnuckleDefeatLimb { - /* 0x00 */ IRON_KNUCKLE_DEFEAT_LIMB_NONE, - /* 0x01 */ IRON_KNUCKLE_DEFEAT_LIMB_ROOT, - /* 0x02 */ IRON_KNUCKLE_DEFEAT_LIMB_LOWER_BODY, - /* 0x03 */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_THIGH, - /* 0x04 */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_SHIN, - /* 0x05 */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_FOOT, - /* 0x06 */ IRON_KNUCKLE_DEFEAT_LIMB_LEFT_THIGH, - /* 0x07 */ IRON_KNUCKLE_DEFEAT_LIMB_LEFT_SHIN, - /* 0x08 */ IRON_KNUCKLE_DEFEAT_LIMB_LEFT_FOOT, - /* 0x09 */ IRON_KNUCKLE_DEFEAT_LIMB_UPPER_BODY_ROOT, - /* 0x0A */ IRON_KNUCKLE_DEFEAT_LIMB_UPPER_BODY, - /* 0x0B */ IRON_KNUCKLE_DEFEAT_LIMB_HEAD_ROOT, - /* 0x0C */ IRON_KNUCKLE_DEFEAT_LIMB_HEAD, - /* 0x0D */ IRON_KNUCKLE_DEFEAT_LIMB_HELMET_ARMOR, - /* 0x0E */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_UPPER_ARM, - /* 0x0F */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_FOREARM, - /* 0x10 */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_HAND_ROOT, - /* 0x11 */ IRON_KNUCKLE_DEFEAT_LIMB_AXE, - /* 0x12 */ IRON_KNUCKLE_DEFEAT_LIMB_RIGHT_HAND, - /* 0x13 */ IRON_KNUCKLE_DEFEAT_LIMB_LEFT_UPPER_ARM, - /* 0x14 */ IRON_KNUCKLE_DEFEAT_LIMB_LEFT_FOREARM, - /* 0x15 */ IRON_KNUCKLE_DEFEAT_LIMB_LEFT_HAND, - /* 0x16 */ IRON_KNUCKLE_DEFEAT_LIMB_UPPER_LEFT_PAULDRON, - /* 0x17 */ IRON_KNUCKLE_DEFEAT_LIMB_LOWER_LEFT_PAULDRON, - /* 0x18 */ IRON_KNUCKLE_DEFEAT_LIMB_UPPER_RIGHT_PAULDRON, - /* 0x19 */ IRON_KNUCKLE_DEFEAT_LIMB_LOWER_RIGHT_PAULDRON, - /* 0x1A */ IRON_KNUCKLE_DEFEAT_LIMB_CHEST_ARMOR_FRONT, - /* 0x1B */ IRON_KNUCKLE_DEFEAT_LIMB_CHEST_ARMOR_BACK, - /* 0x1C */ IRON_KNUCKLE_DEFEAT_LIMB_TORSO, - /* 0x1D */ IRON_KNUCKLE_DEFEAT_LIMB_WAIST, - /* 0x1E */ IRON_KNUCKLE_DEFEAT_LIMB_MAX -} IronKnuckleDefeatLimb; - typedef struct EnIk { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[IRON_KNUCKLE_LIMB_MAX]; - /* 0x0244 */ Vec3s morphTable[IRON_KNUCKLE_LIMB_MAX]; + /* 0x0190 */ Vec3s jointTable[30]; + /* 0x0244 */ Vec3s morphTable[30]; /* 0x02F8 */ u8 unk_2F8; - /* 0x02F9 */ u8 animationTimer; - /* 0x02FA */ u8 drawArmorFlag; - /* 0x02FB */ u8 armorStatusFlag; - /* 0x02FC */ u8 isBreakingProp; - /* 0x02FD */ u8 damageReaction; + /* 0x02F9 */ u8 unk_2F9; + /* 0x02FA */ u8 unk_2FA; + /* 0x02FB */ u8 unk_2FB; + /* 0x02FC */ u8 unk_2FC; + /* 0x02FD */ u8 unk_2FD; /* 0x02FE */ s8 unk_2FE; /* 0x02FF */ s8 unk_2FF; /* 0x0300 */ s16 unk_300; - /* 0x0302 */ s16 switchFlag; + /* 0x0302 */ s16 switchFlags; /* 0x0304 */ EnIkActionFunc actionFunc; /* 0x0308 */ BodyBreak bodyBreak; /* 0x0320 */ ColliderCylinder bodyCollider; @@ -111,10 +30,10 @@ typedef struct EnIk { /* 0x03EC */ ColliderTris shieldCollider; /* 0x040C */ ColliderTrisElement shieldColliderElements[2]; /* 0x04C4 */ s32 blureIdx; - /* 0x04C8 */ s32 csAction; - /* 0x04CC */ s32 csDrawMode; + /* 0x04C8 */ s32 action; + /* 0x04CC */ s32 drawMode; /* 0x04D0 */ u32 cueId; - /* 0x04D4 */ s32 isAxeSummoned; + /* 0x04D4 */ s32 unk_4D4; /* 0x04D8 */ char unk_4D8[0x04]; } EnIk; // size = 0x04DC 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 dff41dd86df..e55f98dace5 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -1,9 +1,3 @@ -/* - * File: z_en_insect.c - * Overlay: ovl_En_Insect - * Description: Bugs - */ - #include "z_en_insect.h" #include "overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.h" @@ -124,7 +118,7 @@ f32 EnInsect_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { return SQ(v1->x - v2->x) + SQ(v1->z - v2->z); } -s32 EnInsect_InBottleRange(EnInsect* this, PlayState* play) { +s32 func_80A7BE6C(EnInsect* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); Vec3f pos; @@ -134,15 +128,12 @@ s32 EnInsect_InBottleRange(EnInsect* this, PlayState* play) { pos.y = player->actor.world.pos.y; pos.z = Math_CosS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f + player->actor.world.pos.z; - //! @bug: this check is superfluous: it is automatically satisfied if the coarse check is satisfied. It may have - //! been intended to check the actor is in front of Player, but yawTowardsPlayer does not depend on Player's - //! world rotation. - if (EnInsect_XZDistanceSquared(&pos, &this->actor.world.pos) <= SQ(20.0f)) { - return true; + if (EnInsect_XZDistanceSquared(&pos, &this->actor.world.pos) <= 400.0f) { + return 1; } } - return false; + return 0; } void EnInsect_SetCrawlAnim(EnInsect* this) { @@ -183,7 +174,7 @@ s32 EnInsect_TryFindNearbySoil(EnInsect* this, PlayState* play) { */ void EnInsect_UpdateCrawlSfx(EnInsect* this) { if (this->crawlSoundDelay > 0) { - this->crawlSoundDelay--; + this->crawlSoundDelay -= 1; return; } @@ -568,9 +559,9 @@ void EnInsect_SetupDropped(EnInsect* this) { EnInsect_SetCrawlAnim(this); this->actionTimer = 100; this->unk_324 = 1.5f; - this->unk_328 = Rand_ZeroOne() * (0xFFFF + 0.5f); + this->unk_328 = Rand_ZeroOne() * 65535.5f; this->unk_316 = (Rand_ZeroOne() - 0.5f) * 1500.0f; - this->actor.world.rot.y = Rand_ZeroOne() * (0xFFFF + 0.5f); + this->actor.world.rot.y = Rand_ZeroOne() * 65535.5f; Actor_SetScale(&this->actor, 0.003f); this->actionFunc = EnInsect_Dropped; this->insectFlags |= INSECT_FLAG_CRAWLING; @@ -722,7 +713,7 @@ void EnInsect_Dropped(EnInsect* this, PlayState* play) { EnInsect_SetupSlowDown(this); } else if ((type == INSECT_TYPE_FIRST_DROPPED || type == INSECT_TYPE_EXTRA_DROPPED) && (this->insectFlags & INSECT_FLAG_0) && this->lifeTimer <= 0 && this->actionTimer <= 0 && - this->actor.floorHeight < BGCHECK_Y_MIN + 10.0f) { + this->actor.floorHeight < -31990.0f) { PRINTF_COLOR_WARNING(); PRINTF(T("BG 抜け? Actor_delete します(%s %d)\n", "BG missing? To do Actor_delete (%s %d)\n"), "../z_en_mushi.c", 1197); @@ -794,10 +785,8 @@ void EnInsect_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (!(this->insectFlags & INSECT_FLAG_UNCATCHABLE) && sCaughtCount < 4 && - EnInsect_InBottleRange(this, play) && - // GI_MAX in this case allows the player to catch the actor in a bottle - Actor_OfferGetItem(&this->actor, play, GI_MAX, 60.0f, 30.0f)) { + if (!(this->insectFlags & INSECT_FLAG_UNCATCHABLE) && sCaughtCount < 4 && func_80A7BE6C(this, play) != 0 && + Actor_OfferGetItem(&this->actor, play, GI_MAX, 60.0f, 30.0f) != 0) { sCaughtCount++; } } 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 173c8cf9a80..a9bd480a191 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -106,16 +106,9 @@ static ColliderCylinderInit sCylinderInits[] = { OC2_TYPE_2, COLSHAPE_CYLINDER, }, - { - ELEM_MATERIAL_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0x4FC1FFF6, 0x00, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_ON, - }, + { 0x00, { 0x00000000, 0x00, 0x00 }, { 0x4FC1FFF6, 0x00, 0x00 }, 0x00, 0x01, 0x01 }, { 55, 70, 0, { 0, 0, 0 } }, - }, + } }; static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_IMMOVABLE }; @@ -386,7 +379,6 @@ void EnIshi_Wait(EnIshi* this, PlayState* play) { if (this->actor.xzDistToPlayer < 400.0f) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 90.0f) { - // GI_NONE in these cases allows the player to lift the actor if (type == ROCK_LARGE) { Actor_OfferGetItem(&this->actor, play, GI_NONE, 80.0f, 20.0f); } else { 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 89ef487ab3f..143db84b373 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -5,7 +5,6 @@ */ #include "z_en_jj.h" -#include "overlays/actors/ovl_Eff_Dust/z_eff_dust.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -22,23 +21,16 @@ #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) -typedef enum EnJjEyeState { - /* 0 */ JABUJABU_EYE_OPEN, - /* 1 */ JABUJABU_EYE_HALF, - /* 2 */ JABUJABU_EYE_CLOSED, - /* 3 */ JABUJABU_EYE_MAX -} EnJjEyeState; - -void EnJj_Init(Actor* thisx, PlayState* play2); +void EnJj_Init(Actor* thisx, PlayState* play); void EnJj_Destroy(Actor* thisx, PlayState* play); void EnJj_Update(Actor* thisx, PlayState* play); -void EnJj_Draw(Actor* thisx, PlayState* play2); +void EnJj_Draw(Actor* thisx, PlayState* play); -void EnJj_UpdateStaticCollision(Actor* thisx, PlayState* play); -void EnJj_WaitToOpenMouth(EnJj* this, PlayState* play); -void EnJj_WaitForFish(EnJj* this, PlayState* play); -void EnJj_BeginCutscene(EnJj* this, PlayState* play); -void EnJj_RemoveDust(EnJj* this, PlayState* play); +void func_80A87BEC(EnJj* this, PlayState* play); +void func_80A87C30(EnJj* this, PlayState* play); +void func_80A87CEC(EnJj* this, PlayState* play); +void func_80A87EF0(EnJj* this, PlayState* play); +void func_80A87F44(Actor* thisx, PlayState* play); ActorProfile En_Jj_Profile = { /**/ ACTOR_EN_JJ, @@ -52,13 +44,133 @@ ActorProfile En_Jj_Profile = { /**/ EnJj_Draw, }; -static s32 sUnused = 0; - -#include "z_en_jj_cutscene_data.inc.c" - -static s32 sUnused2[] = { 0, 0 }; +static s32 sPad = 0; + +static CutsceneData gJabuInhalingCs[0x2D4] = { + { 0x1A }, { 0x65D }, { 0xA }, { 4 }, { 0x50000 }, { 0xF00000 }, + { 0x40000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x6C4 }, { 0x34 }, + { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x300F0 }, { 0xFF0000 }, + { 0x40000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x6C4 }, { 0x34 }, + { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x600FF }, { 0x011D0000 }, + { 0x40000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x6C4 }, { 0x34 }, + { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x20011D }, { 0x012C0000 }, + { 0xC0000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x601 }, { 0x6D }, + { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x44 }, { 4 }, + { 0x10000 }, { 0xEA0000 }, { 0x40000000 }, { -0x681 }, { 0x34 }, { -0x2C }, + { -0x681 }, { 0x34 }, { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, + { 0x200EA }, { 0xF141F8 }, { 0 }, { -0x681 }, { 0x34 }, { -0x2C }, + { -0x643 }, { 0x82 }, { -0x2F }, { 0x410DB6DB }, { 0x41324925 }, { -0x3EF24925 }, + { 0x200F1 }, { 0x01184031 }, { 0 }, { -0x643 }, { 0x82 }, { -0x2F }, + { -0x225 }, { 0x82 }, { -0x34 }, { 0x41D83483 }, { 0 }, { -0x3E27CB7D }, + { 0x30118 }, { 0x012C0000 }, { 0 }, { -0x225 }, { 0x82 }, { -0x34 }, + { -0x225 }, { 0x82 }, { -0x34 }, { 0 }, { 0 }, { 0 }, + { 0x43 }, { 5 }, { 0x10000 }, { 0x5D0000 }, { 0 }, { 0 }, + { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, + { 0 }, { 0 }, { 0x3005D }, { 0x790000 }, { 0 }, { 0 }, + { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, + { 0 }, { 0 }, { 0x10079 }, { 0x920000 }, { 0 }, { 0 }, + { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, + { 0 }, { 0 }, { 0x20092 }, { 0xF10000 }, { 0 }, { 0 }, + { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, + { 0 }, { 0 }, { 0x100F1 }, { 0x01B90000 }, { 0 }, { 0 }, + { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, + { 0 }, { 0 }, { 0x45 }, { 3 }, { 0x10000 }, { 0x5A0000 }, + { 0 }, { 0 }, { -0x21 }, { 9 }, { 0 }, { -0x21 }, + { 9 }, { 0 }, { 0 }, { 0 }, { 0x2005A }, { 0x014A0000 }, + { 0 }, { 0 }, { -0x21 }, { 9 }, { 0 }, { -0x3E }, + { 0x16 }, { 0 }, { 0xBDF77777 }, { 0 }, { 0x3014A }, { 0x017C0000 }, + { 0 }, { 0 }, { -0x3E }, { 0x16 }, { 0 }, { -0x3E }, + { 0x16 }, { 0 }, { 0 }, { 0 }, { 3 }, { 1 }, + { 0xC0447 }, { 0x04890000 }, { 0 }, { -0x2E }, { 0 }, { -0x30 }, + { -0x2E }, { 0 }, { -0x30 }, { 0 }, { 0 }, { 0 }, + { 0x2D }, { 1 }, { 0x90000 }, { 0xA000A }, { 0xA }, { 1 }, + { 0x35012C }, { 0x065D0000 }, { 0 }, { -0x65E }, { 0x34 }, { -0x34 }, + { -0x65E }, { 0x34 }, { -0x34 }, { 0 }, { 0 }, { 0 }, + { 1 }, { 0x10000 }, { 0x04430000 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, + { -0x28FEA4 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x28FE93 }, { 0 }, + { 0x4235998B }, { -0x0668FFA1 }, { -0x28FE82 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, + { -0x28FDDD }, { -0x01000000 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x288F9B }, { 1 }, + { 0x1003C }, { 0x047F0000 }, { 0 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE015C }, + { 0 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE016D }, { 0 }, { 0x4235998B }, + { -0x05FBFF05 }, { 0xDE017E }, { 0 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE0223 }, + { -0x01000000 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE7065 }, { 1 }, { 0x1005A }, + { 0x015F0000 }, { 0 }, { 0x4235998B }, { -0x06A1FE82 }, { 0x01C70000 }, { 0 }, + { 0x4235998B }, { -0x06A1FE82 }, { 0x01C7AC34 }, { 0 }, { 0x4235998B }, { -0x06A1FE82 }, + { 0x01C74428 }, { 0 }, { 0x4235998B }, { -0x069DFE84 }, { 0x01C30000 }, { 0 }, + { 0x4203FFE5 }, { -0x069DFE84 }, { 0x01C3AC10 }, { 0 }, { 0x4203FFE5 }, { -0x069DFE84 }, + { 0x01C30000 }, { 0 }, { 0x4203FFE5 }, { -0x069DFE84 }, { 0x01C30000 }, { 0 }, + { 0x4203FFE5 }, { -0x069DFE84 }, { 0x01C30164 }, { -0x01000000 }, { 0x4203FFE5 }, { -0x069DFE84 }, + { 0x01C3AD78 }, { 1 }, { 0x100DC }, { 0x01880000 }, { 0 }, { 0x4235998B }, + { -0x0668FFA1 }, { -0x290000 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x2853CC }, + { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x28BBD8 }, { 0 }, { 0x4235998B }, + { -0x0668FFA1 }, { -0x290000 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x2853F0 }, + { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x290000 }, { -0x01000000 }, { 0x4235998B }, + { -0x0668FFA1 }, { -0x290000 }, { 1 }, { 0x100F0 }, { 0x05330000 }, { 0 }, + { 0x42366658 }, { -0x0711FFBF }, { -0xF0000 }, { 0 }, { 0x42366658 }, { -0x0711FFBF }, + { -0xE53CC }, { 0 }, { 0x42366658 }, { -0x0711FFBF }, { -0xEBBD8 }, { 0 }, + { 0x42366658 }, { -0x0711FFBF }, { -0xF0000 }, { -0x01000000 }, { 0x42366658 }, { -0x0711FFBF }, + { -0xE53F0 }, { 1 }, { 0x10118 }, { 0x055B0000 }, { 0 }, { 0x42366658 }, + { -0x05FAFFA1 }, { -0x70000 }, { 0 }, { 0x42366658 }, { -0x05FAFFA1 }, { -0x653CC }, + { 0 }, { 0x42366658 }, { -0x05FAFFA1 }, { -0x6BBD8 }, { 0 }, { 0x42366658 }, + { -0x05FAFFA1 }, { -0x70000 }, { -0x01000000 }, { 0x42366658 }, { -0x05FAFFA1 }, { -0x653F0 }, + { 1 }, { 0x10136 }, { 0x058D0000 }, { 0 }, { 0x4235998B }, { -0x06B4FFAD }, + { -0x3B0000 }, { 0 }, { 0x4235998B }, { -0x06B4FFAD }, { -0x3A53CC }, { 0 }, + { 0x4235998B }, { -0x0670FF4F }, { -0x3ABBD8 }, { 0 }, { 0x4235998B }, { -0x05FCFF20 }, + { -0x3B0000 }, { 0 }, { 0x4235998B }, { -0x04DAFF4C }, { -0x3A53F0 }, { 0 }, + { 0x4235998B }, { -0x03B8FFB9 }, { -0x370000 }, { 0 }, { 0x4235998B }, { -0x03B8FFB9 }, + { -0x370000 }, { 0 }, { 0x4235998B }, { -0x03B8FFB9 }, { -0x36FE9C }, { -0x01000000 }, + { 0x4235998B }, { -0x03B8FFB9 }, { -0x365288 }, { 1 }, { 0x10163 }, { 0x05BA0000 }, + { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, { 0 }, { 0x42726667 }, + { -0x0725FF99 }, { 0x12AC34 }, { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x124428 }, + { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, { 0 }, { 0x42726667 }, + { -0x0725FF99 }, { 0x12AC10 }, { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, + { -0x01000000 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, { 2 }, { 0x10000 }, + { 0x04600000 }, { 0x1E }, { 0x4235998B }, { -0x06BB0005 }, { -0x2D0000 }, { 0x1E }, + { 0x4235998B }, { -0x06BB0005 }, { -0x2C53CC }, { 0x3E8 }, { 0x4235998B }, { -0x06BB0005 }, + { -0x2CBBD8 }, { 0x1E }, { 0x4235998B }, { -0x06BB0005 }, { -0x2D0000 }, { -0xFFFFE2 }, + { 0x4235998B }, { -0x06BB0005 }, { -0x2C53F0 }, { 2 }, { 0x1003C }, { 0x049C0000 }, + { 0x1E }, { 0x4235998B }, { -0x059FFF0F }, { 0x860000 }, { 0x1E }, { 0x4235998B }, + { -0x059FFF0F }, { 0x86AC34 }, { 0x3E8 }, { 0x4235998B }, { -0x059FFF0F }, { 0x864428 }, + { 0x1E }, { 0x4235998B }, { -0x059FFF0F }, { 0x860000 }, { -0xFFFFE2 }, { 0x4235998B }, + { -0x059FFF0F }, { 0x86AC10 }, { 2 }, { 0x1005A }, { 0x017C0000 }, { 0x1E }, + { 0x4235998B }, { -0x0649FEA4 }, { 0x01750000 }, { 0x1E }, { 0x4235998B }, { -0x0649FEA4 }, + { 0x0175AC34 }, { 0x32 }, { 0x4235998B }, { -0x0649FEA4 }, { 0x01754428 }, { 0x1E }, + { 0x420D9981 }, { -0x064DFEAE }, { 0x016F0000 }, { 0x1E }, { 0x4203FFE5 }, { -0x064DFEAE }, + { 0x016FAC10 }, { 0x1E }, { 0x4203FFE5 }, { -0x064DFEAE }, { 0x016F0000 }, { 0x1E }, + { 0x4203FFE5 }, { -0x064DFEAE }, { 0x016F0000 }, { 0x1E }, { 0x4203FFE5 }, { -0x064DFEAE }, + { 0x016F0164 }, { -0xFFFFE2 }, { 0x4203FFE5 }, { -0x064DFEAE }, { 0x016FAD78 }, { 2 }, + { 0x100DC }, { 0x01A50000 }, { 0x1E }, { 0x4235998B }, { -0x06BB0005 }, { -0x2D0000 }, + { 0x46 }, { 0x4235998B }, { -0x06BB0005 }, { -0x2C53CC }, { 5 }, { 0x4235998B }, + { -0x06BB0005 }, { -0x2CBBD8 }, { 6 }, { 0x42373325 }, { -0x0638FF6A }, { -0x920000 }, + { 0x1E }, { 0x4235998B }, { -0x05FAFF68 }, { -0x4A53F0 }, { 0x1E }, { 0x4235998B }, + { -0x05FAFF68 }, { -0x4B0000 }, { -0xFFFFE2 }, { 0x4235998B }, { -0x05FAFF68 }, { -0x4B0000 }, + { 2 }, { 0x100F0 }, { 0x05500000 }, { 0x1E }, { 0x42366658 }, { -0x06AFFFB6 }, + { -0x250000 }, { 0x1E }, { 0x42366658 }, { -0x06AFFFB6 }, { -0x2453CC }, { 0x3E8 }, + { 0x42366658 }, { -0x06AFFFB6 }, { -0x24BBD8 }, { 0x1E }, { 0x42366658 }, { -0x06AFFFB6 }, + { -0x250000 }, { -0xFFFFE2 }, { 0x42366658 }, { -0x06AFFFB6 }, { -0x2453F0 }, { 2 }, + { 0x10118 }, { 0x05780000 }, { 0x1E }, { 0x42366658 }, { -0x0652FF9D }, { -0x320000 }, + { 0x1E }, { 0x42366658 }, { -0x0652FF9D }, { -0x3153CC }, { 0x3E8 }, { 0x42366658 }, + { -0x0652FF9D }, { -0x31BBD8 }, { 0x1E }, { 0x42366658 }, { -0x0652FF9D }, { -0x320000 }, + { -0xFFFFE2 }, { 0x42366658 }, { -0x0652FF9D }, { -0x3153F0 }, { 2 }, { 0x10136 }, + { 0x05AA0000 }, { 0xB001E }, { 0x42B5FFCC }, { -0x0649FF73 }, { -0x3B0000 }, { 0x9000A }, + { 0x42B59966 }, { -0x063EFF8E }, { -0x3853CC }, { 0xFC000A }, { 0x42B4CC9A }, { -0x05F7FF40 }, + { -0x35BBD8 }, { 0xA }, { 0x42B53300 }, { -0x0592FF5C }, { -0x360000 }, { 0xCB000A }, + { 0x42B4CC9A }, { -0x0471FF89 }, { -0x2453F0 }, { 0x20000A }, { 0x42B4CC9A }, { -0x033FFFCE }, + { -0x330000 }, { 0x3E8 }, { 0x4235998B }, { -0x0343FFDD }, { -0x330000 }, { 0x1E }, + { 0x4235998B }, { -0x0343FFDD }, { -0x32FE9C }, { -0xFFFFE2 }, { 0x4235998B }, { -0x0343FFDD }, + { -0x325288 }, { 2 }, { 0x10163 }, { 0x05D70000 }, { 0x1E }, { 0x42726667 }, + { -0x06A9FF91 }, { -0x60000 }, { 0x1E }, { 0x42726667 }, { -0x06A9FF91 }, { -0x553CC }, + { 0xA }, { 0x42726667 }, { -0x06A9FF91 }, { -0x5BBD8 }, { 0xA }, { 0x42726667 }, + { -0x06B8FFAE }, { -0x2A0000 }, { 0x3E8 }, { 0x42726667 }, { -0x06B8FFAE }, { -0x2953F0 }, + { 0x1E }, { 0x42726667 }, { -0x06B8FFAE }, { -0x2A0000 }, { -0xFFFFE2 }, { 0x42726667 }, + { -0x06B8FFAE }, { -0x2A0000 }, { 0x2D }, { 1 }, { 0xB014F }, { 0x01560156 }, + { 0x3E8 }, { 1 }, { 0x180159 }, { 0x018B018B }, { 0x3E }, { 1 }, + { 0x10131 }, { 0x01EE0000 }, { 0 }, { -0x577 }, { 0x1C4 }, { -0x35 }, + { -0x577 }, { 0x1C4 }, { -0x35 }, { 0 }, { 0 }, { 0 }, + { -1 }, { 0 }, { 0 }, { 0 }, +}; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_80A88CB4 = { { COL_MATERIAL_NONE, AT_NONE, @@ -78,72 +190,71 @@ static ColliderCylinderInit sCylinderInit = { { 170, 150, 0, { 0, 0, 0 } }, }; -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80A88CE0[] = { ICHAIN_VEC3F_DIV1000(scale, 87, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 4000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 3300, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 1100, ICHAIN_STOP), }; +static Vec3f D_80A88CF0 = { -1589.0f, 53.0f, -43.0f }; +static s32 D_80A88CFC[5] = { 0x06007698, 0x06007A98, 0x06007E98, 0, 0 }; -void EnJj_SetupAction(EnJj* this, EnJjActionFunc actionFunc) { - this->actionFunc = actionFunc; +void func_80A87800(EnJj* this, void (*arg1)(EnJj*, PlayState*)) { + this->unk2FC = arg1; } -void EnJj_Init(Actor* thisx, PlayState* play2) { - PlayState* play = play2; +void EnJj_Init(Actor* thisx, PlayState* play) { + s32 pad; EnJj* this = (EnJj*)thisx; - CollisionHeader* colHeader = NULL; + CollisionHeader* sp4C; - Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + sp4C = NULL; + Actor_ProcessInitChain(&this->dyna.actor, D_80A88CE0); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); - switch (this->dyna.actor.params) { - case JABUJABU_MAIN: - SkelAnime_InitFlex(play, &this->skelAnime, &gJabuJabuSkel, &gJabuJabuAnim, this->jointTable, - this->morphTable, 22); - Animation_PlayLoop(&this->skelAnime, &gJabuJabuAnim); - this->unk_30A = 0; - this->eyeIndex = 0; - this->blinkTimer = 0; - this->extraBlinkCounter = 0; - this->extraBlinkTotal = 0; - + case -1: + SkelAnime_InitFlex(play, &this->unk164, &object_jj_00B9A8_Skel, &object_jj_001F4C_Anim, this->unk1A8, + this->unk22C, 22); + Animation_PlayLoop(&this->unk164, &object_jj_001F4C_Anim); + this->unk30A = 0; + this->unk30E = 0; + this->unk30F = 0; + this->unk310 = 0; + this->unk311 = 0; if (GET_EVENTCHKINF(EVENTCHKINF_OPENED_JABU_JABU)) { - EnJj_SetupAction(this, EnJj_WaitToOpenMouth); + func_80A87800(this, func_80A87BEC); } else { - EnJj_SetupAction(this, EnJj_WaitForFish); + func_80A87800(this, func_80A87C30); } - - this->bodyCollisionActor = (DynaPolyActor*)Actor_SpawnAsChild( + this->unk300 = (EnJj*)Actor_SpawnAsChild( &play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, - JABUJABU_COLLISION); + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gJabuJabuHeadCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); + CollisionHeader_GetVirtual(&object_jj_000A1C_Col, &sp4C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + Collider_InitCylinder(play, &this->unk2B0); + Collider_SetCylinder(play, &this->unk2B0, &this->dyna.actor, &D_80A88CB4); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - break; + return; - case JABUJABU_COLLISION: + case 0: DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gJabuJabuBodyCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + CollisionHeader_GetVirtual(&object_jj_001830_Col, &sp4C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId); - this->dyna.actor.update = EnJj_UpdateStaticCollision; + this->dyna.actor.update = func_80A87F44; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); - break; + return; - case JABUJABU_UNUSED_COLLISION: + case 1: DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gJabuJabuUnusedCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); - this->dyna.actor.update = EnJj_UpdateStaticCollision; + CollisionHeader_GetVirtual(&object_jj_00BA8C_Col, &sp4C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + this->dyna.actor.update = func_80A87F44; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); - break; + return; } } @@ -151,183 +262,163 @@ void EnJj_Destroy(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; switch (this->dyna.actor.params) { - case JABUJABU_MAIN: + case -1: DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(play, &this->collider); - break; + Collider_DestroyCylinder(play, &this->unk2B0); + return; - case JABUJABU_COLLISION: - case JABUJABU_UNUSED_COLLISION: + case 0: + case 1: DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - break; + return; } } -/** - * Blink routine. Blinks at the end of each randomised blinkTimer cycle. If extraBlinkCounter is not zero, blink that - * many more times before resuming random blinkTimer cycles. extraBlinkTotal can be set to a positive number to blink - * that many extra times at the end of every blinkTimer cycle, but the actor always sets it to zero, so only one - * multiblink happens when extraBlinkCounter is nonzero. - */ -void EnJj_Blink(EnJj* this) { - if (this->blinkTimer > 0) { - this->blinkTimer--; +void func_80A87B1C(EnJj* this) { + if (this->unk30F > 0) { + this->unk30F--; } else { - this->eyeIndex++; - if (this->eyeIndex >= JABUJABU_EYE_MAX) { - this->eyeIndex = JABUJABU_EYE_OPEN; - if (this->extraBlinkCounter > 0) { - this->extraBlinkCounter--; + this->unk30E++; + if (this->unk30E >= 3) { + this->unk30E = 0; + if (this->unk310 > 0) { + this->unk310--; } else { - this->blinkTimer = Rand_S16Offset(20, 20); - this->extraBlinkCounter = this->extraBlinkTotal; + this->unk30F = Rand_S16Offset(0x14, 0x14); + this->unk310 = this->unk311; } } } } -void EnJj_OpenMouth(EnJj* this, PlayState* play) { - DynaPolyActor* bodyCollisionActor = this->bodyCollisionActor; - - if (this->mouthOpenAngle >= -5200) { - this->mouthOpenAngle -= 102; +void func_80A87B9C(EnJj* this, PlayState* play) { + EnJj* unk300; - if (this->mouthOpenAngle < -2600) { - DynaPoly_DisableCollision(play, &play->colCtx.dyna, bodyCollisionActor->bgId); + unk300 = this->unk300; + if (this->unk308 >= -0x1450) { + this->unk308 -= 0x66; + if (this->unk308 < -0xA28) { + DynaPoly_DisableCollision(play, &play->colCtx.dyna, unk300->dyna.bgId); } } } -void EnJj_WaitToOpenMouth(EnJj* this, PlayState* play) { +void func_80A87BEC(EnJj* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 300.0f) { - EnJj_SetupAction(this, EnJj_OpenMouth); + func_80A87800(this, func_80A87B9C); } } -void EnJj_WaitForFish(EnJj* this, PlayState* play) { - static Vec3f feedingSpot = { -1589.0f, 53.0f, -43.0f }; +void func_80A87C30(EnJj* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((Math_Vec3f_DistXZ(&feedingSpot, &player->actor.world.pos) < 300.0f) && play->isPlayerDroppingFish(play)) { - this->cutsceneCountdownTimer = 100; - EnJj_SetupAction(this, EnJj_BeginCutscene); + if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && play->isPlayerDroppingFish(play)) { + this->unk30C = 0x64; + func_80A87800(this, func_80A87CEC); } - - this->collider.dim.pos.x = -1245; - this->collider.dim.pos.y = 20; - this->collider.dim.pos.z = -48; - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + this->unk2B0.dim.pos.x = -0x4DD; + this->unk2B0.dim.pos.y = 0x14; + this->unk2B0.dim.pos.z = -0x30; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk2B0.base); } -void EnJj_BeginCutscene(EnJj* this, PlayState* play) { - DynaPolyActor* bodyCollisionActor = this->bodyCollisionActor; +void func_80A87CEC(EnJj* this, PlayState* play) { + EnJj* temp_v1; + Actor* sp1C; - if (this->cutsceneCountdownTimer > 0) { - this->cutsceneCountdownTimer--; - } else { - EnJj_SetupAction(this, EnJj_RemoveDust); - play->csCtx.script = gJabuInhalingCs; - gSaveContext.cutsceneTrigger = 1; - DynaPoly_DisableCollision(play, &play->colCtx.dyna, bodyCollisionActor->bgId); - Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); - SET_EVENTCHKINF(EVENTCHKINF_OPENED_JABU_JABU); - Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); + temp_v1 = this->unk300; + if (this->unk30C > 0) { + this->unk30C--; + return; } + func_80A87800(this, func_80A87EF0); + play->csCtx.script = gJabuInhalingCs; + gSaveContext.cutsceneTrigger = 1; + DynaPoly_DisableCollision(play, &play->colCtx.dyna, temp_v1->dyna.bgId); + Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); + SET_EVENTCHKINF(EVENTCHKINF_OPENED_JABU_JABU); + Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } -void EnJj_CutsceneUpdate(EnJj* this, PlayState* play) { +void func_80A87D94(EnJj* this, PlayState* play) { switch (play->csCtx.actorCues[2]->id) { case 1: - if (this->unk_30A & 2) { - this->eyeIndex = 0; - this->blinkTimer = Rand_S16Offset(20, 20); - this->extraBlinkCounter = 0; - this->extraBlinkTotal = 0; - this->unk_30A ^= 2; + if (this->unk30A & 2) { + this->unk30E = 0; + this->unk30F = Rand_S16Offset(0x14, 0x14); + this->unk310 = 0; + this->unk311 = 0; + this->unk30A ^= 2; } break; case 2: - this->unk_30A |= 1; - - if (!(this->unk_30A & 8)) { - this->dust = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST, -1100.0f, - 105.0f, -27.0f, 0, 0, 0, EFF_DUST_TYPE_0); - this->unk_30A |= 8; + this->unk30A |= 1; + if (!(this->unk30A & 8)) { + this->unk304 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST, -1100.0f, + 105.0f, -27.0f, 0, 0, 0, 0); + this->unk30A |= 8; } break; case 3: - if (!(this->unk_30A & 2)) { - this->eyeIndex = 0; - this->blinkTimer = 0; - this->extraBlinkCounter = 1; - this->extraBlinkTotal = 0; - this->unk_30A |= 2; + if (!(this->unk30A & 2)) { + this->unk30E = 0; + this->unk30F = 0; + this->unk310 = 1; + this->unk311 = 0; + this->unk30A |= 2; } break; } - - if (this->unk_30A & 1) { + if (this->unk30A & 1) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_JABJAB_BREATHE - SFX_FLAG); - - if (this->mouthOpenAngle >= -5200) { - this->mouthOpenAngle -= 102; + if (this->unk308 >= -0x1450) { + this->unk308 -= 0x66; } } } -void EnJj_RemoveDust(EnJj* this, PlayState* play) { - Actor* dust; - - if (!(this->unk_30A & 4)) { - this->unk_30A |= 4; - dust = this->dust; - - if (dust != NULL) { - Actor_Kill(dust); +void func_80A87EF0(EnJj* this, PlayState* play) { + if (!(this->unk30A & 4)) { + this->unk30A |= 4; + if (this->unk304 != NULL) { + Actor_Kill(this->unk304); this->dyna.actor.child = NULL; } } } -void EnJj_UpdateStaticCollision(Actor* thisx, PlayState* play) { +void func_80A87F44(Actor* thisx, PlayState* play) { } void EnJj_Update(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[2] != NULL)) { - EnJj_CutsceneUpdate(this, play); + func_80A87D94(this, play); } else { - this->actionFunc(this, play); - - if (this->skelAnime.curFrame == 41.0f) { + this->unk2FC(this, play); + if (this->unk164.curFrame == 41.0f) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN); } } - - EnJj_Blink(this); - SkelAnime_Update(&this->skelAnime); + func_80A87B1C(this); + SkelAnime_Update(&this->unk164); Actor_SetScale(&this->dyna.actor, 0.087f); - - // Head - this->skelAnime.jointTable[10].z = this->mouthOpenAngle; + this->unk164.jointTable[10].z = (s16)this->unk308; } -void EnJj_Draw(Actor* thisx, PlayState* play2) { - static void* eyeTextures[] = { gJabuJabuEyeOpenTex, gJabuJabuEyeHalfTex, gJabuJabuEyeClosedTex }; - PlayState* play = play2; +void EnJj_Draw(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_en_jj.c", 879); - Gfx_SetupDL_37Opa(play->state.gfxCtx); - Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * (M_PI / 41.0f)) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(0.0f, (cosf(this->unk164.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A88CFC[this->unk30E])); + SkelAnime_DrawFlexOpa(play, this->unk164.skeleton, this->unk164.jointTable, (s32)this->unk164.dListCount, NULL, NULL, this); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_jj.c", 898); } 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 7b37ee0058e..86c614369ca 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -6,31 +6,23 @@ struct EnJj; -typedef void (*EnJjActionFunc)(struct EnJj*, struct PlayState*); - typedef struct EnJj { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ SkelAnime skelAnime; - /* 0x01A8 */ Vec3s jointTable[22]; - /* 0x022C */ Vec3s morphTable[22]; - /* 0x02B0 */ ColliderCylinder collider; - /* 0x02FC */ EnJjActionFunc actionFunc; - /* 0x0300 */ DynaPolyActor* bodyCollisionActor; - /* 0x0304 */ Actor* dust; - /* 0x0308 */ s16 mouthOpenAngle; - /* 0x030A */ u16 unk_30A; - /* 0x030C */ s16 cutsceneCountdownTimer; - /* 0x030E */ u8 eyeIndex; - /* 0x030F */ u8 blinkTimer; - /* 0x0310 */ u8 extraBlinkCounter; - /* 0x0311 */ u8 extraBlinkTotal; -} EnJj; // size = 0x0314 - -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 -} EnJjType; - + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ SkelAnime unk164; + /* 0x1A8 */ Vec3s unk1A8[22]; + /* 0x22C */ Vec3s unk22C[22]; + /* 0x2B0 */ ColliderCylinder unk2B0; + /* 0x2FC */ void (*unk2FC)(struct EnJj*, struct PlayState*); + /* 0x300 */ struct EnJj* unk300; + /* 0x304 */ Actor* unk304; + /* 0x308 */ s16 unk308; + /* 0x30A */ u16 unk30A; + /* 0x30C */ s16 unk30C; + /* 0x30E */ u8 unk30E; + /* 0x30F */ u8 unk30F; + /* 0x310 */ u8 unk310; + /* 0x311 */ u8 unk311; + /* 0x312 */ char pad312[2]; +} EnJj; // size = 0x314 #endif diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c deleted file mode 100644 index 35a67d6972e..00000000000 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c +++ /dev/null @@ -1,158 +0,0 @@ -#include "z_en_jj.h" -#include "cutscene_commands.h" - -// clang-format off -static CutsceneData gJabuInhalingCs[] = { - CS_HEADER(26, 1629), - CS_PLAYER_CUE_LIST(4), - CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 240, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), - CS_PLAYER_CUE(PLAYER_CUEID_3, 240, 255, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), - CS_PLAYER_CUE(PLAYER_CUEID_6, 255, 285, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), - CS_PLAYER_CUE(PLAYER_CUEID_32, 285, 300, 0x0000, 0xC000, 0x0000, -1732, 52, -44, -1537, 109, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), - CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_1_7, 4), - CS_ACTOR_CUE(0x0001, 0, 234, 0x0000, 0x4000, 0x0000, -1665, 52, -44, -1665, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), - CS_ACTOR_CUE(0x0002, 234, 241, 0x41F8, 0x0000, 0x0000, -1665, 52, -44, -1603, 130, -47, CS_FLOAT(0x410DB6DB, 8.857142f), CS_FLOAT(0x41324925, 11.142858f), CS_FLOAT(0xC10DB6DB, -8.857142f)), - CS_ACTOR_CUE(0x0002, 241, 280, 0x4031, 0x0000, 0x0000, -1603, 130, -47, -549, 130, -52, CS_FLOAT(0x41D83483, 27.02564f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC1D83483, -27.02564f)), - CS_ACTOR_CUE(0x0003, 280, 300, 0x0000, 0x0000, 0x0000, -549, 130, -52, -549, 130, -52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_2_4, 5), - CS_ACTOR_CUE(0x0001, 0, 93, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE(0x0003, 93, 121, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE(0x0001, 121, 146, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE(0x0002, 146, 241, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE(0x0001, 241, 441, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_2_5, 3), - CS_ACTOR_CUE(0x0001, 0, 90, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -33, 9, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE(0x0002, 90, 330, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -62, 22, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBDF77777, -0.12083333f), CS_FLOAT(0x0, 0.0f)), - CS_ACTOR_CUE(0x0003, 330, 380, 0x0000, 0x0000, 0x0000, 0, -62, 22, 0, -62, 22, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_MISC_LIST(1), - CS_MISC(CS_MISC_STOP_CUTSCENE, 1095, 1161, 0x0000, 0x00000000, 0xFFFFFFD2, 0x00000000, 0xFFFFFFD0, 0xFFFFFFD2, 0x00000000, 0xFFFFFFD0, 0x00000000, 0x00000000, 0x00000000), - CS_TRANSITION(CS_TRANS_TRIGGER_INSTANCE, 0, 10), - CS_PLAYER_CUE_LIST(1), - CS_PLAYER_CUE(PLAYER_CUEID_53, 300, 1629, 0x0000, 0x0000, 0x0000, -1630, 52, -52, -1630, 52, -52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_CAM_EYE_SPLINE(0, 1091), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x015C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x016D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x017E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0223), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x7065), - CS_CAM_EYE_SPLINE(60, 1151), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x015C), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x016D), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x017E), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x0223), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x7065), - CS_CAM_EYE_SPLINE(90, 351), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1694, 380, 451, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0xAD78), - CS_CAM_EYE_SPLINE(220, 392), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), - CS_CAM_EYE_SPLINE(240, 1331), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0xAC10), - CS_CAM_EYE_SPLINE(280, 1371), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0xAC10), - CS_CAM_EYE_SPLINE(310, 1421), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1717, 83, -59, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1717, 83, -59, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1649, 177, -59, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1533, 224, -59, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1243, 180, -59, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0xAD78), - CS_CAM_EYE_SPLINE(355, 1466), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), - CS_CAM_AT_SPLINE(0, 1120), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC10), - CS_CAM_AT_SPLINE(60, 1180), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0xAC10), - CS_CAM_AT_SPLINE(90, 380), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x420D9981, 35.399906f), -1614, 338, 367, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0xAD78), - CS_CAM_AT_SPLINE(220, 421), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 6, CS_FLOAT(0x42373325, 45.799946f), -1593, 150, -146, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0x0000), - CS_CAM_AT_SPLINE(240, 1360), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0xAC10), - CS_CAM_AT_SPLINE(280, 1400), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0xAC10), - CS_CAM_AT_SPLINE(310, 1450), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x0B, 30, CS_FLOAT(0x42B5FFCC, 90.9996f), -1610, 141, -59, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x09, 10, CS_FLOAT(0x42B59966, 90.79961f), -1599, 114, -57, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xFC, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -1528, 192, -54, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42B53300, 90.59961f), -1427, 164, -54, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0xCB, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -1138, 119, -37, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x20, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -832, 50, -51, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0x0164), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0xAD78), - CS_CAM_AT_SPLINE(355, 1495), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0xAC34), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0x4428), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0xAC10), - CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), - CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), - CS_TRANSITION(CS_TRANS_BLACK_FILL_IN, 335, 342), - CS_DESTINATION(CS_DEST_JABU_JABU, 345, 395), - CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_8_0, 1), - CS_ACTOR_CUE(0x0001, 305, 494, 0x0000, 0x0000, 0x0000, -1399, 452, -53, -1399, 452, -53, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), - CS_END_OF_SCRIPT(), -}; -// clang-format on 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 c848b597dc3..8450b141d54 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -18,7 +18,6 @@ #include "player.h" #include "save.h" -#include "assets/objects/object_dekubaba/object_dekubaba.h" #include "assets/objects/gameplay_keep/shadow_circle.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) @@ -101,13 +100,20 @@ static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_WITHERED_DEKU_BABA, ICHAIN_STOP), }; +extern SkeletonHeader D_06002A40; +extern AnimationHeader D_060002B8; +extern Gfx D_06003070[]; // deku stick drop +extern Gfx D_060010F0[]; // leaf base +extern Gfx D_06001828[]; // upper third of stem +extern Gfx D_06001330[]; // mid third of stem +extern Gfx D_06001628[]; // lower third of stem + void EnKarebaba_Init(Actor* thisx, PlayState* play) { EnKarebaba* this = (EnKarebaba*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &gDekuBabaSkel, &gDekuBabaFastChompAnim, this->jointTable, this->morphTable, - 8); + SkelAnime_Init(play, &this->skelAnime, &D_06002A40, &D_060002B8, this->jointTable, this->morphTable, 8); Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); Collider_UpdateCylinder(&this->actor, &this->bodyCollider); @@ -156,8 +162,8 @@ void EnKarebaba_SetupIdle(EnKarebaba* this) { } void EnKarebaba_SetupAwaken(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 4.0f, 0.0f, - Animation_GetLastFrame(&gDekuBabaFastChompAnim), ANIMMODE_LOOP, -3.0f); + Animation_Change(&this->skelAnime, &D_060002B8, 4.0f, 0.0f, Animation_GetLastFrame(&D_060002B8), ANIMMODE_LOOP, + -3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_DUMMY482); this->actionFunc = EnKarebaba_Awaken; } @@ -208,14 +214,14 @@ void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, PlayState* play) { } void EnKarebaba_SetupRetract(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, -3.0f, Animation_GetLastFrame(&gDekuBabaFastChompAnim), - 0.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &D_060002B8, -3.0f, Animation_GetLastFrame(&D_060002B8), 0.0f, ANIMMODE_ONCE, + -3.0f); EnKarebaba_ResetCollider(this); this->actionFunc = EnKarebaba_Retract; } void EnKarebaba_SetupDead(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &gDekuBabaFastChompAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &D_060002B8, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); EnKarebaba_ResetCollider(this); this->actor.shape.rot.x = -0x4000; this->actor.params = 200; @@ -451,7 +457,7 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play) { } } -void EnKarebaba_DrawBaseShadow(EnKarebaba* this, PlayState* play) { +void EnKarebaba_DrawCenterShadow(EnKarebaba* this, PlayState* play) { MtxF mf; OPEN_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1013); @@ -470,11 +476,11 @@ void EnKarebaba_DrawBaseShadow(EnKarebaba* this, PlayState* play) { void EnKarebaba_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 black = { 0, 0, 0, 0 }; - static Gfx* stemDLists[] = { gDekuBabaStemTopDL, gDekuBabaStemMiddleDL, gDekuBabaStemBaseDL }; + static Gfx* dLists[] = { D_06001330, D_06001628, D_06001828 }; static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnKarebaba* this = (EnKarebaba*)thisx; s32 i; - s32 stemSections; + s32 numDLists; f32 scale; OPEN_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1056); @@ -485,7 +491,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { if (this->actor.params > 40 || PARAMS_GET_U(this->actor.params, 0, 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1066); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStickDropDL); + gSPDisplayList(POLY_OPA_DISP++, D_06003070); } } else if (this->actionFunc != EnKarebaba_Dead) { func_80026230(play, &black, 1, 2); @@ -502,15 +508,15 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { Matrix_RotateZYX(this->actor.shape.rot.x, this->actor.shape.rot.y, 0, MTXMODE_APPLY); if (this->actionFunc == EnKarebaba_Dying) { - stemSections = 2; + numDLists = 2; } else { - stemSections = 3; + numDLists = 3; } - for (i = 0; i < stemSections; i++) { + for (i = 0; i < numDLists; i++) { Matrix_Translate(0.0f, 0.0f, -2000.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1116); - gSPDisplayList(POLY_OPA_DISP++, stemDLists[i]); + gSPDisplayList(POLY_OPA_DISP++, dLists[i]); if (i == 0 && this->actionFunc == EnKarebaba_Dying) { Matrix_MultVec3f(&zeroVec, &this->actor.focus.pos); @@ -530,12 +536,12 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->actor.home.rot.y), MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1144); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaBaseLeavesDL); + gSPDisplayList(POLY_OPA_DISP++, D_060010F0); if (this->actionFunc == EnKarebaba_Dying) { Matrix_RotateZYX(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1155); - gSPDisplayList(POLY_OPA_DISP++, gDekuBabaStemBaseDL); + gSPDisplayList(POLY_OPA_DISP++, D_06001828); } func_80026608(play); @@ -543,6 +549,6 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_karebaba.c", 1163); if (this->boundFloor != NULL) { - EnKarebaba_DrawBaseShadow(this, play); + EnKarebaba_DrawCenterShadow(this, 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 9e905ca5fa1..add77d18f14 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -1,9 +1,3 @@ -/* - * File: z_en_kusa.c - * Overlay: ovl_en_kusa - * Description: Bush - */ - #include "z_en_kusa.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" @@ -14,8 +8,6 @@ #include "printf.h" #include "rand.h" #include "sfx.h" -#include "terminal.h" -#include "translation.h" #include "z_en_item00.h" #include "z_lib.h" #include "effect.h" @@ -30,30 +22,28 @@ void EnKusa_Init(Actor* thisx, PlayState* play); void EnKusa_Destroy(Actor* thisx, PlayState* play2); void EnKusa_Update(Actor* thisx, PlayState* play); -void EnKusa_Draw(Actor* thisx, PlayState* play); -void EnKusa_SetupLiftedUp(EnKusa* this); void EnKusa_SetupWaitForObject(EnKusa* this); +void EnKusa_WaitForObject(EnKusa* this, PlayState* play); void EnKusa_SetupMain(EnKusa* this); +void EnKusa_Main(EnKusa* this, PlayState* play); +void func_80A9BA98(EnKusa* this); +void func_80A9BAD8(EnKusa* this, PlayState* play); void EnKusa_SetupFall(EnKusa* this); -void EnKusa_SetupCut(EnKusa* this); -void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); -void EnKusa_SetupRegrow(EnKusa* this); - void EnKusa_Fall(EnKusa* this, PlayState* play); -void EnKusa_WaitForObject(EnKusa* this, PlayState* play); -void EnKusa_Main(EnKusa* this, PlayState* play); -void EnKusa_LiftedUp(EnKusa* this, PlayState* play); +void EnKusa_SetupCut(EnKusa* this); void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play); void EnKusa_DoNothing(EnKusa* this, PlayState* play); +void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play); +void EnKusa_SetupRegrow(EnKusa* this); void EnKusa_Regrow(EnKusa* this, PlayState* play); +void func_80A9C164(Actor* thisx, PlayState* play); static s16 rotSpeedXtarget = 0; static s16 rotSpeedX = 0; static s16 rotSpeedYtarget = 0; static s16 rotSpeedY = 0; - ActorProfile En_Kusa_Profile = { /**/ ACTOR_EN_KUSA, /**/ ACTORCAT_PROP, @@ -65,95 +55,84 @@ ActorProfile En_Kusa_Profile = { /**/ EnKusa_Update, /**/ NULL, }; - -static s16 sObjectIds[] = { OBJECT_GAMEPLAY_FIELD_KEEP, OBJECT_KUSA, OBJECT_KUSA }; - -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_NONE, - AT_NONE, - AC_ON | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_2, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x4FC00758, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_ON, - }, - { 12, 44, 0, { 0, 0, 0 } }, +static s16 D_80A9C200[4] = { + OBJECT_GAMEPLAY_FIELD_KEEP, + OBJECT_KUSA, + OBJECT_KUSA, }; - -static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 30, MASS_IMMOVABLE }; - -static Vec3f sUnitDirections[] = { +static ColliderCylinderInit D_80A9C208 = { + { 0xA, 0, 9, 0x29, 0x20, 1 }, + { 0, { 0, 0, 0 }, { 0x4FC00758, 0, 0 }, 0, 1, 1 }, + { 0xC, 0x2C, 0, { 0, 0, 0 } }, +}; +static CollisionCheckInfoInit D_80A9C234 = { 0, 0xC, 0x1E, 0xFF }; +static Vec3f sUnitDirections[4] = { { 0.0f, 0.7071f, 0.7071f }, { 0.7071f, 0.7071f, 0.0f }, { 0.0f, 0.7071f, -0.7071f }, { -0.7071f, 0.7071f, 0.0f }, }; - -static s16 sFragmentScales[] = { 108, 102, 96, 84, 66, 55, 42, 38 }; - -static InitChainEntry sInitChain[] = { +static s16 sFragmentScales[8] = { + 0x6C, 0x66, 0x60, 0x54, 0x42, 0x37, 0x2A, 0x26, +}; +static InitChainEntry D_80A9C27C[6] = { ICHAIN_VEC3F_DIV1000(scale, 400, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -17000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1200, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 120, ICHAIN_STOP), }; +static Gfx* D_80A9C294[3] = { + gFieldBushDL, + object_kusa_DL_000140, + object_kusa_DL_000140, +}; -void EnKusa_SetupAction(EnKusa* this, EnKusaActionFunc actionFunc) { - this->timer = 0; +void func_80A9AFA0(EnKusa* this, EnKusaActionFunc actionFunc) { + this->unk19C = 0; this->actionFunc = actionFunc; } -s32 EnKusa_SnapToFloor(EnKusa* this, PlayState* play, f32 yOffset) { +s32 func_80A9AFAC(EnKusa* this, PlayState* play, f32 arg2) { s32 pad; - CollisionPoly* groundPoly; - Vec3f pos; - s32 bgId; - f32 floorY; - - pos.x = this->actor.world.pos.x; - pos.y = this->actor.world.pos.y + 30.0f; - pos.z = this->actor.world.pos.z; - - floorY = BgCheck_EntityRaycastDown4(&play->colCtx, &groundPoly, &bgId, &this->actor, &pos); - - if (floorY > BGCHECK_Y_MIN) { - this->actor.world.pos.y = floorY + yOffset; + CollisionPoly* sp38; + Vec3f sp2C; + UNK_TYPE sp28; + f32 temp_fv0; + + sp2C.x = this->actor.world.pos.x; + sp2C.y = this->actor.world.pos.y + 30.0f; + sp2C.z = this->actor.world.pos.z; + temp_fv0 = BgCheck_EntityRaycastDown4(&play->colCtx, &sp38, &sp28, &this->actor, &sp2C); + if (temp_fv0 > BGCHECK_Y_MIN) { + this->actor.world.pos.y = temp_fv0 + arg2; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - return true; + return 1; } else { PRINTF_COLOR_WARNING(); - PRINTF(T("地面に付着失敗(%s %d)\n", "Failed to attach to ground (%s %d)\n"), "../z_en_kusa.c", 323); + PRINTF("地面に付着失敗(%s %d)\n", "../z_en_kusa.c", 323); PRINTF_RST(); - return false; + return 0; } } -void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { - s16 dropParams; +void func_80A9B07C(EnKusa* this, PlayState* play) { + s16 var_v0; + s32 temp_v0; switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: - dropParams = PARAMS_GET_U(this->actor.params, 8, 4); - - if (dropParams >= COLLECTIBLE_DROP_TABLE_13) { - dropParams = COLLECTIBLE_DROP_TABLE_0; + var_v0 = PARAMS_GET_U(this->actor.params, 8, 4); + if (var_v0 >= 0xD) { + var_v0 = 0; } Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, - COLLECTIBLE_DROP_RANDOM_PARAMS(dropParams, false)); + COLLECTIBLE_DROP_RANDOM_PARAMS(var_v0, false)); break; case ENKUSA_TYPE_1: if (Rand_ZeroOne() < 0.5f) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SEEDS); + Item_DropCollectible(play, &this->actor.world.pos, 0x10); } else { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RECOVERY_HEART); + Item_DropCollectible(play, &this->actor.world.pos, 3); } break; } @@ -161,17 +140,16 @@ void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { void EnKusa_UpdateVelY(EnKusa* this) { this->actor.velocity.y += this->actor.gravity; - if (this->actor.velocity.y < this->actor.minVelocityY) { this->actor.velocity.y = this->actor.minVelocityY; } } -void EnKusa_RandScaleVecToZero(Vec3f* vec, f32 scale) { +void EnKusa_RandScaleVecToZero(Vec3f* arg0, f32 scale) { scale += ((Rand_ZeroOne() * 0.2f) - 0.1f) * scale; - vec->x -= vec->x * scale; - vec->y -= vec->y * scale; - vec->z -= vec->z * scale; + arg0->x -= arg0->x * scale; + arg0->y -= arg0->y * scale; + arg0->z -= arg0->z * scale; } void EnKusa_SetScaleSmall(EnKusa* this) { @@ -180,101 +158,80 @@ void EnKusa_SetScaleSmall(EnKusa* this) { this->actor.scale.z = 0.120000005f; } -void EnKusa_SpawnFragments(EnKusa* this, PlayState* play) { - Vec3f velocity; - Vec3f pos; - s32 i; - s32 scaleIndex; +void func_80A9B21C(EnKusa* this, PlayState* play) { + Vec3f spC4; + Vec3f spB8; Vec3f* dir; + s32 new_var; + s32 i; s32 pad; for (i = 0; i < ARRAY_COUNT(sUnitDirections); i++) { dir = &sUnitDirections[i]; - - pos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 20.0f); - pos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 20.0f) + 10.0f; - pos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 20.0f); - - velocity.x = (Rand_ZeroOne() - 0.5f) * 8.0f; - velocity.y = Rand_ZeroOne() * 10.0f; - velocity.z = (Rand_ZeroOne() - 0.5f) * 8.0f; - - scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) & 7; - - EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80, - KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubStalkDL); - - pos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f); - pos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 40.0f) + 10.0f; - pos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 40.0f); - - velocity.x = (Rand_ZeroOne() - 0.5f) * 6.0f; - velocity.y = Rand_ZeroOne() * 10.0f; - velocity.z = (Rand_ZeroOne() - 0.5f) * 6.0f; - - scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) % 7; - - EffectSsKakera_Spawn(play, &pos, &velocity, &pos, -100, 64, 40, 3, 0, sFragmentScales[scaleIndex], 0, 0, 80, - KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, gCuttableShrubTipDL); + spB8.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 20.0f); + spB8.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 20.0f) + 10.0f; + spB8.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 20.0f); + spC4.x = (Rand_ZeroOne() - 0.5f) * 8.0f; + spC4.y = Rand_ZeroOne() * 10.0f; + spC4.z = (Rand_ZeroOne() - 0.5f) * 8.0f; + new_var = (s32)(Rand_ZeroOne() * 111.1f) & 7; + EffectSsKakera_Spawn(play, &spB8, &spC4, &spB8, -100, 0x40, 0x28, 3, 0, sFragmentScales[new_var], 0, 0, 80, -1, + 1, gCuttableShrubStalkDL); + + spB8.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f); + spB8.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 40.0f) + 10.0f; + spB8.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 40.0f); + spC4.x = (Rand_ZeroOne() - 0.5f) * 6.0f; + spC4.y = Rand_ZeroOne() * 10.0f; + spC4.z = (Rand_ZeroOne() - 0.5f) * 6.0f; + new_var = (s32)(Rand_ZeroOne() * 111.1f) % 7; + EffectSsKakera_Spawn(play, &spB8, &spC4, &spB8, -100, 0x40, 0x28, 3, 0, sFragmentScales[new_var], 0, 0, 80, -1, + 1, gCuttableShrubTipDL); } } -void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { - s32 i; - - for (i = 0; i < 3; i++) { - Actor* bug = - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, INSECT_TYPE_SPAWNED); +void func_80A9B574(EnKusa* this, PlayState* play) { + s32 var_s0; - if (bug == NULL) { + for (var_s0 = 0; var_s0 < 3; var_s0++) { + if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, (s16)(s32)(Rand_ZeroOne() * 65535.0f), 0, + INSECT_TYPE_SPAWNED) == NULL) { break; } } } -void EnKusa_InitCollider(Actor* thisx, PlayState* play) { +void func_80A9B630(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->collider); + Collider_InitCylinder(play, &this->unk150); + Collider_SetCylinder(play, &this->unk150, &this->actor, &D_80A9C208); + Collider_UpdateCylinder(&this->actor, &this->unk150); } void EnKusa_Init(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); - + Actor_ProcessInitChain(&this->actor, D_80A9C27C); if (play->csCtx.state != CS_STATE_IDLE) { this->actor.cullingVolumeDistance += 1000.0f; } - - EnKusa_InitCollider(thisx, play); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - + func_80A9B630(&this->actor, play); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_80A9C234); if (this->actor.shape.rot.y == 0) { - s16 rand = Rand_ZeroFloat(0x10000); - - this->actor.world.rot.y = rand; - this->actor.home.rot.y = rand; - this->actor.shape.rot.y = rand; + this->actor.shape.rot.y = this->actor.home.rot.y = this->actor.world.rot.y = (s16)(s32)Rand_ZeroFloat(65536.0f); } - - if (!EnKusa_SnapToFloor(this, play, 0.0f)) { + if (func_80A9AFAC(this, play, 0.0f) == 0) { Actor_Kill(&this->actor); return; } - - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[PARAMS_GET_U(thisx->params, 0, 2)]); - + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, D_80A9C200[PARAMS_GET_U(this->actor.params, 0, 2)]); if (this->requiredObjectSlot < 0) { - PRINTF(T("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", "Error : Bank danger! (arg_data 0x%04x)(%s %d)\n"), - thisx->params, "../z_en_kusa.c", 561); + PRINTF("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_en_kusa.c", 0x231); Actor_Kill(&this->actor); return; } - EnKusa_SetupWaitForObject(this); } @@ -282,11 +239,11 @@ void EnKusa_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnKusa* this = (EnKusa*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk150); } void EnKusa_SetupWaitForObject(EnKusa* this) { - EnKusa_SetupAction(this, EnKusa_WaitForObject); + func_80A9AFA0(this, EnKusa_WaitForObject); } void EnKusa_WaitForObject(EnKusa* this, PlayState* play) { @@ -296,15 +253,14 @@ void EnKusa_WaitForObject(EnKusa* this, PlayState* play) { } else { EnKusa_SetupMain(this); } - - this->actor.draw = EnKusa_Draw; + this->actor.draw = func_80A9C164; this->actor.objectSlot = this->requiredObjectSlot; this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; } } void EnKusa_SetupMain(EnKusa* this) { - EnKusa_SetupAction(this, EnKusa_Main); + func_80A9AFA0(this, EnKusa_Main); this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; } @@ -312,36 +268,31 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { s32 pad; if (Actor_HasParent(&this->actor, play)) { - EnKusa_SetupLiftedUp(this); + func_80A9BA98(this); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); - } else if (this->collider.base.acFlags & AC_HIT) { - this->collider.base.acFlags &= ~AC_HIT; - EnKusa_SpawnFragments(this, play); - EnKusa_DropCollectible(this, play); + } else if (this->unk150.base.acFlags & AC_HIT) { + this->unk150.base.acFlags &= ~AC_HIT; + func_80A9B21C(this, play); + func_80A9B07C(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); - if (PARAMS_GET_U(this->actor.params, 4, 1)) { - EnKusa_SpawnBugs(this, play); + func_80A9B574(this, play); } - if (PARAMS_GET_U(this->actor.params, 0, 2) == ENKUSA_TYPE_0) { Actor_Kill(&this->actor); return; } - EnKusa_SetupCut(this); this->actor.flags |= ACTOR_FLAG_GRASS_DESTROYED; } else { - if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) { - this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; + if (!(this->unk150.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) { + this->unk150.base.ocFlags1 |= OC1_TYPE_PLAYER; } - if (this->actor.xzDistToPlayer < 600.0f) { - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - + Collider_UpdateCylinder(&this->actor, &this->unk150); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk150.base); if (this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); if (this->actor.xzDistToPlayer < 100.0f) { Actor_OfferCarry(&this->actor, play); } @@ -350,18 +301,18 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { } } -void EnKusa_SetupLiftedUp(EnKusa* this) { - EnKusa_SetupAction(this, EnKusa_LiftedUp); +void func_80A9BA98(EnKusa* this) { + func_80A9AFA0(this, func_80A9BAD8); this->actor.room = -1; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; } -void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { +void func_80A9BAD8(EnKusa* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; EnKusa_SetupFall(this); - this->actor.velocity.x = this->actor.speed * Math_SinS(this->actor.world.rot.y); - this->actor.velocity.z = this->actor.speed * Math_CosS(this->actor.world.rot.y); + 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; this->actor.colChkInfo.mass = 240; this->actor.gravity = -0.1f; EnKusa_UpdateVelY(this); @@ -375,53 +326,50 @@ void EnKusa_LiftedUp(EnKusa* this, PlayState* play) { } void EnKusa_SetupFall(EnKusa* this) { - EnKusa_SetupAction(this, EnKusa_Fall); + func_80A9AFA0(this, EnKusa_Fall); rotSpeedXtarget = -0xBB8; - rotSpeedYtarget = (Rand_ZeroOne() - 0.5f) * 1600.0f; + rotSpeedYtarget = (s16)(s32)((Rand_ZeroOne() - 0.5f) * 1600.0f); rotSpeedX = 0; rotSpeedY = 0; } void EnKusa_Fall(EnKusa* this, PlayState* play) { s32 pad; - Vec3f contactPos; + Vec3f sp30; if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } - EnKusa_SpawnFragments(this, play); - EnKusa_DropCollectible(this, play); + func_80A9B21C(this, play); + func_80A9B07C(this, play); switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: Actor_Kill(&this->actor); break; - case ENKUSA_TYPE_1: EnKusa_SetupUprootedWaitRegrow(this); break; } return; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - contactPos.x = this->actor.world.pos.x; - contactPos.y = this->actor.world.pos.y + this->actor.depthInWater; - contactPos.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(play, &contactPos, NULL, NULL, 0, 400); - EffectSsGRipple_Spawn(play, &contactPos, 150, 650, 0); - EffectSsGRipple_Spawn(play, &contactPos, 400, 800, 4); - EffectSsGRipple_Spawn(play, &contactPos, 500, 1100, 8); + sp30.x = this->actor.world.pos.x; + sp30.y = this->actor.world.pos.y + this->actor.depthInWater; + sp30.z = this->actor.world.pos.z; + EffectSsGSplash_Spawn(play, &sp30, NULL, NULL, 0, 400); + EffectSsGRipple_Spawn(play, &sp30, 150, 650, 0); + EffectSsGRipple_Spawn(play, &sp30, 400, 800, 4); + EffectSsGRipple_Spawn(play, &sp30, 500, 1100, 8); this->actor.minVelocityY = -3.0f; - rotSpeedX >>= 1; - rotSpeedXtarget >>= 1; - rotSpeedY >>= 1; - rotSpeedYtarget >>= 1; + rotSpeedX = (s16)((s16)rotSpeedX >> 1); + rotSpeedXtarget = (s16)((s16)rotSpeedXtarget >> 1); + rotSpeedY = (s16)((s16)rotSpeedY >> 1); + rotSpeedYtarget = (s16)((s16)rotSpeedYtarget >> 1); this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } - EnKusa_UpdateVelY(this); Math_StepToS(&rotSpeedX, rotSpeedXtarget, 0x1F4); Math_StepToS(&rotSpeedY, rotSpeedYtarget, 0xAA); @@ -432,23 +380,23 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6 | UPDBGCHECKINFO_FLAG_7); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk150); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); } void EnKusa_SetupCut(EnKusa* this) { switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_2: - EnKusa_SetupAction(this, EnKusa_DoNothing); + func_80A9AFA0(this, EnKusa_DoNothing); break; case ENKUSA_TYPE_1: - EnKusa_SetupAction(this, EnKusa_CutWaitRegrow); + func_80A9AFA0(this, EnKusa_CutWaitRegrow); break; } } void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play) { - if (this->timer >= 120) { + if (this->unk19C >= 0x78) { EnKusa_SetupRegrow(this); } } @@ -462,21 +410,18 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { this->actor.world.pos.z = this->actor.home.pos.z; EnKusa_SetScaleSmall(this); this->actor.shape.rot = this->actor.home.rot; - EnKusa_SetupAction(this, EnKusa_UprootedWaitRegrow); + func_80A9AFA0(this, EnKusa_UprootedWaitRegrow); } void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play) { - if (this->timer > 120) { - if (Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f)) { - if (this->timer >= 170) { - EnKusa_SetupRegrow(this); - } - } + if ((this->unk19C >= 0x79) && Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f) && + (this->unk19C >= 0xAA)) { + EnKusa_SetupRegrow(this); } } void EnKusa_SetupRegrow(EnKusa* this) { - EnKusa_SetupAction(this, EnKusa_Regrow); + func_80A9AFA0(this, EnKusa_Regrow); EnKusa_SetScaleSmall(this); this->actor.shape.rot = this->actor.home.rot; this->actor.flags &= ~ACTOR_FLAG_GRASS_DESTROYED; @@ -488,21 +433,17 @@ void EnKusa_Regrow(EnKusa* this, PlayState* play) { isFullyGrown &= Math_StepToF(&this->actor.scale.y, 0.4f, 0.014f); isFullyGrown &= Math_StepToF(&this->actor.scale.x, 0.4f, 0.011f); this->actor.scale.z = this->actor.scale.x; - if (isFullyGrown) { Actor_SetScale(&this->actor, 0.4f); EnKusa_SetupMain(this); - this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; + this->unk150.base.ocFlags1 &= ~OC1_TYPE_PLAYER; } } void EnKusa_Update(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - - this->timer++; - + this->unk19C += 1; this->actionFunc(this, play); - if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) { this->actor.shape.yOffset = -6.25f; } else { @@ -510,13 +451,10 @@ void EnKusa_Update(Actor* thisx, PlayState* play) { } } -void EnKusa_Draw(Actor* thisx, PlayState* play) { - static Gfx* dLists[] = { gFieldBushDL, object_kusa_DL_000140, object_kusa_DL_000140 }; - EnKusa* this = (EnKusa*)thisx; - - if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) { +void func_80A9C164(Actor* thisx, PlayState* play) { + if (thisx->flags & ACTOR_FLAG_GRASS_DESTROYED) { Gfx_DrawDListOpa(play, object_kusa_DL_0002E0); } else { - Gfx_DrawDListOpa(play, dLists[PARAMS_GET_U(thisx->params, 0, 2)]); + Gfx_DrawDListOpa(play, D_80A9C294[PARAMS_GET_U(thisx->params, 0, 2)]); } } 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 85ed0d54075..d28547700b6 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -15,11 +15,12 @@ typedef enum EnKusaType { } EnKusaType; typedef struct EnKusa { - /* 0x0000 */ Actor actor; - /* 0x014C */ EnKusaActionFunc actionFunc; - /* 0x0150 */ ColliderCylinder collider; - /* 0x019C */ s16 timer; - /* 0x019E */ s8 requiredObjectSlot; -} EnKusa; // size = 0x01A0 + /* 0x000 */ Actor actor; + /* 0x14C */ EnKusaActionFunc actionFunc; + /* 0x150 */ ColliderCylinder unk150; + /* 0x19C */ s16 unk19C; + /* 0x19E */ s8 requiredObjectSlot; + /* 0x19F */ char pad19F[1]; +} EnKusa; // size = 0x1A0 #endif 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 83cc7fe9c16..bec210601cd 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -302,7 +302,7 @@ void func_80A9CB18(EnKz* this, PlayState* play) { #endif if (EnKz_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, 340.0f, EnKz_GetTextId, - EnKz_UpdateTalkState)) { + EnKz_UpdateTalkState) != 0) { if ((this->actor.textId == 0x401A) && !GET_EVENTCHKINF(EVENTCHKINF_GAVE_LETTER_TO_KING_ZORA)) { if (Actor_GetPlayerExchangeItemId(play) == EXCH_ITEM_BOTTLE_RUTOS_LETTER) { this->actor.textId = 0x401B; 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 ea2433aced4..81bf24d6636 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 @@ -27,7 +27,7 @@ typedef enum EnMThunderAttackStrength { /* 1 */ M_THUNDER_ATTACK_WEAK } EnMThunderAttackStrength; -void EnMThunder_Init(Actor* thisx, PlayState* play2); +void EnMThunder_Init(Actor* thisx, PlayState* play); void EnMThunder_Destroy(Actor* thisx, PlayState* play); void EnMThunder_Update(Actor* thisx, PlayState* play); void EnMThunder_Draw(Actor* thisx, PlayState* play2); @@ -68,27 +68,28 @@ static ColliderCylinderInit sCylinderInit = { { 200, 200, 0, { 0, 0, 0 } }, }; -static u32 sSpinAttackDmgFlags[] = { DMG_SPIN_MASTER, DMG_SPIN_KOKIRI, DMG_SPIN_GIANT }; -static u32 sJumpAttackDmgFlags[] = { DMG_JUMP_MASTER, DMG_JUMP_KOKIRI, DMG_JUMP_GIANT }; +static u32 sSpinAttackDmgFlags[3] = { DMG_SPIN_MASTER, DMG_SPIN_KOKIRI, DMG_SPIN_GIANT }; +static u32 sJumpAttackDmgFlags[3] = { DMG_JUMP_MASTER, DMG_JUMP_KOKIRI, DMG_JUMP_GIANT }; void EnMThunder_SetupAction(EnMThunder* this, EnMThunderActionFunc actionFunc) { this->actionFunc = actionFunc; } -void EnMThunder_Init(Actor* thisx, PlayState* play2) { - PlayState* play = play2; +void EnMThunder_Init(Actor* thisx, PlayState* play) { + s32 pad; EnMThunder* this = (EnMThunder*)thisx; - Player* player = GET_PLAYER(play); - - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - this->swordType = 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); - this->collider.dim.radius = 0; - this->collider.dim.height = 40; - this->collider.dim.yShift = -20; + Player* player; + + player = GET_PLAYER(play); + Collider_InitCylinder(play, &this->unk14C); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); + this->swordType = PARAMS_GET_U(this->actor.params, 0, 8) - 1; + Lights_PointNoGlowSetInfo(&this->unk19C, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + 255, 255, 255, 0); + this->unk198 = LightContext_InsertLight(play, &play->lightCtx, &this->unk19C); + this->unk14C.dim.radius = 0; + this->unk14C.dim.height = 40; + this->unk14C.dim.yShift = -20; this->followPlayerTimer = 8; this->spinTrailTexScroll = 0.0f; this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; @@ -98,22 +99,25 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) { this->actor.room = -1; Actor_SetScale(&this->actor, 0.1f); this->isUsingMagic = false; - if (player->stateFlags2 & PLAYER_STATE2_17) { - if (!gSaveContext.save.info.playerData.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) || - (PARAMS_GET_S(this->actor.params, 8, 8) && - !(Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_NOW)))) { + if (((gSaveContext.save.info.playerData.isMagicAcquired) == 0) || + (gSaveContext.magicState != MAGIC_STATE_IDLE) || + ((PARAMS_GET_S(this->actor.params, 8, 8) != 0) && + (Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_NOW) == 0))) { SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_ROLLING_CUT); SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_SWORD_SWING_HARD); Actor_Kill(&this->actor); return; } - player->stateFlags2 &= ~PLAYER_STATE2_17; this->isUsingMagic = true; - this->collider.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; + this->unk14C.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; this->attackStrength = M_THUNDER_ATTACK_WEAK; - this->targetScale = ((this->swordType == M_THUNDER_SWORD_KOKIRI) ? 2 : 4); + if (this->swordType == M_THUNDER_SWORD_KOKIRI) { + this->targetScale = 2; + } else { + this->targetScale = 4; + } EnMThunder_SetupAction(this, EnMThunder_SpinAttacking); this->followPlayerTimer = 8; SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_ROLLING_CUT_LV1); @@ -130,10 +134,9 @@ void EnMThunder_Destroy(Actor* thisx, PlayState* play) { if (this->isUsingMagic) { Magic_Reset(play); } - - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk14C); EnMThunder_AdjustEnvLights(play, 0.0f); - LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); + LightContext_RemoveLight(play, &play->lightCtx, this->unk198); } void EnMThunder_AdjustEnvLights(PlayState* play, f32 intensity) { @@ -141,98 +144,97 @@ void EnMThunder_AdjustEnvLights(PlayState* play, f32 intensity) { } void EnMThunder_EmptySpinAttack(EnMThunder* this, PlayState* play) { - Player* player = GET_PLAYER(play); + Player* player; + player = GET_PLAYER(play); if (player->stateFlags2 & PLAYER_STATE2_17) { if (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) { SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_ROLLING_CUT); SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_SWORD_SWING_HARD); } - Actor_Kill(&this->actor); return; } - if (!(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) { Actor_Kill(&this->actor); } } void EnMThunder_ChargingSpinAttack(EnMThunder* this, PlayState* play) { - Player* player = GET_PLAYER(play); - Actor* child = this->actor.child; + Player* player; + Actor* child; + player = GET_PLAYER(play); + child = this->actor.child; this->spinChargePercent = player->unk_858; this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; this->actor.shape.rot.y = player->actor.shape.rot.y + 0x8000; - - if (!this->isUsingMagic) { - if (player->unk_858 >= 0.1f) { - if ((gSaveContext.magicState != MAGIC_STATE_IDLE) || - (PARAMS_GET_S(this->actor.params, 8, 8) && - !(Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_WAIT_PREVIEW)))) { - EnMThunder_EmptySpinAttack(this, play); - EnMThunder_SetupAction(this, EnMThunder_EmptySpinAttack); - this->chargeAlpha = 0; - this->dimmingIntensity = 0.0; - this->spinAttackTimer = 0.0f; - return; - } - - this->isUsingMagic = true; + if (!this->isUsingMagic && (player->unk_858 >= 0.10f)) { + if ((gSaveContext.magicState != MAGIC_STATE_IDLE) || + ((PARAMS_GET_S(this->actor.params, 8, 8) != 0) && + (Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_WAIT_PREVIEW) == 0))) { + EnMThunder_EmptySpinAttack(this, play); + EnMThunder_SetupAction(this, EnMThunder_EmptySpinAttack); + this->chargeAlpha = 0; + this->dimmingIntensity = 0; + this->spinAttackTimer = 0.0f; + return; } + this->isUsingMagic = true; } - - if (player->unk_858 >= 0.1f) { - Rumble_Request(0.0f, (s32)(player->unk_858 * 150.0f), 2, (s32)(player->unk_858 * 150.0f)); + if (player->unk_858 >= 0.10f) { + Rumble_Request(0.0f, (u8)(s32)(player->unk_858 * 150.0f), 2, (u8)(s32)(player->unk_858 * 150.0f)); } - if (player->stateFlags2 & PLAYER_STATE2_17) { if ((child != NULL) && (child->update != NULL)) { child->parent = NULL; } - if (player->unk_858 <= 0.15f) { - if ((player->unk_858 >= 0.1f) && (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H)) { + if ((player->unk_858 >= 0.10f) && (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H)) { SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_ROLLING_CUT); SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_SWORD_SWING_HARD); } Actor_Kill(&this->actor); return; - } else { - player->stateFlags2 &= ~PLAYER_STATE2_17; - if (PARAMS_GET_S(this->actor.params, 8, 8)) { - gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; + } + player->stateFlags2 &= ~PLAYER_STATE2_17; + if (PARAMS_GET_S(this->actor.params, 8, 8) != 0) { + gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; + } + if (player->unk_858 < 0.85f) { + this->unk14C.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; + this->attackStrength = M_THUNDER_ATTACK_WEAK; + if (this->swordType == M_THUNDER_SWORD_KOKIRI) { + this->targetScale = 2; + } else { + this->targetScale = 4; } - if (player->unk_858 < 0.85f) { - this->collider.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; - this->attackStrength = M_THUNDER_ATTACK_WEAK; - this->targetScale = ((this->swordType == M_THUNDER_SWORD_KOKIRI) ? 2 : 4); + } else { + this->unk14C.elem.atDmgInfo.dmgFlags = sJumpAttackDmgFlags[this->swordType]; + this->attackStrength = M_THUNDER_ATTACK_STRONG; + if (this->swordType == M_THUNDER_SWORD_KOKIRI) { + this->targetScale = 4; } else { - this->collider.elem.atDmgInfo.dmgFlags = sJumpAttackDmgFlags[this->swordType]; - this->attackStrength = M_THUNDER_ATTACK_STRONG; - this->targetScale = ((this->swordType == M_THUNDER_SWORD_KOKIRI) ? 4 : 8); + this->targetScale = 8; } + } + EnMThunder_SetupAction(this, EnMThunder_SpinAttacking); + this->followPlayerTimer = 8; - EnMThunder_SetupAction(this, EnMThunder_SpinAttacking); - this->followPlayerTimer = 8; - - { - static u16 sSfxIds[] = { - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, - NA_SE_IT_ROLLING_CUT_LV2, - NA_SE_IT_ROLLING_CUT_LV1, - }; - - SFX_PLAY_AT_POS(&player->actor.projectedPos, sSfxIds[this->attackStrength]); - } + { + static u16 D_80AA0464[4] = { + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + NA_SE_IT_ROLLING_CUT_LV2, + NA_SE_IT_ROLLING_CUT_LV1, + }; - this->spinAttackTimer = 1.0f; - return; + SFX_PLAY_AT_POS(&player->actor.projectedPos, D_80AA0464[this->attackStrength]); } - } + this->spinAttackTimer = 1.0f; + return; + } if (!(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) { if (this->actor.child != NULL) { this->actor.child->parent = NULL; @@ -240,31 +242,28 @@ void EnMThunder_ChargingSpinAttack(EnMThunder* this, PlayState* play) { Actor_Kill(&this->actor); return; } - if (player->unk_858 > 0.15f) { - this->chargeAlpha = 255; + this->chargeAlpha = 0xFF; if (this->actor.child == NULL) { Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EFF_DUST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, this->swordType + 2); } - this->dimmingIntensity += ((((player->unk_858 - 0.15f) * 1.5f) - this->dimmingIntensity) * 0.5f); - - } else if (player->unk_858 > .1f) { - this->chargeAlpha = (s32)((player->unk_858 - .1f) * 255.0f * 20.0f); - this->spinAttackTimer = (player->unk_858 - .1f) * 10.0f; + this->dimmingIntensity = + this->dimmingIntensity + ((((player->unk_858 - 0.15f) * 1.5f) - this->dimmingIntensity) * 0.5f); + } else if (player->unk_858 > 0.1f) { + this->chargeAlpha = (u8)(s32)((player->unk_858 - 0.1f) * 255.0f * 20.0f); + this->spinAttackTimer = (player->unk_858 - 0.1f) * 10.0f; } else { this->chargeAlpha = 0; } - if (player->unk_858 > 0.85f) { Audio_PlaySwordChargeSfx(&player->actor.projectedPos, 2); } else if (player->unk_858 > 0.15f) { Audio_PlaySwordChargeSfx(&player->actor.projectedPos, 1); - } else if (player->unk_858 > 0.1f) { + } else if (player->unk_858 > 0.10f) { Audio_PlaySwordChargeSfx(&player->actor.projectedPos, 0); } - if (Play_InCsMode(play)) { Actor_Kill(&this->actor); } @@ -272,106 +271,98 @@ void EnMThunder_ChargingSpinAttack(EnMThunder* this, PlayState* play) { void EnMThunder_UpdateSpinAttack(EnMThunder* this, PlayState* play) { if (this->followPlayerTimer < 2) { - if (this->chargeAlpha < 40) { + if (this->chargeAlpha < 0x28) { this->chargeAlpha = 0; } else { - this->chargeAlpha -= 40; + this->chargeAlpha = this->chargeAlpha - 0x28; } } - this->spinTrailTexScroll += 2.0f * this->spinAttackAlpha; - if (this->dimmingIntensity < this->spinAttackTimer) { - this->dimmingIntensity += ((this->spinAttackTimer - this->dimmingIntensity) * 0.1f); + this->dimmingIntensity = this->dimmingIntensity + ((this->spinAttackTimer - this->dimmingIntensity) * 0.1f); } else { this->dimmingIntensity = this->spinAttackTimer; } } void EnMThunder_SpinAttacking(EnMThunder* this, PlayState* play) { - Player* player = GET_PLAYER(play); + Player* player; + player = GET_PLAYER(play); if (Math_StepToF(&this->spinAttackTimer, 0.0f, 1 / 16.0f)) { Actor_Kill(&this->actor); } else { Math_SmoothStepToF(&this->actor.scale.x, (s32)this->targetScale, 0.6f, 0.8f, 0.0f); Actor_SetScale(&this->actor, this->actor.scale.x); - this->collider.dim.radius = (this->actor.scale.x * 25.0f); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + this->unk14C.dim.radius = this->actor.scale.x * 25.0f; + Collider_UpdateCylinder(&this->actor, &this->unk14C); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk14C.base); } - if (this->followPlayerTimer > 0) { this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; this->actor.world.pos.z = player->bodyPartsPos[PLAYER_BODYPART_WAIST].z; - this->followPlayerTimer--; + this->followPlayerTimer = this->followPlayerTimer - 1; } - if (this->spinAttackTimer > 0.6f) { this->spinAttackAlpha = 1.0f; } else { this->spinAttackAlpha = this->spinAttackTimer * (5.0f / 3.0f); } - EnMThunder_UpdateSpinAttack(this, play); - if (Play_InCsMode(play)) { Actor_Kill(&this->actor); } } void EnMThunder_Update(Actor* thisx, PlayState* play) { + f32 temp_fv0; + s32 temp_v0; EnMThunder* this = (EnMThunder*)thisx; - f32 blueRadius; - s32 redGreen; this->actionFunc(this, play); EnMThunder_AdjustEnvLights(play, this->dimmingIntensity); - blueRadius = this->spinAttackTimer; - redGreen = (u32)(blueRadius * 255.0f) & 0xFF; - Lights_PointNoGlowSetInfo(&this->lightInfo, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, redGreen, redGreen, (u32)(blueRadius * 100.0f), - (s32)(blueRadius * 800.0f)); + temp_fv0 = this->spinAttackTimer; + temp_v0 = (u32)(temp_fv0 * 255.0f) & 0xFF; + Lights_PointNoGlowSetInfo(&this->unk19C, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, + temp_v0, temp_v0, temp_fv0 * 100.0f, temp_fv0 * 800.0f); } +static f32 sSpinChargeScale[9] = { 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.25f, 0.2f, 0.15f, 0.0f }; + void EnMThunder_Draw(Actor* thisx, PlayState* play2) { - static f32 sSpinChargeScale[] = { 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.25f, 0.2f, 0.15f }; + f32 spinChargeScale; PlayState* play = play2; + Player* player; EnMThunder* this = (EnMThunder*)thisx; - Player* player = GET_PLAYER(play); - f32 spinChargeScale; s32 chargeTexScroll; - OPEN_DISPS(play->state.gfxCtx, "../z_en_m_thunder.c", 844); + player = GET_PLAYER(play); + OPEN_DISPS(play->state.gfxCtx, "../z_en_m_thunder.c", 0x34C); Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_Scale(0.02f, 0.02f, 0.02f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_m_thunder.c", 853); - switch (this->attackStrength) { case M_THUNDER_ATTACK_STRONG: case M_THUNDER_ATTACK_WEAK: - gSPSegment(POLY_XLU_DISP++, 0x08, + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, - 0xFF - ((u8)(s32)(this->spinTrailTexScroll * 30) & 0xFF), 0, 64, 32, 1, - 0xFF - ((u8)(s32)(this->spinTrailTexScroll * 20) & 0xFF), 0, 8, 8)); + 0xFF - ((u8)(s32)(this->spinTrailTexScroll * 30.0f) & 0xFF), 0, 64, 32, 1, + 0xFF - ((u8)(s32)(this->spinTrailTexScroll * 20.0f) & 0xFF), 0, 8, 8)); break; } - switch (this->attackStrength) { case M_THUNDER_ATTACK_STRONG: - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, (u8)(this->spinAttackAlpha * 255)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 255, 255, 0xAA, (u8)(this->spinAttackAlpha * 255.0f)); gSPDisplayList(POLY_XLU_DISP++, gSpinAttack3DL); gSPDisplayList(POLY_XLU_DISP++, gSpinAttack4DL); break; case M_THUNDER_ATTACK_WEAK: - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, (u8)(this->spinAttackAlpha * 255)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 0xAA, 255, 255, (u8)(this->spinAttackAlpha * 255.0f)); gSPDisplayList(POLY_XLU_DISP++, gSpinAttack1DL); gSPDisplayList(POLY_XLU_DISP++, gSpinAttack2DL); break; } - Matrix_Mult(&player->mf_9E0, MTXMODE_NEW); - switch (this->swordType) { case M_THUNDER_SWORD_KOKIRI: Matrix_Translate(0.0f, 220.0f, 0.0f, MTXMODE_APPLY); @@ -389,27 +380,23 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) { Matrix_RotateX(16384.0f, MTXMODE_APPLY); break; } - if (this->spinChargePercent >= 0.85f) { - spinChargeScale = (sSpinChargeScale[(play->gameplayFrames & 7)] * 6.0f) + 1.0f; - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->chargeAlpha); + spinChargeScale = (sSpinChargeScale[play->gameplayFrames & 7] * 6.0f) + 1.0f; + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 255, 255, 0xAA, this->chargeAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); - chargeTexScroll = 40; + chargeTexScroll = 0x28; } else { - spinChargeScale = (sSpinChargeScale[play->gameplayFrames & 7] * 2.0f) + 1.0f; - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->chargeAlpha); + spinChargeScale = (2.0f * sSpinChargeScale[play->gameplayFrames & 7]) + 1.0f; + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, 0xAA, 255, 255, this->chargeAlpha); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128); - chargeTexScroll = 20; + chargeTexScroll = 0x14; } Matrix_Scale(1.0f, spinChargeScale, spinChargeScale, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_m_thunder.c", 960); - - gSPSegment(POLY_XLU_DISP++, 0x09, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (play->gameplayFrames * 5) & 0xFF, 0, 32, 32, 1, - (play->gameplayFrames * 20) & 0xFF, (play->gameplayFrames * chargeTexScroll) & 0xFF, 8, - 8)); - + gSPSegment(POLY_XLU_DISP++, 9, + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (play->gameplayFrames * 5) & 0xFF, 0U, 32, 32, 1, + (play->gameplayFrames * 0x14) & 0xFF, (play->gameplayFrames * chargeTexScroll) & 0xFF, + 8, 8)); gSPDisplayList(POLY_XLU_DISP++, gSpinAttackChargingDL); - - CLOSE_DISPS(play->state.gfxCtx, "../z_en_m_thunder.c", 1031); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_m_thunder.c", 0x407); } diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h index 7c9068f7d64..1eec81ac71b 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h @@ -10,22 +10,24 @@ struct EnMThunder; typedef void (*EnMThunderActionFunc)(struct EnMThunder*, struct PlayState*); typedef struct EnMThunder { - /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderCylinder collider; - /* 0x0198 */ LightNode* lightNode; - /* 0x019C */ LightInfo lightInfo; - /* 0x01AC */ f32 spinAttackTimer; - /* 0x01B0 */ f32 spinAttackAlpha; - /* 0x01B4 */ f32 spinTrailTexScroll; - /* 0x01B8 */ f32 spinChargePercent; - /* 0x01BC */ f32 dimmingIntensity; - /* 0x01C0 */ EnMThunderActionFunc actionFunc; - /* 0x01C4 */ u16 followPlayerTimer; - /* 0x01C6 */ u8 attackStrength; // see `EnMThunderAttackStrength` - /* 0x01C7 */ u8 swordType; // see `EnMThunderSwordType` - /* 0x01C8 */ u8 chargeAlpha; - /* 0x01C9 */ u8 targetScale; - /* 0x01CA */ u8 isUsingMagic; -} EnMThunder; // size = 0x01CC + /* 0x000 */ Actor actor; + /* 0x14C */ ColliderCylinder unk14C; + /* 0x198 */ LightNode* unk198; + /* 0x19C */ LightInfo unk19C; + /* 0x1AA */ char pad1AA[2]; + /* 0x1AC */ f32 spinAttackTimer; + /* 0x1B0 */ f32 spinAttackAlpha; + /* 0x1B4 */ f32 spinTrailTexScroll; + /* 0x1B8 */ f32 spinChargePercent; + /* 0x1BC */ f32 dimmingIntensity; + /* 0x1C0 */ EnMThunderActionFunc actionFunc; + /* 0x1C4 */ u16 followPlayerTimer; + /* 0x1C6 */ u8 attackStrength; // see `EnMThunderAttackStrength` + /* 0x1C7 */ u8 swordType; // see `EnMThunderSwordType` + /* 0x1C8 */ u8 chargeAlpha; + /* 0x1C9 */ u8 targetScale; + /* 0x1CA */ u8 isUsingMagic; + /* 0x1CB */ char pad1CB[1]; +} EnMThunder; // size = 0x1CC #endif 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 e52a54d5e44..3d0803a0a2f 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -395,9 +395,9 @@ void EnMag_Update(Actor* thisx, PlayState* play) { } } -BAD_RETURN(s32) EnMag_DrawTextureI8(Gfx** gfxP, void* texture, s16 texWidth, s16 texHeight, s16 rectLeft, s16 rectTop, +BAD_RETURN(s32) EnMag_DrawTextureI8(Gfx** gfxp, void* texture, s16 texWidth, s16 texHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy) { - Gfx* gfx = *gfxP; + Gfx* gfx = *gfxp; gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_I, G_IM_SIZ_8b, texWidth, texHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); @@ -405,14 +405,14 @@ BAD_RETURN(s32) EnMag_DrawTextureI8(Gfx** gfxP, void* texture, s16 texWidth, s16 gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); - *gfxP = gfx; + *gfxp = gfx; } -BAD_RETURN(s32) EnMag_DrawEffectTextures(Gfx** gfxP, void* maskTex, void* effectTex, s16 maskWidth, s16 maskHeight, +BAD_RETURN(s32) EnMag_DrawEffectTextures(Gfx** gfxp, void* maskTex, void* effectTex, s16 maskWidth, s16 maskHeight, s16 effectWidth, s16 effectHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy, u16 shifts, u16 shiftt, u16 flag, EnMag* this) { - Gfx* gfx = *gfxP; + Gfx* gfx = *gfxp; gDPLoadMultiBlock_4b(gfx++, maskTex, 0x0000, G_TX_RENDERTILE, G_IM_FMT_I, maskWidth, maskHeight, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -428,11 +428,11 @@ BAD_RETURN(s32) EnMag_DrawEffectTextures(Gfx** gfxP, void* maskTex, void* effect gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, dsdx, dtdy); - *gfxP = gfx; + *gfxp = gfx; } -void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32 width, u32 height) { - Gfx* gfx = *gfxP; +void EnMag_DrawImageRGBA32(Gfx** gfxp, s16 centerX, s16 centerY, u8* source, u32 width, u32 height) { + Gfx* gfx = *gfxp; u8* curTexture; s32 textureCount; u32 rectLeft; @@ -488,7 +488,7 @@ void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32 } } - *gfxP = gfx; + *gfxp = gfx; } #if PLATFORM_N64 @@ -517,8 +517,8 @@ void func_80AEEA48_unknown(Gfx** gfxP, s16 arg1, s16 arg2, u32 arg3) { } #endif -void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) { - Gfx* gfx = *gfxP; +void EnMag_DrawCharTexture(Gfx** gfxp, u8* texture, s32 rectLeft, s32 rectTop) { + Gfx* gfx = *gfxp; YREG(0) = 1024.0f / (YREG(1) / 100.0f); YREG(2) = 16.0f * (YREG(1) / 100.0f); @@ -529,7 +529,7 @@ void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) { gSPTextureRectangle(gfx++, rectLeft << 2, rectTop << 2, (rectLeft + YREG(2)) << 2, (rectTop + YREG(2)) << 2, G_TX_RENDERTILE, 0, 0, YREG(0), YREG(0)); - *gfxP = gfx; + *gfxp = gfx; } #if PLATFORM_IQUE @@ -545,7 +545,7 @@ void EnMag_DrawCharTexture(Gfx** gfxP, u8* texture, s32 rectLeft, s32 rectTop) { #define TITLE_X_SHIFT (-32) #endif -void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { +void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { static s16 textAlpha = 0; static s16 textFadeDirection = 0; static s16 textFadeTimer = 0; @@ -557,17 +557,11 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { // For iQue, the word "PRESS" is drawn below as a Chinese character instead (gTitlePressCHN) static u8 pressStartFontIndices[] = { #if !PLATFORM_IQUE - FILENAME_UPPERCASE('P'), - FILENAME_UPPERCASE('R'), - FILENAME_UPPERCASE('E'), - FILENAME_UPPERCASE('S'), - FILENAME_UPPERCASE('S'), + FILENAME_UPPERCASE('P'), FILENAME_UPPERCASE('R'), FILENAME_UPPERCASE('E'), + FILENAME_UPPERCASE('S'), FILENAME_UPPERCASE('S'), #endif - FILENAME_UPPERCASE('S'), - FILENAME_UPPERCASE('T'), - FILENAME_UPPERCASE('A'), - FILENAME_UPPERCASE('R'), - FILENAME_UPPERCASE('T'), + FILENAME_UPPERCASE('S'), FILENAME_UPPERCASE('T'), FILENAME_UPPERCASE('A'), + FILENAME_UPPERCASE('R'), FILENAME_UPPERCASE('T'), }; static void* effectMaskTextures[] = { gTitleEffectMask00Tex, gTitleEffectMask01Tex, gTitleEffectMask02Tex, @@ -577,7 +571,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { EnMag* this = (EnMag*)thisx; Font* font = &this->font; s32 pad; - Gfx* gfx = *gfxP; + Gfx* gfx = *gfxp; u16 i, j, k; u16 rectLeft; u16 rectTop; @@ -879,7 +873,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) { } } - *gfxP = gfx; + *gfxp = gfx; } void EnMag_Draw(Actor* thisx, PlayState* play) { 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 bc06afc2b20..f2be2bc220f 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -1,9 +1,3 @@ -/* - * File: z_en_mb.c - * Overlay: ovl_En_Mb - * Description: Moblins - */ - #include "z_en_mb.h" #include "libc64/qrand.h" @@ -683,7 +677,7 @@ void EnMb_SpearPatrolTurnTowardsWaypoint(EnMb* this, PlayState* play) { if (ABS(this->actor.yDistToPlayer) <= 20.0f && EnMb_IsPlayerInCorridor(this, play)) { relYawFromPlayer = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (ABS(relYawFromPlayer) <= 0x4000 || (func_8002DDE4(play) && this->actor.xzDistToPlayer < 160.0f)) { + if (ABS(relYawFromPlayer) <= 0x4000 || ((func_8002DDE4(play) != 0) && this->actor.xzDistToPlayer < 160.0f)) { EnMb_FindWaypointTowardsPlayer(this, play); Actor_PlaySfx(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); @@ -1235,7 +1229,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { f32 playSpeedABS; if (Math_Vec3f_DistXZ(&this->waypointPos, &this->actor.world.pos) <= 8.0f || - (Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f)) { + Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f) { EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } else { Math_SmoothStepToF(&this->actor.speed, 0.59999996f, 0.1f, 1.0f, 0.0f); @@ -1248,7 +1242,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { yDistToPlayerAbs = (this->actor.yDistToPlayer >= 0.0f) ? this->actor.yDistToPlayer : -this->actor.yDistToPlayer; if (yDistToPlayerAbs <= 20.0f && EnMb_IsPlayerInCorridor(this, play)) { relYawTowardsPlayer = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer); - if (ABS(relYawTowardsPlayer) <= 0x4000 || (func_8002DDE4(play) && this->actor.xzDistToPlayer < 160.0f)) { + if (ABS(relYawTowardsPlayer) <= 0x4000 || func_8002DDE4(play) != 0 && this->actor.xzDistToPlayer < 160.0f) { EnMb_FindWaypointTowardsPlayer(this, play); Actor_PlaySfx(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); @@ -1274,7 +1268,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { playSpeedABS = (this->skelAnime.playSpeed >= 0.0f) ? this->skelAnime.playSpeed : -this->skelAnime.playSpeed; if (prevFrame != (s32)this->skelAnime.curFrame) { if ((beforeCurFrame <= 1 && (s32)playSpeedABS + prevFrame >= 1) || - (beforeCurFrame <= 20 && (s32)playSpeedABS + prevFrame >= 20)) { + beforeCurFrame <= 20 && (s32)playSpeedABS + prevFrame >= 20) { Actor_PlaySfx(&this->actor, NA_SE_EN_MORIBLIN_WALK); } } 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 aae2954469b..44af2268dd2 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -1,9 +1,3 @@ -/* - * File: z_en_md.c - * Overlay: ovl_En_Md - * Description: Mido - */ - #include "z_en_md.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" @@ -37,6 +31,9 @@ void EnMd_BlockPath(EnMd* this, PlayState* play); void EnMd_ListenToOcarina(EnMd* this, PlayState* play); void EnMd_Walk(EnMd* this, PlayState* play); +extern AnimationHeader D_60002C8; +extern SkeletonHeader D_6007FB8; + ActorProfile En_Md_Profile = { /**/ ACTOR_EN_MD, /**/ ACTORCAT_NPC, @@ -49,27 +46,12 @@ ActorProfile En_Md_Profile = { /**/ EnMd_Draw, }; -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_2, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_NONE, - OCELEM_ON, - }, - { 36, 46, 0, { 0, 0, 0 } }, +ColliderCylinderInit D_80AAC310 = { + { 0xA, 0, 0, 0x39, 0x20, 1 }, + { 0, { 0, 0, 0 }, { 0, 0, 0 }, 0, 0, 1 }, + { 0x24, 0x2E, 0, { 0, 0, 0 } }, }; - -static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; +CollisionCheckInfoInit2 D_80AAC33C = { 0, 0, 0, 0, 0xFF }; typedef enum EnMdAnimSequence { /* 0x0 */ ENMD_ANIM_SEQ_NONE, @@ -119,26 +101,34 @@ static AnimationInfo sAnimationInfo[] = { { &gMidoAnnoyedToHaltAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { &gMidoIdleToAnnoyedAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, }; +Vec3f D_80AAC498 = { 400.0f, 0.0f, 0.0f }; +void* D_80AAC4A4[3] = { + gMidoEyeOpenTex, + gMidoEyeHalfTex, + gMidoEyeClosedTex, +}; void EnMd_ReverseAnimation(EnMd* this) { - f32 startFrame; + f32 temp_fv0; + f32 temp_fv1; - startFrame = this->skelAnime.startFrame; - this->skelAnime.startFrame = this->skelAnime.endFrame; - this->skelAnime.curFrame = this->skelAnime.endFrame; - this->skelAnime.endFrame = startFrame; - this->skelAnime.playSpeed = -1.0f; + temp_fv0 = this->unk14C.startFrame; + temp_fv1 = this->unk14C.endFrame; + this->unk14C.startFrame = temp_fv1; + this->unk14C.curFrame = temp_fv1; + this->unk14C.endFrame = temp_fv0; + this->unk14C.playSpeed = -1.0f; } void EnMd_UpdateAnimSequence_IdleToHalt(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_HALT); this->animSequenceEntry++; } break; @@ -148,12 +138,12 @@ void EnMd_UpdateAnimSequence_IdleToHalt(EnMd* this) { void EnMd_UpdateAnimSequence_HaltToCurious(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT_TO_CURIOUS); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_HALT_TO_CURIOUS); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS); this->animSequenceEntry++; } break; @@ -163,21 +153,21 @@ void EnMd_UpdateAnimSequence_HaltToCurious(EnMd* this) { void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); this->animSequenceEntry++; } else { break; } FALLTHROUGH; case 2: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_WALK); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_WALK); this->animSequenceEntry++; } break; @@ -187,12 +177,12 @@ void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { void EnMd_UpdateAnimSequence_TwitchIdle_Unused(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -202,13 +192,13 @@ void EnMd_UpdateAnimSequence_TwitchIdle_Unused(EnMd* this) { void EnMd_UpdateAnimSequence_HaltToIdle(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -218,12 +208,12 @@ void EnMd_UpdateAnimSequence_HaltToIdle(EnMd* this) { void EnMd_UpdateAnimSequence_SurpriseToAnnoyed(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } break; @@ -233,13 +223,13 @@ void EnMd_UpdateAnimSequence_SurpriseToAnnoyed(EnMd* this) { void EnMd_UpdateAnimSequence_SurpriseToIdle(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -249,12 +239,12 @@ void EnMd_UpdateAnimSequence_SurpriseToIdle(EnMd* this) { void EnMd_UpdateAnimSequence_CuriousToAnnoyed(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS_TO_ANNOYED); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS_TO_ANNOYED); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } break; @@ -264,12 +254,12 @@ void EnMd_UpdateAnimSequence_CuriousToAnnoyed(EnMd* this) { void EnMd_UpdateAnimSequence_AnnoyedToHalt(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED_TO_HALT); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED_TO_HALT); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_HALT); this->animSequenceEntry++; } break; @@ -279,12 +269,12 @@ void EnMd_UpdateAnimSequence_AnnoyedToHalt(EnMd* this) { void EnMd_UpdateAnimSequence_IdleToAnnoyed(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_ANNOYED); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_ANNOYED); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } break; @@ -294,13 +284,13 @@ void EnMd_UpdateAnimSequence_IdleToAnnoyed(EnMd* this) { void EnMd_UpdateAnimSequence_StopWalking(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -345,8 +335,11 @@ void EnMd_UpdateAnimSequence(EnMd* this) { case ENMD_ANIM_SEQ_IDLE_TO_ANNOYED: EnMd_UpdateAnimSequence_IdleToAnnoyed(this); break; - case ENMD_ANIM_SEQ_STOP_WALKING: + case 11: EnMd_UpdateAnimSequence_StopWalking(this); + break; + default: + break; } } @@ -363,7 +356,7 @@ void EnMd_UpdateAnimSequence_WithTalking(EnMd* this) { if ((this->messageEntry == 5) && (this->animSequence != ENMD_ANIM_SEQ_CURIOUS_TO_ANNOYED)) { EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_CURIOUS_TO_ANNOYED); } - if ((this->messageEntry == 11) && (this->animSequence != ENMD_ANIM_SEQ_ANNOYED_TO_HALT)) { + if ((this->messageEntry == 0xB) && (this->animSequence != ENMD_ANIM_SEQ_ANNOYED_TO_HALT)) { EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_ANNOYED_TO_HALT); } break; @@ -394,109 +387,96 @@ void EnMd_UpdateAnimSequence_WithTalking(EnMd* this) { } break; } - } else if (this->skelAnime.animation != &gMidoIdleAnim) { - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + } else if (this->unk14C.animation != &gMidoIdleAnim) { + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_NONE); } - EnMd_UpdateAnimSequence(this); } -s16 EnMd_TrackMessageState(EnMd* this, PlayState* play) { - s16 messageState = Message_GetState(&play->msgCtx); +s16 EnMd_TrackMessageState(Actor* thisx, PlayState* play) { + EnMd* this = (EnMd*)thisx; + s16 messageState; - if ((this->messageState == TEXT_STATE_AWAITING_NEXT) || (this->messageState == TEXT_STATE_EVENT) || - (this->messageState == TEXT_STATE_CLOSING) || (this->messageState == TEXT_STATE_DONE_HAS_NEXT)) { - if (this->messageState != messageState) { - this->messageEntry++; - } + messageState = Message_GetState(&play->msgCtx); + if (((this->messageState == TEXT_STATE_AWAITING_NEXT) || (this->messageState == TEXT_STATE_EVENT) || + (this->messageState == TEXT_STATE_CLOSING) || (this->messageState == TEXT_STATE_DONE_HAS_NEXT)) && + (this->messageState != messageState)) { + this->messageEntry++; } - this->messageState = messageState; return messageState; } -u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) { - u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_MIDO); +u16 func_80AAACF8(PlayState* play, EnMd* this) { + u16 textId; + textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_MIDO); if (textId != 0) { return textId; } - this->messageEntry = 0; this->messageState = TEXT_STATE_NONE; - if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { return 0x1045; } - if (GET_EVENTCHKINF(EVENTCHKINF_04)) { return 0x1034; } - if ((CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) == EQUIP_VALUE_SHIELD_DEKU) && (CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_KOKIRI)) { return 0x1033; } - if (GET_INFTABLE(INFTABLE_0C)) { return 0x1030; } - return 0x102F; } -u16 EnMd_GetTextIdMidosHouse(PlayState* play, EnMd* this) { +u16 func_80AAADE0(PlayState* play, EnMd* this) { this->messageEntry = 0; this->messageState = TEXT_STATE_NONE; - if (GET_EVENTCHKINF(EVENTCHKINF_40)) { return 0x1028; } - return 0x1046; } -u16 EnMd_GetTextIdLostWoods(PlayState* play, EnMd* this) { +u16 func_80AAAE14(PlayState* play, EnMd* this) { this->messageEntry = 0; this->messageState = TEXT_STATE_NONE; - if (GET_EVENTCHKINF(EVENTCHKINF_48)) { if (GET_INFTABLE(INFTABLE_19)) { return 0x1071; + } else { + return 0x1070; } - return 0x1070; - } - - if (GET_EVENTCHKINF(EVENTCHKINF_0A)) { + } else if (GET_EVENTCHKINF(EVENTCHKINF_0A)) { return 0x1068; - } - - if (GET_INFTABLE(INFTABLE_15)) { + } else if (GET_INFTABLE(INFTABLE_15)) { return 0x1061; + } else { + return 0x1060; } - - return 0x1060; } -u16 EnMd_GetTextId(PlayState* play, Actor* thisx) { +u16 func_80AAAE94(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; switch (play->sceneId) { case SCENE_KOKIRI_FOREST: - return EnMd_GetTextIdKokiriForest(play, this); + return func_80AAACF8(play, this); case SCENE_MIDOS_HOUSE: - return EnMd_GetTextIdMidosHouse(play, this); + return func_80AAADE0(play, this); case SCENE_LOST_WOODS: - return EnMd_GetTextIdLostWoods(play, this); + return func_80AAAE14(play, this); default: return 0; } } s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) { - EnMd* this = (EnMd*)thisx; - switch (EnMd_TrackMessageState(this, play)) { + switch (EnMd_TrackMessageState(thisx, play)) { case TEXT_STATE_NONE: case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_FADING: @@ -506,8 +486,9 @@ s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) { case TEXT_STATE_8: case TEXT_STATE_9: return NPC_TALK_STATE_TALKING; + case TEXT_STATE_CLOSING: - switch (this->actor.textId) { + switch (thisx->textId) { case 0x1028: SET_EVENTCHKINF(EVENTCHKINF_0F); break; @@ -526,143 +507,136 @@ s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) { return NPC_TALK_STATE_ACTION; } return NPC_TALK_STATE_IDLE; + case TEXT_STATE_EVENT: if (Message_ShouldAdvance(play)) { return NPC_TALK_STATE_ACTION; } - FALLTHROUGH; - default: - return NPC_TALK_STATE_TALKING; + break; } + return NPC_TALK_STATE_TALKING; } -u8 EnMd_ShouldSpawn(EnMd* this, PlayState* play) { - if (play->sceneId == SCENE_KOKIRI_FOREST) { - if (!GET_EVENTCHKINF(EVENTCHKINF_1C) && !GET_EVENTCHKINF(EVENTCHKINF_40)) { - return 1; - } - } - - if (play->sceneId == SCENE_MIDOS_HOUSE) { - if (GET_EVENTCHKINF(EVENTCHKINF_1C) || GET_EVENTCHKINF(EVENTCHKINF_40)) { - if (!LINK_IS_ADULT) { - return 1; - } - } - } - - if (play->sceneId == SCENE_LOST_WOODS) { +s32 func_80AAB03C(EnMd* this, PlayState* play) { + if ((play->sceneId == SCENE_KOKIRI_FOREST) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && + !GET_EVENTCHKINF(EVENTCHKINF_40)) { + return 1; + } else if ((play->sceneId == SCENE_MIDOS_HOUSE) && + ((gSaveContext.save.info.eventChkInf[1] & 0x1000) || (gSaveContext.save.info.eventChkInf[4] & 1)) && + !LINK_IS_ADULT) { + return 1; + } else if (play->sceneId == SCENE_LOST_WOODS) { return 1; + } else { + return 0; } - - return 0; } -void EnMd_UpdateEyes(EnMd* this) { - if (DECR(this->blinkTimer) == 0) { - this->eyeTexIndex++; - if (this->eyeTexIndex > 2) { - this->blinkTimer = Rand_S16Offset(30, 30); - this->eyeTexIndex = 0; +void func_80AAB0E0(EnMd* arg0) { + if (DECR(arg0->unk20C) == 0) { + arg0->unk20E += 1; + if (arg0->unk20E >= 3) { + arg0->unk20C = Rand_S16Offset(0x1E, 0x1E); + arg0->unk20E = 0; } } } void EnMd_UpdateTalking(EnMd* this, PlayState* play) { - Player* player = GET_PLAYER(play); - s16 absYawDiff; - s16 trackingMode; + Player* temp_a2; + s16 temp_v1; + s16 temp_ft1; s16 canUpdateTalking; - s16 yawDiff; + s16 trackingMode; + temp_a2 = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 170.0f) { - yawDiff = (f32)this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - absYawDiff = ABS(yawDiff); - - trackingMode = - absYawDiff <= Npc_GetTrackingPresetMaxPlayerYaw(2) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE; - canUpdateTalking = true; + temp_ft1 = (f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y; + temp_v1 = ABS(temp_ft1); + if (temp_v1 <= Npc_GetTrackingPresetMaxPlayerYaw(2)) { + trackingMode = NPC_TRACKING_HEAD_AND_TORSO; + canUpdateTalking = true; + } else { + trackingMode = NPC_TRACKING_NONE; + canUpdateTalking = true; + } } else { trackingMode = NPC_TRACKING_NONE; canUpdateTalking = false; } - if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { trackingMode = NPC_TRACKING_FULL_BODY; } - - if (this->actionFunc == EnMd_Walk) { + if (this->unk190 == EnMd_Walk) { trackingMode = NPC_TRACKING_NONE; canUpdateTalking = false; } - if (this->actionFunc == EnMd_Watch) { + if (this->unk190 == EnMd_Watch) { trackingMode = NPC_TRACKING_FULL_BODY; canUpdateTalking = true; } - - if ((play->csCtx.state != CS_STATE_IDLE) || gDebugCamEnabled) { + if ((play->csCtx.state != CS_STATE_IDLE) || (gDebugCamEnabled != 0)) { this->interactInfo.trackPos = play->view.eye; this->interactInfo.yOffset = 40.0f; trackingMode = NPC_TRACKING_HEAD_AND_TORSO; } else { - this->interactInfo.trackPos = player->actor.world.pos; - this->interactInfo.yOffset = (gSaveContext.save.linkAge > 0) ? 0.0f : -18.0f; + this->interactInfo.trackPos = temp_a2->actor.world.pos; + if (gSaveContext.save.linkAge > 0) { + this->interactInfo.yOffset = 0.0f; + } else { + this->interactInfo.yOffset = -18.0f; + } } - Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode); - if (this->actionFunc != EnMd_ListenToOcarina) { - if (canUpdateTalking) { - Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, - EnMd_GetTextId, EnMd_UpdateTalkState); - } + if ((this->unk190 != EnMd_ListenToOcarina) && canUpdateTalking) { + Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unk194.dim.radius + 30.0f, + func_80AAAE94, EnMd_UpdateTalkState); } } -u8 EnMd_FollowPath(EnMd* this, PlayState* play) { - Path* path; - Vec3s* pointPos; - f32 pathDiffX; - f32 pathDiffZ; +s32 func_80AAB370(EnMd* this, PlayState* play) { + Path* temp_a0; + s32 pad; + f32 temp_fa0; + f32 temp_fa1; + Vec3s* temp_v0; + s32 temp_a2; - if (ENMD_GET_PATH_INDEX_NOSHIFT(this) == (ENMD_PATH_NONE << 8)) { + temp_a2 = ENMD_GET_PATH_INDEX_NOSHIFT(this); + if (temp_a2 == (ENMD_PATH_NONE << 8)) { return 0; } - - path = &play->pathList[ENMD_GET_PATH_INDEX(this)]; - pointPos = SEGMENTED_TO_VIRTUAL(path->points); - pointPos += this->waypoint; - - pathDiffX = pointPos->x - this->actor.world.pos.x; - pathDiffZ = pointPos->z - this->actor.world.pos.z; - Math_SmoothStepToS(&this->actor.world.rot.y, Math_FAtan2F(pathDiffX, pathDiffZ) * (65536.0f / (2 * M_PI)), 4, 4000, - 1); - - if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 100.0f) { - this->waypoint++; - if (this->waypoint >= path->count) { - this->waypoint = 0; + temp_a0 = &play->pathList[temp_a2 >> 8]; + temp_v0 = SEGMENTED_TO_VIRTUAL(temp_a0->points); + temp_v0 += this->unk212; + temp_fa0 = (f32)temp_v0->x - this->actor.world.pos.x; + temp_fa1 = (f32)temp_v0->z - this->actor.world.pos.z; + Math_SmoothStepToS(&this->actor.world.rot.y, (Math_FAtan2F(temp_fa0, temp_fa1) * 10430.378f), 4, 0xFA0, 1); + if (((temp_fa0 * temp_fa0) + (temp_fa1 * temp_fa1)) < 100.0f) { + this->unk212++; + if (this->unk212 >= temp_a0->count) { + this->unk212 = 0; } return 1; } return 0; } -u8 EnMd_SetMovedPos(EnMd* this, PlayState* play) { - Path* path; - Vec3s* lastPointPos; +s32 func_80AAB4DC(EnMd* this, PlayState* play) { + Path* temp_a1; + s32 temp_v1; + Vec3s* temp_a3; - if (ENMD_GET_PATH_INDEX_NOSHIFT(this) == (ENMD_PATH_NONE << 8)) { + temp_v1 = ENMD_GET_PATH_INDEX_NOSHIFT(this); + if (temp_v1 == (ENMD_PATH_NONE << 8)) { return 0; } - - path = &play->pathList[ENMD_GET_PATH_INDEX(this)]; - lastPointPos = SEGMENTED_TO_VIRTUAL(path->points); - lastPointPos += path->count - 1; - - this->actor.world.pos.x = lastPointPos->x; - this->actor.world.pos.y = lastPointPos->y; - this->actor.world.pos.z = lastPointPos->z; - + temp_a1 = &play->pathList[temp_v1 >> 8]; + temp_a3 = SEGMENTED_TO_VIRTUAL(temp_a1->points); + temp_a3 += temp_a1->count - 1; + this->actor.world.pos.x = temp_a3->x; + this->actor.world.pos.y = temp_a3->y; + this->actor.world.pos.z = temp_a3->z; return 1; } @@ -670,15 +644,17 @@ void EnMd_UpdateAlphaByDistance(EnMd* this, PlayState* play) { f32 radius; if (play->sceneId != SCENE_MIDOS_HOUSE) { - radius = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && - (play->sceneId == SCENE_KOKIRI_FOREST)) - ? 100.0f - : 400.0f; - this->alpha = Actor_UpdateAlphaByDistance(&this->actor, play, this->alpha, radius); - this->actor.shape.shadowAlpha = this->alpha; + if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && + (play->sceneId == SCENE_KOKIRI_FOREST)) { + radius = 100.0f; + } else { + radius = 400.0f; + } + this->unk210 = Actor_UpdateAlphaByDistance(&this->actor, play, this->unk210, radius); + this->actor.shape.shadowAlpha = (u8)this->unk210; } else { - this->alpha = 255; - this->actor.shape.shadowAlpha = this->alpha; + this->unk210 = 255; + this->actor.shape.shadowAlpha = (u8)this->unk210; } } @@ -687,237 +663,207 @@ void EnMd_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->jointTable, this->morphTable, MIDO_LIMB_MAX); - - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (!EnMd_ShouldSpawn(this, play)) { + SkelAnime_InitFlex(play, &this->unk14C, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); + Collider_InitCylinder(play, &this->unk194); + Collider_SetCylinder(play, &this->unk194, &this->actor, &D_80AAC310); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AAC33C); + if (func_80AAB03C(this, play) == 0) { Actor_Kill(&this->actor); return; } - - Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_DEFAULT); + Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_DEFAULT); Actor_SetScale(&this->actor, 0.01f); this->actor.attentionRangeType = ATTENTION_RANGE_6; - this->alpha = 255; + this->unk210 = 255; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI); - if (((play->sceneId == SCENE_KOKIRI_FOREST) && !GET_EVENTCHKINF(EVENTCHKINF_04)) || ((play->sceneId == SCENE_KOKIRI_FOREST) && GET_EVENTCHKINF(EVENTCHKINF_04) && CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) || ((play->sceneId == SCENE_LOST_WOODS) && !GET_EVENTCHKINF(EVENTCHKINF_0A))) { this->actor.home.pos = this->actor.world.pos; - this->actionFunc = EnMd_BlockPath; - return; - } - - if (play->sceneId != SCENE_MIDOS_HOUSE) { - EnMd_SetMovedPos(this, play); + this->unk190 = EnMd_BlockPath; + } else { + if (play->sceneId != SCENE_MIDOS_HOUSE) { + func_80AAB4DC(this, play); + } + this->unk190 = EnMd_Idle; } - - this->actionFunc = EnMd_Idle; } void EnMd_Destroy(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; - Collider_DestroyCylinder(play, &this->collider); + + Collider_DestroyCylinder(play, &this->unk194); } void EnMd_Idle(EnMd* this, PlayState* play) { - if (this->skelAnime.animation == &gMidoIdleAnim) { + if (this->unk14C.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->animSequence != ENMD_ANIM_SEQ_SURPRISE_TO_IDLE)) { EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_SURPRISE_TO_IDLE); } - EnMd_UpdateAnimSequence_WithTalking(this); } void EnMd_Watch(EnMd* this, PlayState* play) { - if (this->skelAnime.animation == &gMidoIdleAnim) { + if (this->unk14C.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } EnMd_UpdateAnimSequence(this); } void EnMd_BlockPath(EnMd* this, PlayState* play) { - Player* player = GET_PLAYER(play); - f32 temp; - Actor* actorToBlock = &GET_PLAYER(play)->actor; - s16 yaw; - + Player* sp2C; + f32 temp_fv1; + Player* sp24; + s16 temp_v0_3; + s32 temp_v0_4; + + sp2C = GET_PLAYER(play); + sp24 = GET_PLAYER(play); EnMd_UpdateAnimSequence_WithTalking(this); - if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - - yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &actorToBlock->world.pos); - + this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; + temp_v0_3 = Math_Vec3f_Yaw(&this->actor.home.pos, &sp24->actor.world.pos); this->actor.world.pos.x = this->actor.home.pos.x; - this->actor.world.pos.x += 60.0f * Math_SinS(yaw); - + this->actor.world.pos.x += 60.0f * Math_SinS(temp_v0_3); this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.z += 60.0f * Math_CosS(yaw); - - temp = fabsf((f32)this->actor.yawTowardsPlayer - yaw) * 0.001f * 3.0f; - this->skelAnime.playSpeed = CLAMP(temp, 1.0f, 3.0f); + this->actor.world.pos.z += 60.0f * Math_CosS(temp_v0_3); + temp_fv1 = fabsf((f32)this->actor.yawTowardsPlayer - (f32)temp_v0_3) * 0.001f * 3.0f; + this->unk14C.playSpeed = CLAMP(temp_fv1, 1.0f, 3.0f); } - if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && (play->sceneId == SCENE_KOKIRI_FOREST)) { play->msgCtx.msgMode = MSGMODE_PAUSED; } - if (play->sceneId == SCENE_KOKIRI_FOREST) { SET_EVENTCHKINF(EVENTCHKINF_04); } if (play->sceneId == SCENE_LOST_WOODS) { SET_EVENTCHKINF(EVENTCHKINF_0A); } - EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_WALK_AWAY); EnMd_UpdateAnimSequence(this); - this->waypoint = 1; + this->unk212 = 1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - this->actionFunc = EnMd_Walk; + this->unk190 = EnMd_Walk; this->actor.speed = 1.5f; - return; - } - - if (this->skelAnime.animation == &gMidoIdleAnim) { - Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); - } - - if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_LOST_WOODS)) { - if (player->stateFlags2 & PLAYER_STATE2_24) { - player->stateFlags2 |= PLAYER_STATE2_25; - player->unk_6A8 = &this->actor; - Message_StartOcarina(play, OCARINA_ACTION_CHECK_SARIA); - this->actionFunc = EnMd_ListenToOcarina; - return; + } else { + if (this->unk14C.animation == &gMidoIdleAnim) { + Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } - - if (this->actor.xzDistToPlayer < (30.0f + this->collider.dim.radius)) { - player->stateFlags2 |= PLAYER_STATE2_23; + if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_LOST_WOODS)) { + if (sp2C->stateFlags2 & PLAYER_STATE2_24) { + sp2C->stateFlags2 |= PLAYER_STATE2_25; + sp2C->unk_6A8 = &this->actor; + Message_StartOcarina(play, OCARINA_ACTION_CHECK_SARIA); + this->unk190 = EnMd_ListenToOcarina; + } else if (this->actor.xzDistToPlayer < (30.0f + (f32)this->unk194.dim.radius)) { + sp2C->stateFlags2 |= PLAYER_STATE2_23; + } } } } void EnMd_ListenToOcarina(EnMd* this, PlayState* play) { - Player* player = GET_PLAYER(play); + Player* temp_v0; + temp_v0 = GET_PLAYER(play); if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { - this->actionFunc = EnMd_BlockPath; + this->unk190 = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { SFX_PLAY_CENTERED(NA_SE_SY_CORRECT_CHIME); this->actor.textId = 0x1067; - Actor_OfferTalk(&this->actor, play, this->collider.dim.radius + 30.0f); - - this->actionFunc = EnMd_BlockPath; + Actor_OfferTalk(&this->actor, play, (f32)this->unk194.dim.radius + 30.0f); + this->unk190 = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { - player->stateFlags2 |= PLAYER_STATE2_23; + temp_v0->stateFlags2 |= PLAYER_STATE2_23; } } void EnMd_Walk(EnMd* this, PlayState* play) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); EnMd_UpdateAnimSequence(this); - - if (!(EnMd_FollowPath(this, play)) || (this->waypoint != 0)) { + if ((func_80AAB370(this, play) == 0) || (this->unk212 != 0)) { this->actor.shape.rot = this->actor.world.rot; - return; - } - - if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && - (play->sceneId == SCENE_KOKIRI_FOREST)) { + } else if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && + (play->sceneId == SCENE_KOKIRI_FOREST)) { Message_CloseTextbox(play); SET_EVENTCHKINF(EVENTCHKINF_1C); Actor_Kill(&this->actor); - return; + } else { + EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_STOP_WALKING); + this->unk14C.playSpeed = 0.0f; + this->actor.speed = 0.0f; + this->actor.home.pos = this->actor.world.pos; + this->unk190 = EnMd_Watch; } - - EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_STOP_WALKING); - - this->skelAnime.playSpeed = 0.0f; - this->actor.speed = 0.0f; - this->actor.home.pos = this->actor.world.pos; - this->actionFunc = EnMd_Watch; } void EnMd_Update(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; s32 pad; - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - SkelAnime_Update(&this->skelAnime); - EnMd_UpdateEyes(this); + Collider_UpdateCylinder(&this->actor, &this->unk194); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk194.base); + SkelAnime_Update(&this->unk14C); + func_80AAB0E0(this); EnMd_UpdateAlphaByDistance(this, play); Actor_MoveXZGravity(&this->actor); EnMd_UpdateTalking(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->actionFunc(this, play); + this->unk190(this, play); } -s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { +s32 func_80AABEF0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; Vec3s limbRot; if (limbIndex == MIDO_LIMB_HEAD) { - Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(1200.0f, 0.0f, 0.0f, 1U); limbRot = this->interactInfo.headRot; Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); - Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(-1200.0f, 0.0f, 0.0f, 1U); } if (limbIndex == MIDO_LIMB_TORSO) { limbRot = this->interactInfo.torsoRot; Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); } - - if (((limbIndex == MIDO_LIMB_TORSO) || (limbIndex == MIDO_LIMB_LEFT_UPPER_ARM)) || + if ((limbIndex == MIDO_LIMB_TORSO) || (limbIndex == MIDO_LIMB_LEFT_UPPER_ARM) || (limbIndex == MIDO_LIMB_RIGHT_UPPER_ARM)) { - rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; - rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; + rot->y += (Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE); + rot->z += (Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE); } - - return false; + return 0; } -void EnMd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void func_80AAC104(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; - Vec3f vec = { 400.0f, 0.0f, 0.0f }; + Vec3f sp18; + sp18 = D_80AAC498; if (limbIndex == MIDO_LIMB_HEAD) { - Matrix_MultVec3f(&vec, &this->actor.focus.pos); + Matrix_MultVec3f(&sp18, &this->actor.focus.pos); } } void EnMd_Draw(Actor* thisx, PlayState* play) { - static void* sEyeTextures[] = { - gMidoEyeOpenTex, - gMidoEyeHalfTex, - gMidoEyeClosedTex, - }; EnMd* this = (EnMd*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_md.c", 1280); - - if (this->alpha == 255) { - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); - func_80034BA0(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); - } else if (this->alpha != 0) { - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); - func_80034CC4(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); + if (this->unk210 == 255) { + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80AAC4A4[this->unk20E])); + func_80034BA0(play, &this->unk14C, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); + } else if (this->unk210 != 0) { + gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80AAC4A4[this->unk20E])); + func_80034CC4(play, &this->unk14C, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); } - CLOSE_DISPS(play->state.gfxCtx, "../z_en_md.c", 1317); } 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 802e6822a86..a6f95356d8a 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -15,23 +15,23 @@ typedef void (*EnMdActionFunc)(struct EnMd*, struct PlayState*); #define ENMD_PATH_NONE 0xFF typedef struct EnMd { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ EnMdActionFunc actionFunc; - /* 0x0194 */ ColliderCylinder collider; - /* 0x01E0 */ NpcInteractInfo interactInfo; - /* 0x0208 */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` - /* 0x0209 */ u8 messageState; // last known result of `Message_GetState` - /* 0x020A */ u8 animSequenceEntry; // each one changes animation info and waits - /* 0x020B */ u8 animSequence; - /* 0x020C */ s16 blinkTimer; - /* 0x020E */ s16 eyeTexIndex; - /* 0x0210 */ s16 alpha; - /* 0x0212 */ s16 waypoint; - /* 0x0214 */ s16 fidgetTableY[MIDO_LIMB_MAX]; - /* 0x0236 */ s16 fidgetTableZ[MIDO_LIMB_MAX]; - /* 0x0258 */ Vec3s jointTable[MIDO_LIMB_MAX]; - /* 0x02BE */ Vec3s morphTable[MIDO_LIMB_MAX]; + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ EnMdActionFunc unk190; + /* 0x194 */ ColliderCylinder unk194; + /* 0x1E0 */ NpcInteractInfo interactInfo; + /* 0x208 */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` + /* 0x209 */ u8 messageState; // last known result of `Message_GetState` + /* 0x20A */ u8 animSequenceEntry; // each one changes animation info and waits + /* 0x20B */ u8 animSequence; + /* 0x20C */ s16 unk20C; + /* 0x20E */ s16 unk20E; + /* 0x210 */ s16 unk210; + /* 0x212 */ s16 unk212; + /* 0x214 */ s16 fidgetTableY[MIDO_LIMB_MAX]; + /* 0x236 */ s16 fidgetTableZ[MIDO_LIMB_MAX]; + /* 0x258 */ Vec3s unk258[MIDO_LIMB_MAX]; + /* 0x2BE */ Vec3s unk2BE[MIDO_LIMB_MAX]; } EnMd; // size = 0x0324 #endif diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 42846bd7aa9..d5e46241c21 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -361,12 +361,12 @@ s32 EnMk_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po rot->z += this->headRotation.x; } - return false; + return 0; } void EnMk_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f D_80AAD64C = { 1000.0f, -100.0f, 0.0f }; - EnMk* this = (EnMk*)thisx; + EnMk* this = thisx; if (limbIndex == 11) { Matrix_MultVec3f(&D_80AAD64C, &this->actor.focus.pos); 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 e4ded4a594d..e763f0a3f89 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -536,10 +536,9 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { if (GET_ITEMGETINF(ITEMGETINF_3B)) { s32 linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD); - // Draw Bunny Hood if (linkChildObjectSlot >= 0) { Mtx* mtx; - Vec3s earRot; + Vec3s sp50; Mtx* mtx2; mtx = GRAPH_ALLOC(play->state.gfxCtx, sizeof(Mtx) * 2); @@ -551,20 +550,18 @@ void EnMm_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x0B, mtx); gSPSegment(POLY_OPA_DISP++, 0x0D, mtx2 - 7); - // Draw the ears in the neutral position (unlike Player, no flopping physics) + sp50.x = 994; + sp50.y = 3518; + sp50.z = -13450; - // Right ear - earRot.x = 0x3E2; - earRot.y = 0xDBE; - earRot.z = -0x348A; - Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &earRot); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &sp50); MATRIX_TO_MTX(mtx++, "../z_en_mm.c", 1124); - // Left ear - earRot.x = -0x3E2; - earRot.y = -0xDBE; - earRot.z = -0x348A; - Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &earRot); + sp50.x = -994; + sp50.y = -3518; + sp50.z = -13450; + + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &sp50); MATRIX_TO_MTX(mtx, "../z_en_mm.c", 1131); gSPDisplayList(POLY_OPA_DISP++, gLinkChildBunnyHoodDL); diff --git a/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/src/overlays/actors/ovl_En_Ms/z_en_ms.c index d4e173f2bb7..7c262e003fb 100644 --- a/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -121,10 +121,12 @@ void EnMs_Wait(EnMs* this, PlayState* play) { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; EnMs_SetOfferText(this, play); - if (Actor_TalkOfferAccepted(&this->actor, play)) { this->actionFunc = EnMs_Talk; - } else if ((this->actor.xzDistToPlayer < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range + return; + } + + if ((this->actor.xzDistToPlayer < 90.0f) && (ABS(yawDiff) < 0x2000)) { // talk range Actor_OfferTalk(&this->actor, play, 90.0f); } } @@ -137,20 +139,22 @@ void EnMs_Talk(EnMs* this, PlayState* play) { if ((dialogState == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { // advanced final textbox this->actionFunc = EnMs_Wait; } - } else if (Message_ShouldAdvance(play)) { - switch (play->msgCtx.choiceIndex) { - case 0: // yes - if (gSaveContext.save.info.playerData.rupees < sPrices[BEANS_BOUGHT]) { - Message_ContinueTextbox(play, 0x4069); // not enough rupees text + } else { + if (Message_ShouldAdvance(play)) { + switch (play->msgCtx.choiceIndex) { + case 0: // yes + if (gSaveContext.save.info.playerData.rupees < sPrices[BEANS_BOUGHT]) { + Message_ContinueTextbox(play, 0x4069); // not enough rupees text + return; + } + Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEAN, 90.0f, 10.0f); + this->actionFunc = EnMs_Sell; + return; + case 1: // no + Message_ContinueTextbox(play, 0x4068); + default: return; - } - Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEAN, 90.0f, 10.0f); - this->actionFunc = EnMs_Sell; - return; - case 1: // no - Message_ContinueTextbox(play, 0x4068); - default: - return; + } } } } @@ -160,9 +164,9 @@ void EnMs_Sell(EnMs* this, PlayState* play) { Rupees_ChangeBy(-sPrices[BEANS_BOUGHT]); this->actor.parent = NULL; this->actionFunc = EnMs_TalkAfterPurchase; - } else { - Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEAN, 90.0f, 10.0f); + return; } + Actor_OfferGetItem(&this->actor, play, GI_MAGIC_BEAN, 90.0f, 10.0f); } void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { 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 d72977d3b09..08126a82536 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -1,9 +1,3 @@ -/* - * File: z_en_nb.c - * Overlay: ovl_En_Nb - * Description: Nabooru - */ - #include "z_en_nb.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" @@ -77,6 +71,34 @@ void EnNb_Destroy(Actor* thisx, PlayState* play); void EnNb_Update(Actor* thisx, PlayState* play); void EnNb_Draw(Actor* thisx, PlayState* play); +/* +extern FlexSkeletonHeader D_060181C8; +extern AnimationHeader D_06004BB4; // standing up hands on hips +extern AnimationHeader D_06006E78; +extern AnimationHeader D_06004E60; // getting up from crawlspace +extern AnimationHeader D_06004BB4; +extern AnimationHeader D_06009238; +extern AnimationHeader D_06009694; // hands on hips standing +extern AnimationHeader D_0600274C; // raising both arms up transition (giving medallion to link ?) +extern AnimationHeader D_06002B4C; // raising both arms up stable (giving medallion to link ?) +extern AnimationHeader D_06000410; // clasping hands together +extern AnimationHeader D_06001E7C; // looking around ? +extern AnimationHeader D_06001350; // i think this is the animation where she is in the purple thing +extern AnimationHeader D_06001104; // transition to raising arm up in purple portal +extern AnimationHeader D_06008BD0; // falls to the ground +extern AnimationHeader D_060046A8; // looking in crawlspace ? +extern AnimationHeader D_06003954; // on ground getting up ?? +extern AnimationHeader D_06004030; // looking behind her to the right +extern AnimationHeader D_06002DBC; // freaking out +extern AnimationHeader D_060035A8; // looking behind her +extern AnimationHeader D_06006320; // sees unk from behind, turns and runs +extern AnimationHeader D_06000BC0; // crossed legs +extern AnimationHeader D_06005CA4; // crossed legs, turns head and looks behind to the right +extern AnimationHeader D_06005614; // crossed legs, looking behind to the right +extern Gfx D_06013158[]; +extern UNK_TYPE D_0600D8E8; +*/ + static ColliderCylinderInitType1 sCylinderInit = { { COL_MATERIAL_HIT0, @@ -96,10 +118,10 @@ static ColliderCylinderInitType1 sCylinderInit = { { 25, 80, 0, { 0, 0, 0 } }, }; -static void* sEyeTextures[] = { - gNabooruEyeOpenTex, - gNabooruEyeHalfTex, - gNabooruEyeClosedTex, +static UNK_PTR sEyeTextures[] = { + object_nb_00B428_Tex, + object_nb_00D0E8_Tex, + object_nb_00D4E8_Tex, }; #if DEBUG_FEATURES @@ -336,7 +358,7 @@ void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 mo } void EnNb_SetChamberAnim(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsChamberOfSagesAnim, 0, 0, 0); + EnNb_SetCurrentAnim(this, &object_nb_009694_Anim, 0, 0, 0); this->actor.shape.yOffset = -10000.0f; } @@ -398,7 +420,7 @@ void EnNb_SetupDefaultChamberIdle(EnNb* this) { } void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { - AnimationHeader* animation = &gNabooruRaisingArmsGivingMedallionAnim; + AnimationHeader* animation = &object_nb_00274C_Anim; CsCmdActorCue* cue; if (play->csCtx.state != CS_STATE_IDLE) { @@ -412,7 +434,7 @@ void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { } void EnNb_SetupRaisedArmTransition(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &gNabooruArmsRaisedGivingMedallionAnim; + AnimationHeader* animation = &object_nb_002B4C_Anim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -479,7 +501,7 @@ void func_80AB19FC(EnNb* this, PlayState* play) { } void EnNb_SetupLightArrowOrSealingCs(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &gNabooruPuttingHandsTogetherCastingMagicAnim, 2, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_000410_Anim, 2, 0.0f, 0); this->action = NB_ACTION_7; this->actor.shape.shadowAlpha = 0; } @@ -598,7 +620,7 @@ void EnNb_DrawTransparency(EnNb* this, PlayState* play) { } void EnNb_InitKidnap(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &gNabooruTrappedInVortexPushingGroundAnim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_001E7C_Anim, 0, 0.0f, 0); this->action = NB_KIDNAPPED; this->actor.shape.shadowAlpha = 0; SET_EVENTCHKINF(EVENTCHKINF_95); @@ -648,7 +670,7 @@ void EnNb_SetupCaptureCutsceneState(EnNb* this, PlayState* play) { } void EnNb_SetRaisedArmCaptureAnim(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &gNabooruSuckedByVortexAnim; + AnimationHeader* animation = &object_nb_001350_Anim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -657,7 +679,7 @@ void EnNb_SetRaisedArmCaptureAnim(EnNb* this, s32 animFinished) { } void EnNb_SetupLookAroundInKidnap(EnNb* this) { - AnimationHeader* animation = &gNabooruTrappedInVortexPushingGroundAnim; + AnimationHeader* animation = &object_nb_001E7C_Anim; Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, -8.0f); this->action = NB_KIDNAPPED_LOOK_AROUND; @@ -665,7 +687,7 @@ void EnNb_SetupLookAroundInKidnap(EnNb* this) { } void EnNb_SetupKidnap(EnNb* this) { - AnimationHeader* animation = &gNabooruTrappedInVortexRaisingArmAnim; + AnimationHeader* animation = &object_nb_001104_Anim; Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, -8.0f); this->action = NB_PORTAL_FALLTHROUGH; @@ -729,7 +751,7 @@ void EnNb_SuckedInByPortal(EnNb* this, PlayState* play) { } void EnNb_SetupConfrontation(EnNb* this, PlayState* play) { - AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; + AnimationHeader* animation = &object_nb_008BD0_Anim; EnNb_SetCurrentAnim(this, animation, 0, 0.0f, 0); this->action = NB_IN_CONFRONTATION; @@ -788,28 +810,28 @@ void func_80AB26C8(EnNb* this) { void func_80AB26DC(EnNb* this, PlayState* play) { s32 pad; - AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; - f32 lastFrame = Animation_GetLastFrame(animation); + AnimationHeader* animation = &object_nb_008BD0_Anim; + f32 frames = Animation_GetLastFrame(animation); EnNb_SetStartPosRotFromCue1(this, play, 1); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); this->action = NB_ACTION_14; this->drawMode = NB_DRAW_KNEEL; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_SetupKneel(EnNb* this) { - AnimationHeader* animation = &gNabooruCollapseFromStandingToKneelingTransitionAnim; - f32 lastFrame = Animation_GetLastFrame(animation); + AnimationHeader* animation = &object_nb_008BD0_Anim; + f32 frames = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); this->action = NB_KNEEL; this->drawMode = NB_DRAW_KNEEL; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_CheckIfKneeling(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &gNabooruOnAllFoursAnim; + AnimationHeader* animation = &object_nb_0046A8_Anim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -819,17 +841,17 @@ void EnNb_CheckIfKneeling(EnNb* this, s32 animFinished) { } void EnNb_SetupLookRight(EnNb* this) { - AnimationHeader* animation = &gNabooruOnAllFoursToOnOneKneeLookingRightTransitionAnim; - f32 lastFrame = Animation_GetLastFrame(animation); + AnimationHeader* animation = &object_nb_003954_Anim; + f32 frames = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -8.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); this->action = NB_LOOK_RIGHT; this->drawMode = NB_DRAW_DEFAULT; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_CheckIfLookingRight(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &gNabooruOnOneKneeLookingRightAnim; + AnimationHeader* animation = &object_nb_004030_Anim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -839,17 +861,17 @@ void EnNb_CheckIfLookingRight(EnNb* this, s32 animFinished) { } void EnNb_SetupLookLeft(EnNb* this) { - AnimationHeader* animation = &gNabooruOnOneKneeTurningHeadRightToLeftTransitionAnim; - f32 lastFrame = Animation_GetLastFrame(animation); + AnimationHeader* animation = &object_nb_002DBC_Anim; + f32 frames = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -8.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); this->action = NB_LOOK_LEFT; this->drawMode = NB_DRAW_LOOK_DIRECTION; this->actor.shape.shadowAlpha = 0xFF; } void EnNb_CheckIfLookLeft(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &gNabooruOnOneKneeLookingLeftAnim; + AnimationHeader* animation = &object_nb_0035A8_Anim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -865,10 +887,10 @@ void EnNb_SetupDemo6KInConfrontation(EnNb* this, PlayState* play, s32 animFinish } void EnNb_SetupRun(EnNb* this) { - AnimationHeader* animation = &gNabooruKneeingToRunningToHitAnim; - f32 lastFrame = Animation_GetLastFrame(animation); + AnimationHeader* animation = &object_nb_006320_Anim; + f32 frames = Animation_GetLastFrame(animation); - Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, -8.0f); + Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); this->action = NB_RUN; this->drawMode = NB_DRAW_LOOK_DIRECTION; this->actor.shape.shadowAlpha = 0xFF; @@ -998,8 +1020,8 @@ void func_80AB2E70(EnNb* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_nb_inConfrontion.c", 572); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideTex)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideTex)); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(object_nb_00D8E8_Tex)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(object_nb_00D8E8_Tex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, @@ -1011,8 +1033,8 @@ void func_80AB2E70(EnNb* this, PlayState* play) { s32 func_80AB2FC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; - if (limbIndex == NABOORU_LIMB_HEAD) { - *dList = gNabooruHeadMouthOpenDL; + if (limbIndex == 15) { + *dList = object_nb_013158_DL; } return 0; @@ -1039,7 +1061,7 @@ void func_80AB2FE4(EnNb* this, PlayState* play) { } void EnNb_SetupCreditsSpawn(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedAnim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_000BC0_Anim, 0, 0.0f, 0); this->action = NB_CREDITS_INIT; this->drawMode = NB_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -1053,7 +1075,7 @@ void EnNb_SetAlphaInCredits(EnNb* this) { if ((kREG(17) + 10.0f) <= this->alphaTimer) { this->alpha = 255; - this->actor.shape.shadowAlpha = 255; + this->actor.shape.shadowAlpha = 0xFF; } else { alpha = (*alphaTimer / (kREG(17) + 10.0f)) * 255.0f; this->alpha = alpha; @@ -1075,13 +1097,13 @@ void EnNb_SetupCreditsSit(EnNb* this) { } void EnNb_SetupCreditsHeadTurn(EnNb* this) { - EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedTurningToLookUpRightTransitionAnim, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_005CA4_Anim, 2, -8.0f, 0); this->action = NB_CREDITS_HEAD_TURN; } void EnNb_CheckIfLookingUp(EnNb* this, s32 animFinished) { if (animFinished) { - EnNb_SetCurrentAnim(this, &gNabooruSittingCrossLeggedLookingUpRightAnim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_005614_Anim, 0, 0.0f, 0); } } @@ -1146,13 +1168,13 @@ void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { // looking into crawlspace if (!GET_EVENTCHKINF(EVENTCHKINF_94)) { - EnNb_SetCurrentAnim(this, &gNabooruKneeingAtCrawlspaceAnim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_006E78_Anim, 0, 0.0f, 0); this->action = NB_CROUCH_CRAWLSPACE; this->drawMode = NB_DRAW_DEFAULT; } else { s32 pad; - EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_004BB4_Anim, 0, 0.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; this->actor.world.pos = this->finalPos; @@ -1224,7 +1246,7 @@ void func_80AB36DC(EnNb* this, PlayState* play) { void EnNb_CheckNoticed(EnNb* this, PlayState* play) { if (EnNb_GetNoticedStatus(this, play)) { - EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_004E60_Anim, 2, -8.0f, 0); this->action = NB_NOTICE_PLAYER; EnNb_SetNoticeSFX(this); } @@ -1232,7 +1254,7 @@ void EnNb_CheckNoticed(EnNb* this, PlayState* play) { void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { if (animFinished) { - EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, -8.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_004BB4_Anim, 0, -8.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; this->action = NB_IDLE_CRAWLSPACE; @@ -1258,7 +1280,7 @@ void func_80AB3838(EnNb* this, PlayState* play) { } void EnNb_SetupPathMovement(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &gNabooruStandingToWalkingTransitionAnim, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_004E60_Anim, 2, -8.0f, 0); SET_EVENTCHKINF(EVENTCHKINF_94); this->action = NB_IN_PATH; this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY); @@ -1323,12 +1345,12 @@ void EnNb_SetTextIdAsChild(EnNb* this, PlayState* play) { void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { u16 movementTimer = this->movementTimer; - if ((u16)(kREG(17) + 25) > movementTimer) { + if ((u16)(kREG(17) + 0x19) > movementTimer) { if (animFinished) { - EnNb_SetCurrentAnim(this, &gNabooruWalkingAnim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_009238_Anim, 0, 0.0f, 0); } } else { - EnNb_SetCurrentAnim(this, &gNabooruStandingHandsOnHipsAnim, 0, -8.0f, 0); + EnNb_SetCurrentAnim(this, &object_nb_004BB4_Anim, 0, -8.0f, 0); this->action = NB_IDLE_AFTER_TALK; } } @@ -1476,8 +1498,7 @@ void EnNb_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); EnNb_SetupCollider(thisx, play); - SkelAnime_InitFlex(play, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, - NABOORU_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &object_nb_0181C8_Skel, NULL, this->jointTable, this->morphTable, 19); switch (EnNb_GetType(this)) { case NB_TYPE_DEMO02: @@ -1507,13 +1528,13 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po s32 ret = false; if (this->headTurnFlag != 0) { - if (limbIndex == NABOORU_LIMB_TORSO) { + if (limbIndex == 8) { s32 pad; rot->x += interactInfo->torsoRot.y; rot->y -= interactInfo->torsoRot.x; ret = false; - } else if (limbIndex == NABOORU_LIMB_HEAD) { + } else if (limbIndex == 15) { rot->x += interactInfo->headRot.y; rot->z += interactInfo->headRot.x; ret = false; @@ -1526,7 +1547,7 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnNb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; - if (limbIndex == NABOORU_LIMB_HEAD) { + if (limbIndex == 15) { Vec3f vec1 = { 0.0f, 10.0f, 0.0f }; Vec3f vec2; 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 e27a3b0ebb6..f9e8f5d26ac 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -3,7 +3,6 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_nb/object_nb.h" struct EnNb; @@ -13,8 +12,8 @@ typedef void (*EnNbDrawFunc)(struct EnNb*, struct PlayState*); typedef struct EnNb { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[NABOORU_LIMB_MAX]; - /* 0x0202 */ Vec3s morphTable[NABOORU_LIMB_MAX]; + /* 0x0190 */ Vec3s jointTable[19]; + /* 0x0202 */ Vec3s morphTable[19]; /* 0x0274 */ s16 eyeIdx; /* 0x0276 */ s16 blinkTimer; /* 0x0278 */ s32 action; diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 3a811453e45..6135742123a 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -373,24 +373,27 @@ void EnNiw_SpawnAttackCucco(EnNiw* this, PlayState* play) { f32 viewY; f32 viewZ; Vec3f attackCuccoPos; - Actor* attackCucco; - - if ((this->timer5 == 0) && (this->unk_296 < 7)) { - viewX = play->view.at.x - play->view.eye.x; - viewY = play->view.at.y - play->view.eye.y; - viewZ = play->view.at.z - play->view.eye.z; - attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + play->view.eye.x; - attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((play->view.eye.y + 50.0f) + (viewY * 0.5f)); - attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + play->view.eye.z; - attackCucco = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ATTACK_NIW, attackCuccoPos.x, - attackCuccoPos.y, attackCuccoPos.z, 0, 0, 0, 0); - - if (attackCucco != NULL) { - this->unk_296++; - this->timer5 = 10; - } else { - PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 発生できず ☆☆☆☆☆ \n", " ☆☆☆☆☆ Cannot spawn ☆☆☆☆☆ \n") VT_RST); + EnAttackNiw* attackCucco; + + if (this->timer5 == 0) { + if (this->unk_296 < 7) { + viewX = play->view.at.x - play->view.eye.x; + viewY = play->view.at.y - play->view.eye.y; + viewZ = play->view.at.z - play->view.eye.z; + attackCuccoPos.x = ((Rand_ZeroOne() - 0.5f) * viewX) + play->view.eye.x; + attackCuccoPos.y = Rand_CenteredFloat(0.3f) + ((play->view.eye.y + 50.0f) + (viewY * 0.5f)); + attackCuccoPos.z = ((Rand_ZeroOne() - 0.5f) * viewZ) + play->view.eye.z; + attackCucco = + (EnAttackNiw*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ATTACK_NIW, + attackCuccoPos.x, attackCuccoPos.y, attackCuccoPos.z, 0, 0, 0, 0); + + if (attackCucco != NULL) { + this->unk_296++; + this->timer5 = 10; + } else { + PRINTF("\n\n"); + PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 発生できず ☆☆☆☆☆ \n", " ☆☆☆☆☆ Cannot occur ☆☆☆☆☆ \n") VT_RST); + } } } } @@ -458,7 +461,7 @@ void func_80AB6324(EnNiw* this, PlayState* play) { } void func_80AB63A8(EnNiw* this, PlayState* play) { - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.velocity.y < 0.0f) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND && this->actor.velocity.y < 0.0f) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; this->unk_2AC.y = this->unk_2B8.y = this->actor.world.pos.y; this->unk_2AC.z = this->unk_2B8.z = this->actor.world.pos.z; @@ -490,7 +493,6 @@ void func_80AB6450(EnNiw* this, PlayState* play) { this->actor.speed = 0.0f; this->actionFunc = func_80AB6BF8; } else { - // GI_NONE in this case allows the player to lift the actor Actor_OfferGetItem(&this->actor, play, GI_NONE, 25.0f, 10.0f); func_80AB5BF8(this, play, 1); } 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 4e9ccbb9d63..c930fd0c177 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 @@ -275,7 +275,7 @@ void EnNiwGirl_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnNiwGirlOverrideLimbDraw, NULL, this); + EnNiwGirlOverrideLimbDraw, 0, this); func_80033C30(&this->actor.world.pos, &sp4C, 255, play); CLOSE_DISPS(play->state.gfxCtx, "../z_en_niw_girl.c", 592); diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 066bf1476d0..e5bdc8c22a8 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -349,13 +349,13 @@ void func_80ABA654(EnNiwLady* this, PlayState* play) { this->unk_26E = 0xB; if (!GET_ITEMGETINF(ITEMGETINF_0C)) { this->actor.parent = NULL; - this->getItemId = GI_BOTTLE_EMPTY; + this->unk_284 = GI_BOTTLE_EMPTY; Actor_OfferGetItem(&this->actor, play, GI_BOTTLE_EMPTY, 100.0f, 50.0f); this->actionFunc = func_80ABAC00; return; } if (this->unk_26C == 1) { - this->getItemId = GI_RUPEE_PURPLE; + this->unk_284 = GI_RUPEE_PURPLE; Actor_OfferGetItem(&this->actor, play, GI_RUPEE_PURPLE, 100.0f, 50.0f); this->actionFunc = func_80ABAC00; } @@ -481,7 +481,7 @@ void func_80ABAC00(EnNiwLady* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actionFunc = func_80ABAC84; } else { - getItemId = this->getItemId; + getItemId = this->unk_284; if (LINK_IS_ADULT) { getItemId = !GET_ITEMGETINF(ITEMGETINF_2C) ? GI_POCKET_EGG : GI_COJIRO; } diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h index 124efa5947b..27951753568 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.h @@ -37,7 +37,7 @@ typedef struct EnNiwLady { /* 0x027E */ s16 unk_27E; /* 0x0280 */ s8 aneObjectSlot; /* 0x0281 */ s8 osAnimeObjectSlot; - /* 0x0284 */ s32 getItemId; + /* 0x0284 */ s32 unk_284; /* 0x0288 */ NpcInteractInfo interactInfo; /* 0x02B0 */ ColliderCylinder collider; } EnNiwLady; // size = 0x02FC 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 4d5ec7f3ca3..4081fac4887 100644 --- a/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c +++ b/src/overlays/actors/ovl_En_Nwc/z_en_nwc.c @@ -34,8 +34,8 @@ void EnNwc_Idle(EnNwc* this, PlayState* play); #define CHICK_BG_WALL (1 << 1) typedef enum ChickTypes { - /* 0 */ CHICK_NONE, - /* 1 */ CHICK_NORMAL + CHICK_NONE, + CHICK_NORMAL } ChickTypes; ActorProfile En_Nwc_Profile = { 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 fd5e4e909d4..755759d88ae 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -1,7 +1,7 @@ /* * File: z_en_ru1.c * Overlay: En_Ru1 - * Description: Ruto (child) + * Description: */ #include "z_en_ru1.h" @@ -14,7 +14,6 @@ #include "printf.h" #include "regs.h" #include "segmented_address.h" -#include "seqcmd.h" #include "sequence.h" #include "sfx.h" #include "sys_matrix.h" @@ -422,14 +421,16 @@ s32 EnRu1_IsTextboxClosing(PlayState* play) { #if DEBUG_FEATURES void func_80AEB1D8(EnRu1* this) { + Actor* thisx = &this->actor; + this->action = ENRU1_ACTION_THROWN_ONTO_SAPPHIRE_PLATFORM; this->drawConfig = ENRU1_DRAW_NOTHING; - this->actor.velocity.x = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.velocity.z = 0.0f; - this->actor.speed = 0.0f; - this->actor.gravity = 0.0f; - this->actor.minVelocityY = 0.0f; + thisx->velocity.x = 0.0f; + thisx->velocity.y = 0.0f; + thisx->velocity.z = 0.0f; + thisx->speed = 0.0f; + thisx->gravity = 0.0f; + thisx->minVelocityY = 0.0f; EnRu1_SetPlatformCamSetting(this, 0); } @@ -508,9 +509,9 @@ void EnRu1_SpawnRipple(EnRu1* this, PlayState* play, s16 radiusMax, s16 life) { Vec3f pos; Actor* thisx = &this->actor; - pos.x = this->actor.world.pos.x; - pos.y = this->actor.world.pos.y + this->actor.depthInWater; - pos.z = this->actor.world.pos.z; + pos.x = thisx->world.pos.x; + pos.y = thisx->world.pos.y + thisx->depthInWater; + pos.z = thisx->world.pos.z; EffectSsGRipple_Spawn(play, &pos, 100, radiusMax, life); } @@ -530,10 +531,11 @@ void EnRu1_SpawnThreeRipples(EnRu1* this, PlayState* play) { void EnRu1_SpawnSplash(EnRu1* this, PlayState* play) { Vec3f pos; + Actor* thisx = &this->actor; - pos.x = this->actor.world.pos.x; - pos.y = this->actor.world.pos.y + this->actor.depthInWater; - pos.z = this->actor.world.pos.z; + pos.x = thisx->world.pos.x; + pos.y = thisx->world.pos.y + thisx->depthInWater; + pos.z = thisx->world.pos.z; EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 1, 0); } @@ -581,14 +583,14 @@ f32 EnRu1_Lerp(f32 scale, s32 startPos, s32 endPos) { } void EnRu1_InitPositionFromFountainCue(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; CsCmdActorCue* cue = EnRu1_GetFountainCue(play); if (cue != NULL) { - this->actor.world.rot.y = this->actor.shape.rot.y = cue->rot.y; - - this->actor.world.pos.x = cue->startPos.x; - this->actor.world.pos.y = cue->startPos.y; - this->actor.world.pos.z = cue->startPos.z; + thisx->world.rot.y = thisx->shape.rot.y = cue->rot.y; + thisx->world.pos.x = cue->startPos.x; + thisx->world.pos.y = cue->startPos.y; + thisx->world.pos.z = cue->startPos.z; } } @@ -608,11 +610,11 @@ void EnRu1_SwimTowardLink(EnRu1* this, PlayState* play) { Vec3f* thisPos; f32 swimProximity; CsCmdActorCue* cue = EnRu1_GetFountainCue(play); - s32 pad; + Actor* thisx = &this->actor; if (cue != NULL) { swimProximity = EnRu1_GetSwimLerpFactor(cue, play); - thisPos = &this->actor.world.pos; + thisPos = &thisx->world.pos; thisPos->x = EnRu1_Lerp(swimProximity, cue->startPos.x, cue->endPos.x); thisPos->y = EnRu1_Lerp(swimProximity, cue->startPos.y, cue->endPos.y); thisPos->z = EnRu1_Lerp(swimProximity, cue->startPos.z, cue->endPos.z); @@ -629,11 +631,11 @@ void EnRu1_SwimAwayFromLink(EnRu1* this, PlayState* play) { Vec3f* thisPos; f32 proximity; CsCmdActorCue* cue = EnRu1_GetFountainCue(play); - s32 pad2; + Actor* thisx = &this->actor; if (cue != NULL) { proximity = EnRu1_GetSwimLerpFactor(cue, play); - thisPos = &this->actor.world.pos; + thisPos = &thisx->world.pos; thisPos->x = EnRu1_Lerp(proximity, treadStartPos->x, cue->endPos.x); thisPos->y = EnRu1_Lerp(proximity, treadStartPos->y, cue->endPos.y); thisPos->z = EnRu1_Lerp(proximity, treadStartPos->z, cue->endPos.z); @@ -847,6 +849,8 @@ void EnRu1_Fountain_FinishingSwimBack(EnRu1* this, PlayState* play) { } void EnRu1_InitInJabuJabuHolesRoom(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; + if (!GET_INFTABLE(INFTABLE_RUTO_MET_FIRST_TIME)) { EnRu1_AnimationChange(this, &gRutoChildWait2Anim, ANIMMODE_LOOP, 0, false); this->action = ENRU1_ACTION_MEETING_RANGE_CHECK; @@ -857,18 +861,18 @@ void EnRu1_InitInJabuJabuHolesRoom(EnRu1* this, PlayState* play) { s8 actorRoom; EnRu1_AnimationChange(this, &gRutoChildWait2Anim, ANIMMODE_LOOP, 0, false); - actorRoom = this->actor.room; + actorRoom = thisx->room; this->action = ENRU1_ACTION_SPEAK_JABU_PRE_SPAWN; - this->actor.room = -1; + thisx->room = -1; this->drawConfig = ENRU1_DRAW_NOTHING; this->roomNum1 = actorRoom; this->roomNum3 = actorRoom; this->roomNum2 = actorRoom; } else { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } } else { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } } @@ -876,49 +880,53 @@ void EnRu1_InitInJabuJabuHolesRoom(EnRu1* this, PlayState* play) { * Accelerates Ruto forward as she starts to walk away. This lasts for eight frames. */ void EnRu1_AccelerateAway(EnRu1* this) { + Actor* thisx = &this->actor; f32 walkingFrame = this->walkingFrame; if (walkingFrame < 8.0f) { - this->actor.speed = (((kREG(3) * 0.01f) + 2.7f) / 8.0f) * walkingFrame; + thisx->speed = (((kREG(3) * 0.01f) + 2.7f) / 8.0f) * walkingFrame; } else { - this->actor.speed = (kREG(3) * 0.01f) + 2.7f; + thisx->speed = (kREG(3) * 0.01f) + 2.7f; } - this->actor.velocity.y = -1.0f; - Actor_MoveXZGravity(&this->actor); + thisx->velocity.y = -1.0f; + Actor_MoveXZGravity(thisx); } /** * Moves Ruto forward at a constant speed walking away from Link. */ void EnRu1_MoveForwardConstant(EnRu1* this) { - this->actor.velocity.y = -1.0f; - Actor_MoveXZGravity(&this->actor); + Actor* thisx = &this->actor; + thisx->velocity.y = -1.0f; + Actor_MoveXZGravity(thisx); } /** * Accelerate's Ruto's actor downward as she falls down the hole. */ void EnRu1_AccelerateDownHole(EnRu1* this) { - f32* speedXZ = &this->actor.speed; + Actor* thisx = &this->actor; + f32* speedXZ = &thisx->speed; f32* walkingFrame = &this->walkingFrame; if (this->walkingFrame < 8.0f) { *walkingFrame += 1.0f; *speedXZ *= (8.0f - *walkingFrame) / 8.0f; - this->actor.velocity.y = -*walkingFrame * (((kREG(4) * 0.01f) + 13.0f) / 8.0f); + thisx->velocity.y = -*walkingFrame * (((kREG(4) * 0.01f) + 13.0f) / 8.0f); } else { *speedXZ = 0.0f; - this->actor.velocity.y = -((kREG(4) * 0.01f) + 13.0f); + thisx->velocity.y = -((kREG(4) * 0.01f) + 13.0f); } - Actor_MoveXZGravity(&this->actor); + Actor_MoveXZGravity(thisx); } s32 EnRu1_IsPlayerInRangeForFirstEncounter(EnRu1* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 thisPosZ = this->actor.world.pos.z; + Actor* thisx = &this->actor; + f32 thisPosZ = thisx->world.pos.z; f32 playerPosZ = player->actor.world.pos.z; - if ((playerPosZ - thisPosZ <= 265.0f) && (player->actor.world.pos.y >= this->actor.world.pos.y)) { + if ((playerPosZ - thisPosZ <= 265.0f) && (player->actor.world.pos.y >= thisx->world.pos.y)) { return true; } return false; @@ -967,17 +975,18 @@ void EnRu1_CheckStartFirstEncounter(EnRu1* this, PlayState* play) { } void EnRu1_SetupPositionForFirstEncounter(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; CsCmdActorCue* cue; s16 newRotY; if (EnRu1_CheckCueNotMatchingId(play, 1, 3)) { cue = play->csCtx.actorCues[3]; - this->actor.world.pos.x = cue->startPos.x; - this->actor.world.pos.y = cue->startPos.y; - this->actor.world.pos.z = cue->startPos.z; + thisx->world.pos.x = cue->startPos.x; + thisx->world.pos.y = cue->startPos.y; + thisx->world.pos.z = cue->startPos.z; newRotY = cue->rot.y; - this->actor.shape.rot.y = newRotY; - this->actor.world.rot.y = newRotY; + thisx->shape.rot.y = newRotY; + thisx->world.rot.y = newRotY; this->action = ENRU1_ACTION_MEETING_FACING_LINK; this->drawConfig = ENRU1_DRAW_OPA; } @@ -1011,12 +1020,13 @@ void EnRu1_AdvanceWalkingAway(EnRu1* this) { } void EnRu1_CheckStartFalling(EnRu1* this) { - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + Actor* thisx = &this->actor; + if (!(thisx->bgCheckFlags & BGCHECKFLAG_GROUND)) { s32 pad; this->action = ENRU1_ACTION_MEETING_FALLING_DOWN_HOLE; this->walkingFrame = 0.0f; - this->actor.velocity.y = 0.0f; + thisx->velocity.y = 0.0f; } } @@ -1086,16 +1096,16 @@ void EnRu1_Meeting_End(EnRu1* this, PlayState* play) { } void EnRu1_SpawnBlueWarp(EnRu1* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->actor; Vec3f* pos; s16 yawTowardsPlayer; f32 spawnX; f32 spawnY; f32 spawnZ; - s32 pad2[2]; + s32 pad[2]; - yawTowardsPlayer = this->actor.yawTowardsPlayer; - pos = &this->actor.world.pos; + yawTowardsPlayer = thisx->yawTowardsPlayer; + pos = &thisx->world.pos; spawnX = ((kREG(1) + 12.0f) * Math_SinS(yawTowardsPlayer)) + pos->x; spawnY = pos->y; spawnZ = ((kREG(1) + 12.0f) * Math_CosS(yawTowardsPlayer)) + pos->z; @@ -1122,13 +1132,13 @@ void EnRu1_Rise(EnRu1* this, PlayState* play) { * Ruto rises up in sync with Link as they warp out together. */ void EnRu1_RiseWithLink(EnRu1* this, PlayState* play) { - s32 pad2; + Actor* thisx = &this->actor; Player* player = GET_PLAYER(play); Vec3f* playerPos = &player->actor.world.pos; s16 shapeRotY = player->actor.shape.rot.y; s32 pad; f32 xzDistToPlayer = this->xzDistToPlayerInBlueWarp; - Vec3f* pos = &this->actor.world.pos; + Vec3f* pos = &thisx->world.pos; pos->x = (Math_SinS(shapeRotY) * xzDistToPlayer) + playerPos->x; pos->y = playerPos->y; @@ -1136,11 +1146,11 @@ void EnRu1_RiseWithLink(EnRu1* this, PlayState* play) { } void EnRu1_SetPlayerMarkInBlueWarp(EnRu1* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->actor; Player* player = GET_PLAYER(play); Vec3f* player_unk_450 = &player->unk_450; - Vec3f* pos = &this->actor.world.pos; - s16 shapeRotY = this->actor.shape.rot.y; + Vec3f* pos = &thisx->world.pos; + s16 shapeRotY = thisx->shape.rot.y; player_unk_450->x = ((kREG(2) + 30.0f) * Math_SinS(shapeRotY)) + pos->x; player_unk_450->z = ((kREG(2) + 30.0f) * Math_CosS(shapeRotY)) + pos->z; @@ -1205,9 +1215,10 @@ void EnRu1_SetupRiseThroughBlueWarp(EnRu1* this, PlayState* play) { } void EnRu1_EndRise(EnRu1* this) { - if (this->actor.shape.yOffset >= 0.0f) { + Actor* thisx = &this->actor; + if (thisx->shape.yOffset >= 0.0f) { this->action = ENRU1_ACTION_WAIT_INSIDE_BLUE_WARP; - this->actor.shape.yOffset = 0.0f; + thisx->shape.yOffset = 0.0f; EnRu1_SetBlueWarpState(this, WARP_BLUE_RUTO_STATE_READY); } } @@ -1280,23 +1291,25 @@ void EnRu1_BossRoom_WarpingOut(EnRu1* this, PlayState* play) { } void EnRu1_InitInJabuJabuBasement(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; + if (GET_INFTABLE(INFTABLE_RUTO_MET_FIRST_TIME) && !GET_INFTABLE(INFTABLE_RUTO_HAS_SAPPHIRE) && !GET_INFTABLE(INFTABLE_RUTO_PLACED_ON_SWITCH) && !GET_INFTABLE(INFTABLE_RUTO_BROUGHT_BACK_TO_HOLES_ROOM)) { if (!EnRu1_IsAssistingLink(this, play)) { s8 actorRoom; EnRu1_AnimationChange(this, &gRutoChildWait2Anim, ANIMMODE_LOOP, 0, false); - actorRoom = this->actor.room; + actorRoom = thisx->room; this->action = ENRU1_ACTION_SPEAK_JABU_PRE_SPAWN; - this->actor.room = -1; + thisx->room = -1; this->roomNum1 = actorRoom; this->roomNum3 = actorRoom; this->roomNum2 = actorRoom; } else { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } } else { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } } @@ -1330,14 +1343,15 @@ void func_80AED600(EnRu1* this) { } s32 func_80AED624(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; s8 curRoomNum = play->roomCtx.curRoom.num; if (this->roomNum2 != curRoomNum) { - Actor_Kill(&this->actor); + Actor_Kill(thisx); return false; } else if (((this->roomNum1 != curRoomNum) || (this->roomNum2 != curRoomNum)) && // roomNum2 is always curRoomNum here - (this->actor.depthInWater > kREG(16) + 50.0f) && (this->action != ENRU1_ACTION_SITTING_DISAPPEARING)) { + (thisx->depthInWater > kREG(16) + 50.0f) && (this->action != ENRU1_ACTION_SITTING_DISAPPEARING)) { this->action = ENRU1_ACTION_SITTING_DISAPPEARING; this->drawConfig = ENRU1_DRAW_XLU; this->alpha = 0xFF; @@ -1426,10 +1440,11 @@ void EnRu1_UpdateHeadRotation(EnRu1* this) { } void EnRu1_ResetBgCheckFlags(EnRu1* this, PlayState* play) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); + Actor* thisx = &this->actor; + DynaPolyActor* dyna = DynaPoly_GetActor(&play->colCtx, thisx->floorBgId); - if (dynaPolyActor == NULL || dynaPolyActor->actor.id == ACTOR_EN_BOX) { - this->actor.bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); + if (dyna == NULL || dyna->actor.id == ACTOR_EN_BOX) { + thisx->bgCheckFlags &= ~(BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL | BGCHECKFLAG_CEILING); } } @@ -1439,14 +1454,14 @@ void EnRu1_UpdateBouncing(EnRu1* this, PlayState* play) { f32* gravity; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - DynaPolyActor* dynaPolyActor; + DynaPolyActor* temp_dyna; velocityY = &this->actor.velocity.y; - dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); + temp_dyna = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); if (*velocityY <= 0.0f) { speedXZ = &this->actor.speed; - if (dynaPolyActor != NULL) { - if (dynaPolyActor->actor.id != ACTOR_EN_BOX) { + if (temp_dyna != NULL) { + if (temp_dyna->actor.id != ACTOR_EN_BOX) { *speedXZ = 0.0f; } } else { @@ -1457,8 +1472,8 @@ void EnRu1_UpdateBouncing(EnRu1* this, PlayState* play) { } } gravity = &this->actor.gravity; - if (dynaPolyActor != NULL) { - if (dynaPolyActor->actor.id != ACTOR_EN_BOX) { + if (temp_dyna != NULL) { + if (temp_dyna->actor.id != ACTOR_EN_BOX) { *velocityY = 0.0f; this->actor.minVelocityY = 0.0f; *gravity = 0.0f; @@ -1525,9 +1540,9 @@ void EnRu1_UpdateBouncing(EnRu1* this, PlayState* play) { void EnRu1_UpdateSpeedXZ(EnRu1* this, PlayState* play) { f32* speedXZ = &this->actor.speed; - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); + DynaPolyActor* dyna = DynaPoly_GetActor(&play->colCtx, this->actor.floorBgId); - if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_EN_BOX) { + if (dyna != NULL && dyna->actor.id == ACTOR_EN_BOX) { if (*speedXZ != 0.0f) { *speedXZ *= 1.1f; } else { @@ -1548,12 +1563,14 @@ void EnRu1_UpdatePosition(EnRu1* this, PlayState* play) { } void EnRu1_StopMoving(EnRu1* this) { - this->actor.velocity.x = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.velocity.z = 0.0f; - this->actor.speed = 0.0f; - this->actor.gravity = 0.0f; - this->actor.minVelocityY = 0.0f; + Actor* thisx = &this->actor; + + thisx->velocity.x = 0.0f; + thisx->velocity.y = 0.0f; + thisx->velocity.z = 0.0f; + thisx->speed = 0.0f; + thisx->gravity = 0.0f; + thisx->minVelocityY = 0.0f; } void EnRu1_UpdateWaterState(EnRu1* this) { @@ -1613,17 +1630,19 @@ void EnRu1_UpdateWaterState(EnRu1* this) { } s32 EnRu1_TalkOfferAccepted(EnRu1* this, PlayState* play) { - if (!Actor_TalkOfferAccepted(&this->actor, play)) { - this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; + Actor* thisx = &this->actor; + + if (!Actor_TalkOfferAccepted(thisx, play)) { + thisx->flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; if (GET_INFTABLE(INFTABLE_RUTO_LET_LINK_CARRY)) { - this->actor.textId = 0x404E; - Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); + thisx->textId = 0x404E; + Actor_OfferTalkNearColChkInfoCylinder(thisx, play); } else if (GET_INFTABLE(INFTABLE_RUTO_EXPLAINED_WHY_IN_JABU)) { - this->actor.textId = 0x404D; - Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); + thisx->textId = 0x404D; + Actor_OfferTalkNearColChkInfoCylinder(thisx, play); } else { - this->actor.textId = 0x404C; - Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); + thisx->textId = 0x404C; + Actor_OfferTalkNearColChkInfoCylinder(thisx, play); } return false; } @@ -1631,14 +1650,14 @@ s32 EnRu1_TalkOfferAccepted(EnRu1* this, PlayState* play) { } void EnRu1_CheckForDoorSwitch(EnRu1* this, PlayState* play) { - DynaPolyActor* dynaPolyActor; + DynaPolyActor* dyna; s32 floorBgId; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.floorBgId != BGCHECK_SCENE)) { floorBgId = this->actor.floorBgId; - dynaPolyActor = DynaPoly_GetActor(&play->colCtx, floorBgId); - if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) { - if (PARAMS_GET_U(dynaPolyActor->actor.params, 8, 6) == 0x38) { + dyna = DynaPoly_GetActor(&play->colCtx, floorBgId); + if ((dyna != NULL) && (dyna->actor.id == ACTOR_BG_BDAN_SWITCH)) { + if (PARAMS_GET_U(dyna->actor.params, 8, 6) == 0x38) { SET_INFTABLE(INFTABLE_RUTO_PLACED_ON_SWITCH); return; } @@ -1650,21 +1669,21 @@ void EnRu1_CheckForDoorSwitch(EnRu1* this, PlayState* play) { s32 EnRu1_IsOnSapphirePlatform(EnRu1* this, PlayState* play) { s32 pad[2]; CollisionContext* colCtx; - DynaPolyActor* dynaPolyActor; + DynaPolyActor* dynaActor; s32 floorBgId; if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && this->actor.floorBgId != BGCHECK_SCENE) { colCtx = &play->colCtx; floorBgId = this->actor.floorBgId; // necessary match, can't move this out of this block unfortunately - dynaPolyActor = DynaPoly_GetActor(colCtx, floorBgId); - if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_BG_BDAN_OBJECTS && - dynaPolyActor->actor.params == 0 && !Player_InCsMode(play) && play->msgCtx.msgLength == 0) { + dynaActor = DynaPoly_GetActor(colCtx, floorBgId); + if (dynaActor != NULL && dynaActor->actor.id == ACTOR_BG_BDAN_OBJECTS && dynaActor->actor.params == 0 && + !Player_InCsMode(play) && play->msgCtx.msgLength == 0) { EnRu1_StopMoving(this); play->csCtx.script = gRutoObtainingSapphireCs; gSaveContext.cutsceneTrigger = 1; this->action = ENRU1_ACTION_THROWN_ONTO_SAPPHIRE_PLATFORM; this->drawConfig = ENRU1_DRAW_NOTHING; - this->bigOctoPlatform = (BgBdanObjects*)dynaPolyActor; + this->bigOctoPlatform = (BgBdanObjects*)dynaActor; this->actor.shape.shadowAlpha = 0; return true; } @@ -1673,28 +1692,30 @@ s32 EnRu1_IsOnSapphirePlatform(EnRu1* this, PlayState* play) { } void EnRu1_UpdateSittingAction(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; s8 curRoomNum; // Test if Link is picking Ruto up - if (Actor_HasParent(&this->actor, play)) { + if (Actor_HasParent(thisx, play)) { // Ruto has been picked up curRoomNum = play->roomCtx.curRoom.num; this->roomNum3 = curRoomNum; this->action = ENRU1_ACTION_SITTING_CARRIED; EnRu1_PlayLiftingSfx(this, play); - } else if (!EnRu1_IsOnSapphirePlatform(this, play) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + } else if ((!EnRu1_IsOnSapphirePlatform(this, play)) && (!(thisx->bgCheckFlags & BGCHECKFLAG_GROUND))) { s32 pad; - this->actor.minVelocityY = -((kREG(24) * 0.01f) + 6.8f); - this->actor.gravity = -((kREG(23) * 0.01f) + 1.3f); + thisx->minVelocityY = -((kREG(24) * 0.01f) + 6.8f); + thisx->gravity = -((kREG(23) * 0.01f) + 1.3f); this->action = ENRU1_ACTION_SITTING_RELEASED; } } void EnRu1_CheckLanding(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; + if (!EnRu1_IsOnSapphirePlatform(this, play)) { - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->actor.speed == 0.0f) && - (this->actor.minVelocityY == 0.0f)) { + if ((thisx->bgCheckFlags & BGCHECKFLAG_GROUND) && (thisx->speed == 0.0f) && (thisx->minVelocityY == 0.0f)) { s32 pad; EnRu1_StopMoving(this); @@ -1704,7 +1725,7 @@ void EnRu1_CheckLanding(EnRu1* this, PlayState* play) { return; } - if (this->actor.depthInWater > 0.0f) { + if (thisx->depthInWater > 0.0f) { this->action = ENRU1_ACTION_SITTING_ENTERING_WATER; this->waterState = ENRU1_WATER_OUTSIDE; } @@ -1815,11 +1836,13 @@ s32 EnRu1_CheckHitBottomUnderwater(EnRu1* this, PlayState* play) { } void EnRu1_CheckSinkingState(EnRu1* this, PlayState* play) { - if ((!EnRu1_CheckHitBottomUnderwater(this, play)) && (this->waterState == ENRU1_WATER_SINKING)) { + Actor* thisx = &this->actor; + + if ((EnRu1_CheckHitBottomUnderwater(this, play) == 0) && (this->waterState == ENRU1_WATER_SINKING)) { this->action = ENRU1_ACTION_SITTING_SINKING; EnRu1_StopMoving(this); - this->actor.gravity = -0.1f; - this->actor.minVelocityY = -((kREG(18) * 0.1f) + 0.7f); + thisx->gravity = -0.1f; + thisx->minVelocityY = -((kREG(18) * 0.1f) + 0.7f); } } @@ -2076,6 +2099,7 @@ void EnRu1_LookUpAtSapphire(EnRu1* this) { } void EnRu1_SetupRetrievingSapphireAnimation(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; f32 frameCount; CsCmdActorCue* cue; CsCmdActorCue* cue2; @@ -2086,24 +2110,24 @@ void EnRu1_SetupRetrievingSapphireAnimation(EnRu1* this, PlayState* play) { // this weird part with the redundant variable is necessary to match for some reason cue2 = play->csCtx.actorCues[3]; cue = cue2; - this->actor.world.pos.x = cue->startPos.x; - this->actor.world.pos.y = cue->startPos.y; - this->actor.world.pos.z = cue->startPos.z; + thisx->world.pos.x = cue->startPos.x; + thisx->world.pos.y = cue->startPos.y; + thisx->world.pos.z = cue->startPos.z; newRotTmp = cue->rot.x; - this->actor.shape.rot.x = newRotTmp; - this->actor.world.rot.x = newRotTmp; + thisx->shape.rot.x = newRotTmp; + thisx->world.rot.x = newRotTmp; newRotTmp = cue->rot.y; - this->actor.shape.rot.y = newRotTmp; - this->actor.world.rot.y = newRotTmp; + thisx->shape.rot.y = newRotTmp; + thisx->world.rot.y = newRotTmp; newRotTmp = cue->rot.z; - this->actor.shape.rot.z = newRotTmp; - this->actor.world.rot.z = newRotTmp; + thisx->shape.rot.z = newRotTmp; + thisx->world.rot.z = newRotTmp; Animation_Change(&this->skelAnime, &gRutoChildWalkToAndHoldUpSapphireAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); EnRu1_StartWalkingTowardSapphire(this, play); this->action = ENRU1_ACTION_RETRIEVING_SAPPHIRE; this->drawConfig = ENRU1_DRAW_OPA; - this->actor.shape.shadowAlpha = 0xFF; + thisx->shape.shadowAlpha = 0xFF; } } @@ -2147,13 +2171,15 @@ void EnRu1_EndRetrievalCutscene(EnRu1* this, PlayState* play) { } void EnRu1_RespondToAbduction(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; + if (EnRu1_GetPlatformCamSetting(this) == 3) { - this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; - this->actor.textId = 0x4048; + thisx->flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; + thisx->textId = 0x4048; #if !OOT_PAL_N64 - Message_ContinueTextbox(play, this->actor.textId); + Message_ContinueTextbox(play, thisx->textId); #else - Message_StartTextbox(play, this->actor.textId, NULL); + Message_StartTextbox(play, thisx->textId, NULL); #endif EnRu1_PlayAbductedSfx(this, play); this->action = ENRU1_ACTION_BEING_ABDUCTED; @@ -2243,6 +2269,8 @@ void EnRu1_SapphireRoom_BeingAbducted(EnRu1* this, PlayState* play) { } void EnRu1_InitInSapphireRoom(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; + if (GET_INFTABLE(INFTABLE_RUTO_HAS_SAPPHIRE) && !GET_INFTABLE(INFTABLE_RUTO_ABDUCTED)) { s32 pad; @@ -2250,9 +2278,9 @@ void EnRu1_InitInSapphireRoom(EnRu1* this, PlayState* play) { this->action = ENRU1_ACTION_WAITING_IN_SAPPHIRE_ROOM; this->bigOctoPlatform = EnRu1_FindBigOctoPlatform(play); EnRu1_SetPlatformCamSetting(this, 1); - this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY); + thisx->flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY); } else { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } } @@ -2266,24 +2294,28 @@ void EnRu1_SapphireRoom_Waiting(EnRu1* this, PlayState* play) { } void EnRu1_InitBesideKingZora(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; + if (GET_EVENTCHKINF(EVENTCHKINF_37) && LINK_IS_CHILD) { EnRu1_AnimationChange(this, &gRutoChildWait2Anim, ANIMMODE_LOOP, 0, false); - this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; + thisx->flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->action = ENRU1_ACTION_THRONE_IDLE; this->drawConfig = ENRU1_DRAW_OPA; } else { - Actor_Kill(&this->actor); + Actor_Kill(thisx); } } s32 EnRu1_ThroneRoomTalkOfferAccepted(EnRu1* this, PlayState* play) { - if (!Actor_TalkOfferAccepted(&this->actor, play)) { - this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; - this->actor.textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_RUTO); - if (this->actor.textId == 0) { - this->actor.textId = 0x402C; + Actor* thisx = &this->actor; + + if (!Actor_TalkOfferAccepted(thisx, play)) { + thisx->flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; + thisx->textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_RUTO); + if (thisx->textId == 0) { + thisx->textId = 0x402C; } - Actor_OfferTalkNearColChkInfoCylinder(&this->actor, play); + Actor_OfferTalkNearColChkInfoCylinder(thisx, play); return false; } return true; @@ -2330,22 +2362,23 @@ void EnRu1_ThroneRoom_Talk(EnRu1* this, PlayState* play) { * Places Ruto beside the door switch outside the room with the map. */ void EnRu1_InitBesideDoorSwitch(EnRu1* this, PlayState* play) { + Actor* thisx = &this->actor; s8 actorRoom; if (GET_INFTABLE(INFTABLE_RUTO_MET_FIRST_TIME) && GET_INFTABLE(INFTABLE_RUTO_PLACED_ON_SWITCH) && !GET_INFTABLE(INFTABLE_RUTO_HAS_SAPPHIRE) && !(EnRu1_IsAssistingLink(this, play))) { EnRu1_AnimationChange(this, &gRutoChildWait2Anim, ANIMMODE_LOOP, 0, false); - actorRoom = this->actor.room; + actorRoom = thisx->room; this->action = ENRU1_ACTION_SPEAK_JABU_PRE_SPAWN; - this->actor.room = -1; + thisx->room = -1; this->drawConfig = ENRU1_DRAW_NOTHING; this->roomNum1 = actorRoom; this->roomNum3 = actorRoom; this->roomNum2 = actorRoom; - PRINTF(T("スイッチルトセット!!!!!!!!!!!!!!!!!!!!!!\n", "Ruto switch set!!!!!!!!!!!!!!!!!!!!!!\n")); + PRINTF("スイッチルトセット!!!!!!!!!!!!!!!!!!!!!!\n"); } else { - PRINTF(T("スイッチルトセットしない!!!!!!!!!!!!!!!!!!!!!!\n", "Ruto switch not set!!!!!!!!!!!!!!!!!!!!!!\n")); - Actor_Kill(&this->actor); + PRINTF("スイッチルトセットしない!!!!!!!!!!!!!!!!!!!!!!\n"); + Actor_Kill(thisx); } } @@ -2362,7 +2395,7 @@ void func_80AF0050(EnRu1* this, PlayState* play) { void EnRu1_Update(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; - if (this->action < 0 || this->action >= ARRAY_COUNT(sActionFuncs) || sActionFuncs[this->action] == NULL) { + if (this->action < 0 || this->action >= 46 || sActionFuncs[this->action] == NULL) { PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; @@ -2372,10 +2405,10 @@ void EnRu1_Update(Actor* thisx, PlayState* play) { } void EnRu1_Init(Actor* thisx, PlayState* play) { - s32 pad; EnRu1* this = (EnRu1*)thisx; + s32 pad; - ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); + ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 30.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17); EnRu1_InitColliders(&this->actor, play); switch (EnRu1_GetType(this)) { @@ -2406,8 +2439,8 @@ void EnRu1_Init(Actor* thisx, PlayState* play) { break; #endif default: - Actor_Kill(&this->actor); - PRINTF(T("該当 arge_data = %d 無し\n", "Relevant arge_data = %d unacceptable\n"), EnRu1_GetType(this)); + Actor_Kill(thisx); + PRINTF("該当 arge_data = %d 無し\n", EnRu1_GetType(this)); break; } } @@ -2434,8 +2467,7 @@ s32 EnRu1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p if ((this->preLimbDrawIndex < 0) || (this->preLimbDrawIndex > 0) || (*sPreLimbDrawFuncs[this->preLimbDrawIndex] == NULL)) { - PRINTF(VT_FGCOL(RED) T("首回しモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "Neck rotation mode is improper!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); + PRINTF(VT_FGCOL(RED) "首回しモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); } else { sPreLimbDrawFuncs[this->preLimbDrawIndex](this, play, limbIndex, rot); } @@ -2516,7 +2548,7 @@ void EnRu1_DrawXlu(EnRu1* this, PlayState* play) { void EnRu1_Draw(Actor* thisx, PlayState* play) { EnRu1* this = (EnRu1*)thisx; - if (this->drawConfig < 0 || this->drawConfig >= ARRAY_COUNT(sDrawFuncs) || sDrawFuncs[this->drawConfig] == NULL) { + if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); 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 7bfc40627b4..2c502abecf9 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -259,19 +259,19 @@ CsCmdActorCue* EnRu2_GetCue(PlayState* play, s32 cueChannel) { s32 EnRu2_CheckCueMatchingId(EnRu2* this, PlayState* play, u16 cueId, s32 cueChannel) { CsCmdActorCue* cue = EnRu2_GetCue(play, cueChannel); - if ((cue != NULL) && (cue->id == cueId)) { - return true; + if (cue != NULL && cue->id == cueId) { + return 1; } - return false; + return 0; } s32 EnRu2_CheckCueNotMatchingId(EnRu2* this, PlayState* play, u16 cueId, s32 cueChannel) { CsCmdActorCue* cue = EnRu2_GetCue(play, cueChannel); - if ((cue != NULL) && (cue->id != cueId)) { - return true; + if (cue != NULL && cue->id != cueId) { + return 1; } - return false; + return 0; } /** @@ -366,7 +366,7 @@ void EnRu2_CheckWaterMedallionCutscene(EnRu2* this, PlayState* play) { Player* player; s16 yaw; - if ((gSaveContext.chamberCutsceneNum == CHAMBER_CS_WATER) && !IS_CUTSCENE_LAYER) { + if (gSaveContext.chamberCutsceneNum == CHAMBER_CS_WATER && !IS_CUTSCENE_LAYER) { player = GET_PLAYER(play); this->action = ENRU2_AWAIT_BLUE_WARP; play->csCtx.script = gWaterMedallionCs; @@ -384,8 +384,7 @@ void EnRu2_CheckIfBlueWarpShouldSpawn(EnRu2* this, PlayState* play) { if (csCtx->state != CS_STATE_IDLE) { cue = csCtx->actorCues[3]; - - if ((cue != NULL) && (cue->id == 2)) { + if (cue != NULL && cue->id == 2) { this->action = ENRU2_RISE_THROUGH_BLUE_WARP; this->drawConfig = ENRU2_DRAW_OPA; EnRu2_SpawnBlueWarp(this, play); @@ -412,8 +411,7 @@ void EnRu2_CheckStartRaisingArms(EnRu2* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { cue = play->csCtx.actorCues[3]; - - if ((cue != NULL) && (cue->id == 3)) { + if (cue != NULL && cue->id == 3) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, 0.0f); this->action = ENRU2_RAISE_ARMS; @@ -439,8 +437,7 @@ void EnRu2_CheckIfWaterMedallionShouldSpawn(EnRu2* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { cue = play->csCtx.actorCues[6]; - - if ((cue != NULL) && (cue->id == 2)) { + if (cue != NULL && cue->id == 2) { this->action = ENRU2_FINISH_WATER_MEDALLION_CS; EnRu2_SpawnWaterMedallion(this, play); } @@ -710,8 +707,7 @@ void EnRu2_NextCreditsAction(EnRu2* this, PlayState* play) { EnRu2_SetupTurnHeadDownLeftAnimation(this); break; default: - PRINTF(T("En_Ru2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n", - "En_Ru2_inEnding_Check_DemoMode: There is no such action!!!!!!!!\n")); + PRINTF("En_Ru2_inEnding_Check_DemoMode:そんな動作は無い!!!!!!!!\n"); break; } this->cueId = nextCueId; @@ -778,7 +774,7 @@ void EnRu2_PlayFanfare(void) { void EnRu2_SwimUpProgress(EnRu2* this) { f32 funcFloat; - this->swimmingUpFrame++; + this->swimmingUpFrame += 1; funcFloat = Environment_LerpWeightAccelDecel((kREG(2) + 0x96) & 0xFFFF, 0, this->swimmingUpFrame, 8, 0); this->actor.world.pos.y = this->actor.home.pos.y + (300.0f * funcFloat); } @@ -842,11 +838,11 @@ void EnRu2_DialogCameraHandler(EnRu2* this, PlayState* play) { if (dialogState == TEXT_STATE_DONE_FADING) { if (this->lastDialogState != TEXT_STATE_DONE_FADING) { - PRINTF(T("おれが小松だ! \n", "I'm Komatsu! \n")); // (cinema scene dev) + PRINTF("おれが小松だ! \n"); this->textboxCount++; if (this->textboxCount % 6 == 3) { player = GET_PLAYER(play); - PRINTF(T("うおりゃー! \n", "uorya-! \n")); // (screaming sound) + PRINTF("うおりゃー! \n"); Camera_SetFinishedFlag(GET_ACTIVE_CAM(play)); player->actor.world.pos.x = 820.0f; player->actor.world.pos.y = 0.0f; @@ -872,7 +868,7 @@ void EnRu2_StartSwimmingUp(EnRu2* this, PlayState* play) { } void EnRu2_EndSwimmingUp(EnRu2* this, PlayState* play) { - if (this->swimmingUpFrame > ((((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96))) & 0xFFFF)) { + if (this->swimmingUpFrame > (((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96)) & 0xFFFF)) { Actor_Kill(&this->actor); } } @@ -928,7 +924,7 @@ void EnRu2_WaterTempleSwimmingUp(EnRu2* this, PlayState* play) { void EnRu2_Update(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; - if ((this->action < 0) || (this->action >= ARRAY_COUNT(sActionFuncs)) || (sActionFuncs[this->action] == NULL)) { + if (this->action < 0 || this->action >= 20 || sActionFuncs[this->action] == 0) { PRINTF(VT_FGCOL(RED) T("メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The main mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; @@ -988,8 +984,7 @@ void EnRu2_DrawOpa(EnRu2* this, PlayState* play) { void EnRu2_Draw(Actor* thisx, PlayState* play) { EnRu2* this = (EnRu2*)thisx; - if ((this->drawConfig < 0) || (this->drawConfig >= ARRAY_COUNT(sDrawFuncs)) || - (sDrawFuncs[this->drawConfig] == NULL)) { + if (this->drawConfig < 0 || this->drawConfig >= 3 || sDrawFuncs[this->drawConfig] == NULL) { PRINTF(VT_FGCOL(RED) T("描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n", "The drawing mode is wrong!!!!!!!!!!!!!!!!!!!!!!!!!\n") VT_RST); return; 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 aadb6a52444..e9a3f83be56 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -68,7 +68,7 @@ static ColliderCylinderInitType1 sCylinderInit = { { 30, 40, 0, { 0, 0, 0 } }, }; -static DamageTable sDamageTable[] = { +static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x0), /* Deku stick */ DMG_ENTRY(0, 0x0), /* Slingshot */ DMG_ENTRY(0, 0x0), @@ -121,14 +121,14 @@ typedef enum ShellbladeBehavior { /* 0x01 */ SHELLBLADE_WAIT_CLOSED, /* 0x02 */ SHELLBLADE_WAIT_OPEN, /* 0x03 */ SHELLBLADE_LUNGE, - /* 0x04 */ SHELLBLADE_BOUNCE + /* 0x04 */ SHELLBLADE_BOUNCE, } ShellbladeBehavior; void EnSb_Init(Actor* thisx, PlayState* play) { EnSb* this = (EnSb*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.colChkInfo.damageTable = sDamageTable; + this->actor.colChkInfo.damageTable = &sDamageTable; this->actor.colChkInfo.health = 2; SkelAnime_InitFlex(play, &this->skelAnime, &object_sb_Skel_002BF0, &object_sb_Anim_000194, NULL, NULL, 0); Collider_InitCylinder(play, &this->collider); 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 72d1f55bde6..879e34666be 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -56,7 +56,7 @@ void EnSkb_TakeDamage(EnSkb* this, PlayState* play); void EnSkb_SetupDeath(EnSkb* this, PlayState* play); void EnSkb_Death(EnSkb* this, PlayState* play); -static ColliderJntSphElementInit sJntSphElementsInit[] = { +static ColliderJntSphElementInit D_80AFE020[2] = { { { ELEM_MATERIAL_UNK0, @@ -81,7 +81,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { }, }; -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit D_80AFE068 = { { COL_MATERIAL_HIT6, AT_ON | AT_TYPE_ENEMY, @@ -90,43 +90,15 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, + 2, + D_80AFE020, }; -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0xF), - /* Slingshot */ DMG_ENTRY(1, 0xF), - /* Explosive */ DMG_ENTRY(2, 0xF), - /* Boomerang */ DMG_ENTRY(0, 0x1), - /* Normal arrow */ DMG_ENTRY(2, 0xF), - /* Hammer swing */ DMG_ENTRY(2, 0xF), - /* Hookshot */ DMG_ENTRY(0, 0x1), - /* Kokiri sword */ DMG_ENTRY(1, 0xE), - /* Master sword */ DMG_ENTRY(2, 0xF), - /* Giant's Knife */ DMG_ENTRY(4, 0xF), - /* Fire arrow */ DMG_ENTRY(4, 0x7), - /* Ice arrow */ DMG_ENTRY(2, 0xF), - /* Light arrow */ DMG_ENTRY(2, 0xF), - /* Unk arrow 1 */ DMG_ENTRY(2, 0xF), - /* Unk arrow 2 */ DMG_ENTRY(0, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(0, 0x0), - /* Fire magic */ DMG_ENTRY(4, 0x7), - /* Ice magic */ DMG_ENTRY(0, 0x6), - /* Light magic */ DMG_ENTRY(3, 0xD), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0xD), - /* Giant spin */ DMG_ENTRY(4, 0xF), - /* Master spin */ DMG_ENTRY(2, 0xF), - /* Kokiri jump */ DMG_ENTRY(2, 0xF), - /* Giant jump */ DMG_ENTRY(8, 0xF), - /* Master jump */ DMG_ENTRY(4, 0xF), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0xF), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), +static DamageTable D_80AFE078 = { + { + 0x10, 0xF2, 0xF1, 0xF2, 0x10, 0xF2, 0xF2, 0x10, 0xE1, 0xF2, 0xF4, 0x74, 0xF2, 0xF2, 0xF2, 0, + 0, 0x74, 0x60, 0xD3, 0, 0, 0xD1, 0xF4, 0xF2, 0xF2, 0xF8, 0xF4, 0, 0, 0xF4, 0, + }, }; ActorProfile En_Skb_Profile = { @@ -141,75 +113,81 @@ ActorProfile En_Skb_Profile = { /**/ EnSkb_Draw, }; -void EnSkb_SetupAction(EnSkb* this, EnSkbActionFunc actionFunc) { - this->actionFunc = actionFunc; -} - -void EnSkb_SpawnDebris(PlayState* play, EnSkb* this, Vec3f* spawnPos) { - Vec3f pos; - Vec3f vel = { 0.0f, 8.0f, 0.0f }; - Vec3f accel = { 0.0f, -1.5f, 0.0f }; - f32 spreadAngle; - f32 scale; - - spreadAngle = (Rand_ZeroOne() - 0.5f) * 6.28f; - pos.y = this->actor.floorHeight; - pos.x = (Math_SinF(spreadAngle) * 15.0f) + spawnPos->x; - pos.z = (Math_CosF(spreadAngle) * 15.0f) + spawnPos->z; - accel.x = Rand_CenteredFloat(1.0f); - accel.z = Rand_CenteredFloat(1.0f); - vel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; - scale = (Rand_ZeroOne() * 5.0f) + 12.0f; - EffectSsHahen_Spawn(play, &pos, &vel, &accel, 2, scale * 0.8f, -1, 10, NULL); - func_80033480(play, &pos, 10.0f, 1, 150, 0, 1); -} - -static InitChainEntry sInitChain[] = { +static Vec3f D_80AFE0B8 = { 0.0f, 8.0f, 0.0f }; +static Vec3f D_80AFE0C4 = { 0.0f, -1.5f, 0.0f }; +static InitChainEntry D_80AFE0D0[] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; +void func_80AFC9A0(EnSkb* this, void (*arg1)(EnSkb*, PlayState*)) { + this->unk284 = arg1; +} + +void func_80AFC9A8(PlayState* play, EnSkb* this, Vec3f* arg2) { + Vec3f sp5C; + Vec3f sp50; + Vec3f sp44; + f32 temp_fa0; + s32 pad; + + sp50 = D_80AFE0B8; + sp44 = D_80AFE0C4; + temp_fa0 = (Rand_ZeroOne() - 0.5f) * 6.28f; + sp5C.y = this->actor.floorHeight; + sp5C.x = (Math_SinF(temp_fa0) * 15.0f) + arg2->x; + sp5C.z = (Math_CosF(temp_fa0) * 15.0f) + arg2->z; + sp44.x = Rand_CenteredFloat(1.0f); + sp44.z = Rand_CenteredFloat(1.0f); + sp50.y += (Rand_ZeroOne() - 0.5f) * 4.0f; + EffectSsHahen_Spawn(play, &sp5C, &sp50, &sp44, 2, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, -1, 10, NULL); + func_80033480(play, &sp5C, 10.0f, 1, 0x96, 0, 1U); +} + void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.colChkInfo.damageTable = &sDamageTable; + Actor_ProcessInitChain(&this->actor, D_80AFE0D0); + this->actor.colChkInfo.damageTable = &D_80AFE078; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.focus.pos = this->actor.world.pos; this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlingAnim, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->unk14C, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->unk190, this->unk208, + 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; - - Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); + Collider_InitJntSph(play, &this->unk2A4); + Collider_SetJntSph(play, &this->unk2A4, &this->actor, &D_80AFE068, this->unk2C4); Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f); - - this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius = - 10 + this->actor.params; - this->collider.elements[1].dim.modelSphere.radius = this->collider.elements[1].dim.worldSphere.radius = - 20 + (this->actor.params * 2); - + this->unk2A4.elements[0].dim.modelSphere.radius = this->unk2A4.elements[0].dim.worldSphere.radius = + this->actor.params + 10; + this->unk2A4.elements[1].dim.modelSphere.radius = this->unk2A4.elements[1].dim.worldSphere.radius = + (this->actor.params + 10) * 2; this->actor.home.pos = this->actor.world.pos; this->actor.floorHeight = this->actor.world.pos.y; EnSkb_SetupRiseFromGround(this); } +typedef struct UnkActor { + Actor actor; + char pad14C[6]; + s16 unk152; +} UnkActor; + void EnSkb_Destroy(Actor* thisx, PlayState* play) { + UnkActor* temp_v1; EnSkb* this = (EnSkb*)thisx; - if (this->actor.parent != NULL) { - EnEncount1* spawner = (EnEncount1*)this->actor.parent; - - if (spawner->actor.update != NULL) { - if (spawner->curNumSpawn > 0) { - spawner->curNumSpawn--; + if ((this->actor.parent != NULL)) { + temp_v1 = (UnkActor*)this->actor.parent; + if ((temp_v1->actor.update != NULL)) { + if (temp_v1->unk152 > 0) { + temp_v1->unk152 -= 1; } } } - Collider_DestroyJntSph(play, &this->collider); + Collider_DestroyJntSph(play, &this->unk2A4); } void EnSkb_DecideNextAction(EnSkb* this) { @@ -224,93 +202,83 @@ void EnSkb_DecideNextAction(EnSkb* this) { } void EnSkb_SetupRiseFromGround(EnSkb* this) { - Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalchildUncurlingAnim, 1.0f); + Animation_PlayOnceSetSpeed(&this->unk14C, &object_skb_001854_Anim, 1.0f); this->actionState = SKB_BEHAVIOR_BURIED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_APPEAR); - EnSkb_SetupAction(this, EnSkb_RiseFromGround); + func_80AFC9A0(this, EnSkb_RiseFromGround); } void EnSkb_RiseFromGround(EnSkb* this, PlayState* play) { - if (this->skelAnime.curFrame < 4.0f) { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + if (this->unk14C.curFrame < 4.0f) { + this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 800.0f, 0.0f); Math_SmoothStepToF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f, 0.0f); - if ((play->gameplayFrames & 1) != 0) { - EnSkb_SpawnDebris(play, this, &this->actor.world.pos); + if (play->gameplayFrames & 1) { + func_80AFC9A8(play, this, &this->actor.world.pos); } - if (SkelAnime_Update(&this->skelAnime) && (0.0f == this->actor.shape.yOffset)) { + if (SkelAnime_Update(&this->unk14C) && (this->actor.shape.yOffset == 0.0f)) { EnSkb_DecideNextAction(this); } } void EnSkb_SetupDespawn(EnSkb* this) { - Animation_Change(&this->skelAnime, &gStalchildUncurlingAnim, -1.0f, - Animation_GetLastFrame(&gStalchildUncurlingAnim), 0.0f, ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->unk14C, &object_skb_001854_Anim, -1.0f, Animation_GetLastFrame(&object_skb_001854_Anim), + 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState = SKB_BEHAVIOR_BURIED; this->setColliderAT = false; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - EnSkb_SetupAction(this, EnSkb_Despawn); + func_80AFC9A0(this, EnSkb_Despawn); } void EnSkb_Despawn(EnSkb* this, PlayState* play) { if ((Math_SmoothStepToF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f, 0.0f) != 0.0f) && (play->gameplayFrames & 1)) { - EnSkb_SpawnDebris(play, this, &this->actor.world.pos); + func_80AFC9A8(play, this, &this->actor.world.pos); } Math_SmoothStepToF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f, 0.0f); - if (SkelAnime_Update(&this->skelAnime)) { + if (SkelAnime_Update(&this->unk14C)) { Actor_Kill(&this->actor); } } void EnSkb_SetupWalkForward(EnSkb* this) { - Animation_Change(&this->skelAnime, &gStalchildWalkingAnim, 0.96000004f, 0.0f, - Animation_GetLastFrame(&gStalchildWalkingAnim), ANIMMODE_LOOP, -4.0f); + Animation_Change(&this->unk14C, &object_skb_0047E0_Anim, 0.96000004f, 0.0f, + Animation_GetLastFrame(&object_skb_0047E0_Anim), ANIMMODE_LOOP, -4.0f); this->actionState = SKB_BEHAVIOR_WALKING; this->headlessYawOffset = 0; this->actor.speed = this->actor.scale.y * 160.0f; - EnSkb_SetupAction(this, EnSkb_WalkForward); + func_80AFC9A0(this, EnSkb_WalkForward); } void EnSkb_WalkForward(EnSkb* this, PlayState* play) { - s32 thisKeyFrame; - s32 prevKeyFrame; - f32 playSpeed; - Player* player = GET_PLAYER(play); - - if ((this->breakFlags != 0) && ((play->gameplayFrames & 0xF) == 0)) { - this->headlessYawOffset = Rand_CenteredFloat(50000.0f); + s32 temp_ft2_sp34; + f32 var_fv1_2; + s32 temp_ft4; + Actor* sp28; + + sp28 = play->actorCtx.actorLists[2].head; + if ((this->breakFlags != 0) && !(play->gameplayFrames & 0xF)) { + this->headlessYawOffset = (s16)(s32)Rand_CenteredFloat(50000.0f); } - Math_SmoothStepToS(&this->actor.shape.rot.y, (this->actor.yawTowardsPlayer + this->headlessYawOffset), 1, 0x2EE, 0); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->headlessYawOffset, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - thisKeyFrame = this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - if (this->skelAnime.playSpeed >= 0.0f) { - playSpeed = this->skelAnime.playSpeed; - } else { - playSpeed = -this->skelAnime.playSpeed; - } - prevKeyFrame = (this->skelAnime.curFrame - playSpeed); - if (this->skelAnime.playSpeed >= 0.0f) { - playSpeed = this->skelAnime.playSpeed; - } else { - playSpeed = -this->skelAnime.playSpeed; + temp_ft2_sp34 = (s32)this->unk14C.curFrame; + SkelAnime_Update(&this->unk14C); + var_fv1_2 = ABS(this->unk14C.playSpeed); + temp_ft4 = (s32)(this->unk14C.curFrame - var_fv1_2); + var_fv1_2 = ABS(this->unk14C.playSpeed); + if ((temp_ft2_sp34 != (s32)this->unk14C.curFrame) && + (((temp_ft4 < 9) && (((s32)var_fv1_2 + temp_ft2_sp34) >= 8)) || + ((temp_ft4 < 0x10) && (((s32)var_fv1_2 + temp_ft2_sp34) >= 0xF)))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); } - if (thisKeyFrame != (s32)this->skelAnime.curFrame) { - if (((prevKeyFrame < 9) && (((s32)playSpeed + thisKeyFrame) >= 8)) || - !((prevKeyFrame >= 16) || (((s32)playSpeed + thisKeyFrame) < 15))) { - - Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); - } - } - if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 800.0f || IS_DAY) { + if ((Math_Vec3f_DistXZ(&this->actor.home.pos, &sp28->world.pos) > 800.0f) || IS_DAY) { EnSkb_SetupDespawn(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x11C7) && (this->actor.xzDistToPlayer < (60.0f + (this->actor.params * 6.0f)))) { @@ -319,58 +287,61 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { } void EnSkb_SetupAttack(EnSkb* this) { - Animation_Change(&this->skelAnime, &gStalchildAttackingAnim, 0.6f, 0.0f, - Animation_GetLastFrame(&gStalchildAttackingAnim), ANIMMODE_ONCE_INTERP, 4.0f); - this->collider.base.atFlags &= ~AT_BOUNCED; + Animation_Change(&this->unk14C, &object_skb_000460_Anim, 0.6f, 0.0f, + Animation_GetLastFrame(&object_skb_000460_Anim), ANIMMODE_ONCE_INTERP, 4.0f); + this->unk2A4.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_ATTACKING; this->actor.speed = 0.0f; - EnSkb_SetupAction(this, EnSkb_Attack); + func_80AFC9A0(this, EnSkb_Attack); } void EnSkb_Attack(EnSkb* this, PlayState* play) { - s32 frameData; + s32 temp_ft1; + u8 temp_v0; - frameData = this->skelAnime.curFrame; - if (frameData == 3) { + temp_ft1 = (s32)this->unk14C.curFrame; + if (temp_ft1 == 3) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->setColliderAT = true; - } else if (frameData == 6) { + } else if (temp_ft1 == 6) { this->setColliderAT = false; } - if (this->collider.base.atFlags & AT_BOUNCED) { - this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); + if (this->unk2A4.base.atFlags & AT_BOUNCED) { + this->unk2A4.base.atFlags &= ~(AT_HIT | AT_BOUNCED); EnSkb_SetupRecoil(this); - } else if (SkelAnime_Update(&this->skelAnime)) { + } else if (SkelAnime_Update(&this->unk14C)) { EnSkb_DecideNextAction(this); } } void EnSkb_SetupRecoil(EnSkb* this) { - Animation_Change(&this->skelAnime, &gStalchildAttackingAnim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, + Animation_Change(&this->unk14C, &object_skb_000460_Anim, -0.4f, this->unk14C.curFrame - 1.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f); - this->collider.base.atFlags &= ~AT_BOUNCED; + this->unk2A4.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_RECOILING; this->setColliderAT = false; - EnSkb_SetupAction(this, EnSkb_Recoil); + func_80AFC9A0(this, EnSkb_Recoil); } void EnSkb_Recoil(EnSkb* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime)) { + if (SkelAnime_Update(&this->unk14C)) { EnSkb_DecideNextAction(this); } } -void EnSkb_SetupStunned(EnSkb* this) { +void func_80AFD540(EnSkb* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = 0.0f; } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->setColliderAT = false; this->actionState = SKB_BEHAVIOR_STUNNED; - EnSkb_SetupAction(this, EnSkb_Stunned); + func_80AFC9A0(this, EnSkb_Stunned); } void EnSkb_Stunned(EnSkb* this, PlayState* play) { + f32 temp_fv0; + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } @@ -389,45 +360,42 @@ void EnSkb_Stunned(EnSkb* this, PlayState* play) { } void EnSkb_SetupTakeDamage(EnSkb* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDamagedAnim, -4.0f); + Animation_MorphToPlayOnce(&this->unk14C, &object_skb_000D98_Anim, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -4.0f; } this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->actionState = SKB_BEHAVIOR_DAMAGED; - EnSkb_SetupAction(this, EnSkb_TakeDamage); + func_80AFC9A0(this, EnSkb_TakeDamage); } void EnSkb_TakeDamage(EnSkb* this, PlayState* play) { - // this cast is likely not real, but allows for a match u8* new_var; new_var = &this->breakFlags; if ((this->breakFlags != 1) || BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) { - if ((*new_var) != 0) { - this->breakFlags = (*new_var) | 2; + if (*new_var != 0) { + this->breakFlags = *new_var | 2; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - this->actor.speed = 0; + this->actor.speed = 0.0f; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } } - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (SkelAnime_Update(&this->unk14C) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnSkb_DecideNextAction(this); } } } void EnSkb_SetupDeath(EnSkb* this, PlayState* play) { - Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDyingAnim, -4.0f); - this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->actor.world.rot.y = this->actor.yawTowardsPlayer; + Animation_MorphToPlayOnce(&this->unk14C, &object_skb_0009DC_Anim, -4.0f); + this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -6.0f; } @@ -435,35 +403,34 @@ void EnSkb_SetupDeath(EnSkb* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; BodyBreak_Alloc(&this->bodyBreak, 18, play); this->breakFlags |= 4; - EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 0x28); - EnSkb_SetupAction(this, EnSkb_Death); + EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 40); + func_80AFC9A0(this, EnSkb_Death); } void EnSkb_Death(EnSkb* this, PlayState* play) { + if (BodyBreak_SpawnParts(&this->actor, &this->bodyBreak, play, 1)) { if (this->actor.scale.x == 0.01f) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_1, false)); } else if (this->actor.scale.x <= 0.015f) { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); + Item_DropCollectible(play, &this->actor.world.pos, 1); } else { - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); - Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, 2); + Item_DropCollectible(play, &this->actor.world.pos, 2); + Item_DropCollectible(play, &this->actor.world.pos, 2); } - this->breakFlags |= 8; Actor_Kill(&this->actor); } } void EnSkb_CheckDamage(EnSkb* this, PlayState* play) { - s16 pad; - s32 i; - Vec3f flamePos; - s16 scale; - s16 colorFilterDuration; Player* player; + s32 colorFilterDuration; + Vec3f sp54; + s16 sp52; + s32 var_s0; if ((this->actionState != SKB_BEHAVIOR_DYING) && (this->actor.bgCheckFlags & (BGCHECKFLAG_WATER | BGCHECKFLAG_WATER_TOUCH)) && @@ -471,50 +438,46 @@ void EnSkb_CheckDamage(EnSkb* this, PlayState* play) { this->actor.colChkInfo.health = 0; this->setColliderAT = false; EnSkb_SetupDeath(this, play); - } else if (this->actionState >= SKB_BEHAVIOR_ATTACKING) { - if (this->collider.base.acFlags & AC_HIT) { - this->collider.base.acFlags &= ~AC_HIT; - if (this->actor.colChkInfo.damageReaction != 6) { - this->lastDamageReaction = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->collider.elements[1].base, true); - this->setColliderAT = false; - if (this->actor.colChkInfo.damageReaction == 1) { - if (this->actionState != SKB_BEHAVIOR_STUNNED) { - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, - 80); - Actor_ApplyDamage(&this->actor); - EnSkb_SetupStunned(this); + } else if ((this->actionState >= SKB_BEHAVIOR_ATTACKING) && (this->unk2A4.base.acFlags & AC_HIT)) { + this->unk2A4.base.acFlags &= ~AC_HIT; + if (((this->actor.colChkInfo.damageReaction != 6))) { + this->lastDamageReaction = this->actor.colChkInfo.damageReaction; + Actor_SetDropFlag(&this->actor, &this->unk2A4.elements[1].base, true); + this->setColliderAT = false; + if (this->actor.colChkInfo.damageReaction == 1) { + if (this->actionState != SKB_BEHAVIOR_STUNNED) { + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); + Actor_ApplyDamage(&this->actor); + func_80AFD540(this); + } + } else { + colorFilterDuration = 8; + if (this->actor.colChkInfo.damageReaction == 7) { + sp52 = this->actor.scale.y * 7500.0f; + for (var_s0 = 4; var_s0 >= 0; var_s0--) { + sp54 = this->actor.world.pos; + sp54.x += Rand_CenteredFloat(20.0f); + sp54.z += Rand_CenteredFloat(20.0f); + sp54.y += Rand_ZeroOne() * 25.0f; + EffectSsEnFire_SpawnVec3f(play, &this->actor, &sp54, sp52, 0, 0, -1); } + colorFilterDuration = 25; + } + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, + colorFilterDuration); + if (Actor_ApplyDamage(&this->actor) == 0) { + EnSkb_SetupDeath(this, play); } else { - colorFilterDuration = 8; - if (this->actor.colChkInfo.damageReaction == 7) { - scale = this->actor.scale.y * 7500.0f; - for (i = 4; i >= 0; i--) { - flamePos = this->actor.world.pos; - flamePos.x += Rand_CenteredFloat(20.0f); - flamePos.z += Rand_CenteredFloat(20.0f); - flamePos.y += (Rand_ZeroOne() * 25.0f); - EffectSsEnFire_SpawnVec3f(play, &this->actor, &flamePos, scale, 0, 0, -1); - } - colorFilterDuration = 25; - } - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, - colorFilterDuration); - if (!Actor_ApplyDamage(&this->actor)) { - EnSkb_SetupDeath(this, play); - return; - } player = GET_PLAYER(play); - if (this->breakFlags == 0) { - if ((this->actor.colChkInfo.damageReaction == 0xD) || - ((this->actor.colChkInfo.damageReaction == 0xE) && - ((player->meleeWeaponAnimation >= PLAYER_MWA_RIGHT_SLASH_1H && - player->meleeWeaponAnimation <= PLAYER_MWA_LEFT_COMBO_2H) || - (player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_RIGHT || - player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)))) { - BodyBreak_Alloc(&this->bodyBreak, 2, play); - this->breakFlags = 1; // setup for head bodybreak - } + if ((this->breakFlags == 0) && + (((this->actor.colChkInfo.damageReaction == 0xD)) || + ((this->actor.colChkInfo.damageReaction == 0xE) && + (((((player->meleeWeaponAnimation >= PLAYER_MWA_RIGHT_SLASH_1H))) && + (player->meleeWeaponAnimation <= PLAYER_MWA_LEFT_COMBO_2H)) || + (player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_RIGHT) || + (player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT))))) { + BodyBreak_Alloc(&this->bodyBreak, 2, play); + this->breakFlags = 1; // setup for head bodybreak } EnSkb_SetupTakeDamage(this); } @@ -532,58 +495,54 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->actionFunc(this, play); + this->unk284(this, play); this->actor.focus.pos = this->actor.world.pos; - this->actor.focus.pos.y += (3000.0f * this->actor.scale.y); + this->actor.focus.pos.y += 3000.0f * this->actor.scale.y; if (this->setColliderAT) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk2A4.base); } - - if (this->actionState >= SKB_BEHAVIOR_ATTACKING) { - if ((this->actor.colorFilterTimer == 0) || ((this->actor.colorFilterParams & 0x4000) == 0)) { - - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - } + if ((this->actionState >= SKB_BEHAVIOR_ATTACKING) && + ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk2A4.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk2A4.base); } -s32 EnSkb_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnSkb* this = (EnSkb*)thisx; - PlayState* play = (PlayState*)play2; - s16 color; +s32 func_80AFDD30(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg5, void* thisx) { + EnSkb* this = thisx; + PlayState* arg0 = play; + s32 temp_v0; - if (limbIndex == 11) { - if ((this->breakFlags & 2) == 0) { // head limb, head is still attached - OPEN_DISPS(play->state.gfxCtx, "../z_en_skb.c", 972); - color = ABS((s16)(Math_SinS(play->gameplayFrames * 0x1770) * 95.0f)) + 160; + if (arg1 == 11) { + if (!(this->breakFlags & 2)) { // head limb, head is still attached + OPEN_DISPS(arg0->state.gfxCtx, "../z_en_skb.c", 972); + temp_v0 = (s16)(ABS((s16)(Math_SinS(arg0->gameplayFrames * 0x1770) * 95.0f)) + 0xA0) & 0xFF; gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, color, color, color, 255); - CLOSE_DISPS(play->state.gfxCtx, "../z_en_skb.c", 978); + gDPSetEnvColor(POLY_OPA_DISP++, temp_v0, temp_v0, temp_v0, 255); + CLOSE_DISPS(arg0->state.gfxCtx, "../z_en_skb.c", 978); } else { - *dList = NULL; + *arg2 = NULL; } - } else if ((limbIndex == 12) && ((this->breakFlags & 2) != 0)) { // jaw limb, don't draw if headless - *dList = NULL; + } else if ((arg1 == 12) && (this->breakFlags & 2)) { // jaw limb, don't draw if headless + *arg2 = NULL; } return 0; } -void EnSkb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnSkb* this = (EnSkb*)thisx; - - Collider_UpdateSpheres(limbIndex, &this->collider); +void func_80AFDF24(PlayState* arg0, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { + EnSkb* this = thisx; + Collider_UpdateSpheres(arg1, &this->unk2A4); if ((this->breakFlags ^ 1) == 0) { - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 11, 12, 18, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, arg1, 11, 12, 18, arg2, BODYBREAK_OBJECT_SLOT_DEFAULT); } else if ((this->breakFlags ^ (this->breakFlags | 4)) == 0) { - BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 18, 18, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, arg1, 0, 18, 18, arg2, BODYBREAK_OBJECT_SLOT_DEFAULT); } } void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; + Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, - EnSkb_PostLimbDraw, &this->actor); + SkelAnime_DrawOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80AFDD30, func_80AFDF24, this); } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index e40c049cfa7..f434fdedd58 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -6,22 +6,21 @@ struct EnSkb; -typedef void (*EnSkbActionFunc)(struct EnSkb*, struct PlayState*); - typedef struct EnSkb { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[20]; - /* 0x0208 */ Vec3s morphTable[20]; - /* 0x0280 */ u8 actionState; - /* 0x0281 */ u8 setColliderAT; - /* 0x0282 */ u8 lastDamageReaction; - /* 0x0283 */ u8 breakFlags; - /* 0x0284 */ EnSkbActionFunc actionFunc; - /* 0x0288 */ s16 headlessYawOffset; - /* 0x028C */ BodyBreak bodyBreak; - /* 0x02A4 */ ColliderJntSph collider; - /* 0x02C4 */ ColliderJntSphElement colliderElements[2]; -} EnSkb; // size = 0x0344 + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ Vec3s unk190[20]; + /* 0x208 */ Vec3s unk208[20]; + /* 0x280 */ u8 actionState; + /* 0x281 */ u8 setColliderAT; + /* 0x282 */ u8 lastDamageReaction; + /* 0x283 */ u8 breakFlags; + /* 0x284 */ void (*unk284)(struct EnSkb*, struct PlayState*); + /* 0x288 */ s16 headlessYawOffset; + /* 0x28A */ char pad28A[2]; + /* 0x28C */ BodyBreak bodyBreak; + /* 0x2A4 */ ColliderJntSph unk2A4; + /* 0x2C4 */ ColliderJntSphElement unk2C4[2]; +} EnSkb; // size = 0x344 #endif 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 f9b9e6e2a4e..ddab8998b78 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -1,9 +1,3 @@ -/* - * File: z_en_st.c - * Overlay: ovl_En_St - * Description: Skulltula (normal, big, invisible) - */ - #include "z_en_st.h" #include "libc64/qrand.h" @@ -152,7 +146,7 @@ void EnSt_SetupAction(EnSt* this, EnStActionFunc actionFunc) { } /** - * Spawns `dustCnt` dust particles in a random pattern around the Skulltula + * Spawns `dustCnt` dust particles in a random pattern around the skulltulla */ void EnSt_SpawnDust(EnSt* this, PlayState* play, s32 dustCnt) { Color_RGBA8 primColor = { 170, 130, 90, 255 }; @@ -220,8 +214,8 @@ s32 EnSt_CreateBlureEffect(PlayState* play) { } /** - * Checks for the position of the ceiling above the Skulltula. - * If no ceiling is found it is set to 1000 units above the Skulltula + * Checks for the position of the ceiling above the skulltulla. + * If no ceiling is found it is set to 1000 units above the skulltulla */ s32 EnSt_CheckCeilingPos(EnSt* this, PlayState* play) { CollisionPoly* poly; @@ -291,7 +285,7 @@ void EnSt_SetDropAnimAndVel(EnSt* this) { } /** - * Initializes the Skulltula's 6 cylinders, and sphere collider. + * Initializes the skulltulla's 6 cylinders, and sphere collider. */ void EnSt_InitColliders(EnSt* this, PlayState* play) { ColliderCylinderInit* cylinders[6] = { @@ -505,11 +499,11 @@ s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) { } /** - * Checks if the Skulltula's colliders have been hit, returns true if the hit has dealt damage to the Skulltula + * Checks if the skulltulla's colliders have been hit, returns true if the hit has dealt damage to the skulltulla */ s32 EnSt_CheckColliders(EnSt* this, PlayState* play) { if (EnSt_CheckHitFrontside(this)) { - // player has hit the front shield area of the Skulltula + // player has hit the front shield area of the skulltulla return false; } @@ -518,12 +512,12 @@ s32 EnSt_CheckColliders(EnSt* this, PlayState* play) { } if (EnSt_CheckHitBackside(this, play)) { - // player has hit the backside of the Skulltula + // player has hit the backside of the skulltulla return true; } if (this->stunTimer == 0 && this->takeDamageSpinTimer == 0) { - // check if the Skulltula has hit the player. + // check if the skulltulla has hit the player. EnSt_CheckHitPlayer(this, play); } return false; @@ -590,7 +584,7 @@ s32 EnSt_DecrStunTimer(EnSt* this) { } /** - * Updates the yaw of the Skulltula, used for the shaking animation right before + * Updates the yaw of the skulltulla, used for the shaking animation right before * turning, and the actual turning to face away from the player, and then back to * face the player */ @@ -616,7 +610,7 @@ void EnSt_UpdateYaw(EnSt* this, PlayState* play) { if (this->swayTimer == 0 && this->deathTimer == 0 && this->finishDeathTimer == 0) { // not swaying or dying if (this->takeDamageSpinTimer != 0 || this->gaveDamageSpinTimer != 0) { - // Skulltula is doing a spinning animation + // skulltulla is doing a spinning animation this->actor.shape.rot.y += 0x2000; return; } @@ -674,17 +668,17 @@ void EnSt_UpdateYaw(EnSt* this, PlayState* play) { } /** - * Checks to see if the Skulltula is done bouncing on the ground, - * spawns dust particles as the Skulltula hits the ground + * Checks to see if the skulltulla is done bouncing on the ground, + * spawns dust particles as the skulltulla hits the ground */ s32 EnSt_IsDoneBouncing(EnSt* this, PlayState* play) { if (this->actor.velocity.y > 0.0f || this->groundBounces == 0) { - // the Skulltula is moving upwards or the groundBounces is 0 + // the skulltulla is moving upwards or the groundBounces is 0 return false; } if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - // the Skulltula is not on the ground. + // the skulltulla is not on the ground. return false; } @@ -696,7 +690,7 @@ s32 EnSt_IsDoneBouncing(EnSt* this, PlayState* play) { if (this->groundBounces != 0) { return false; } else { - // make sure the Skulltula stays on the ground. + // make sure the skulltulla stays on the ground. this->actor.velocity.y = 0.0f; } return true; @@ -719,19 +713,19 @@ s32 EnSt_IsCloseToPlayer(EnSt* this, PlayState* play) { // skull is spinning from damage. return false; } else if (this->actor.xzDistToPlayer > 160.0f) { - // player is more than 160 xz units from the Skulltula + // player is more than 160 xz units from the skulltulla return false; } yDist = this->actor.world.pos.y - player->actor.world.pos.y; if (yDist < 0.0f || yDist > 400.0f) { - // player is above the Skulltula or more than 400 units below - // the Skulltula + // player is above the skulltulla or more than 400 units below + // the skulltulla return false; } if (player->actor.world.pos.y < this->actor.floorHeight) { - // player is below the Skulltula's ground position + // player is below the Skulltulla's ground position return false; } return true; @@ -758,7 +752,7 @@ s32 EnSt_IsCloseToGround(EnSt* this) { } /** - * Does the animation of the Skulltula swaying back and forth after the Skulltula + * Does the animation of the skulltulla swaying back and forth after the skulltulla * has been hit in the front by a sword */ void EnSt_Sway(EnSt* this) { @@ -850,7 +844,7 @@ void EnSt_WaitOnCeiling(EnSt* this, PlayState* play) { } /** - * Skulltula is waiting on the ground for the player to move away, or for + * Skulltulla is waiting on the ground for the player to move away, or for * a collider to have contact */ void EnSt_WaitOnGround(EnSt* this, PlayState* play) { @@ -902,12 +896,12 @@ void EnSt_LandOnGround(EnSt* this, PlayState* play) { this->sfxTimer++; if (this->sfxTimer == 14) { - // play the sound effect of the Skulltula hitting the ground. + // play the sound effect of the skulltulla hitting the ground. Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_DOWN_SET); } if ((this->actor.floorHeight + this->floorHeightOffset) < this->actor.world.pos.y) { - // the Skulltula has hit the ground. + // the skulltulla has hit the ground. this->sfxTimer = 0; EnSt_SetupAction(this, EnSt_WaitOnGround); } else { @@ -928,7 +922,7 @@ void EnSt_MoveToGround(EnSt* this, PlayState* play) { EnSt_SetReturnToCeilingAnimation(this); EnSt_SetupAction(this, EnSt_ReturnToCeiling); } else if (EnSt_IsCloseToGround(this)) { - // The Skulltula has become close to the ground. + // The skulltulla has become close to the ground. EnSt_SpawnBlastEffect(this, play); EnSt_SetLandAnimation(this); EnSt_SetupAction(this, EnSt_LandOnGround); @@ -950,7 +944,7 @@ void EnSt_ReturnToCeiling(EnSt* this, PlayState* play) { EnSt_SetDropAnimAndVel(this); EnSt_SetupAction(this, EnSt_MoveToGround); } else if (EnSt_IsCloseToInitialPos(this)) { - // the Skulltula is close to the initial postion. + // the skulltulla is close to the initial postion. EnSt_SetWaitingAnimation(this); EnSt_SetupAction(this, EnSt_WaitOnCeiling); } else { @@ -960,7 +954,7 @@ void EnSt_ReturnToCeiling(EnSt* this, PlayState* play) { } /** - * The Skulltula has been killed, bounce around + * The skulltulla has been killed, bounce around */ void EnSt_BounceAround(EnSt* this, PlayState* play) { this->actor.colorFilterTimer = this->deathTimer; @@ -1053,14 +1047,14 @@ void EnSt_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); if ((this->stunTimer == 0) && (this->swayTimer == 0)) { - // run the current action if the Skulltula isn't stunned + // run the current action if the skulltulla isn't stunned // or swaying. this->actionFunc(this, play); } else if (this->stunTimer != 0) { // decrement the stun timer. EnSt_DecrStunTimer(this); } else { - // sway the Skulltula. + // sway the skulltulla. EnSt_Sway(this); } 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 4b3135ed97d..f55b494fa6f 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 @@ -497,7 +497,7 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos); } -s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_80B1148C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSyatekiMan* this = (EnSyatekiMan*)thisx; s32 turnDirection; @@ -522,7 +522,7 @@ void EnSyatekiMan_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnSyatekiMan_OverrideLimbDraw, NULL, this); + func_80B1148C, NULL, this); } #if DEBUG_FEATURES 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 8dc9f764c8d..74e711380fc 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -76,68 +76,29 @@ void func_80862FA8(EnTest* this, PlayState* play); s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this); +extern SkeletonHeader D_06007C28; +extern AnimationHeader D_0600316C; // ready stance +extern AnimationHeader D_06001978; // jump back +extern AnimationHeader D_0600B00C; // slash 1 +extern AnimationHeader D_0600B4E4; // slash 1 end +extern AnimationHeader D_0600BE4C; // slash 2 +extern AnimationHeader D_0600A324; // jumpslash start +extern AnimationHeader D_0600A99C; // jumpslash +extern AnimationHeader D_0600E2B0; // sidestep +extern AnimationHeader D_060081B4; // walk forward? +extern AnimationHeader D_06001C20; // block +extern AnimationHeader D_060026D4; //? +extern AnimationHeader D_06000444; +extern AnimationHeader D_06001420; +extern AnimationHeader D_06008604; +extern AnimationHeader D_06009A90; +extern AnimationHeader D_0600C438; + static u8 sUpperBodyLimbCopyMap[] = { - false, // STALFOS_LIMB_NONE - false, // STALFOS_LIMB_ROOT - false, // STALFOS_LIMB_UPPERBODY_ROOT - false, // STALFOS_LIMB_CORE_LOWER_ROOT - true, // STALFOS_LIMB_CORE_UPPER_ROOT - true, // STALFOS_LIMB_NECK_ROOT - true, // STALFOS_LIMB_HEAD_ROOT - true, // STALFOS_LIMB_7 - true, // STALFOS_LIMB_8 - true, // STALFOS_LIMB_JAW_ROOT - true, // STALFOS_LIMB_JAW - true, // STALFOS_LIMB_HEAD - true, // STALFOS_LIMB_NECK_UPPER - true, // STALFOS_LIMB_NECK_LOWER - true, // STALFOS_LIMB_CORE_UPPER - true, // STALFOS_LIMB_CHEST - true, // STALFOS_LIMB_SHOULDER_R_ROOT - true, // STALFOS_LIMB_SHOULDER_ARMOR_R_ROOT - true, // STALFOS_LIMB_SHOULDER_ARMOR_R - true, // STALFOS_LIMB_SHOULDER_L_ROOT - true, // STALFOS_LIMB_SHOULDER_ARMOR_L_ROOT - true, // STALFOS_LIMB_SHOULDER_ARMOR_L - true, // STALFOS_LIMB_ARM_L_ROOT - true, // STALFOS_LIMB_UPPERARM_L_ROOT - true, // STALFOS_LIMB_FOREARM_L_ROOT - true, // STALFOS_LIMB_HAND_L_ROOT - true, // STALFOS_LIMB_HAND_L - true, // STALFOS_LIMB_SHIELD - true, // STALFOS_LIMB_FOREARM_L - true, // STALFOS_LIMB_UPPERARM_L - true, // STALFOS_LIMB_ARM_R_ROOT - true, // STALFOS_LIMB_UPPERARM_R_ROOT - true, // STALFOS_LIMB_FOREARM_R_ROOT - true, // STALFOS_LIMB_HAND_R_ROOT - true, // STALFOS_LIMB_SWORD - true, // STALFOS_LIMB_HAND_R - true, // STALFOS_LIMB_FOREARM_R - true, // STALFOS_LIMB_UPPERARM_R - true, // STALFOS_LIMB_CORE_LOWER - false, // STALFOS_LIMB_LOWERBODY_ROOT - false, // STALFOS_LIMB_WAIST_ROOT - false, // STALFOS_LIMB_LEGS_ROOT - false, // STALFOS_LIMB_LEG_L_ROOT - false, // STALFOS_LIMB_THIGH_L_ROOT - false, // STALFOS_LIMB_LOWERLEG_L_ROOT - false, // STALFOS_LIMB_ANKLE_L_ROOT - false, // STALFOS_LIMB_ANKLE_L - false, // STALFOS_LIMB_FOOT_L_ROOT - false, // STALFOS_LIMB_FOOT_L - false, // STALFOS_LIMB_LOWERLEG_L - false, // STALFOS_LIMB_THIGH_L - false, // STALFOS_LIMB_LEG_R_ROOT - false, // STALFOS_LIMB_THIGH_R_ROOT - false, // STALFOS_LIMB_LOWERLEG_R_ROOT - false, // STALFOS_LIMB_ANKLE_R_ROOT - false, // STALFOS_LIMB_ANKLE_R - false, // STALFOS_LIMB_FOOT_R_ROOT - false, // STALFOS_LIMB_FOOT_R - false, // STALFOS_LIMB_LOWERLEG_R - false, // STALFOS_LIMB_THIGH_R - false, // STALFOS_LIMB_WAIST + false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, + true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, + false, false, false, false, false, false, false, false, false, false, false, false, false, }; ActorProfile En_Test_Profile = { @@ -274,10 +235,9 @@ void EnTest_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(play, &this->skelAnime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->jointTable, this->morphTable, - STALFOS_LIMB_MAX); - SkelAnime_Init(play, &this->upperSkelanime, &gStalfosSkel, &gStalfosMiddleGuardAnim, this->upperJointTable, - this->upperMorphTable, STALFOS_LIMB_MAX); + SkelAnime_Init(play, &this->skelAnime, &D_06007C28, &D_0600316C, this->jointTable, this->morphTable, 61); + SkelAnime_Init(play, &this->upperSkelanime, &D_06007C28, &D_0600316C, this->upperJointTable, this->upperMorphTable, + 61); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); @@ -439,7 +399,7 @@ void EnTest_ChooseAction(EnTest* this, PlayState* play) { } void EnTest_SetupWaitGround(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &gStalfosMiddleGuardAnim); + Animation_PlayLoop(&this->skelAnime, &D_0600316C); this->unk_7C8 = 0; this->timer = 15; this->actor.scale.y = 0.0f; @@ -470,7 +430,7 @@ void EnTest_WaitGround(EnTest* this, PlayState* play) { } void EnTest_SetupWaitAbove(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &gStalfosMiddleGuardAnim); + Animation_PlayLoop(&this->skelAnime, &D_0600316C); this->unk_7C8 = 0; this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; Actor_SetScale(&this->actor, 0.0f); @@ -491,7 +451,7 @@ void EnTest_WaitAbove(EnTest* this, PlayState* play) { } void EnTest_SetupIdle(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &gStalfosMiddleGuardAnim); + Animation_PlayLoop(&this->skelAnime, &D_0600316C); this->unk_7C8 = 0xA; this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; @@ -551,7 +511,7 @@ void EnTest_Idle(EnTest* this, PlayState* play) { } void EnTest_Fall(EnTest* this, PlayState* play) { - Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalfosLandFromLeapAnim, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &D_0600C438, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.world.pos.y <= this->actor.floorHeight) { @@ -571,9 +531,8 @@ void EnTest_Land(EnTest* this, PlayState* play) { } void EnTest_SetupWalkAndBlock(EnTest* this) { - Animation_Change(&this->upperSkelanime, &gStalfosBlockWithShieldAnim, 2.0f, 0.0f, - Animation_GetLastFrame(&gStalfosBlockWithShieldAnim), 2, 2.0f); - Animation_PlayLoop(&this->skelAnime, &gStalfosSlowAdvanceAnim); + Animation_Change(&this->upperSkelanime, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2, 2.0f); + Animation_PlayLoop(&this->skelAnime, &D_060081B4); this->timer = (s16)(Rand_ZeroOne() * 5.0f); this->unk_7C8 = 0xD; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -617,12 +576,12 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { if (ABS(this->actor.speed) < 3.0f) { s32 pad; - Animation_Change(&this->skelAnime, &gStalfosSlowAdvanceAnim, 0.0f, this->skelAnime.curFrame, - Animation_GetLastFrame(&gStalfosSlowAdvanceAnim), 0, -6.0f); + Animation_Change(&this->skelAnime, &D_060081B4, 0.0f, this->skelAnime.curFrame, + Animation_GetLastFrame(&D_060081B4), 0, -6.0f); playSpeed = this->actor.speed * 10.0f; } else { - Animation_Change(&this->skelAnime, &gStalfosFastAdvanceAnim, 0.0f, this->skelAnime.curFrame, - Animation_GetLastFrame(&gStalfosFastAdvanceAnim), 0, -4.0f); + Animation_Change(&this->skelAnime, &D_060026D4, 0.0f, this->skelAnime.curFrame, + Animation_GetLastFrame(&D_060026D4), 0, -4.0f); playSpeed = this->actor.speed * 10.0f * 0.02f; } @@ -656,11 +615,12 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); + + beforeCurFrame = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed); absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); if ((s32)this->skelAnime.curFrame != prevFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; + s32 afterPrevFrame = (s32)absPlaySpeed + prevFrame; if (((afterPrevFrame > 1) && (beforeCurFrame < 1)) || ((beforeCurFrame < 7) && (afterPrevFrame > 7))) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_WALK); @@ -725,7 +685,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { // a variation of sidestep void func_80860BDC(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &gStalfosSidestepAnim); + Animation_PlayLoop(&this->skelAnime, &D_0600E2B0); this->unk_7C8 = 0xE; EnTest_SetupAction(this, func_80860C24); } @@ -738,7 +698,7 @@ void func_80860C24(EnTest* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 afterPrevFrame; - s32 absPlaySpeed; + f32 absPlaySpeed; if (!EnTest_ReactToProjectile(play, this)) { yawDiff = this->actor.yawTowardsPlayer; @@ -764,13 +724,17 @@ void func_80860C24(EnTest* this, PlayState* play) { this->skelAnime.playSpeed = playSpeed; } - prevFrame = (s32)this->skelAnime.curFrame; + prevFrame = this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); + + beforeCurFrame = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed); + absPlaySpeed = ABS(this->skelAnime.playSpeed); + + if (1) {} if ((s32)this->skelAnime.curFrame != prevFrame) { - afterPrevFrame = absPlaySpeed + prevFrame; + afterPrevFrame = (s32)absPlaySpeed + prevFrame; if (((afterPrevFrame > 2) && (beforeCurFrame <= 0)) || ((beforeCurFrame < 7) && (afterPrevFrame >= 9))) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_WALK); @@ -793,7 +757,7 @@ void func_80860C24(EnTest* this, PlayState* play) { // a variation of sidestep void func_80860EC0(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &gStalfosSidestepAnim); + Animation_PlayLoop(&this->skelAnime, &D_0600E2B0); this->unk_7C8 = 0xF; this->actor.speed = (Rand_ZeroOne() > 0.5f) ? -0.5f : 0.5f; this->timer = (s16)((Rand_ZeroOne() * 15.0f) + 25.0f); @@ -812,7 +776,8 @@ void func_80860F84(EnTest* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 checkDist = 0.0f; s16 newYaw; - s32 absPlaySpeed; + f32 absPlaySpeed; + s32 afterPrevFrame; if (!EnTest_ReactToProjectile(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); @@ -878,14 +843,14 @@ void func_80860F84(EnTest* this, PlayState* play) { } this->skelAnime.playSpeed = this->actor.speed * 0.5f; - - prevFrame = (s32)this->skelAnime.curFrame; + prevFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); + + beforeCurFrame = this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed); + absPlaySpeed = ABS(this->skelAnime.playSpeed); if ((s32)this->skelAnime.curFrame != prevFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; + afterPrevFrame = (s32)absPlaySpeed + prevFrame; if (((afterPrevFrame > 1) && (beforeCurFrame < 1)) || ((beforeCurFrame < 7) && (afterPrevFrame > 7))) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_WALK); @@ -908,7 +873,7 @@ void func_80860F84(EnTest* this, PlayState* play) { } void EnTest_SetupSlashDown(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosDownSlashAnim); + Animation_PlayOnce(&this->skelAnime, &D_0600B00C); Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU); this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->unk_7C8 = 0x10; @@ -948,7 +913,7 @@ void EnTest_SlashDown(EnTest* this, PlayState* play) { } void EnTest_SetupSlashDownEnd(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosRecoverFromDownSlashAnim); + Animation_PlayOnce(&this->skelAnime, &D_0600B4E4); this->unk_7C8 = 0x12; this->actor.speed = 0.0f; EnTest_SetupAction(this, EnTest_SlashDownEnd); @@ -1008,7 +973,7 @@ void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { } void EnTest_SetupSlashUp(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosUpSlashAnim); + Animation_PlayOnce(&this->skelAnime, &D_0600BE4C); this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->unk_7C8 = 0x11; this->swordCollider.elem.atDmgInfo.damage = 16; @@ -1039,7 +1004,7 @@ void EnTest_SlashUp(EnTest* this, PlayState* play) { } void EnTest_SetupJumpBack(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosJumpBackwardsAnim); + Animation_PlayOnce(&this->skelAnime, &D_06001978); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); this->unk_7C8 = 0x14; this->timer = 5; @@ -1090,7 +1055,7 @@ void EnTest_JumpBack(EnTest* this, PlayState* play) { } void EnTest_SetupJumpslash(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosJumpAnim); + Animation_PlayOnce(&this->skelAnime, &D_0600A324); Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU); this->timer = 0; this->unk_7C8 = 0x17; @@ -1110,7 +1075,7 @@ void EnTest_SetupJumpslash(EnTest* this) { void EnTest_Jumpslash(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer == 0) { - Animation_PlayOnce(&this->skelAnime, &gStalfosJumpslashAnim); + Animation_PlayOnce(&this->skelAnime, &D_0600A99C); this->timer = 1; this->swordState = 1; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_SAKEBI); @@ -1137,7 +1102,7 @@ void EnTest_Jumpslash(EnTest* this, PlayState* play) { } void EnTest_SetupJumpUp(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosJumpAnim); + Animation_PlayOnce(&this->skelAnime, &D_0600A324); this->timer = 0; this->unk_7C8 = 4; this->actor.velocity.y = 14.0f; @@ -1165,14 +1130,13 @@ void EnTest_JumpUp(EnTest* this, PlayState* play) { this->actor.speed = 0.0f; this->unk_7C8 = 0xC; this->timer = 4; - Animation_Change(&this->skelAnime, &gStalfosLandFromLeapAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f); + Animation_Change(&this->skelAnime, &D_0600C438, 0.0f, 0.0f, 0.0f, 2, 0.0f); EnTest_SetupAction(this, EnTest_Land); } } void EnTest_SetupStopAndBlock(EnTest* this) { - Animation_Change(&this->skelAnime, &gStalfosBlockWithShieldAnim, 2.0f, 0.0f, - Animation_GetLastFrame(&gStalfosBlockWithShieldAnim), 2, 2.0f); + Animation_Change(&this->skelAnime, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2, 2.0f); this->unk_7C8 = 0x15; this->actor.speed = 0.0f; this->timer = (Rand_ZeroOne() * 10.0f) + 11.0f; @@ -1199,7 +1163,7 @@ void EnTest_StopAndBlock(EnTest* this, PlayState* play) { } void EnTest_SetupIdleFromBlock(EnTest* this) { - Animation_MorphToLoop(&this->skelAnime, &gStalfosMiddleGuardAnim, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &D_0600316C, -4.0f); this->unk_7C8 = 0x16; EnTest_SetupAction(this, EnTest_IdleFromBlock); } @@ -1223,7 +1187,7 @@ void EnTest_IdleFromBlock(EnTest* this, PlayState* play) { } void func_80862154(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosFlinchFromHitFrontAnim); + Animation_PlayOnce(&this->skelAnime, &D_06008604); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DAMAGE); this->unk_7C8 = 8; this->actor.speed = -2.0f; @@ -1267,7 +1231,7 @@ void func_808621D4(EnTest* this, PlayState* play) { } void func_80862398(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &gStalfosFlinchFromHitBehindAnim); + Animation_PlayOnce(&this->skelAnime, &D_06000444); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DAMAGE); this->unk_7C8 = 9; this->actor.speed = -2.0f; @@ -1321,7 +1285,7 @@ void EnTest_SetupStunned(EnTest* this) { if (this->lastDamageReaction == STALFOS_DMG_REACT_FREEZE) { this->iceTimer = 36; } else { - Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalfosFlinchFromHitFrontAnim, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &D_06008604, 0.0f); } } @@ -1365,7 +1329,7 @@ void func_808627C4(EnTest* this, PlayState* play) { return; } - Animation_MorphToLoop(&this->skelAnime, &gStalfosSidestepAnim, -2.0f); + Animation_MorphToLoop(&this->skelAnime, &D_0600E2B0, -2.0f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); this->actor.speed = ((play->gameplayFrames % 2) != 0) ? -4.0f : 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; @@ -1386,6 +1350,7 @@ void func_808628C8(EnTest* this, PlayState* play) { f32 checkDist = 0.0f; s16 newYaw; f32 absPlaySpeed; + s32 afterPrevFrame; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); @@ -1464,7 +1429,7 @@ void func_808628C8(EnTest* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_WARAU); } if ((s32)this->skelAnime.curFrame != prevFrame) { - s32 afterPrevFrame = (s32)absPlaySpeed + prevFrame; + afterPrevFrame = (s32)absPlaySpeed + prevFrame; if (((afterPrevFrame > 1) && (beforeCurFrame < 1)) || ((beforeCurFrame < 7) && (afterPrevFrame > 7))) { Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_WALK); @@ -1550,7 +1515,7 @@ void func_80862E6C(EnTest* this, PlayState* play) { } void func_80862FA8(EnTest* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &gStalfosFallOverBackwardsAnim); + Animation_PlayOnce(&this->skelAnime, &D_06001420); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7DE = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; @@ -1579,7 +1544,7 @@ void func_80863044(EnTest* this, PlayState* play) { } void func_808630F0(EnTest* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &gStalfosFallOverForwardsAnim); + Animation_PlayOnce(&this->skelAnime, &D_06009A90); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7C8 = 6; this->actor.colorFilterTimer = 0; @@ -1757,8 +1722,8 @@ void EnTest_Update(Actor* thisx, PlayState* play) { break; case 1: - Animation_Change(&this->upperSkelanime, &gStalfosBlockWithShieldAnim, 2.0f, 0.0f, - Animation_GetLastFrame(&gStalfosBlockWithShieldAnim), 2, 2.0f); + Animation_Change(&this->upperSkelanime, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2, + 2.0f); AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->upperSkelanime.jointTable, sUpperBodyLimbCopyMap); this->unk_7DE++; @@ -1841,11 +1806,11 @@ s32 EnTest_OverrideLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3f* EnTest* this = (EnTest*)thisx; PlayState* play = (PlayState*)play2; - if (limbIndex == STALFOS_LIMB_HEAD_ROOT) { + if (limbIndex == 6) { rot->x += this->headRot.y; rot->y -= this->headRot.x; rot->z += this->headRot.z; - } else if (limbIndex == STALFOS_LIMB_HEAD) { + } else if (limbIndex == 11) { OPEN_DISPS(play->state.gfxCtx, "../z_en_test.c", 3582); gDPPipeSync(POLY_OPA_DISP++); @@ -1886,7 +1851,7 @@ void EnTest_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 60, 60, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); - if (limbIndex == STALFOS_LIMB_SWORD) { + if (limbIndex == 34) { Matrix_MultVec3f(&D_8086467C, &this->swordCollider.dim.quad[1]); Matrix_MultVec3f(&D_80864688, &this->swordCollider.dim.quad[0]); Matrix_MultVec3f(&D_80864694, &this->swordCollider.dim.quad[3]); @@ -1906,16 +1871,16 @@ void EnTest_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot this->swordState = -1; } - } else if ((limbIndex == STALFOS_LIMB_SHIELD) && (this->unk_7DE != 0)) { + } else if ((limbIndex == 27) && (this->unk_7DE != 0)) { Matrix_MultVec3f(&D_80864670, &sp64); this->shieldCollider.dim.pos.x = sp64.x; this->shieldCollider.dim.pos.y = sp64.y; this->shieldCollider.dim.pos.z = sp64.z; } else { - Actor_SetFeetPos(&this->actor, limbIndex, STALFOS_LIMB_FOOT_L, &D_80864658, STALFOS_LIMB_ANKLE_R, &D_80864658); + Actor_SetFeetPos(&this->actor, limbIndex, 48, &D_80864658, 55, &D_80864658); - if ((limbIndex == STALFOS_LIMB_FOOT_L) || (limbIndex == STALFOS_LIMB_ANKLE_R)) { + if ((limbIndex == 48) || (limbIndex == 55)) { if ((this->unk_7C8 == 0x15) || (this->unk_7C8 == 0x16)) { if (this->actor.speed != 0.0f) { Matrix_MultVec3f(&D_80864658, &sp64); @@ -1927,31 +1892,31 @@ void EnTest_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot if (this->iceTimer != 0) { switch (limbIndex) { - case STALFOS_LIMB_HEAD: + case 11: bodyPart = 0; break; - case STALFOS_LIMB_CHEST: + case 15: bodyPart = 1; break; - case STALFOS_LIMB_SWORD: + case 34: bodyPart = 2; break; - case STALFOS_LIMB_SHIELD: + case 27: bodyPart = 3; break; - case STALFOS_LIMB_UPPERARM_R: + case 37: bodyPart = 4; break; - case STALFOS_LIMB_UPPERARM_L: + case 29: bodyPart = 5; break; - case STALFOS_LIMB_WAIST: + case 60: bodyPart = 6; break; - case STALFOS_LIMB_FOOT_L: + case 48: bodyPart = 7; break; - case STALFOS_LIMB_FOOT_R: + case 57: bodyPart = 8; break; } @@ -1992,7 +1957,7 @@ void EnTest_Draw(Actor* thisx, PlayState* play) { // a variation of sidestep void func_80864158(EnTest* this, f32 xzSpeed) { - Animation_MorphToLoop(&this->skelAnime, &gStalfosSidestepAnim, -2.0f); + Animation_MorphToLoop(&this->skelAnime, &D_0600E2B0, -2.0f); this->actor.speed = xzSpeed; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; this->timer = (Rand_ZeroOne() * 20.0f) + 15.0f; 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 8cd0191654c..ca6655f8d1a 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.h +++ b/src/overlays/actors/ovl_En_Test/z_en_test.h @@ -13,11 +13,11 @@ typedef struct EnTest { /* 0x000 */ Actor actor; /* 0x14C */ Vec3s bodyPartsPos[10]; /* 0x188 */ SkelAnime skelAnime; - /* 0x1CC */ Vec3s jointTable[STALFOS_LIMB_MAX]; - /* 0x33A */ Vec3s morphTable[STALFOS_LIMB_MAX]; + /* 0x1CC */ Vec3s jointTable[61]; + /* 0x33A */ Vec3s morphTable[61]; /* 0x4A8 */ SkelAnime upperSkelanime; - /* 0x4EC */ Vec3s upperJointTable[STALFOS_LIMB_MAX]; - /* 0x65A */ Vec3s upperMorphTable[STALFOS_LIMB_MAX]; + /* 0x4EC */ Vec3s upperJointTable[61]; + /* 0x65A */ Vec3s upperMorphTable[61]; /* 0x7C8 */ u8 unk_7C8; /* 0x7CC */ EnTestActionFunc actionFunc; /* 0x7D0 */ Vec3s headRot; 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 b61f66d3a6e..03d45955c6b 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -888,7 +888,7 @@ void EnTite_CheckDamage(Actor* thisx, PlayState* play) { if (thisx->colChkInfo.health == 0) { EnTite_SetupDeathCry(this); } else { - // Flip tektite back up if it's on its back + // Flip tektite back up if it's on it's back Actor_PlaySfx(thisx, NA_SE_EN_TEKU_DAMAGE); if (this->flipState != TEKTITE_FLIPPED) { EnTite_SetupRecoil(this); 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 c1ad2ac47aa..1338fb88fc5 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -32,30 +32,22 @@ void EnTp_Destroy(Actor* thisx, PlayState* play); void EnTp_Update(Actor* thisx, PlayState* play); void EnTp_Draw(Actor* thisx, PlayState* play); -void EnTp_Tail_SetupFollowHead(EnTp* this); -void EnTp_Tail_FollowHead(EnTp* this, PlayState* play); -void EnTp_Head_SetupApproachPlayer(EnTp* this); -void EnTp_Head_ApproachPlayer(EnTp* this, PlayState* play); -void EnTp_SetupDie(EnTp* this); -void EnTp_Die(EnTp* this, PlayState* play); -void EnTp_Fragment_SetupFade(EnTp* this); -void EnTp_Fragment_Fade(EnTp* this, PlayState* play); -void EnTp_Head_SetupTakeOff(EnTp* this); -void EnTp_Head_TakeOff(EnTp* this, PlayState* play); -void EnTp_Head_SetupWait(EnTp* this); -void EnTp_Head_Wait(EnTp* this, PlayState* play); -void EnTp_Head_SetupBurrowReturnHome(EnTp* this); -void EnTp_Head_BurrowReturnHome(EnTp* this, PlayState* play); - -typedef enum TailpasaranAction { - /* 0 */ TAILPASARAN_ACTION_FRAGMENT_FADE, - /* 1 */ TAILPASARAN_ACTION_DIE, - /* 2 */ TAILPASARAN_ACTION_TAIL_FOLLOWHEAD, - /* 4 */ TAILPASARAN_ACTION_HEAD_WAIT = 4, - /* 7 */ TAILPASARAN_ACTION_HEAD_APPROACHPLAYER = 7, - /* 8 */ TAILPASARAN_ACTION_HEAD_TAKEOFF, - /* 9 */ TAILPASARAN_ACTION_HEAD_BURROWRETURNHOME -} TailpasaranAction; +void func_80B20DE0(EnTp* this, void (*arg1)(EnTp*, PlayState*)); +void func_80B21084(EnTp* this); +void func_80B210B0(EnTp* this, PlayState* play); +void func_80B2128C(EnTp* this); +void func_80B212C0(EnTp* this, PlayState* play); +void func_80B21454(EnTp* this); +void func_80B214CC(EnTp* this, PlayState* play); +void func_80B217FC(EnTp* this); +void func_80B21900(EnTp* this, PlayState* play); +void func_80B2194C(EnTp* this); +void func_80B219A8(EnTp* this, PlayState* play); +void func_80B21B90(EnTp* this); +void func_80B21BDC(EnTp* this, PlayState* play); +void func_80B21EE8(EnTp* this); +void func_80B21F18(EnTp* this, PlayState* play); +void func_80B221E8(EnTp* this, PlayState* play); ActorProfile En_Tp_Profile = { /**/ ACTOR_EN_TP, @@ -69,7 +61,7 @@ ActorProfile En_Tp_Profile = { /**/ EnTp_Draw, }; -static ColliderJntSphElementInit sJntSphElementsInit[] = { +static ColliderJntSphElementInit D_80B22A90[1] = { { { ELEM_MATERIAL_UNK0, @@ -83,7 +75,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { }, }; -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit D_80B22AB4 = { { COL_MATERIAL_HIT1, AT_ON | AT_TYPE_ENEMY, @@ -92,542 +84,449 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, + 1, + D_80B22A90, }; -typedef enum TailpasaranDamageReaction { - /* 00 */ TAILPASARAN_DMG_REACT_NONE, - /* 01 */ TAILPASARAN_DMG_REACT_DEKUNUT, - /* 14 */ TAILPASARAN_DMG_REACT_SHOCKING = 14, // Kills the Tailpasaran but shocks Player - /* 15 */ TAILPASARAN_DMG_REACT_INSULATING // Kills the Tailpasaran and does not shock Player -} TailpasaranDamageReaction; - -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_DEKUNUT), - /* Deku stick */ DMG_ENTRY(2, TAILPASARAN_DMG_REACT_INSULATING), - /* Slingshot */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Explosive */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(1, TAILPASARAN_DMG_REACT_INSULATING), - /* Normal arrow */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, TAILPASARAN_DMG_REACT_SHOCKING), - /* Hookshot */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Kokiri sword */ DMG_ENTRY(1, TAILPASARAN_DMG_REACT_SHOCKING), - /* Master sword */ DMG_ENTRY(2, TAILPASARAN_DMG_REACT_SHOCKING), - /* Giant's Knife */ DMG_ENTRY(4, TAILPASARAN_DMG_REACT_SHOCKING), - /* Fire arrow */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Ice arrow */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Light arrow */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Unk arrow 1 */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Unk arrow 2 */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Unk arrow 3 */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Fire magic */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Ice magic */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Light magic */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Shield */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, TAILPASARAN_DMG_REACT_SHOCKING), - /* Giant spin */ DMG_ENTRY(4, TAILPASARAN_DMG_REACT_SHOCKING), - /* Master spin */ DMG_ENTRY(2, TAILPASARAN_DMG_REACT_SHOCKING), - /* Kokiri jump */ DMG_ENTRY(2, TAILPASARAN_DMG_REACT_SHOCKING), - /* Giant jump */ DMG_ENTRY(8, TAILPASARAN_DMG_REACT_SHOCKING), - /* Master jump */ DMG_ENTRY(4, TAILPASARAN_DMG_REACT_SHOCKING), - /* Unknown 1 */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, TAILPASARAN_DMG_REACT_SHOCKING), - /* Unknown 2 */ DMG_ENTRY(0, TAILPASARAN_DMG_REACT_NONE), +static DamageTable D_80B22AC4 = { + { + 0x10, 0xF2, 0, 0, 0xF1, 0, 0xE2, 0, 0xE1, 0xE2, 0xE4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0xE1, 0xE4, 0xE2, 0xE2, 0xE8, 0xE4, 0, 0, 0xE4, 0, + }, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80B22AE4[] = { ICHAIN_F32(lockOnArrowOffset, 10, ICHAIN_STOP), }; -void EnTp_SetupAction(EnTp* this, EnTpActionFunc actionFunc) { - this->actionFunc = actionFunc; +void func_80B20DE0(EnTp* this, void (*arg1)(EnTp*, PlayState*)) { + this->unk154 = arg1; } void EnTp_Init(Actor* thisx, PlayState* play2) { - PlayState* play = play2; + EnTp* temp_v0_2; + EnTp* var_s5; + s32 var_s1; EnTp* this = (EnTp*)thisx; - EnTp* now; - EnTp* next; - s32 i; + PlayState* play = play2; + s64 new_var; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->actor, D_80B22AE4); this->actor.attentionRangeType = ATTENTION_RANGE_3; - this->actor.colChkInfo.damageTable = &sDamageTable; + this->actor.colChkInfo.damageTable = &D_80B22AC4; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.14f); - this->unk_150 = 0; + this->unk150 = 0; this->actor.colChkInfo.health = 1; - now = this; - this->alpha = 255; - Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - - if (this->actor.params <= TAILPASARAN_HEAD) { + var_s5 = this; + this->unk15E = 0xFF; + Collider_InitJntSph(play, &this->unk174); + Collider_SetJntSph(play, &this->unk174, &this->actor, &D_80B22AB4, &this->unk194); + if (this->actor.params < 0) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; - this->timer = 0; - this->collider.base.acFlags |= AC_HARD; - this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius = 8; - EnTp_Head_SetupWait(this); + this->unk15A = 0; + this->unk174.base.acFlags |= 4; + this->unk174.elements[0].dim.worldSphere.radius = 8; + this->unk174.elements[0].dim.modelSphere.radius = this->unk174.elements[0].dim.worldSphere.radius; + func_80B21B90(this); this->actor.focus.pos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED; Actor_SetScale(&this->actor, 1.5f); - - for (i = 0; i <= 6; i++) { - next = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0 * i); - - if ((0 * i) != 0) {} // Very fake, but needed to get the s registers right - - if (next != NULL) { - now->actor.child = &next->actor; - next->actor.parent = &now->actor; - next->kiraSpawnTimer = i + 1; - next->head = this; - Actor_SetScale(&next->actor, 0.3f); - - if (i == 2) { - next->actor.flags |= + for (var_s1 = 0; var_s1 < 7; var_s1++) { + if (((0 * var_s1) != 0) && ((0 * var_s1) != 0)) {} + temp_v0_2 = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0 * var_s1); + if (temp_v0_2 != NULL) { + var_s5->actor.child = &temp_v0_2->actor; + temp_v0_2->actor.parent = &var_s5->actor; + temp_v0_2->unk162 = (s16)(var_s1 + 1); + temp_v0_2->unk1D4 = this; + Actor_SetScale(&temp_v0_2->actor, 0.3f); + if (var_s1 == 2) { + temp_v0_2->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED; - next->unk_150 = 1; // Why? + temp_v0_2->unk150 = 1; } - - next->timer = next->unk_15C = i * -5; - next->horizontalVariation = 6.0f - (i * 0.75f); - now = next; - - if ((0 * i) != 0) {} + temp_v0_2->unk15C = var_s1 * -5; + temp_v0_2->unk15A = var_s1 * -5; + var_s5 = (EnTp*)temp_v0_2; + temp_v0_2->unk16C = (f32)(6.0f - ((f32)var_s1 * 0.75f)); } } - } else if (this->actor.params == TAILPASARAN_TAIL) { - EnTp_Tail_SetupFollowHead(this); + } else if (this->actor.params == 0) { + func_80B21084(this); } else { - EnTp_Fragment_SetupFade(this); + func_80B217FC(this); } } void EnTp_Destroy(Actor* thisx, PlayState* play) { EnTp* this = (EnTp*)thisx; - Collider_DestroyJntSph(play, &this->collider); + Collider_DestroyJntSph(play, &this->unk174); } -void EnTp_Tail_SetupFollowHead(EnTp* this) { - this->actionIndex = TAILPASARAN_ACTION_TAIL_FOLLOWHEAD; - EnTp_SetupAction(this, EnTp_Tail_FollowHead); +void func_80B21084(EnTp* this) { + this->unk14C = 2; + func_80B20DE0(this, func_80B210B0); } -void EnTp_Tail_FollowHead(EnTp* this, PlayState* play) { - s16 angle; - s16 phase; - - if (this->actor.params == TAILPASARAN_TAIL_DYING) { - this->actionIndex = TAILPASARAN_ACTION_DIE; +void func_80B210B0(EnTp* this, PlayState* play) { + s16 sp36; + s16 temp_a0_sp34; + if (this->actor.params == 0xB) { + this->unk14C = 1; if (this->actor.parent == NULL) { - EnTp_SetupDie(this); + func_80B21454(this); } } else { - if (this->unk_150 != 0) { + if (this->unk150 != 0) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } - - if (this->head->unk_150 != 0) { - this->actor.speed = this->red = this->actor.velocity.y = this->heightPhase = 0.0f; - if (this->actor.world.pos.y < this->head->actor.home.pos.y) { + if (this->unk1D4->unk150 != 0) { + this->actor.speed = this->unk160 = this->actor.velocity.y = this->unk168 = 0.0f; + if (this->actor.world.pos.y < this->unk1D4->actor.home.pos.y) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } - this->actor.world.pos = this->actor.parent->prevPos; } else { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.parent->world.pos.y - 4.0f, 1.0f, 1.0f, 0.0f); - angle = this->head->actor.shape.rot.y + 0x4000; - phase = 2000 * (this->head->unk_15C + this->timer); + sp36 = this->unk1D4->actor.shape.rot.y + 0x4000; + temp_a0_sp34 = (this->unk1D4->unk15C + this->unk15A) * 0x7D0; this->actor.world.pos.x = - this->actor.home.pos.x + Math_SinS(phase) * (Math_SinS(angle) * this->horizontalVariation); + (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->unk16C)) + this->actor.home.pos.x; this->actor.world.pos.z = - this->actor.home.pos.z + Math_SinS(phase) * (Math_CosS(angle) * this->horizontalVariation); + (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->unk16C)) + this->actor.home.pos.z; } } } -void EnTp_Head_SetupApproachPlayer(EnTp* this) { - this->actionIndex = TAILPASARAN_ACTION_HEAD_APPROACHPLAYER; - this->timer = 200; - EnTp_SetupAction(this, EnTp_Head_ApproachPlayer); +void func_80B2128C(EnTp* this) { + this->unk14C = 7; + this->unk15A = 0xC8; + func_80B20DE0(this, func_80B212C0); } -void EnTp_Head_ApproachPlayer(EnTp* this, PlayState* play) { - Player* player = GET_PLAYER(play); +void func_80B212C0(EnTp* this, PlayState* play) { + Player* player; + player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 30.0f, 1.0f, 0.5f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); - - if (this->collider.base.atFlags & AT_HIT) { - this->collider.base.atFlags &= ~AT_HIT; - if (&player->actor == this->collider.base.at) { - this->timer = 1; + if (this->unk174.base.atFlags & AT_HIT) { + this->unk174.base.atFlags &= ~AT_HIT; + if (&player->actor == this->unk174.base.at) { + this->unk15A = 1; } } - - if (this->red < 255) { - this->red += 15; + if (this->unk160 < 0xFF) { + this->unk160 += 0xF; } - - if (Math_CosF(this->heightPhase) == 0.0f) { - this->extraHeightVariation = 2.0f * Rand_ZeroOne(); + if (Math_CosF(this->unk168) == 0.0f) { + this->unk170 = 2.0f * Rand_ZeroOne(); } - - this->actor.world.pos.y += Math_CosF(this->heightPhase) * (2.0f + this->extraHeightVariation); - this->heightPhase += 0.2f; + this->actor.world.pos.y += Math_CosF(this->unk168) * (2.0f + this->unk170); + this->unk168 += 0.2f; Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); - this->timer--; - - if (this->timer != 0) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 750, 0); + this->unk15A -= 1; + if (this->unk15A != 0) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.shape.rot.y = this->actor.world.rot.y; } else { - EnTp_Head_SetupBurrowReturnHome(this); + func_80B21EE8(this); } } -void EnTp_SetupDie(EnTp* this) { - Actor* now; - - this->timer = 2; +void func_80B21454(EnTp* this) { + Actor* var_v0; - if (this->actor.params <= TAILPASARAN_HEAD) { - for (now = this->actor.child; now != NULL; now = now->child) { - now->params = TAILPASARAN_TAIL_DYING; - now->colChkInfo.health = 0; + this->unk15A = 2; + if (this->actor.params < 0) { + var_v0 = this->actor.child; + while (var_v0 != NULL) { + var_v0->params = 0xB; + var_v0->colChkInfo.health = 0; + var_v0 = var_v0->child; } - - this->timer = 13; + this->unk15A = 0xD; Actor_PlaySfx(&this->actor, NA_SE_EN_TAIL_DEAD); } - this->actionIndex = TAILPASARAN_ACTION_DIE; - EnTp_SetupAction(this, EnTp_Die); + this->unk14C = 1; + func_80B20DE0(this, func_80B214CC); } -/** - * Spawns effects and smaller tail segment-like fragments - */ -void EnTp_Die(EnTp* this, PlayState* play) { - EnTp* now; - s16 i; +void func_80B214CC(EnTp* this, PlayState* play) { + s16 var_s1; + EnTp* temp_v0; s32 pad; - Vec3f effectVelAccel = { 0.0f, 0.5f, 0.0f }; - Vec3f effectPos = { 0.0f, 0.0f, 0.0f }; - - this->timer--; - - if (this->timer <= 0) { - if (this->actor.params == TAILPASARAN_HEAD_DYING) { - effectPos.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; - effectPos.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; - effectPos.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; - EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, 0, - 255, 1, 9, 1); - - effectPos.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; - effectPos.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; - effectPos.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; - EffectSsDeadDb_Spawn(play, &effectPos, &effectVelAccel, &effectVelAccel, 100, 0, 255, 255, 255, 255, 0, 0, - 255, 1, 9, 1); + Vec3f sp78 = { 0.0f, 0.5f, 0.0f }; + Vec3f sp6C = { 0.0f, 0.0f, 0.0f }; + + this->unk15A -= 1; + if (this->unk15A <= 0) { + if (this->actor.params == 0xC) { + sp6C.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; + sp6C.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; + sp6C.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; + EffectSsDeadDb_Spawn(play, (Vec3f*)&sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); + sp6C.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; + sp6C.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; + sp6C.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; + EffectSsDeadDb_Spawn(play, (Vec3f*)&sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); } else { #if OOT_VERSION < NTSC_1_1 - for (i = 0; i < 2; i++) + for (var_s1 = 0; var_s1 < 2; var_s1++) #else - for (i = 0; i < 1; i++) + for (var_s1 = 0; var_s1 < 1; var_s1++) #endif { - now = - (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, TAILPASARAN_FRAGMENT); - - if (now != NULL) { - Actor_SetScale(&now->actor, this->actor.scale.z * 0.5f); - now->red = this->red; + temp_v0 = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xA); + if (temp_v0 != NULL) { + Actor_SetScale(&temp_v0->actor, this->actor.scale.z * 0.5f); + temp_v0->unk160 = (s16)this->unk160; } } } - if (this->actor.child != NULL) { this->actor.child->parent = NULL; - this->actor.child->params = TAILPASARAN_TAIL_DYING; + this->actor.child->params = 0xB; this->actor.child->colChkInfo.health = 0; } - - this->unk_150 = 2; + this->unk150 = 2; Actor_Kill(&this->actor); } } -void EnTp_Fragment_SetupFade(EnTp* this) { - this->actionIndex = TAILPASARAN_ACTION_FRAGMENT_FADE; - this->actor.world.pos.x += ((Rand_ZeroOne() - 0.5f) * 5.0f); - this->actor.world.pos.y += ((Rand_ZeroOne() - 0.5f) * 5.0f); - this->actor.world.pos.z += ((Rand_ZeroOne() - 0.5f) * 5.0f); +void func_80B217FC(EnTp* this) { + this->unk14C = 0; + this->actor.world.pos.x += (Rand_ZeroOne() - 0.5f) * 5.0f; + this->actor.world.pos.y += (Rand_ZeroOne() - 0.5f) * 5.0f; + this->actor.world.pos.z += (Rand_ZeroOne() - 0.5f) * 5.0f; this->actor.velocity.x = (Rand_ZeroOne() - 0.5f) * 1.5f; this->actor.velocity.y = (Rand_ZeroOne() - 0.5f) * 1.5f; this->actor.velocity.z = (Rand_ZeroOne() - 0.5f) * 1.5f; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - EnTp_SetupAction(this, EnTp_Fragment_Fade); + func_80B20DE0(this, func_80B21900); } -void EnTp_Fragment_Fade(EnTp* this, PlayState* play) { +void func_80B21900(EnTp* this, PlayState* play) { Actor_UpdatePos(&this->actor); - this->alpha -= 20; - - if (this->alpha < 20) { - this->alpha = 0; + this->unk15E -= 0x14; + if (this->unk15E < 0x14) { + this->unk15E = 0; Actor_Kill(&this->actor); } } -void EnTp_Head_SetupTakeOff(EnTp* this) { - this->timer = (Rand_ZeroOne() * 15.0f) + 40.0f; - this->actionIndex = TAILPASARAN_ACTION_HEAD_TAKEOFF; - EnTp_SetupAction(this, EnTp_Head_TakeOff); +void func_80B2194C(EnTp* this) { + this->unk15A = (Rand_ZeroOne() * 15.0f) + 40.0f; + this->unk14C = 8; + func_80B20DE0(this, func_80B219A8); } -/** - * Flies up and loops around until it makes for Player - */ -void EnTp_Head_TakeOff(EnTp* this, PlayState* play) { +void func_80B219A8(EnTp* this, PlayState* play) { s32 pad; - Player* player = GET_PLAYER(play); + Player* player; + player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); - Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->horizontalVariation, 1.0f, + Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->unk16C, 1.0f, this->actor.speed * 0.25f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); - - if (this->collider.base.atFlags & AT_HIT) { - this->collider.base.atFlags &= ~AT_HIT; - if (&player->actor == this->collider.base.at) { - this->unk_15C = 1; + if (this->unk174.base.atFlags & AT_HIT) { + this->unk174.base.atFlags &= ~AT_HIT; + if (&player->actor == this->unk174.base.at) { + this->unk15C = 1; } } - - if (this->red != 0) { - this->red -= 15; + if (this->unk160 != 0) { + this->unk160 -= 0xF; } - - if (Math_CosF(this->heightPhase) == 0.0f) { - this->extraHeightVariation = Rand_ZeroOne() * 4.0f; + if (Math_CosF(this->unk168) == 0.0f) { + this->unk170 = Rand_ZeroOne() * 4.0f; } - - this->actor.world.pos.y += - Math_CosF(this->heightPhase) * ((this->actor.speed * 0.25f) + this->extraHeightVariation); - this->actor.world.rot.y += this->unk_164; - this->heightPhase += 0.2f; - - if (this->timer != 0) { - this->timer--; + this->actor.world.pos.y += Math_CosF(this->unk168) * ((this->actor.speed * 0.25f) + this->unk170); + this->actor.world.rot.y += this->unk164; + this->unk168 += 0.2f; + if (this->unk15A != 0) { + this->unk15A -= 1; } - - Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 1, 750, - 0); - - if (this->timer == 0) { - EnTp_Head_SetupApproachPlayer(this); + Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 1, + 0x2EE, 0); + if (this->unk15A == 0) { + func_80B2128C(this); } - this->actor.shape.rot.y = this->actor.world.rot.y; } -void EnTp_Head_SetupWait(EnTp* this) { - this->actionIndex = TAILPASARAN_ACTION_HEAD_WAIT; - this->unk_150 = 0; +void func_80B21B90(EnTp* this) { + this->unk14C = 4; + this->unk150 = 0; this->actor.shape.rot.x = -0x4000; - this->timer = 60; - this->unk_15C = 0; + this->unk15A = 0x3C; + this->unk15C = 0; this->actor.speed = 0.0f; - EnTp_SetupAction(this, EnTp_Head_Wait); + func_80B20DE0(this, func_80B21BDC); } -/** - * Awaken and rise from the ground when Player is closer than 200 - */ -void EnTp_Head_Wait(EnTp* this, PlayState* play) { - Player* player = GET_PLAYER(play); - s16 yaw; - - this->unk_15C--; +void func_80B21BDC(EnTp* this, PlayState* play) { + Player* player; + s16 sp32; + player = GET_PLAYER(play); + this->unk15C -= 1; if (this->actor.xzDistToPlayer < 200.0f) { - if (this->collider.base.atFlags & AT_HIT) { - this->collider.base.atFlags &= ~AT_HIT; - if (&player->actor == this->collider.base.at) { - this->timer = 0; + if (this->unk174.base.atFlags & AT_HIT) { + this->unk174.base.atFlags &= ~AT_HIT; + if (&player->actor == this->unk174.base.at) { + this->unk15A = 0; } } - - if (this->timer != 0) { - this->timer--; - - Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 500, 0); - Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 1500, 0); - - yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos) + 0x4000; + if (this->unk15A != 0) { + this->unk15A -= 1; + Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x1F4, 0); + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x5DC, 0); + sp32 = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos) + 0x4000; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 30.0f, 0.3f, 1.0f, 0.3f); - this->actor.world.pos.x = this->actor.home.pos.x + - (Math_SinS(2000 * this->unk_15C) * (Math_SinS(yaw) * this->horizontalVariation)); - this->actor.world.pos.z = this->actor.home.pos.z + - (Math_SinS(2000 * this->unk_15C) * (Math_CosS(yaw) * this->horizontalVariation)); + this->actor.world.pos.x = + (Math_SinS(this->unk15C * 0x7D0) * (Math_SinS(sp32) * this->unk16C)) + this->actor.home.pos.x; + this->actor.world.pos.z = + (Math_SinS(this->unk15C * 0x7D0) * (Math_CosS(sp32) * this->unk16C)) + this->actor.home.pos.z; } else { this->actor.shape.rot.x = 0; - this->unk_150 = 1; - EnTp_Head_SetupTakeOff(this); + this->unk150 = 1; + func_80B2194C(this); } } else { - Math_SmoothStepToS(&this->actor.shape.rot.x, -0x4000, 1, 500, 0); - + Math_SmoothStepToS(&this->actor.shape.rot.x, -0x4000, 1, 0x1F4, 0); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.3f, 1.5f, 0.3f) == 0.0f) { - this->timer = 60; + this->unk15A = 0x3C; } else { - yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); + sp32 = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); this->actor.world.pos.x = - this->actor.home.pos.x + (Math_SinS(2000 * this->unk_15C) * (Math_SinS(yaw) * 6.0f)); + (Math_SinS(this->unk15C * 0x7D0) * (Math_SinS(sp32) * 6.0f)) + this->actor.home.pos.x; this->actor.world.pos.z = - this->actor.home.pos.z + (Math_SinS(2000 * this->unk_15C) * (Math_CosS(yaw) * 6.0f)); + (Math_SinS(this->unk15C * 0x7D0) * (Math_CosS(sp32) * 6.0f)) + this->actor.home.pos.z; } } - this->actor.shape.rot.y = this->actor.world.rot.y; - if (this->actor.world.pos.y != this->actor.home.pos.y) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); } } -void EnTp_Head_SetupBurrowReturnHome(EnTp* this) { - this->actionIndex = TAILPASARAN_ACTION_HEAD_BURROWRETURNHOME; - this->timer = 0; - EnTp_SetupAction(this, EnTp_Head_BurrowReturnHome); +void func_80B21EE8(EnTp* this) { + this->unk14C = 9; + this->unk15A = 0; + func_80B20DE0(this, func_80B21F18); } -void EnTp_Head_BurrowReturnHome(EnTp* this, PlayState* play) { - static Vec3f bubbleAccel = { 0.0f, -0.5f, 0.0f }; - static Color_RGBA8 bubblePrimColor = { 255, 255, 255, 255 }; - static Color_RGBA8 bubbleEnvColor = { 150, 150, 150, 0 }; - Vec3f bubbleVelocity; - Vec3f bubblePos; - s32 closeToFloor; - EnTp* now; - s16 temp_v0; // Required to match, usage can maybe be improved - - closeToFloor = false; - temp_v0 = this->timer; - this->unk_15C--; - - if ((temp_v0 != 0) || ((this->actor.home.pos.y - this->actor.world.pos.y) > 60.0f)) { - this->timer = temp_v0 - 1; - temp_v0 = this->timer; - - if (temp_v0 == 0) { - EnTp_Head_SetupWait(this); - - for (now = (EnTp*)this->actor.child; now != NULL; now = (EnTp*)now->actor.child) { - now->unk_15C = now->timer; +void func_80B21F18(EnTp* this, PlayState* play) { + static Vec3f D_80B22B00 = { 0.0f, -0.5f, 0.0f }; + static Color_RGBA8 D_80B22B0C = { 0xFF, 0xFF, 0xFF, 0xFF }; + static Color_RGBA8 D_80B22B10 = { 0x96, 0x96, 0x96, 0 }; + Vec3f sp54; + Vec3f sp48; + s32 sp44; + EnTp* var_v0; + s16 new_var; + + sp44 = 0; + this->unk15C -= 1; + if ((this->unk15A != 0) || ((this->actor.home.pos.y - this->actor.world.pos.y) > 60.0f)) { + if (1) { + this->unk15A -= 1; + } + if ((new_var = this->unk15A) == 0) { + func_80B21B90(this); + var_v0 = (EnTp*)this->actor.child; + while (var_v0 != NULL) { + var_v0->unk15C = var_v0->unk15A; + var_v0 = (EnTp*)var_v0->actor.child; } } else { if (this->actor.shape.rot.x != -0x4000) { - this->timer = 80; + this->unk15A = 0x50; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos = this->actor.home.pos; this->actor.shape.rot.x = -0x4000; - - for (now = (EnTp*)this->actor.child; now != NULL; now = (EnTp*)now->actor.child) { - now->actor.velocity.y = 0.0f; - now->actor.speed = 0.0f; - now->actor.world.pos = this->actor.home.pos; - now->actor.world.pos.y = this->actor.home.pos.y - 80.0f; + var_v0 = (EnTp*)this->actor.child; + while (var_v0 != NULL) { + var_v0->actor.velocity.y = 0.0f; + var_v0->actor.speed = 0.0f; + var_v0->actor.world.pos = this->actor.home.pos; + var_v0->actor.world.pos.y = this->actor.home.pos.y - 80.0f; + var_v0 = (EnTp*)var_v0->actor.child; } } - - this->actor.world.pos.y = this->actor.home.pos.y - this->timer; + this->actor.world.pos.y = this->actor.home.pos.y - (f32)this->unk15A; } } else { if (this->actor.shape.rot.x != 0x4000) { this->actor.shape.rot.x -= 0x400; } - - if (this->red != 0) { - this->red -= 15; + if (this->unk160 != 0) { + this->unk160 -= 0xF; } - this->actor.speed = 2.0f * Math_CosS(this->actor.shape.rot.x); this->actor.velocity.y = Math_SinS(this->actor.shape.rot.x) * -2.0f; - if ((this->actor.world.pos.y - this->actor.floorHeight) < 20.0f) { - closeToFloor = true; + sp44 = 1; } - if (this->actor.world.pos.y != this->actor.home.pos.y) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); } - - if (closeToFloor && ((play->gameplayFrames & 1) != 0)) { - bubblePos = this->actor.world.pos; - bubblePos.y = this->actor.floorHeight; - - bubbleVelocity.x = Rand_CenteredFloat(5.0f); - bubbleVelocity.y = (Rand_ZeroOne() * 3.5f) + 1.5f; - bubbleVelocity.z = Rand_CenteredFloat(5.0f); - - EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVelocity, &bubbleAccel, &bubblePrimColor, - &bubbleEnvColor, Rand_S16Offset(100, 50), 20, 0); + if ((sp44 != 0) && (play->gameplayFrames & 1)) { + sp48 = this->actor.world.pos; + sp48.y = this->actor.floorHeight; + sp54.x = Rand_CenteredFloat(5.0f); + sp54.y = (Rand_ZeroOne() * 3.5f) + 1.5f; + sp54.z = Rand_CenteredFloat(5.0f); + EffectSsDtBubble_SpawnCustomColor(play, &sp48, &sp54, &D_80B22B00, &D_80B22B0C, &D_80B22B10, + Rand_S16Offset(100, 50), 20, 0); } } } -void EnTp_UpdateDamage(EnTp* this, PlayState* play) { - s32 phi_s2; - s32 phi_s4; - EnTp* head; // Can eliminate this and just use now, but they're used differently - EnTp* now; - - if ((this->collider.base.acFlags & AC_HIT) && (this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD)) { - phi_s4 = phi_s2 = 0; - - if (this->actor.params <= TAILPASARAN_HEAD) { - phi_s2 = 1; +void func_80B221E8(EnTp* this, PlayState* play) { + EnTp* var_s0; + EnTp* var_s0_2; + s32 var_s2; + s32 var_s4; + EnTp* new_var; + + if ((this->unk174.base.acFlags & AC_HIT) && (this->unk14C >= 2)) { + var_s2 = 0; + var_s4 = 0; + if (this->actor.params < 0) { + var_s2 = 1; } - - this->collider.base.acFlags &= ~AC_HIT; - Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); - this->damageReaction = this->actor.colChkInfo.damageReaction; - - if (this->actor.colChkInfo.damageReaction != TAILPASARAN_DMG_REACT_NONE) { - if (this->actor.colChkInfo.damageReaction == TAILPASARAN_DMG_REACT_DEKUNUT) { - phi_s4 = 1; + this->unk174.base.acFlags &= ~2; + Actor_SetDropFlagJntSph(&this->actor, &this->unk174, true); + this->unk158 = this->actor.colChkInfo.damageReaction; + if (this->actor.colChkInfo.damageReaction != 0) { + if (this->actor.colChkInfo.damageReaction == 1) { + var_s4 = 1; } - - // Head is invincible - if (phi_s2 == 0) { + if (var_s2 == 0) { Actor_ApplyDamage(&this->actor); } - if (this->actor.colChkInfo.health == 0) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - head = this->head; - - if (head->actor.params <= TAILPASARAN_HEAD) { - EnTp_SetupDie(head); - head->damageReaction = this->actor.colChkInfo.damageReaction; - head->actor.params = TAILPASARAN_HEAD_DYING; + new_var = this->unk1D4; + if (new_var->actor.params < 0) { + func_80B21454(new_var); + new_var->unk158 = this->actor.colChkInfo.damageReaction; + new_var->actor.params = 0xC; } } else { - if (phi_s4 != 0) { + if (var_s4 != 0) { this->actor.freezeTimer = 80; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - if (phi_s2 != 0) { + if (var_s2 != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); } else { @@ -635,37 +534,36 @@ void EnTp_UpdateDamage(EnTp* this, PlayState* play) { 80); } } - - for (now = (EnTp*)this->actor.parent; now != NULL; now = (EnTp*)now->actor.parent) { - now->collider.base.acFlags &= ~AC_HIT; - - if (phi_s4 != 0) { - now->actor.freezeTimer = 80; + var_s0 = (EnTp*)this->actor.parent; + while (var_s0 != NULL) { + var_s0->unk174.base.acFlags &= ~AC_HIT; + if (var_s4 != 0) { + var_s0->actor.freezeTimer = 80; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - - if (phi_s2 != 0) { - Actor_SetColorFilter(&now->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, - 80); + if (var_s2 != 0) { + Actor_SetColorFilter(&var_s0->actor, COLORFILTER_COLORFLAG_BLUE, 255, + COLORFILTER_BUFFLAG_OPA, 80); } else { - Actor_SetColorFilter(&now->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, - 80); + Actor_SetColorFilter(&var_s0->actor, COLORFILTER_COLORFLAG_BLUE, 255, + COLORFILTER_BUFFLAG_XLU, 80); } } + var_s0 = (EnTp*)var_s0->actor.parent; } - - for (now = (EnTp*)this->actor.child; now != NULL; now = (EnTp*)now->actor.child) { - now->collider.base.acFlags &= ~AC_HIT; - if (phi_s4 != 0) { - now->actor.freezeTimer = 80; - - if (phi_s2 != 0) { - Actor_SetColorFilter(&now->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, - 80); + var_s0_2 = (EnTp*)this->actor.child; + while (var_s0_2 != NULL) { + var_s0_2->unk174.base.acFlags &= ~AC_HIT; + if (var_s4 != 0) { + var_s0_2->actor.freezeTimer = 80; + if (var_s2 != 0) { + Actor_SetColorFilter(&var_s0_2->actor, COLORFILTER_COLORFLAG_BLUE, 255, + COLORFILTER_BUFFLAG_OPA, 80); } else { - Actor_SetColorFilter(&now->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, - 80); + Actor_SetColorFilter(&var_s0_2->actor, COLORFILTER_COLORFLAG_BLUE, 255, + COLORFILTER_BUFFLAG_XLU, 80); } } + var_s0_2 = (EnTp*)var_s0_2->actor.child; } } } @@ -673,121 +571,102 @@ void EnTp_UpdateDamage(EnTp* this, PlayState* play) { } void EnTp_Update(Actor* thisx, PlayState* play) { + Player* player; s32 pad; + Vec3f sp5C = { 0.0f, 0.0f, 0.0f }; + Vec3f sp50 = { 0.0f, -0.6f, 0.0f }; + Vec3f sp44; + Color_RGBA8 sp40 = { 0, 0, 255, 255 }; + Color_RGBA8 sp3C = { 0, 0, 0, 0 }; EnTp* this = (EnTp*)thisx; - Vec3f kiraVelocity = { 0.0f, 0.0f, 0.0f }; - Vec3f kiraAccel = { 0.0f, -0.6f, 0.0f }; - Vec3f kiraPos; - Color_RGBA8 kiraPrimColor = { 0, 0, 255, 255 }; - Color_RGBA8 kiraEnvColor = { 0, 0, 0, 0 }; - Player* player = GET_PLAYER(play); - s16 yawToWall; - - if (player->stateFlags1 & PLAYER_STATE1_26) { // Shielding - this->damageReaction = TAILPASARAN_DMG_REACT_NONE; - } + s16 v; + player = GET_PLAYER(play); + + if (player->stateFlags1 & PLAYER_STATE1_26) { + this->unk158 = 0; + } if (this->actor.colChkInfo.health != 0) { - EnTp_UpdateDamage(this, play); + func_80B221E8(this, play); } - - this->actionFunc(this, play); - - if (this->actor.params <= TAILPASARAN_HEAD) { + this->unk154(this, play); + if (this->actor.params < 0) { Actor_MoveXZGravity(&this->actor); - - if (this->actionIndex != TAILPASARAN_ACTION_HEAD_BURROWRETURNHOME) { + if (this->unk14C != 9) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } - - // Turn away from wall if ((this->actor.speed != 0.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL)) { - yawToWall = this->actor.wallYaw - this->actor.world.rot.y; - - if (ABS(yawToWall) > 0x4000) { - if (yawToWall >= 0) { - this->actor.world.rot.y -= 500; + v = this->actor.wallYaw - this->actor.world.rot.y; + if (ABS(v) > 0x4000) { + if (v >= 0) { + this->actor.world.rot.y -= 0x1F4; } else { - this->actor.world.rot.y += 500; + this->actor.world.rot.y += 0x1F4; } - this->actor.shape.rot.y = this->actor.world.rot.y; } } - this->actor.shape.rot.z += 0x800; - if (this->actor.shape.rot.z == 0) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_CRY); } - - if (this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + if (this->unk14C >= 2) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk174.base); } } - - if (this->actor.params != TAILPASARAN_TAIL_DYING) { - this->kiraSpawnTimer--; - this->kiraSpawnTimer &= 7; + if (this->actor.params != 0xB) { + this->unk162 -= 1; + this->unk162 &= 7; } - this->actor.focus.pos = this->actor.world.pos; - - if (this->damageReaction == TAILPASARAN_DMG_REACT_SHOCKING) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + if (this->unk158 == 0xE) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk174.base); } - - if ((this->kiraSpawnTimer & 7) == 0) { - kiraPrimColor.r = this->red; - kiraAccel.x = -this->actor.velocity.x * 0.25f; - kiraAccel.y = -this->actor.velocity.y * 0.25f; - kiraAccel.z = -this->actor.velocity.z * 0.25f; - kiraPos.x = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.x; - kiraPos.y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + this->actor.world.pos.y; - kiraPos.z = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnSmall(play, &kiraPos, &kiraVelocity, &kiraAccel, &kiraPrimColor, &kiraEnvColor); + if ((this->unk162 & 7) == 0) { + sp40.r = this->unk160; + sp50.x = -this->actor.velocity.x * 0.25f; + sp50.y = -this->actor.velocity.y * 0.25f; + sp50.z = -this->actor.velocity.z * 0.25f; + sp44.x = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.x; + sp44.y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + this->actor.world.pos.y; + sp44.z = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.z; + EffectSsKiraKira_SpawnSmall(play, &sp44, &sp5C, &sp50, &sp40, &sp3C); } - - if ((this->actionIndex >= TAILPASARAN_ACTION_TAIL_FOLLOWHEAD) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + if ((this->unk14C >= 2) && (this->actor.colChkInfo.health != 0)) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk174.base); } } void EnTp_Draw(Actor* thisx, PlayState* play) { - s32 pad; + s16 temp_v0; EnTp* this = (EnTp*)thisx; - OPEN_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1451); - - if (this->unk_150 != 2) { - if ((thisx->params <= TAILPASARAN_HEAD) || (thisx->params == TAILPASARAN_HEAD_DYING)) { + OPEN_DISPS(play->state.gfxCtx, "../z_en_tp.c", 0x5AB); + if (this->unk150 != 2) { + temp_v0 = this->actor.params; + if ((temp_v0 < 0) || (temp_v0 == 0xC)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_tp.c", 1459); - gSPDisplayList(POLY_OPA_DISP++, gTailpasaranHeadDL); - - Matrix_Translate(0.0f, 0.0f, 8.0f, MTXMODE_APPLY); + gSPDisplayList(POLY_OPA_DISP++, object_tp_0008D0_DL); + Matrix_Translate(0.0f, 0.0f, 8.0f, 1U); } else { Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); - - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, this->red, 0, 255, this->alpha); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->unk160, 0, 255, this->unk15E); gDPPipeSync(POLY_XLU_DISP++); gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); gDPPipeSync(POLY_XLU_DISP++); - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gTailpasaranTailSegmentTex)); + gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(object_tp_000C68_Tex)); gDPPipeSync(POLY_XLU_DISP++); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_tp.c", 1480); - gSPDisplayList(POLY_XLU_DISP++, gTailpasaranTailSegmentDL); + gSPDisplayList(POLY_XLU_DISP++, object_tp_000000_DL); } } - - CLOSE_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1495); - - if ((thisx->params <= TAILPASARAN_TAIL) || (thisx->params == TAILPASARAN_TAIL_DYING)) { - Collider_UpdateSpheres(0, &this->collider); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tp.c", 0x5D7); + if ((this->actor.params <= 0) || (this->actor.params == 0xB)) { + Collider_UpdateSpheres(0, &this->unk174); } } 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 7e596aadbda..f272a43976a 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -6,34 +6,26 @@ struct EnTp; -typedef void (*EnTpActionFunc)(struct EnTp*, struct PlayState*); - typedef struct EnTp { - /* 0x0000 */ Actor actor; - /* 0x014C */ s32 actionIndex; - /* 0x0150 */ s32 unk_150; // Some kind of state indicator - /* 0x0154 */ EnTpActionFunc actionFunc; - /* 0x0158 */ u8 damageReaction; // Used to propagate the reaction to the other segments' actors - /* 0x015A */ s16 timer; - /* 0x015C */ s16 unk_15C; // Multipurpose, used to change the horizontal position of tail segments - /* 0x015E */ s16 alpha; // The dying types fade away - /* 0x0160 */ s16 red; - /* 0x0162 */ s16 kiraSpawnTimer; - /* 0x0164 */ s16 unk_164; // Used once, never set to nonzero - /* 0x0168 */ f32 heightPhase; - /* 0x016C */ f32 horizontalVariation; - /* 0x0170 */ f32 extraHeightVariation; - /* 0x0174 */ ColliderJntSph collider; - /* 0x0194 */ ColliderJntSphElement colliderElements[1]; - /* 0x01D4 */ struct EnTp* head; -} EnTp; // size = 0x01D8 - -typedef enum EnTpType { - /* -1 */ TAILPASARAN_HEAD = -1, // Used when scenes spawn them: code only cares about < 0 - /* 0 */ TAILPASARAN_TAIL, - /* 10 */ TAILPASARAN_FRAGMENT = 10, - /* 11 */ TAILPASARAN_TAIL_DYING, - /* 12 */ TAILPASARAN_HEAD_DYING -} EnTpType; + /* 0x000 */ Actor actor; + /* 0x14C */ s32 unk14C; + /* 0x150 */ s32 unk150; + /* 0x154 */ void (*unk154)(struct EnTp*, struct PlayState*); + /* 0x158 */ u8 unk158; + /* 0x159 */ char pad159[1]; + /* 0x15A */ s16 unk15A; + /* 0x15C */ s16 unk15C; + /* 0x15E */ s16 unk15E; + /* 0x160 */ s16 unk160; + /* 0x162 */ s16 unk162; + /* 0x164 */ s16 unk164; + /* 0x166 */ char pad166[2]; + /* 0x168 */ f32 unk168; + /* 0x16C */ f32 unk16C; + /* 0x170 */ f32 unk170; + /* 0x174 */ ColliderJntSph unk174; + /* 0x194 */ ColliderJntSphElement unk194; + /* 0x1D4 */ struct EnTp* unk1D4; +} EnTp; // size = 0x1D8 #endif diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index 4ec4839c665..9bed9fce9ba 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -26,13 +26,12 @@ void EnTr_Destroy(Actor* thisx, PlayState* play); void EnTr_Update(Actor* thisx, PlayState* play); void EnTr_Draw(Actor* thisx, PlayState* play); -void EnTr_DoNothing(EnTr* this, PlayState* play); -void EnTr_ShrinkVanish(EnTr* this, PlayState* play); -void EnTr_WaitToReappear(EnTr* this, PlayState* play); -void EnTr_ChooseAction1(EnTr* this, PlayState* play); - -void EnTr_SetRotFromCue(EnTr* this, PlayState* play, s32 cueChannel); +void func_80B22F1C(EnTr* this, PlayState* play); +void func_80B234D4(EnTr* this, PlayState* play); +void func_80B23820(EnTr* this, PlayState* play); +void func_80B23A88(EnTr* this, PlayState* play); void func_80B24038(EnTr* this, PlayState* play, s32 cueChannel); +void EnTr_SetRotFromCue(EnTr* this, PlayState* play, s32 cueChannel); void EnTr_SetStartPosRotFromCue(EnTr* this, PlayState* play, s32 cueChannel); ActorProfile En_Tr_Profile = { @@ -46,51 +45,41 @@ ActorProfile En_Tr_Profile = { /**/ EnTr_Update, /**/ EnTr_Draw, }; - -// The first elements of these animation arrays are for Koume, the second for Kotake - -static AnimationHeader* unused[] = { +static AnimationHeader* D_80B24360[2] = { &gKotakeKoumeStandingBroomOverRightShoulderAnim, &gKotakeKoumeStandingBroomOverLeftShoulderAnim, }; - -static AnimationHeader* D_80B24368[] = { +static AnimationHeader* D_80B24368[2] = { &gKotakeKoumeLookOverLeftShoulderAnim, &gKotakeKoumeLookOverRightShoulderAnim, }; - -static AnimationHeader* D_80B24370[] = { +static AnimationHeader* D_80B24370[2] = { &gKotakeKoumeLookingOverLeftShoulderAnim, &gKotakeKoumeLookingOverRightShoulderAnim, }; - -static AnimationHeader* D_80B24378[] = { +static AnimationHeader* D_80B24378[2] = { &gKotakeKoumeFlyAnim, &gKotakeKoumeFlyAnim, }; - -static AnimationHeader* D_80B24380[] = { +static AnimationHeader* D_80B24380[2] = { &gKotakeKoumeCastMagicAnim, &gKotakeKoumeCastMagicAnim, }; - -static f32 D_80B24388[] = { 0.0f, 20.0f, -30.0f, 20.0f, -20.0f, -20.0f, 30.0f }; - -static f32 D_80B243A4[] = { 0.0f, 30.0f, 0.0f, -30.0f, 30.0f, -30.0f, 0.0f }; - -// Has to be 1-dimensional to match +static f32 D_80B24388[7] = { 0.0f, 20.0f, -30.0f, 20.0f, -20.0f, -20.0f, 30.0f }; +static f32 D_80B243A4[7] = { 0.0f, 30.0f, 0.0f, -30.0f, 30.0f, -30.0f, 0.0f }; static Color_RGBA8 D_80B243C0[4] = { - { 255, 200, 0, 255 }, - { 255, 0, 0, 255 }, - { 255, 255, 255, 255 }, - { 0, 0, 255, 255 }, + { 0xFF, 0xC8, 0, 0xFF }, + { 0xFF, 0, 0, 0xFF }, + { 0xFF, 0xFF, 0xFF, 0xFF }, + { 0, 0, 0xFF, 0xFF }, }; - -static void* sEyeTextures[] = { +static void* D_80B243D0[3] = { gKotakeKoumeEyeOpenTex, gKotakeKoumeEyeHalfTex, gKotakeKoumeEyeClosedTex, }; +static Vec3f D_80B243DC = { 2300.0f, 0.0f, -600.0f }; +static Vec3f D_80B243E8 = { 0.0f, 0.0f, 0.0f }; void EnTr_SetupAction(EnTr* this, EnTrActionFunc actionFunc) { this->actionFunc = actionFunc; @@ -100,32 +89,31 @@ void EnTr_Init(Actor* thisx, PlayState* play) { EnTr* this = (EnTr*)thisx; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - EnTr_SetupAction(this, EnTr_DoNothing); - this->unk_2D4 = 0; // Set and not used + EnTr_SetupAction(this, func_80B22F1C); + this->unk2D4 = 0; this->actor.child = NULL; Actor_SetScale(&this->actor, 0.01f); - switch (this->actor.params) { - case TR_KOUME: - SkelAnime_InitFlex(play, &this->skelAnime, &gKoumeSkel, &gKotakeKoumeStandingBroomOverRightShoulderAnim, - this->jointTable, this->morphTable, KOTAKE_KOUME_LIMB_MAX); - Animation_PlayOnce(&this->skelAnime, &gKotakeKoumeStandingBroomOverRightShoulderAnim); - this->animation = NULL; - EnTr_SetupAction(this, EnTr_ChooseAction1); + case 0: + SkelAnime_InitFlex(play, &this->unk14C, &gKoumeSkel, &gKotakeKoumeStandingBroomOverRightShoulderAnim, + this->unk190, this->unk232, KOTAKE_KOUME_LIMB_MAX); + Animation_PlayOnce(&this->unk14C, &gKotakeKoumeStandingBroomOverRightShoulderAnim); + this->unk2E4 = NULL; + EnTr_SetupAction(this, func_80B23A88); this->cueChannel = 3; break; - case TR_KOTAKE: - SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeKoumeStandingBroomOverLeftShoulderAnim, - this->jointTable, this->morphTable, KOTAKE_KOUME_LIMB_MAX); - Animation_PlayOnce(&this->skelAnime, &gKotakeKoumeStandingBroomOverLeftShoulderAnim); - this->animation = NULL; - EnTr_SetupAction(this, EnTr_ChooseAction1); + case 1: + SkelAnime_InitFlex(play, &this->unk14C, &gKotakeSkel, &gKotakeKoumeStandingBroomOverLeftShoulderAnim, + this->unk190, this->unk232, KOTAKE_KOUME_LIMB_MAX); + Animation_PlayOnce(&this->unk14C, &gKotakeKoumeStandingBroomOverLeftShoulderAnim); + this->unk2E4 = NULL; + EnTr_SetupAction(this, func_80B23A88); this->cueChannel = 2; break; default: - ASSERT(0, "0", "../z_en_tr.c", 277); + ASSERT(0, "0", "../z_en_tr.c", 0x115); break; } } @@ -133,43 +121,43 @@ void EnTr_Init(Actor* thisx, PlayState* play) { void EnTr_Destroy(Actor* thisx, PlayState* play) { } -void EnTr_CrySpellcast(EnTr* this, PlayState* play) { - if (this->timer == 11) { - // Both cry in the title screen cutscene, but only Kotake in the in-game cutscene - if ((this->actor.params != TR_KOUME) || (gSaveContext.sceneLayer == 6)) { - SFX_PLAY_CENTERED(NA_SE_EN_TWINROBA_SHOOT_VOICE); - } +void func_80B22E6C(EnTr* this, PlayState* play) { + if ((this->unk2D6 == 0xB) && ((this->actor.params != 0) || (gSaveContext.sceneLayer == 6))) { + SFX_PLAY_CENTERED(NA_SE_EN_TWINROBA_SHOOT_VOICE); } - - if (this->timer > 0) { - this->timer--; - } else if (this->actor.child != NULL) { - this->actor.child = NULL; + if (this->unk2D6 > 0) { + this->unk2D6--; + } else { + if (this->actor.child != NULL) { + this->actor.child = NULL; + } } Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } -void EnTr_DoNothing(EnTr* this, PlayState* play) { +void func_80B22F1C(EnTr* this, PlayState* play) { } -void EnTr_ChooseAction2(EnTr* this, PlayState* play) { - if (play->csCtx.state != CS_STATE_IDLE) { - if (play->csCtx.actorCues[this->cueChannel] != NULL) { - switch (play->csCtx.actorCues[this->cueChannel]->id) { +void func_80B22F28(EnTr* this, PlayState* play) { + CsCmdActorCue* temp_v0; + if (play->csCtx.state != CS_STATE_IDLE) { + temp_v0 = play->csCtx.actorCues[this->cueChannel]; + if (temp_v0 != NULL) { + switch (temp_v0->id) { case 4: Actor_SetScale(&this->actor, 0.01f); - EnTr_SetupAction(this, EnTr_ShrinkVanish); - this->timer = 24; + EnTr_SetupAction(this, func_80B234D4); + this->unk2D6 = 0x18; Actor_PlaySfx(&this->actor, NA_SE_EN_PO_DEAD2); break; case 6: - Animation_Change(&this->skelAnime, D_80B24380[this->actor.params], 1.0f, 0.0f, + Animation_Change(&this->unk14C, D_80B24380[this->actor.params], 1.0f, 0.0f, Animation_GetLastFrame(D_80B24380[this->actor.params]), ANIMMODE_ONCE, -5.0f); - EnTr_SetupAction(this, EnTr_CrySpellcast); - this->animation = D_80B24378[this->actor.params]; - this->timer = 39; + EnTr_SetupAction(this, func_80B22E6C); + this->unk2E4 = D_80B24378[this->actor.params]; + this->unk2D6 = 0x27; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_DEMO_6K, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, this->actor.params + 9); @@ -186,30 +174,30 @@ void EnTr_ChooseAction2(EnTr* this, PlayState* play) { } } -void EnTr_FlyKidnapCutscene(EnTr* this, PlayState* play) { - Vec3f originalPos = this->actor.world.pos; +void func_80B230D8(EnTr* this, PlayState* play) { + Vec3f sp34; + CsCmdActorCue* temp_v0; + sp34 = this->actor.world.pos; if (play->csCtx.state != CS_STATE_IDLE) { - if (play->csCtx.actorCues[this->cueChannel] != NULL) { - if (play->csCtx.actorCues[this->cueChannel]->id == 8) { + temp_v0 = play->csCtx.actorCues[this->cueChannel]; + if (temp_v0 != NULL) { + if (temp_v0->id == 8) { func_80B24038(this, play, this->cueChannel); this->actor.world.rot.y = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 10, 0x400, 0x100); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 0xA, 0x400, 0x100); this->actor.world.rot.y = this->actor.shape.rot.y; } else { EnTr_SetStartPosRotFromCue(this, play, this->cueChannel); - this->actor.world.pos.x += Math_SinS(this->timer) * 150.0f; + this->actor.world.pos.x += Math_SinS(this->unk2D6) * 150.0f; this->actor.world.pos.y += -100.0f; - this->actor.world.pos.z += Math_CosS(this->timer) * 150.0f; - - this->actor.shape.rot.y = (s16)(this->timer) + 0x4000; - this->timer += 0x400; - - this->actor.velocity.x = this->actor.world.pos.x - originalPos.x; - this->actor.velocity.y = this->actor.world.pos.y - originalPos.y; - this->actor.velocity.z = this->actor.world.pos.z - originalPos.z; + this->actor.world.pos.z += Math_CosS(this->unk2D6) * 150.0f; + this->actor.shape.rot.y = (s16)this->unk2D6 + 0x4000; + this->unk2D6 += 0x400; + this->actor.velocity.x = this->actor.world.pos.x - sp34.x; + this->actor.velocity.y = this->actor.world.pos.y - sp34.y; + this->actor.velocity.z = this->actor.world.pos.z - sp34.z; } - if (play->csCtx.curFrame < 670) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } @@ -217,164 +205,169 @@ void EnTr_FlyKidnapCutscene(EnTr* this, PlayState* play) { } } -void func_80B23254(EnTr* this, PlayState* play, s32 arg2, f32 arg3, f32 scale) { - Vec3f pos; - Vec3f velocity; - Vec3f accel; +void func_80B23254(EnTr* this, PlayState* play, s32 arg2, f32 arg3, f32 arg4) { + Vec3f sp7C; + Vec3f sp70; + Vec3f sp64; Vec3f sp58; - Color_RGBA8* primColor; - Color_RGBA8* envColor; - Vec3f cameraEye = GET_ACTIVE_CAM(play)->eye; - s16 yaw = Math_Vec3f_Yaw(&cameraEye, &this->actor.world.pos); - s16 reversePitch = -Math_Vec3f_Pitch(&cameraEye, &this->actor.world.pos); - f32 sp3C; - - accel.x = accel.z = 0.0f; - sp3C = Math_SinS(yaw); - velocity.x = Math_CosS(reversePitch) * (arg3 * sp3C); - velocity.y = Math_SinS(reversePitch) * arg3; - sp3C = Math_CosS(yaw); - velocity.z = Math_CosS(reversePitch) * (arg3 * sp3C); - accel.y = 0.5f; - - primColor = &D_80B243C0[2 * this->actor.params]; - envColor = &D_80B243C0[2 * this->actor.params + 1]; - + Color_RGBA8* sp54; + Color_RGBA8* sp50; + Vec3f sp44; + s16 temp_s0; + s16 sp40; + + sp44 = GET_ACTIVE_CAM(play)->eye; + temp_s0 = Math_Vec3f_Yaw(&sp44, &this->actor.world.pos); + sp40 = -Math_Vec3f_Pitch(&sp44, &this->actor.world.pos); + sp64.z = 0.0f; + sp64.x = 0.0f; + sp70.x = arg3 * Math_SinS(temp_s0) * Math_CosS(sp40); + sp70.y = arg3 * Math_SinS(sp40); + sp70.z = arg3 * Math_CosS(temp_s0) * Math_CosS(sp40); + sp64.y = 0.5f; + sp54 = &D_80B243C0[(this->actor.params * 2) + 0]; + sp50 = &D_80B243C0[(this->actor.params * 2) + 1]; sp58 = this->actor.world.pos; - sp58.x -= velocity.x * 10.0f; - sp58.y -= velocity.y * 10.0f; - sp58.z -= velocity.z * 10.0f; - - pos.x = sp58.x + ((D_80B24388[arg2] * scale) * Math_CosS(yaw)); - pos.y = sp58.y + (D_80B243A4[arg2] * scale); - pos.z = sp58.z - ((D_80B24388[arg2] * scale) * Math_SinS(yaw)); - func_8002829C(play, &pos, &velocity, &accel, primColor, envColor, (s32)(800.0f * scale), (s32)(80.0f * scale)); + sp58.x -= sp70.x * 10.0f; + sp58.y -= sp70.y * 10.0f; + sp58.z -= sp70.z * 10.0f; + sp7C.x = sp58.x + (D_80B24388[arg2] * arg4 * Math_CosS(temp_s0)); + sp7C.y = sp58.y + (D_80B243A4[arg2] * arg4); + sp7C.z = sp58.z - (D_80B24388[arg2] * arg4 * Math_SinS(temp_s0)); + func_8002829C(play, &sp7C, &sp70, &sp64, sp54, sp50, 800.0f * arg4, 80.0f * arg4); } -void EnTr_ShrinkVanish(EnTr* this, PlayState* play) { +void func_80B234D4(EnTr* this, PlayState* play) { s32 temp_hi; - if (this->timer >= 17) { - this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; + if (this->unk2D6 >= 0x11) { + this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->unk2D6 * 0x28F)) + 0x3D68; + } else if (this->unk2D6 >= 5) { + Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); + this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->unk2D6 * 0x28F)) + 0x3D68; + } else if (this->unk2D6 > 0) { + temp_hi = (this->unk2D6 * 2) % 7; + func_80B23254(this, play, temp_hi, 5.0f, 0.2f); + func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 0.2f); + Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); + this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->unk2D6 * 0x28F)) + 0x3D68; } else { - if (this->timer >= 5) { - Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); - this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; - } else if (this->timer > 0) { - temp_hi = (this->timer * 2) % 7; - - func_80B23254(this, play, temp_hi, 5.0f, 0.2f); - func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 0.2f); - Actor_SetScale(&this->actor, this->actor.scale.x * 0.9f); - this->actor.shape.rot.y = (this->actor.shape.rot.y - (this->timer * 0x28F)) + 0x3D68; - } else { - EnTr_SetupAction(this, EnTr_WaitToReappear); - this->actor.draw = NULL; - } + EnTr_SetupAction(this, func_80B23820); + this->actor.draw = NULL; } - - if (this->timer == 4) { + if (this->unk2D6 == 4) { Actor_PlaySfx(&this->actor, NA_SE_EN_BUBLE_DOWN); } - - if (this->timer > 0) { - this->timer--; + if (this->unk2D6 > 0) { + this->unk2D6--; } } -void EnTr_Reappear(EnTr* this, PlayState* play) { - if (this->timer >= 31) { - s32 temp_hi = (this->timer * 2) % 7; +void func_80B23690(EnTr* this, PlayState* play) { + s32 temp_hi; + if (this->unk2D6 >= 0x1F) { + temp_hi = (this->unk2D6 * 2) % 7; func_80B23254(this, play, temp_hi, 5.0f, 1.0f); func_80B23254(this, play, (temp_hi + 1) % 7, 5.0f, 1.0f); - } else if (this->timer == 30) { + } else if (this->unk2D6 == 0x1E) { this->actor.draw = EnTr_Draw; - this->actor.shape.rot.y += this->timer * 0x1A6; - } else if (this->timer > 0) { - this->actor.shape.rot.y += this->timer * 0x1A6; + this->actor.shape.rot.y += this->unk2D6 * 0x1A6; + } else if (this->unk2D6 > 0) { + this->actor.shape.rot.y += this->unk2D6 * 0x1A6; Actor_SetScale(&this->actor, (this->actor.scale.x * 0.8f) + 0.002f); } else { - EnTr_SetupAction(this, EnTr_ChooseAction2); + EnTr_SetupAction(this, func_80B22F28); Actor_SetScale(&this->actor, 0.01f); } - - if (this->timer > 0) { - this->timer--; + if (this->unk2D6 > 0) { + this->unk2D6--; } Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_TWINROBA_FLY_DEMO - SFX_FLAG); } -void EnTr_WaitToReappear(EnTr* this, PlayState* play) { +void func_80B23820(EnTr* this, PlayState* play) { + CsCmdActorCue* temp_v0; + if (play->csCtx.state != CS_STATE_IDLE) { - if ((play->csCtx.actorCues[this->cueChannel] != NULL) && ((play->csCtx.actorCues[this->cueChannel]->id == 3) || - (play->csCtx.actorCues[this->cueChannel]->id == 5))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM); - this->timer = 34; + temp_v0 = play->csCtx.actorCues[this->cueChannel]; + if ((temp_v0 != NULL) && (((temp_v0->id == 3)) || (temp_v0->id == 5))) { + Actor_PlaySfx(&this->actor, 0x390DU); + this->unk2D6 = 0x22; EnTr_SetStartPosRotFromCue(this, play, this->cueChannel); - EnTr_SetupAction(this, EnTr_Reappear); - Animation_PlayLoop(&this->skelAnime, &gKotakeKoumeFlyAnim); - this->animation = NULL; + EnTr_SetupAction(this, func_80B23690); + Animation_PlayLoop(&this->unk14C, &gKotakeKoumeFlyAnim); + this->unk2E4 = NULL; Actor_SetScale(&this->actor, 0.003f); } } } -void EnTr_TakeOff(EnTr* this, PlayState* play) { - f32 lastFrame = Animation_GetLastFrame(D_80B24378[this->actor.params]); +void func_80B238E0(EnTr* this, PlayState* play) { + CsCmdActorCue* temp_v0; + f32 temp_fv0; + temp_fv0 = Animation_GetLastFrame(D_80B24378[this->actor.params]); if (play->csCtx.state != CS_STATE_IDLE) { - if ((play->csCtx.actorCues[this->cueChannel] != NULL) && (play->csCtx.actorCues[this->cueChannel]->id == 3)) { - Animation_Change(&this->skelAnime, D_80B24378[this->actor.params], 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP, - -10.0f); - this->animation = NULL; - EnTr_SetupAction(this, EnTr_ChooseAction2); + temp_v0 = play->csCtx.actorCues[this->cueChannel]; + if ((temp_v0 != NULL) && (temp_v0->id == 3)) { + Animation_Change(&this->unk14C, D_80B24378[this->actor.params], 1.0f, 0.0f, temp_fv0, 0U, -10.0f); + this->unk2E4 = NULL; + EnTr_SetupAction(this, func_80B22F28); } } } -void EnTr_TurnLookOverShoulder(EnTr* this, PlayState* play) { - f32 lastFrame = Animation_GetLastFrame(D_80B24368[this->actor.params]); +void func_80B239A8(EnTr* this, PlayState* play) { + CsCmdActorCue* temp_v0; + f32 temp_fv0; + temp_fv0 = Animation_GetLastFrame(D_80B24368[this->actor.params]); if (play->csCtx.state != CS_STATE_IDLE) { - if ((play->csCtx.actorCues[this->cueChannel] != NULL) && (play->csCtx.actorCues[this->cueChannel]->id == 2)) { - Animation_Change(&this->skelAnime, D_80B24368[this->actor.params], 1.0f, 0.0f, lastFrame, ANIMMODE_ONCE, - -4.0f); - this->animation = D_80B24370[this->actor.params]; - EnTr_SetupAction(this, EnTr_TakeOff); + temp_v0 = play->csCtx.actorCues[this->cueChannel]; + if ((temp_v0 != NULL) && (temp_v0->id == 2)) { + Animation_Change(&this->unk14C, D_80B24368[this->actor.params], 1.0f, 0.0f, temp_fv0, 2U, -4.0f); + this->unk2E4 = D_80B24370[this->actor.params]; + EnTr_SetupAction(this, func_80B238E0); } } } -void EnTr_ChooseAction1(EnTr* this, PlayState* play) { - u32 frames = play->gameplayFrames; +void func_80B23A88(EnTr* this, PlayState* play) { + u32 temp_a3; + CsCmdActorCue* temp_v1; + temp_a3 = play->gameplayFrames; if (play->csCtx.state != CS_STATE_IDLE) { - if (play->csCtx.actorCues[this->cueChannel] != NULL) { - switch (play->csCtx.actorCues[this->cueChannel]->id) { + temp_v1 = play->csCtx.actorCues[this->cueChannel]; + if (temp_v1 != NULL) { + switch (temp_v1->id) { case 1: EnTr_SetStartPosRotFromCue(this, play, this->cueChannel); - EnTr_SetupAction(this, EnTr_TurnLookOverShoulder); + EnTr_SetupAction(this, func_80B239A8); break; case 3: EnTr_SetStartPosRotFromCue(this, play, this->cueChannel); - EnTr_SetupAction(this, EnTr_ChooseAction2); - Animation_PlayLoop(&this->skelAnime, &gKotakeKoumeFlyAnim); - this->animation = NULL; + EnTr_SetupAction(this, func_80B22F28); + Animation_PlayLoop(&this->unk14C, &gKotakeKoumeFlyAnim); + this->unk2E4 = NULL; break; case 4: - EnTr_SetupAction(this, EnTr_WaitToReappear); + EnTr_SetupAction(this, func_80B23820); this->actor.draw = NULL; break; case 7: - EnTr_SetupAction(this, EnTr_FlyKidnapCutscene); - Animation_PlayLoop(&this->skelAnime, &gKotakeKoumeFlyAnim); - this->animation = NULL; - this->timer = - ((this->actor.params != TR_KOUME) ? ((u8)frames * 0x400) + 0x8000 : (u8)frames * 0x400); + EnTr_SetupAction(this, func_80B230D8); + Animation_PlayLoop(&this->unk14C, &gKotakeKoumeFlyAnim); + this->unk2E4 = NULL; + if (this->actor.params != 0) { + this->unk2D6 = ((u8)temp_a3 * 0x400) + 0x8000; + } else { + this->unk2D6 = (u8)temp_a3 * 0x400; + } break; } } @@ -382,158 +375,159 @@ void EnTr_ChooseAction1(EnTr* this, PlayState* play) { } void EnTr_Update(Actor* thisx, PlayState* play) { - s32 pad; EnTr* this = (EnTr*)thisx; + s32 pad; Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); - - if (SkelAnime_Update(&this->skelAnime)) { - if (this->animation != NULL) { - if ((this->animation == &gKotakeKoumeLookingOverLeftShoulderAnim) || - (this->animation == &gKotakeKoumeLookingOverRightShoulderAnim)) { - if (this->actor.params != TR_KOUME) { + if (SkelAnime_Update(&this->unk14C)) { + if (this->unk2E4 != NULL) { + if ((this->unk2E4 == &gKotakeKoumeLookingOverLeftShoulderAnim) || + (this->unk2E4 == &gKotakeKoumeLookingOverRightShoulderAnim)) { + if (this->actor.params != 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_TWINROBA_LAUGH2); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_TWINROBA_LAUGH); } - Animation_PlayLoop(&this->skelAnime, this->animation); - } else if (this->animation == &gKotakeKoumeFlyAnim) { - EnTr_SetupAction(this, EnTr_ChooseAction2); - Animation_Change(&this->skelAnime, &gKotakeKoumeFlyAnim, 1.0f, 0.0f, + Animation_PlayLoop(&this->unk14C, this->unk2E4); + } else if (this->unk2E4 == &gKotakeKoumeFlyAnim) { + EnTr_SetupAction(this, func_80B22F28); + Animation_Change(&this->unk14C, &gKotakeKoumeFlyAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gKotakeKoumeFlyAnim), ANIMMODE_LOOP, -5.0f); } else { - Animation_PlayLoop(&this->skelAnime, this->animation); + Animation_PlayLoop(&this->unk14C, this->unk2E4); } - this->animation = NULL; + this->unk2E4 = NULL; } else { - this->skelAnime.curFrame = 0.0f; + this->unk14C.curFrame = 0.0f; } } Actor_SetFocus(&this->actor, 0.0f); - - if (DECR(this->blinkTimer) == 0) { - this->blinkTimer = Rand_S16Offset(60, 60); + if (DECR(this->unk2E2) == 0) { + this->unk2E2 = Rand_S16Offset(0x3C, 0x3C); } - this->eyeIndex = this->blinkTimer; - if (this->eyeIndex >= 3) { - this->eyeIndex = 0; + this->unk2E0 = this->unk2E2; + if (this->unk2E0 >= 3) { + this->unk2E0 = 0; } } -s32 EnTr_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - Vec3f src = { 2300.0f, 0.0f, -600.0f }; - Vec3f dest = { 0.0f, 0.0f, 0.0f }; - EnTr* this = (EnTr*)thisx; - Actor* child = this->actor.child; - - if ((child != NULL) && (limbIndex == KOTAKE_KOUME_LIMB_RIGHT_HAND)) { - Matrix_MultVec3f(&src, &dest); - dest.x -= (10.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)))); - dest.z -= (10.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)))); - child->world.pos = dest; +s32 EnTr_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { + Vec3f sp34; + Vec3f sp28; + EnTr* this = thisx; + Actor* sp20; + + sp34 = D_80B243DC; + sp28 = D_80B243E8; + sp20 = this->actor.child; + if ((sp20 != NULL) && (arg1 == KOTAKE_KOUME_LIMB_RIGHT_HAND)) { + Matrix_MultVec3f(&sp34, &sp28); + sp28.x -= 10.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + sp28.z -= 10.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + sp20->world.pos = sp28; } return 0; } void EnTr_Draw(Actor* thisx, PlayState* play) { - s32 pad; EnTr* this = (EnTr*)thisx; - - if (1) {} + s32 pad; if ((play->csCtx.state == CS_STATE_IDLE) || (play->csCtx.actorCues[this->cueChannel] == NULL)) { this->actor.shape.shadowDraw = NULL; } else { + if (1) {} this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - OPEN_DISPS(play->state.gfxCtx, "../z_en_tr.c", 840); Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B243D0[this->unk2E0])); func_8002EBCC(&this->actor, play, 0); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + SkelAnime_DrawFlexOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, this->unk14C.dListCount, EnTr_OverrideLimbDraw, NULL, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_tr.c", 854); } } -f32 func_80B23FDC(PlayState* play, s32 cueChannel) { - f32 phi_f2 = Environment_LerpWeight(play->csCtx.actorCues[cueChannel]->endFrame, - play->csCtx.actorCues[cueChannel]->startFrame, play->csCtx.curFrame); - phi_f2 = CLAMP_MAX(phi_f2, 1.0f); - return phi_f2; +f32 func_80B23FDC(PlayState* arg0, s32 cueChannel) { + CsCmdActorCue* temp_v0; + f32 temp_fv0; + f32 var_fv1; + + temp_v0 = arg0->csCtx.actorCues[cueChannel]; + temp_fv0 = Environment_LerpWeight(temp_v0->endFrame, temp_v0->startFrame, arg0->csCtx.curFrame); + var_fv1 = temp_fv0; + if (temp_fv0 > 1.0f) { + var_fv1 = 1.0f; + } + return var_fv1; } void func_80B24038(EnTr* this, PlayState* play, s32 cueChannel) { - Vec3f startPos; - Vec3f endPos; - f32 temp_f0; - f32 temp_f0_2; - f32 phi_f12; - - startPos.x = play->csCtx.actorCues[cueChannel]->startPos.x; - startPos.y = play->csCtx.actorCues[cueChannel]->startPos.y; - startPos.z = play->csCtx.actorCues[cueChannel]->startPos.z; - - endPos.x = play->csCtx.actorCues[cueChannel]->endPos.x; - endPos.y = play->csCtx.actorCues[cueChannel]->endPos.y; - endPos.z = play->csCtx.actorCues[cueChannel]->endPos.z; - - temp_f0 = func_80B23FDC(play, cueChannel); - - startPos.x = ((endPos.x - startPos.x) * temp_f0) + startPos.x; - startPos.y = ((endPos.y - startPos.y) * temp_f0) + startPos.y; - startPos.z = ((endPos.z - startPos.z) * temp_f0) + startPos.z; - - endPos.x = (startPos.x - this->actor.world.pos.x) * 0.1f; - endPos.y = (startPos.y - this->actor.world.pos.y) * 0.1f; - endPos.z = (startPos.z - this->actor.world.pos.z) * 0.1f; - - temp_f0_2 = sqrtf(SQ(endPos.x) + SQ(endPos.y) + SQ(endPos.z)); - phi_f12 = CLAMP(temp_f0_2, 0.0f, 20.0f); - - if ((temp_f0_2 != phi_f12) && (temp_f0_2 != 0.0f)) { - endPos.x *= phi_f12 / temp_f0_2; - endPos.y *= phi_f12 / temp_f0_2; - endPos.z *= phi_f12 / temp_f0_2; + Vec3f sp34; + Vec3f sp28; + f32 temp_fv0; + f32 var_fa0; + CsCmdActorCue* v; + + v = play->csCtx.actorCues[cueChannel]; + sp34.x = v->startPos.x; + sp34.y = v->startPos.y; + sp34.z = v->startPos.z; + sp28.x = v->endPos.x; + sp28.y = v->endPos.y; + sp28.z = v->endPos.z; + temp_fv0 = func_80B23FDC(play, (s32)cueChannel); + sp34.x = ((sp28.x - sp34.x) * temp_fv0) + sp34.x; + sp34.y = ((sp28.y - sp34.y) * temp_fv0) + sp34.y; + sp34.z = ((sp28.z - sp34.z) * temp_fv0) + sp34.z; + sp28.x = (sp34.x - this->actor.world.pos.x) * 0.1f; + sp28.y = (sp34.y - this->actor.world.pos.y) * 0.1f; + sp28.z = (sp34.z - this->actor.world.pos.z) * 0.1f; + temp_fv0 = sqrtf(SQXYZ(sp28)); + var_fa0 = CLAMP(temp_fv0, 0.0f, 20.0f); + if ((temp_fv0 != var_fa0) && (temp_fv0 != 0.0f)) { + sp28.x *= var_fa0 / temp_fv0; + sp28.y *= var_fa0 / temp_fv0; + sp28.z *= var_fa0 / temp_fv0; } - - Math_StepToF(&this->actor.velocity.x, endPos.x, 1.0f); - Math_StepToF(&this->actor.velocity.y, endPos.y, 1.0f); - Math_StepToF(&this->actor.velocity.z, endPos.z, 1.0f); + Math_StepToF(&this->actor.velocity.x, sp28.x, 1.0f); + Math_StepToF(&this->actor.velocity.y, sp28.y, 1.0f); + Math_StepToF(&this->actor.velocity.z, sp28.z, 1.0f); Actor_UpdatePos(&this->actor); } void EnTr_SetRotFromCue(EnTr* this, PlayState* play, s32 cueChannel) { - s16 rotY = play->csCtx.actorCues[cueChannel]->rot.y; - s32 rotDiff = this->actor.world.rot.y - rotY; - s32 rotSign; - - if (rotDiff < 0) { - rotDiff = -rotDiff; - rotSign = 1; + s32 var_v0; + s16 new_var; + s32 var_v1; + + new_var = play->csCtx.actorCues[cueChannel]->rot.y; + var_v1 = this->actor.world.rot.y - new_var; + if (var_v1 < 0) { + var_v1 = -var_v1; + var_v0 = 1; } else { - rotSign = -1; + var_v0 = -1; } - - if (rotDiff >= 0x8000) { - rotSign = -rotSign; - rotDiff = 0x10000 - rotDiff; + if (var_v1 >= 0x8000) { + var_v0 = -var_v0; + var_v1 = 0x10000 - var_v1; } - - rotDiff *= 0.1f; - - this->actor.world.rot.y += rotDiff * rotSign; + var_v1 *= 0.1f; + this->actor.world.rot.y += var_v1 * var_v0; this->actor.shape.rot.y = this->actor.world.rot.y; } void EnTr_SetStartPosRotFromCue(EnTr* this, PlayState* play, s32 cueChannel) { - Vec3f startPos; - - startPos.x = play->csCtx.actorCues[cueChannel]->startPos.x; - startPos.y = play->csCtx.actorCues[cueChannel]->startPos.y; - startPos.z = play->csCtx.actorCues[cueChannel]->startPos.z; - - this->actor.world.pos = startPos; - this->actor.world.rot.y = this->actor.shape.rot.y = play->csCtx.actorCues[cueChannel]->rot.y; + Vec3f spC; + s16 temp_v1; + + spC.x = play->csCtx.actorCues[cueChannel]->startPos.x; + spC.y = play->csCtx.actorCues[cueChannel]->startPos.y; + spC.z = play->csCtx.actorCues[cueChannel]->startPos.z; + this->actor.world.pos = spC; + temp_v1 = play->csCtx.actorCues[cueChannel]->rot.y; + this->actor.shape.rot.y = temp_v1; + this->actor.world.rot.y = temp_v1; } 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 d6490902299..020ab15a901 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.h +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.h @@ -40,22 +40,18 @@ typedef enum KotakeKoumeLimb { } KotakeKoumeLimb; typedef struct EnTr { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[KOTAKE_KOUME_LIMB_MAX]; - /* 0x0232 */ Vec3s morphTable[KOTAKE_KOUME_LIMB_MAX]; - /* 0x02D4 */ s16 unk_2D4; - /* 0x02D6 */ u16 timer; // Also used as an angle - /* 0x02D8 */ s16 cueChannel; - /* 0x02DC */ EnTrActionFunc actionFunc; - /* 0x02E0 */ s16 eyeIndex; - /* 0x02E2 */ s16 blinkTimer; - /* 0x02E4 */ AnimationHeader* animation; -} EnTr; // size = 0x02E8 - -typedef enum TwinrovaType { - /* 0 */ TR_KOUME, - /* 1 */ TR_KOTAKE -} TwinrovaType; + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ Vec3s unk190[KOTAKE_KOUME_LIMB_MAX]; + /* 0x232 */ Vec3s unk232[KOTAKE_KOUME_LIMB_MAX]; + /* 0x2D4 */ s16 unk2D4; + /* 0x2D6 */ u16 unk2D6; + /* 0x2D8 */ s16 cueChannel; + /* 0x2DA */ char pad2DA[2]; + /* 0x2DC */ EnTrActionFunc actionFunc; + /* 0x2E0 */ s16 unk2E0; + /* 0x2E2 */ s16 unk2E2; + /* 0x2E4 */ AnimationHeader* unk2E4; +} EnTr; // size = 0x2E8 #endif 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 251528bad57..9f4bee28456 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -28,20 +28,18 @@ void EnVali_Destroy(Actor* thisx, PlayState* play); void EnVali_Update(Actor* thisx, PlayState* play); void EnVali_Draw(Actor* thisx, PlayState* play); -void EnVali_SetupLurk(EnVali* this); -void EnVali_SetupDropAppear(EnVali* this); - -void EnVali_Lurk(EnVali* this, PlayState* play); -void EnVali_DropAppear(EnVali* this, PlayState* play); -void EnVali_FloatIdle(EnVali* this, PlayState* play); -void EnVali_Attacked(EnVali* this, PlayState* play); -void EnVali_Retaliate(EnVali* this, PlayState* play); -void EnVali_MoveArmsDown(EnVali* this, PlayState* play); -void EnVali_Burnt(EnVali* this, PlayState* play); -void EnVali_DivideAndDie(EnVali* this, PlayState* play); -void EnVali_Stunned(EnVali* this, PlayState* play); -void EnVali_Frozen(EnVali* this, PlayState* play); -void EnVali_ReturnToLurk(EnVali* this, PlayState* play); +void func_80B26878(EnVali* this); +void func_80B27098(EnVali* this, PlayState* play); +void func_80B270D8(EnVali* this, PlayState* play); +void func_80B2716C(EnVali* this, PlayState* play); +void func_80B27318(EnVali* this, PlayState* play); +void func_80B273D0(EnVali* this, PlayState* play); +void func_80B2742C(EnVali* this, PlayState* play); +void func_80B27464(EnVali* this, PlayState* play); +void func_80B274A0(EnVali* this, PlayState* play); +void func_80B27654(EnVali* this, PlayState* play); +void func_80B27710(EnVali* this, PlayState* play); +void func_80B278A0(EnVali* this, PlayState* play); ActorProfile En_Vali_Profile = { /**/ ACTOR_EN_VALI, @@ -55,7 +53,7 @@ ActorProfile En_Vali_Profile = { /**/ EnVali_Draw, }; -static ColliderQuadInit sQuadInit = { +static ColliderQuadInit D_80B288A0 = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_ENEMY, @@ -75,7 +73,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 } } }, }; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_80B288F0 = { { COL_MATERIAL_HIT8, AT_ON | AT_TYPE_ENEMY, @@ -95,84 +93,43 @@ static ColliderCylinderInit sCylinderInit = { { 17, 35, -15, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit sColChkInfoInit = { 2, 18, 32, MASS_HEAVY }; - -typedef enum BariDamageReaction { - /* 0x0 */ BARI_DMG_REACT_NONE, - /* 0x1 */ BARI_DMG_REACT_STUN, - /* 0x2 */ BARI_DMG_REACT_FIRE, - /* 0x3 */ BARI_DMG_REACT_ICE, - /* 0xE */ BARI_DMG_REACT_SLINGSHOT = 0xE, - /* 0xF */ BARI_DMG_REACT_SWORD -} BariDamageReaction; - -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, BARI_DMG_REACT_STUN), - /* Deku stick */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Slingshot */ DMG_ENTRY(0, BARI_DMG_REACT_SLINGSHOT), - /* Explosive */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(0, BARI_DMG_REACT_STUN), - /* Normal arrow */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Hookshot */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Kokiri sword */ DMG_ENTRY(1, BARI_DMG_REACT_SWORD), - /* Master sword */ DMG_ENTRY(2, BARI_DMG_REACT_SWORD), - /* Giant's Knife */ DMG_ENTRY(4, BARI_DMG_REACT_SWORD), - /* Fire arrow */ DMG_ENTRY(4, BARI_DMG_REACT_FIRE), - /* Ice arrow */ DMG_ENTRY(4, BARI_DMG_REACT_ICE), - /* Light arrow */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Unk arrow 1 */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Unk arrow 2 */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Unk arrow 3 */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Fire magic */ DMG_ENTRY(4, BARI_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(4, BARI_DMG_REACT_ICE), - /* Light magic */ DMG_ENTRY(0, BARI_DMG_REACT_NONE), - /* Shield */ DMG_ENTRY(0, BARI_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, BARI_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, BARI_DMG_REACT_NONE), - /* Giant spin */ DMG_ENTRY(4, BARI_DMG_REACT_NONE), - /* Master spin */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Kokiri jump */ DMG_ENTRY(2, BARI_DMG_REACT_NONE), - /* Giant jump */ DMG_ENTRY(8, BARI_DMG_REACT_NONE), - /* Master jump */ DMG_ENTRY(4, BARI_DMG_REACT_NONE), - /* Unknown 1 */ DMG_ENTRY(0, BARI_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, BARI_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, BARI_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, BARI_DMG_REACT_NONE), +static CollisionCheckInfoInit D_80B2891C = { 2, 0x12, 0x20, 0xFE }; +static DamageTable D_80B28924 = { + { + 0x10, 2, 0xE0, 2, 0x10, 2, 2, 2, 0xF1, 0xF2, 0xF4, 0x24, 0x34, 2, 2, 2, + 2, 0x24, 0x34, 0, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, + }, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80B28944[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BARI, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 5000, ICHAIN_STOP), }; +static Color_RGBA8 D_80B28950 = { 255, 255, 255, 255 }; +static Color_RGBA8 D_80B28954 = { 200, 255, 255, 255 }; void EnVali_Init(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; - s32 bgId; + s32 sp34; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(&this->actor, D_80B28944); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &gBariSkel, &gBariLurkingAnim, this->jointTable, this->morphTable, - VALI_LIMB_MAX); - - Collider_InitQuad(play, &this->leftArmCollider); - Collider_SetQuad(play, &this->leftArmCollider, &this->actor, &sQuadInit); - Collider_InitQuad(play, &this->rightArmCollider); - Collider_SetQuad(play, &this->rightArmCollider, &this->actor, &sQuadInit); - Collider_InitCylinder(play, &this->bodyCollider); - Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - - EnVali_SetupLurk(this); - + SkelAnime_Init(play, &this->unk14C, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->unk198, this->unk246, + 29); + Collider_InitQuad(play, &this->unk2FC); + Collider_SetQuad(play, &this->unk2FC, &this->actor, &D_80B288A0); + Collider_InitQuad(play, &this->unk37C); + Collider_SetQuad(play, &this->unk37C, &this->actor, &D_80B288A0); + Collider_InitCylinder(play, &this->unk3FC); + Collider_SetCylinder(play, &this->unk3FC, &this->actor, &D_80B288F0); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B28924, &D_80B2891C); + func_80B26878(this); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.floorHeight = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); - this->actor.params = BARI_TYPE_NORMAL; - + BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &sp34, &this->actor, &this->actor.world.pos); + this->actor.params = 0; if (this->actor.floorHeight == BGCHECK_Y_MIN) { Actor_Kill(&this->actor); } @@ -180,279 +137,300 @@ void EnVali_Init(Actor* thisx, PlayState* play) { void EnVali_Destroy(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; - - Collider_DestroyQuad(play, &this->leftArmCollider); - Collider_DestroyQuad(play, &this->rightArmCollider); - Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->unk2FC); + Collider_DestroyQuad(play, &this->unk37C); + Collider_DestroyCylinder(play, &this->unk3FC); } -void EnVali_SetupLurk(EnVali* this) { - Animation_PlayLoop(&this->skelAnime, &gBariLurkingAnim); +void func_80B26878(EnVali* this) { + Animation_PlayLoop(&this->unk14C, &object_vali_Anim_0014AC); this->actor.draw = NULL; - this->bodyCollider.base.acFlags &= ~AC_ON; - this->actionFunc = EnVali_Lurk; + this->unk3FC.base.acFlags &= ~AC_ON; + this->unk190 = func_80B27098; } -void EnVali_SetupDropAppear(EnVali* this) { +void func_80B268C8(EnVali* this) { this->actor.draw = EnVali_Draw; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; + this->unk190 = func_80B270D8; this->actor.velocity.y = 1.0f; - this->actionFunc = EnVali_DropAppear; } -void EnVali_SetupFloatIdle(EnVali* this) { - Animation_MorphToLoop(&this->skelAnime, &gBariWaitingAnim, -3.0f); - this->leftArmCollider.dim.quad[2] = this->leftArmCollider.dim.quad[3] = this->rightArmCollider.dim.quad[2] = - this->rightArmCollider.dim.quad[3] = this->leftArmCollider.dim.quad[0] = this->leftArmCollider.dim.quad[1] = - this->rightArmCollider.dim.quad[0] = this->rightArmCollider.dim.quad[1] = this->actor.world.pos; - - this->leftArmCollider.dim.quad[2].y = this->leftArmCollider.dim.quad[3].y = this->rightArmCollider.dim.quad[2].y = - this->rightArmCollider.dim.quad[3].y = this->leftArmCollider.dim.quad[0].y = - this->leftArmCollider.dim.quad[1].y = this->rightArmCollider.dim.quad[0].y = - this->rightArmCollider.dim.quad[1].y = this->actor.world.pos.y - 10.0f; - +void func_80B268FC(EnVali* this) { + Vec3f sp84; + Vec3f sp78; + Vec3f sp6C; + Vec3f sp60; + Vec3f sp54; + Vec3f sp48; + Vec3f sp3C; + f32 temp_fv0; + f32 temp_fv1; + s32 pad[6]; + + Animation_MorphToLoop(&this->unk14C, &object_vali_Anim_000710, -3.0f); + sp3C = this->actor.world.pos; + this->unk37C.dim.quad[1] = sp3C; + sp48 = sp3C; + this->unk37C.dim.quad[0] = sp48; + sp54 = sp48; + this->unk2FC.dim.quad[1] = sp54; + sp60 = sp54; + this->unk2FC.dim.quad[0] = sp60; + sp6C = sp60; + this->unk37C.dim.quad[3] = sp6C; + sp78 = sp6C; + this->unk37C.dim.quad[2] = sp78; + sp84 = sp78; + this->unk2FC.dim.quad[3] = sp84; + temp_fv1 = this->actor.world.pos.y; + temp_fv0 = temp_fv1 - 10.0f; + this->unk2FC.dim.quad[2] = sp84; + this->unk2FC.dim.quad[2].y = temp_fv0; + this->unk2FC.dim.quad[3].y = temp_fv0; + this->unk37C.dim.quad[2].y = temp_fv0; + this->unk37C.dim.quad[3].y = temp_fv0; + this->unk2FC.dim.quad[0].y = temp_fv0; + this->unk2FC.dim.quad[1].y = temp_fv0; + this->unk37C.dim.quad[0].y = temp_fv0; + this->unk37C.dim.quad[1].y = temp_fv0; this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->bodyCollider.base.acFlags |= AC_ON; - this->slingshotReactionTimer = 0; - this->floatHomeHeight = this->actor.world.pos.y; - this->actionFunc = EnVali_FloatIdle; + this->unk3FC.base.acFlags |= AC_ON; + this->unk195 = 0; + this->unk190 = func_80B2716C; + this->unk2F8 = temp_fv1; } -/** - * Used for both touching player/player's shield and being hit with sword. What to do next is determined by params. - */ -void EnVali_SetupAttacked(EnVali* this) { - this->lightningTimer = 20; +void func_80B26B18(EnVali* this) { + this->unk194 = 0x14; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->bodyCollider.base.acFlags &= ~AC_ON; - this->actionFunc = EnVali_Attacked; + this->unk3FC.base.acFlags &= ~AC_ON; + this->unk190 = func_80B27318; } -void EnVali_SetupRetaliate(EnVali* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gBariRetaliatingAnim, -5.0f); +void func_80B26B4C(EnVali* this) { + Animation_MorphToPlayOnce(&this->unk14C, &object_vali_Anim_000854, -5.0f); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); - this->actor.params = BARI_TYPE_NORMAL; - this->bodyCollider.base.acFlags &= ~AC_ON; - this->actionFunc = EnVali_Retaliate; + this->actor.params = 0; + this->unk3FC.base.acFlags &= ~AC_ON; + this->unk190 = func_80B273D0; } -void EnVali_SetupMoveArmsDown(EnVali* this) { - Animation_PlayOnce(&this->skelAnime, &gBariMovingArmsDownAnim); - this->actionFunc = EnVali_MoveArmsDown; +void func_80B26BBC(EnVali* this) { + Animation_PlayOnce(&this->unk14C, &object_vali_Anim_000B34); + this->unk190 = func_80B2742C; } -void EnVali_SetupBurnt(EnVali* this) { - this->timer = 2; - this->bodyCollider.base.acFlags &= ~AC_ON; +void func_80B26BF8(EnVali* this) { + this->unk196 = 2; + this->unk3FC.base.acFlags &= ~AC_ON; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); - this->actionFunc = EnVali_Burnt; + this->unk190 = func_80B27464; } -void EnVali_SetupDivideAndDie(EnVali* this, PlayState* play) { - s32 i; +void func_80B26C50(EnVali* this, PlayState* play) { + PosRot* temp_s1; + s32 var_s1; - for (i = 0; i < 3; i++) { + for (var_s1 = 0; var_s1 < 3; var_s1++) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BILI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); - - this->actor.world.rot.y += 0x10000 / 3; + this->actor.world.rot.y += 0x5555; } - - Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, + temp_s1 = &this->actor.world; + Item_DropCollectibleRandom(play, &this->actor, &temp_s1->pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); - this->timer = Rand_S16Offset(10, 10); - this->bodyCollider.base.acFlags &= ~AC_ON; - SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BARI_SPLIT); + this->unk196 = Rand_S16Offset(0xA, 0xA); + this->unk3FC.base.acFlags &= ~AC_ON; + SfxSource_PlaySfxAtFixedWorldPos(play, &temp_s1->pos, 40, NA_SE_EN_BARI_SPLIT); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.draw = NULL; - this->actionFunc = EnVali_DivideAndDie; + this->unk190 = func_80B274A0; } -void EnVali_SetupStunned(EnVali* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gBariWaitingAnim, 10.0f); - this->timer = 80; +void func_80B26D54(EnVali* this) { + Animation_MorphToPlayOnce(&this->unk14C, &object_vali_Anim_000710, 10.0f); + this->unk196 = 0x50; this->actor.velocity.y = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 80); - this->bodyCollider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; - Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); + this->unk3FC.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; + Actor_PlaySfx(&this->actor, 0x389EU); + this->unk190 = func_80B27654; this->actor.velocity.y = 1.0f; - this->actionFunc = EnVali_Stunned; } -void EnVali_SetupFrozen(EnVali* this) { +void func_80B26DE0(EnVali* this) { this->actor.velocity.y = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 36); - this->bodyCollider.base.acFlags &= ~AC_ON; - this->timer = 36; - this->actionFunc = EnVali_Frozen; + this->unk3FC.base.acFlags &= ~AC_ON; + this->unk196 = 0x24; + this->unk190 = func_80B27710; } -void EnVali_SetupReturnToLurk(EnVali* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gBariLurkingAnim, 10.0f); +void func_80B26E40(EnVali* this) { + Animation_MorphToPlayOnce(&this->unk14C, &object_vali_Anim_0014AC, 10.0f); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actionFunc = EnVali_ReturnToLurk; -} - -void EnVali_DischargeLightning(EnVali* this, PlayState* play) { - static Color_RGBA8 primColor = { 255, 255, 255, 255 }; - static Color_RGBA8 envColor = { 200, 255, 255, 255 }; - Vec3f pos; - s32 i; - f32 cos; - f32 sin; - s16 yaw; - - for (i = 0; i < 4; i++) { - cos = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); - sin = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); - if (!((this->lightningTimer + (i << 1)) % 4)) { - yaw = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; - pos.x = this->actor.world.pos.x + (Math_SinS(yaw) * 12.0f * cos); - pos.y = this->actor.world.pos.y - (Math_CosS(yaw) * 12.0f) + 10.0f; - pos.z = this->actor.world.pos.z + (Math_SinS(yaw) * 12.0f * sin); - - EffectSsLightning_Spawn(play, &pos, &primColor, &envColor, 17, yaw, 6, 2); + this->unk190 = func_80B278A0; +} + +void func_80B26E9C(EnVali* this, PlayState* play) { + Vec3f sp8C; + f32 temp_fs1; + f32 temp_fs2; + s32 var_s1; + s16 temp_v0; + + for (var_s1 = 0; var_s1 < 4; var_s1++) { + temp_fs1 = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + temp_fs2 = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + if (!((this->unk194 + (var_s1 << 1)) % 4)) { + temp_v0 = (s16)Rand_CenteredFloat(12288.0f) + (var_s1 * 0x4000) + 0x2000; + sp8C.x = this->actor.world.pos.x + (Math_SinS(temp_v0) * 12.0f * temp_fs1); + sp8C.y = this->actor.world.pos.y - (Math_CosS(temp_v0) * 12.0f) + 10.0f; + sp8C.z = this->actor.world.pos.z + (Math_SinS(temp_v0) * 12.0f * temp_fs2); + EffectSsLightning_Spawn(play, &sp8C, &D_80B28950, &D_80B28954, 17, temp_v0, 6, 2); } } - Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); } -void EnVali_Lurk(EnVali* this, PlayState* play) { +void func_80B27098(EnVali* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { - EnVali_SetupDropAppear(this); + func_80B268C8(this); } } -void EnVali_DropAppear(EnVali* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); +void func_80B270D8(EnVali* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); this->actor.velocity.y *= 1.5f; this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 40.0f); - if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); - EnVali_SetupFloatIdle(this); + func_80B268FC(this); } } -void EnVali_FloatIdle(EnVali* this, PlayState* play) { - s32 curFrame; - - SkelAnime_Update(&this->skelAnime); +void func_80B2716C(EnVali* this, PlayState* play) { + s32 var_v1; - if (this->slingshotReactionTimer != 0) { - this->slingshotReactionTimer--; + SkelAnime_Update(&this->unk14C); + if (this->unk195 != 0) { + this->unk195 -= 1; } - - curFrame = this->skelAnime.curFrame; - - Math_StepToF(&this->floatHomeHeight, this->actor.floorHeight + 40.0f, 1.2f); - this->actor.world.pos.y = this->floatHomeHeight - (sinf(curFrame * M_PI * 0.0125f) * 8.0f); - - if (this->slingshotReactionTimer) { + var_v1 = (s32)this->unk14C.curFrame; + Math_StepToF(&this->unk2F8, this->actor.floorHeight + 40.0f, 1.2f); + this->actor.world.pos.y = this->unk2F8 - (sinf(var_v1 * 3.1415927f * 0.0125f) * 8.0f); + if (this->unk195 != 0) { this->actor.shape.rot.y += 0x800; - - if (((this->slingshotReactionTimer % 6) == 0) && (curFrame > 15) && (curFrame <= 55)) { + if (((this->unk195 % 6) == 0) && (var_v1 >= 0x10) && (var_v1 < 0x38)) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_ROLL); } - } else if ((curFrame == 16) || (curFrame == 30) || (curFrame == 42) || (curFrame == 55)) { + } else if ((var_v1 == 0x10) || (var_v1 == 0x1E) || (var_v1 == 0x2A) || (var_v1 == 0x37)) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_ROLL); } - - curFrame = ((curFrame > 40) ? (80 - curFrame) : curFrame); - - this->actor.shape.rot.y += DEG_TO_BINANG((curFrame + 4) * 0.4f); + if (var_v1 >= 0x29) { + var_v1 = 0x50 - var_v1; + } + this->actor.shape.rot.y += DEG_TO_BINANG((var_v1 + 4) * 0.4f); if (this->actor.xzDistToPlayer > 250.0f) { - EnVali_SetupReturnToLurk(this); + func_80B26E40(this); } } -void EnVali_Attacked(EnVali* this, PlayState* play) { - if (this->lightningTimer != 0) { - this->lightningTimer--; +void func_80B27318(EnVali* this, PlayState* play) { + if (this->unk194 != 0) { + this->unk194 -= 1; } - - EnVali_DischargeLightning(this, play); - - if (this->lightningTimer == 0) { + func_80B26E9C(this, play); + if (this->unk194 == 0) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - this->bodyCollider.base.acFlags |= AC_ON; - if (this->actor.params == BARI_TYPE_SWORD_DAMAGE) { - EnVali_SetupRetaliate(this); + this->unk3FC.base.acFlags |= AC_ON; + if (this->actor.params == 1) { + func_80B26B4C(this); } else { - this->actionFunc = EnVali_FloatIdle; + this->unk190 = func_80B2716C; } - } else if ((this->lightningTimer % 2) != 0) { - this->actor.world.pos.y += 1.0f; } else { - this->actor.world.pos.y -= 1.0f; + if (this->unk194 & 1) { + this->actor.world.pos.y += 1.0f; + } else { + this->actor.world.pos.y -= 1.0f; + } } } -void EnVali_Retaliate(EnVali* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime)) { +void func_80B273D0(EnVali* this, PlayState* play) { + if (SkelAnime_Update(&this->unk14C)) { if (this->actor.colChkInfo.health != 0) { - EnVali_SetupMoveArmsDown(this); + func_80B26BBC(this); } else { - EnVali_SetupDivideAndDie(this, play); + func_80B26C50(this, play); } } } -void EnVali_MoveArmsDown(EnVali* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime)) { - EnVali_SetupFloatIdle(this); +void func_80B2742C(EnVali* this, PlayState* play) { + if (SkelAnime_Update(&this->unk14C)) { + func_80B268FC(this); } } -void EnVali_Burnt(EnVali* this, PlayState* play) { - if (this->timer != 0) { - this->timer--; +void func_80B27464(EnVali* this, PlayState* play) { + if (this->unk196 != 0) { + this->unk196 -= 1; } - - if (this->timer == 0) { - EnVali_SetupDivideAndDie(this, play); + if (this->unk196 == 0) { + func_80B26C50(this, play); } } -void EnVali_DivideAndDie(EnVali* this, PlayState* play) { - static Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - static Vec3f accel = { 0.0f, 0.0f, 0.0f }; - s16 scale; - Vec3f pos; - s32 i; +void func_80B274A0(EnVali* this, PlayState* play) { + static Vec3f D_80B28958 = { 0.0f, 0.0f, 0.0f }; + static Vec3f D_80B28964 = { 0.0f, 0.0f, 0.0f }; + s16 temp_s0; + Vec3f sp70; + s32 var_s1; - if (this->timer != 0) { - this->timer--; + if (this->unk196 != 0) { + this->unk196 -= 1; } - - for (i = 0; i < 2; i++) { - pos.x = this->actor.world.pos.x + Rand_CenteredFloat(20.0f); - pos.y = this->actor.world.pos.y + Rand_CenteredFloat(8.0f); - pos.z = this->actor.world.pos.z + Rand_CenteredFloat(20.0f); - velocity.y = (Rand_ZeroOne() + 1.0f); - scale = Rand_S16Offset(40, 40); - + for (var_s1 = 0; var_s1 < 2; var_s1++) { + sp70.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; + sp70.y = Rand_CenteredFloat(8.0f) + this->actor.world.pos.y; + sp70.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; + D_80B28958.y = Rand_ZeroOne() + 1.0f; + temp_s0 = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &sp70, &D_80B28958, &D_80B28964, temp_s0, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(play, &pos, &velocity, &accel, scale, 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &sp70, &D_80B28958, &D_80B28964, temp_s0, 25, 0, 1); } } - - if (this->timer == 0) { + if (this->unk196 == 0) { Actor_Kill(&this->actor); } } -void EnVali_Stunned(EnVali* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); +static Vec3f D_80B28970 = { 3000.0f, 0.0f, 0.0f }; +static Vec3f D_80B2897C = { -1000.0f, 0.0f, 0.0f }; +static Vec3f D_80B28988 = { 1.0f, 1.0f, 1.0f }; +static Gfx D_80B28998[] = { + gsDPSetCombineLERP(1, TEXEL0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, + PRIM_LOD_FRAC, COMBINED), + gsSPEndDisplayList(), +}; +static Gfx D_80B289A8[] = { + gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, + PRIM_LOD_FRAC, COMBINED), + gsSPEndDisplayList(), +}; - if (this->timer != 0) { - this->timer--; +void func_80B27654(EnVali* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); + if (this->unk196 != 0) { + this->unk196 -= 1; } - if (this->actor.velocity.y != 0.0f) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { this->actor.velocity.y = 0.0f; @@ -461,358 +439,310 @@ void EnVali_Stunned(EnVali* this, PlayState* play) { this->actor.velocity.y += 1.0f; } } - - if (this->timer == 0) { - this->bodyCollider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; - EnVali_SetupFloatIdle(this); + if (this->unk196 == 0) { + this->unk3FC.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; + func_80B268FC(this); } } -void EnVali_Frozen(EnVali* this, PlayState* play) { - Vec3f pos; - s32 temp_v0; +void func_80B27710(EnVali* this, PlayState* play) { + Vec3f sp54; + s32 temp_v0_2; s32 temp_v1; - if (this->timer != 0) { - this->timer--; + if (this->unk196 != 0) { + this->unk196 -= 1; } - - temp_v1 = this->timer - 20; + temp_v1 = this->unk196 - 0x14; this->actor.colorFilterTimer = 36; - if (temp_v1 > 0) { - temp_v0 = temp_v1 >> 1; - - if ((this->timer % 2) != 0) { - pos.y = this->actor.world.pos.y - 20.0f + (-temp_v0 * 5 + 40); - pos.x = this->actor.world.pos.x + ((temp_v0 & 2) ? 12.0f : -12.0f); - pos.z = this->actor.world.pos.z + ((temp_v0 & 1) ? 12.0f : -12.0f); - - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &pos, 150, 150, 150, 250, 235, 245, 255, + temp_v0_2 = temp_v1 >> 1; + if (this->unk196 & 1) { + sp54.y = (this->actor.world.pos.y - 20.0f) + ((-temp_v0_2 * 5) + 40); + sp54.x = this->actor.world.pos.x + ((temp_v0_2 & 2) ? 12.0f : -12.0f); + sp54.z = this->actor.world.pos.z + ((temp_v0_2 & 1) ? 12.0f : -12.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp54, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 1.3f); } - } else if (this->timer == 0) { + } else if (this->unk196 == 0) { this->actor.velocity.y += 1.0f; if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { - EnVali_SetupDivideAndDie(this, play); + func_80B26C50(this, play); this->actor.colorFilterTimer = 0; } } } -void EnVali_ReturnToLurk(EnVali* this, PlayState* play) { - SkelAnime_Update(&this->skelAnime); - +void func_80B278A0(EnVali* this, PlayState* play) { + SkelAnime_Update(&this->unk14C); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 15.0f, 0.1f) < 0.01f) { - EnVali_SetupLurk(this); + func_80B26878(this); } } -void EnVali_UpdateDamage(EnVali* this, PlayState* play) { - if (this->bodyCollider.base.acFlags & AC_HIT) { - this->bodyCollider.base.acFlags &= ~AC_HIT; - Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); - - if ((this->actor.colChkInfo.damageReaction != BARI_DMG_REACT_NONE) || (this->actor.colChkInfo.damage != 0)) { +void func_80B2790C(EnVali* this, PlayState* play) { + if ((this->unk3FC.base.acFlags & AC_HIT)) { + this->unk3FC.base.acFlags &= ~AC_HIT; + if (((Actor_SetDropFlag(&this->actor, &this->unk3FC.elem, true), + (this->actor.colChkInfo.damageReaction != 0)) || + (this->actor.colChkInfo.damage != 0))) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_DEAD); Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - } else if ((this->actor.colChkInfo.damageReaction != BARI_DMG_REACT_STUN) && - (this->actor.colChkInfo.damageReaction != BARI_DMG_REACT_SLINGSHOT)) { - Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_DAMAGE); + } else { + if ((this->actor.colChkInfo.damageReaction != 1) && (this->actor.colChkInfo.damageReaction != 0xE)) { + Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_DAMAGE); + } } - - if (this->actor.colChkInfo.damageReaction == BARI_DMG_REACT_STUN) { - if (this->actionFunc != EnVali_Stunned) { - EnVali_SetupStunned(this); + if (this->actor.colChkInfo.damageReaction == 1) { + if (this->unk190 != func_80B27654) { + func_80B26D54(this); } - } else if (this->actor.colChkInfo.damageReaction == BARI_DMG_REACT_SWORD) { - if (this->actionFunc != EnVali_Stunned) { - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); - this->actor.params = BARI_TYPE_SWORD_DAMAGE; - EnVali_SetupAttacked(this); + } else { + if (this->actor.colChkInfo.damageReaction == 0xF) { + if (this->unk190 != func_80B27654) { + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); + this->actor.params = 1; + func_80B26B18(this); + } else { + func_80B26B4C(this); + } + } else if (this->actor.colChkInfo.damageReaction == 2) { + func_80B26BF8(this); + } else if (this->actor.colChkInfo.damageReaction == 3) { + func_80B26DE0(this); + } else if (this->actor.colChkInfo.damageReaction == 0xE) { + if (this->unk195 == 0) { + this->unk195 = 0x14; + } } else { - EnVali_SetupRetaliate(this); - } - } else if (this->actor.colChkInfo.damageReaction == BARI_DMG_REACT_FIRE) { - EnVali_SetupBurnt(this); - } else if (this->actor.colChkInfo.damageReaction == BARI_DMG_REACT_ICE) { - EnVali_SetupFrozen(this); - } else if (this->actor.colChkInfo.damageReaction == BARI_DMG_REACT_SLINGSHOT) { - if (this->slingshotReactionTimer == 0) { - this->slingshotReactionTimer = 20; + func_80B26B4C(this); } - } else { - EnVali_SetupRetaliate(this); } } } } void EnVali_Update(Actor* thisx, PlayState* play) { - s32 pad; EnVali* this = (EnVali*)thisx; + s32 pad; - if ((this->bodyCollider.base.atFlags & AT_HIT) || (this->leftArmCollider.base.atFlags & AT_HIT) || - (this->rightArmCollider.base.atFlags & AT_HIT)) { - this->leftArmCollider.base.atFlags &= ~AT_HIT; - this->rightArmCollider.base.atFlags &= ~AT_HIT; - this->bodyCollider.base.atFlags &= ~AT_HIT; - EnVali_SetupAttacked(this); - } - - EnVali_UpdateDamage(this, play); - this->actionFunc(this, play); - - if ((this->actionFunc != EnVali_DivideAndDie) && (this->actionFunc != EnVali_Lurk)) { - Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - - if (this->actionFunc == EnVali_FloatIdle) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->leftArmCollider.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->rightArmCollider.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->bodyCollider.base); + if ((this->unk3FC.base.atFlags & AT_HIT) || (this->unk2FC.base.atFlags & AT_HIT) || + (this->unk37C.base.atFlags & AT_HIT)) { + this->unk2FC.base.atFlags &= ~AT_HIT; + this->unk37C.base.atFlags &= ~AT_HIT; + this->unk3FC.base.atFlags &= ~AT_HIT; + func_80B26B18(this); + } + func_80B2790C(this, play); + this->unk190(this, play); + if ((this->unk190 != func_80B274A0) && (this->unk190 != func_80B27098)) { + Collider_UpdateCylinder(&this->actor, &this->unk3FC); + if (this->unk190 == func_80B2716C) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk2FC.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk37C.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk3FC.base); } - - if (this->bodyCollider.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + if (this->unk3FC.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk3FC.base); } - - CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk3FC.base); Actor_SetFocus(&this->actor, 0.0f); } } -// Draw and associated functions +void func_80B27C1C(EnVali* this, f32 arg1, Vec3f* arg2) { + f32 temp_fv0; + f32 temp_fv0_2; + f32 temp_fv1; + s32 var_v0; -void EnVali_PulseOutside(EnVali* this, f32 curFrame, Vec3f* scale) { - f32 scaleChange; - s32 scalePhase; - - if (this->actionFunc == EnVali_Attacked) { - scalePhase = 20 - (this->lightningTimer % 20); - if (scalePhase >= 10) { - scalePhase -= 10; + if (this->unk190 == func_80B27318) { + var_v0 = 0x14 - (this->unk194 % 20); + if (var_v0 >= 0xA) { + var_v0 -= 0xA; } - - scale->y -= 0.2f * sinf((M_PI / 10) * scalePhase); - } else if (this->actionFunc == EnVali_Retaliate) { - scaleChange = sinf((M_PI / 10) * curFrame); - scale->y -= 0.24f * scaleChange; - scale->x -= 0.13f * scaleChange; - scale->z = scale->x; - } else if (this->actionFunc == EnVali_MoveArmsDown) { - scaleChange = cosf((M_PI / 50) * curFrame); - scale->y -= 0.24f * scaleChange; - scale->x -= 0.13f * scaleChange; - scale->z = scale->x; - } else if (this->actionFunc == EnVali_Stunned) { - scaleChange = sinf((M_PI / 10) * this->timer) * 0.08f; - scale->x += scaleChange; - scale->y -= scaleChange; - scale->z += scaleChange; + arg2->y -= 0.2f * sinf(var_v0 * 0.31415927f); + } else if (this->unk190 == func_80B273D0) { + temp_fv0 = sinf(0.31415927f * arg1); + arg2->y -= 0.24f * temp_fv0; + arg2->x -= 0.13f * temp_fv0; + arg2->z = arg2->x; + } else if (this->unk190 == func_80B2742C) { + temp_fv0_2 = cosf(0.06283186f * arg1); + arg2->y -= 0.24f * temp_fv0_2; + arg2->x -= 0.13f * temp_fv0_2; + arg2->z = arg2->x; + } else if (this->unk190 == func_80B27654) { + temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; + arg2->x += temp_fv1; + arg2->y -= temp_fv1; + arg2->z += temp_fv1; } else { - if (curFrame >= 40.0f) { - curFrame -= 40.0f; + if (arg1 >= 40.0f) { + arg1 -= 40.0f; } - - scale->y -= 0.2f * sinf((M_PI / 40) * curFrame); + arg2->y -= 0.2f * sinf(0.07853982f * arg1); } } -void EnVali_PulseInsides(EnVali* this, f32 curFrame, Vec3f* scale) { - f32 scaleChange; - s32 scalePhase; +void func_80B27E38(EnVali* this, f32 arg1, Vec3f* arg2) { + f32 temp_fv0; + f32 temp_fv0_2; + f32 temp_fv1; + s32 var_v0; - if (this->actionFunc == EnVali_Attacked) { - scalePhase = 20 - (this->lightningTimer % 20); - if (scalePhase >= 10) { - scalePhase -= 10; + if (this->unk190 == func_80B27318) { + var_v0 = 0x14 - (this->unk194 % 20); + if (var_v0 >= 0xA) { + var_v0 -= 0xA; } - - scale->y -= 0.13f * sinf((M_PI / 10) * scalePhase); - } else if (this->actionFunc == EnVali_Retaliate) { - scaleChange = sinf((M_PI / 10) * curFrame); - scale->y -= 0.18f * scaleChange; - scale->x -= 0.1f * scaleChange; - scale->z = scale->x; - } else if (this->actionFunc == EnVali_MoveArmsDown) { - scaleChange = cosf((M_PI / 50) * curFrame); - scale->y -= 0.18f * scaleChange; - scale->x -= 0.1f * scaleChange; - scale->z = scale->x; - } else if (this->actionFunc == EnVali_Stunned) { - scaleChange = sinf((M_PI / 10) * this->timer) * 0.08f; - scale->x -= scaleChange; - scale->y += scaleChange; - scale->z -= scaleChange; + arg2->y -= 0.13f * sinf(var_v0 * 0.31415927f); + } else if (this->unk190 == func_80B273D0) { + temp_fv0 = sinf(0.31415927f * arg1); + arg2->y -= 0.18f * temp_fv0; + arg2->x -= 0.1f * temp_fv0; + arg2->z = arg2->x; + } else if (this->unk190 == func_80B2742C) { + temp_fv0_2 = cosf(0.06283186f * arg1); + arg2->y -= 0.18f * temp_fv0_2; + arg2->x -= 0.1f * temp_fv0_2; + arg2->z = arg2->x; + } else if (this->unk190 == func_80B27654) { + temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; + arg2->x -= temp_fv1; + arg2->y += temp_fv1; + arg2->z -= temp_fv1; } else { - if (curFrame >= 40.0f) { - curFrame -= 40.0f; + if (arg1 >= 40.0f) { + arg1 -= 40.0f; } - - scale->y -= 0.13f * sinf((M_PI / 40) * curFrame); + arg2->y -= 0.13f * sinf(0.07853982f * arg1); } } -s32 EnVali_SetArmLength(EnVali* this, f32 curFrame) { - f32 targetArmScale; +s32 func_80B28054(EnVali* this, f32 arg1) { + f32 var_fv1; - if (this->actionFunc == EnVali_FloatIdle) { - if (curFrame <= 10.0f) { - targetArmScale = curFrame * 0.05f + 1.0f; - } else if (curFrame > 70.0f) { - targetArmScale = (80.0f - curFrame) * 0.05f + 1.0f; + if (this->unk190 == func_80B2716C) { + if (arg1 <= 10.0f) { + var_fv1 = (arg1 * 0.05f) + 1.0f; + } else if (arg1 > 70.0f) { + var_fv1 = ((80.0f - arg1) * 0.05f) + 1.0f; } else { - targetArmScale = 1.5f; + var_fv1 = 1.5f; } - } else if (this->actionFunc == EnVali_Retaliate) { - targetArmScale = 1.0f - sinf((M_PI / 10) * curFrame) * 0.35f; - } else if (this->actionFunc == EnVali_MoveArmsDown) { - targetArmScale = 1.0f - cosf((M_PI / 50) * curFrame) * 0.35f; - } else if ((this->actionFunc == EnVali_Attacked) || (this->actionFunc == EnVali_Frozen)) { - targetArmScale = this->armScale; + } else if (this->unk190 == func_80B273D0) { + var_fv1 = 1.0f - (sinf(0.31415927f * arg1) * 0.35f); + } else if (this->unk190 == func_80B2742C) { + var_fv1 = 1.0f - (cosf(0.06283186f * arg1) * 0.35f); + } else if ((this->unk190 == func_80B27318) || (this->unk190 == func_80B27710)) { + var_fv1 = this->unk2F4; } else { - targetArmScale = 1.0f; + var_fv1 = 1.0f; } - - Math_StepToF(&this->armScale, targetArmScale, 0.1f); - - if (this->armScale == 1.0f) { - return false; + Math_StepToF(&this->unk2F4, var_fv1, 0.1f); + if (this->unk2F4 == 1.0f) { + return 0; } else { - return true; + return 1; } } -s32 EnVali_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, - Gfx** gfx) { - EnVali* this = (EnVali*)thisx; - f32 curFrame; +s32 func_80B281F0(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx) { + EnVali* this = thisx; + f32 new_var; - if ((limbIndex == VALI_LIMB_NUCLEUS) || (limbIndex == VALI_LIMB_OUTER_HOOD) || - (limbIndex == VALI_LIMB_INNER_HOOD)) { - *dList = NULL; - return false; + if ((arg1 == 2) || (arg1 == 0x1C) || (arg1 == 0x1B)) { + *arg2 = NULL; + return 0; } else { - curFrame = this->skelAnime.curFrame; - - if ((limbIndex == VALI_LIMB_LEFT_ARM_BASE) || (limbIndex == VALI_LIMB_RIGHT_ARM_BASE)) { - if (EnVali_SetArmLength(this, curFrame)) { - Matrix_Scale(this->armScale, 1.0f, 1.0f, MTXMODE_APPLY); - } + new_var = this->unk14C.curFrame; + if (((arg1 == 9) || (arg1 == 0x12)) && (func_80B28054(this, new_var) != 0)) { + Matrix_Scale(this->unk2F4, 1.0f, 1.0f, MTXMODE_APPLY); } - - return false; + return 0; } } -void EnVali_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { - static Vec3f D_80B28970 = { 3000.0f, 0.0f, 0.0f }; - static Vec3f D_80B2897C = { -1000.0f, 0.0f, 0.0f }; +void func_80B28280(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx, Gfx** gfx) { Vec3f sp3C; Vec3f sp30; - EnVali* this = (EnVali*)thisx; - - if (this->actionFunc == EnVali_FloatIdle) { - if ((limbIndex == VALI_LIMB_LEFT_FOREARM_BASE) || (limbIndex == VALI_LIMB_RIGHT_FOREARM_BASE)) { - Matrix_MultVec3f(&D_80B28970, &sp3C); - Matrix_MultVec3f(&D_80B2897C, &sp30); - - if (limbIndex == VALI_LIMB_LEFT_FOREARM_BASE) { - Collider_SetQuadVertices(&this->leftArmCollider, &sp30, &sp3C, &this->leftArmCollider.dim.quad[0], - &this->leftArmCollider.dim.quad[1]); - } else { - Collider_SetQuadVertices(&this->rightArmCollider, &sp30, &sp3C, &this->rightArmCollider.dim.quad[0], - &this->rightArmCollider.dim.quad[1]); - } + EnVali* this = thisx; + + if (this->unk190 == func_80B2716C) { + switch (arg1) { + case 0xB: + case 0x14: + Matrix_MultVec3f(&D_80B28970, &sp3C); + Matrix_MultVec3f(&D_80B2897C, &sp30); + if (arg1 == 0xB) { + Collider_SetQuadVertices(&this->unk2FC, &sp30, &sp3C, this->unk2FC.dim.quad, + &this->unk2FC.dim.quad[1]); + } else { + Collider_SetQuadVertices(&this->unk37C, &sp30, &sp3C, this->unk37C.dim.quad, + &this->unk37C.dim.quad[1]); + } + break; } } } -void EnVali_DrawBody(EnVali* this, PlayState* play) { - MtxF mtx; - f32 cos; - f32 sin; - f32 curFrame; - Vec3f scale = { 1.0f, 1.0f, 1.0f }; +void func_80B28344(EnVali* this, PlayState* play) { + MtxF sp80; + f32 sp7C; + f32 sp78; + f32 sp74; + Vec3f sp68; + sp68 = D_80B28988; OPEN_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1428); - - Matrix_Get(&mtx); - curFrame = this->skelAnime.curFrame; - EnVali_PulseInsides(this, curFrame, &scale); - Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); - + Matrix_Get(&sp80); + sp74 = this->unk14C.curFrame; + func_80B27E38(this, sp74, &sp68); + Matrix_Scale(sp68.x, sp68.y, sp68.z, 1U); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1436); - gSPDisplayList(POLY_XLU_DISP++, gBariInnerHoodDL); - - Matrix_Put(&mtx); + gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002610); + Matrix_Put(&sp80); Matrix_RotateY(BINANG_TO_RAD(-this->actor.shape.rot.y), MTXMODE_APPLY); - - cos = Math_CosS(this->actor.shape.rot.y); - sin = Math_SinS(this->actor.shape.rot.y); - + sp7C = Math_CosS(this->actor.shape.rot.y); + sp78 = Math_SinS(this->actor.shape.rot.y); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1446); - gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); - - Matrix_Translate((506.0f * cos) + (372.0f * sin), 1114.0f, (372.0f * cos) - (506.0f * sin), MTXMODE_APPLY); - + gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002740); + Matrix_Translate((506.0f * sp7C) + (372.0f * sp78), 1114.0f, (372.0f * sp7C) - (506.0f * sp78), MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1455); - gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); - - Matrix_Translate((-964.0f * cos) - (804.0f * sin), -108.0f, (-804.0f * cos) + (964.0f * sin), MTXMODE_APPLY); - + gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002740); + Matrix_Translate((-964.0f * sp7C) - (804.0f * sp78), -108.0f, (-804.0f * sp7C) + (964.0f * sp78), MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1463); - gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); - - Matrix_Put(&mtx); - - scale.x = scale.y = scale.z = 1.0f; - - EnVali_PulseOutside(this, curFrame, &scale); - Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); - + gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002740); + Matrix_Put(&sp80); + sp68.z = 1.0f; + sp68.y = 1.0f; + sp68.x = 1.0f; + func_80B27C1C(this, sp74, &sp68); + Matrix_Scale(sp68.x, sp68.y, sp68.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1471); - gSPDisplayList(POLY_XLU_DISP++, gBariOuterHoodDL); - - Matrix_Put(&mtx); - + gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_0027D8); + Matrix_Put(&sp80); CLOSE_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1477); } -static Gfx D_80B28998[] = { - gsDPSetCombineLERP(1, TEXEL0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, - PRIM_LOD_FRAC, COMBINED), - gsSPEndDisplayList(), -}; - -static Gfx D_80B289A8[] = { - gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, - PRIM_LOD_FRAC, COMBINED), - gsSPEndDisplayList(), -}; - void EnVali_Draw(Actor* thisx, PlayState* play) { - s32 pad; EnVali* this = (EnVali*)thisx; + s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1505); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - - gSPSegment(POLY_XLU_DISP++, 0x08, - Gfx_TexScroll(play->state.gfxCtx, 0, (127 - (play->gameplayFrames * 12)) % 128, 32, 32)); - - if ((this->lightningTimer % 2) != 0) { - gSPSegment(POLY_XLU_DISP++, 0x09, D_80B28998); + gSPSegment(POLY_XLU_DISP++, 8, + Gfx_TexScroll(play->state.gfxCtx, 0U, (0x7F - (play->gameplayFrames * 0xC)) & 0x7F, 32, 32)); + if (this->unk194 & 1) { + gSPSegment(POLY_XLU_DISP++, 9, D_80B28998); } else { - gSPSegment(POLY_XLU_DISP++, 0x09, D_80B289A8); + gSPSegment(POLY_XLU_DISP++, 9, D_80B289A8); } - - EnVali_DrawBody(this, play); - - POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVali_OverrideLimbDraw, - EnVali_PostLimbDraw, this, POLY_XLU_DISP); - + func_80B28344(this, play); + POLY_XLU_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80B281F0, func_80B28280, + this, POLY_XLU_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1538); } 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 3659882f61d..b53ecdecaf8 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -3,31 +3,23 @@ #include "ultra64.h" #include "actor.h" -#include "assets/objects/object_vali/object_vali.h" struct EnVali; -typedef void (*EnValiActionFunc)(struct EnVali*, struct PlayState*); - typedef struct EnVali { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ EnValiActionFunc actionFunc; - /* 0x0194 */ u8 lightningTimer; - /* 0x0195 */ u8 slingshotReactionTimer; - /* 0x0196 */ s16 timer; - /* 0x0198 */ Vec3s jointTable[VALI_LIMB_MAX]; - /* 0x0246 */ Vec3s morphTable[VALI_LIMB_MAX]; - /* 0x02F4 */ f32 armScale; - /* 0x02F8 */ f32 floatHomeHeight; // Used as a centre for floating when visible (home is used for the lurk height) - /* 0x02FC */ ColliderQuad leftArmCollider; - /* 0x037C */ ColliderQuad rightArmCollider; - /* 0x03FC */ ColliderCylinder bodyCollider; -} EnVali; // size = 0x0448 - -typedef enum EnValiType { - /* 0 */ BARI_TYPE_NORMAL, - /* 1 */ BARI_TYPE_SWORD_DAMAGE -} EnValiType; + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ void (*unk190)(struct EnVali*, struct PlayState*); + /* 0x194 */ u8 unk194; + /* 0x195 */ u8 unk195; + /* 0x196 */ s16 unk196; + /* 0x198 */ Vec3s unk198[29]; + /* 0x246 */ Vec3s unk246[29]; + /* 0x2F4 */ f32 unk2F4; + /* 0x2F8 */ f32 unk2F8; + /* 0x2FC */ ColliderQuad unk2FC; + /* 0x37C */ ColliderQuad unk37C; + /* 0x3FC */ ColliderCylinder unk3FC; +} EnVali; // size = 0x448 #endif 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 2244575349d..3b5b9c971a5 100644 --- a/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c +++ b/src/overlays/actors/ovl_En_Viewer/z_en_viewer.c @@ -580,7 +580,7 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { if (type == ENVIEWER_TYPE_9_GANONDORF) { SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, - this->skin.skelAnime.dListCount, NULL, EnViewer_Ganondorf9PostLimbDraw, this); + this->skin.skelAnime.dListCount, 0, EnViewer_Ganondorf9PostLimbDraw, this); } else if (type == ENVIEWER_TYPE_3_GANONDORF) { SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, this->skin.skelAnime.dListCount, EnViewer_Ganondorf3OverrideLimbDraw, @@ -590,12 +590,12 @@ void EnViewer_DrawGanondorf(EnViewer* this, PlayState* play) { type == ENVIEWER_TYPE_7_GANONDORF || type == ENVIEWER_TYPE_8_GANONDORF) { if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[1] != NULL)) { SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, - this->skin.skelAnime.dListCount, NULL, EnViewer_GanondorfPostLimbDrawUpdateCapeVec, + this->skin.skelAnime.dListCount, 0, EnViewer_GanondorfPostLimbDrawUpdateCapeVec, this); EnViewer_UpdateGanondorfCape(play, this); } } else { - SkelAnime_DrawOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, NULL, NULL, this); + SkelAnime_DrawOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, NULL, 0, this); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1511); } @@ -702,7 +702,7 @@ void EnViewer_DrawImpa(EnViewer* this, PlayState* play) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); SkelAnime_DrawFlexOpa(play, this->skin.skelAnime.skeleton, this->skin.skelAnime.jointTable, - this->skin.skelAnime.dListCount, EnViewer_ImpaOverrideLimbDraw, NULL, this); + this->skin.skelAnime.dListCount, EnViewer_ImpaOverrideLimbDraw, 0, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_viewer.c", 1740); } diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index cda2c07dc04..df230fdee72 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -1,21 +1,19 @@ /* * File: z_en_wall_tubo.c * Overlay: ovl_En_Wall_Tubo - * Description: Bombchu Bowling Alley Bullseyes/Pits + * Description: Bombchu Bowling Alley Wall 2 */ #include "z_en_wall_tubo.h" -#include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" #include "overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h" -#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h" +#include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" +#include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" #include "rand.h" #include "regs.h" #include "sfx.h" #include "printf.h" #include "quake.h" -#include "terminal.h" -#include "translation.h" #include "z_lib.h" #include "debug_display.h" #include "effect.h" @@ -27,9 +25,9 @@ void EnWallTubo_Init(Actor* thisx, PlayState* play); void EnWallTubo_Destroy(Actor* thisx, PlayState* play); void EnWallTubo_Update(Actor* thisx, PlayState* play); -void EnWallTubo_FindGirl(EnWallTubo* this, PlayState* play); -void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play); -void EnWallTubo_SetWallFall(EnWallTubo* this, PlayState* play); +void func_80B2EE5C(EnWallTubo* this, PlayState* play); +void func_80B2EE9C(EnWallTubo* this, PlayState* play); +void func_80B2F0B8(EnWallTubo* this, PlayState* play); ActorProfile En_Wall_Tubo_Profile = { /**/ ACTOR_EN_WALL_TUBO, @@ -42,107 +40,106 @@ ActorProfile En_Wall_Tubo_Profile = { /**/ EnWallTubo_Update, /**/ NULL, }; +Vec3f D_80B2F340 = { 0.0f, 0.1f, 0.0f }; +Vec3f D_80B2F34C = { 0.0f, 0.0f, 0.0f }; +Vec3f D_80B2F358 = { 0.0f, 0.1f, 0.0f }; +Vec3f D_80B2F364 = { 0.0f, 0.0f, 0.0f }; void EnWallTubo_Init(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; PRINTF("\n\n"); - PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ 壁のツボ ☆☆☆☆☆ \n", "☆☆☆☆☆ Points on the wall ☆☆☆☆☆ \n") VT_RST); - this->unk_164 = this->actor.world.pos; - this->actionFunc = EnWallTubo_FindGirl; + PRINTF("\x1b[33m☆☆☆☆☆ 壁のツボ ☆☆☆☆☆ \n\x1b[m"); + this->unk164 = this->actor.world.pos; + this->unk14C = func_80B2EE5C; } void EnWallTubo_Destroy(Actor* thisx, PlayState* play) { } -void EnWallTubo_FindGirl(EnWallTubo* this, PlayState* play) { - Actor* lookForGirl; - - lookForGirl = play->actorCtx.actorLists[ACTORCAT_NPC].head; +void func_80B2EE5C(EnWallTubo* this, PlayState* play) { + Actor* var_v0; - while (lookForGirl != NULL) { - if (lookForGirl->id != ACTOR_EN_BOM_BOWL_MAN) { - lookForGirl = lookForGirl->next; - } else { - this->chuGirl = (EnBomBowlMan*)lookForGirl; - break; + var_v0 = play->actorCtx.actorLists[4].head; + while (var_v0 != NULL) { + if (var_v0->id != ACTOR_EN_BOM_BOWL_MAN) { + var_v0 = var_v0->next; + continue; } + this->unk160 = (EnBomBowlMan*)var_v0; + break; } - - this->actionFunc = EnWallTubo_DetectChu; + this->unk14C = func_80B2EE9C; } -void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play) { - EnBomChu* chu; - s32 pad; - Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; - Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; - Vec3f chuPosDiff; - s16 quakeIndex; - - if (this->chuGirl->minigamePlayStatus != 0) { - if (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { - chu = (EnBomChu*)play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; - - while (chu != NULL) { - if ((&chu->actor == &this->actor) || (chu->actor.id != ACTOR_EN_BOM_CHU)) { - chu = (EnBomChu*)chu->actor.next; - continue; - } - - chuPosDiff.x = chu->actor.world.pos.x - this->actor.world.pos.x; - chuPosDiff.y = chu->actor.world.pos.y - this->actor.world.pos.y; - chuPosDiff.z = chu->actor.world.pos.z - this->actor.world.pos.z; - - if (((fabsf(chuPosDiff.x) < 40.0f) || (BREG(2))) && ((fabsf(chuPosDiff.y) < 40.0f) || (BREG(2))) && - (fabsf(chuPosDiff.z) < 40.0f || (BREG(2)))) { - this->chuGirl->wallStatus[this->actor.params] = 1; - chu->timer = 2; - Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); - this->timer = 60; - EffectSsBomb2_SpawnLayered(play, &this->explosionCenter, &effVelocity, &effAccel, 200, 40); - quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); - Quake_SetSpeed(quakeIndex, 0x7FFF); - Quake_SetPerturbations(quakeIndex, 100, 0, 0, 0); - Quake_SetDuration(quakeIndex, 100); - this->actionFunc = EnWallTubo_SetWallFall; - break; - } - - chu = (EnBomChu*)chu->actor.next; +void func_80B2EE9C(EnWallTubo* this, PlayState* play) { + Actor* var_v0; + Actor* thisx = &this->actor; + Vec3f sp4C; + Vec3f sp40; + Vec3f diff; + s16 sp32; + s16 temp_v0; + + sp4C = D_80B2F340; + sp40 = D_80B2F34C; + if ((this->unk160->unk_258 != 0) && (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING)) { + var_v0 = play->actorCtx.actorLists[3].head; + while (var_v0 != NULL) { + if ((var_v0 == thisx) || (var_v0->id != ACTOR_EN_BOM_CHU)) { + var_v0 = var_v0->next; + continue; + } + diff.x = var_v0->world.pos.x - this->actor.world.pos.x; + diff.y = var_v0->world.pos.y - this->actor.world.pos.y; + diff.z = var_v0->world.pos.z - this->actor.world.pos.z; + if (((fabsf(diff.x) < 40.0f) || (gRegEditor->data[0x962] != 0)) && + ((fabsf(diff.y) < 40.0f) || (gRegEditor->data[0x962] != 0)) && + ((fabsf(diff.z) < 40.0f) || (gRegEditor->data[0x962] != 0))) { + this->unk160->unk23E_arr[this->actor.params] = 1; + ((EnBomChu*)var_v0)->timer = 2; + Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); + this->unk150 = 0x3C; + EffectSsBomb2_SpawnLayered(play, &this->unk154, &sp40, &sp4C, 200, 40); + temp_v0 = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_1); + sp32 = temp_v0; + Quake_SetSpeed(temp_v0, 0x7FFF); + Quake_SetPerturbations(sp32, 0x64, 0, 0, 0); + Quake_SetDuration(sp32, 0x64); + this->unk14C = func_80B2F0B8; + return; } + var_v0 = var_v0->next; } } } -void EnWallTubo_SetWallFall(EnWallTubo* this, PlayState* play) { - BgBowlWall* wall; - Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; - Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; - Vec3f effPos; - - if ((play->gameplayFrames & 1) == 0) { - effPos.x = this->explosionCenter.x + Rand_CenteredFloat(300.0f); - effPos.y = this->explosionCenter.y + Rand_CenteredFloat(300.0f); - effPos.z = this->explosionCenter.z; - EffectSsBomb2_SpawnLayered(play, &effPos, &effVelocity, &effAccel, 100, 30); - EffectSsHahen_SpawnBurst(play, &effPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); - Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); +void func_80B2F0B8(EnWallTubo* this, PlayState* play) { + Actor* temp_v0; + Vec3f sp50; + Vec3f sp44; + Vec3f sp38; + + sp50 = D_80B2F358; + sp44 = D_80B2F364; + if (!(play->gameplayFrames & 1)) { + sp38.x = Rand_CenteredFloat(300.0f) + this->unk154.x; + sp38.y = Rand_CenteredFloat(300.0f) + this->unk154.y; + sp38.z = this->unk154.z; + EffectSsBomb2_SpawnLayered(play, &sp38, &sp44, &sp50, 100, 30); + EffectSsHahen_SpawnBurst(play, &sp38, 10.0f, 0, 50, 15, 3, -1, 10, NULL); + Actor_PlaySfx(&this->actor, 0x180EU); } - - if (this->timer == 0) { - wall = (BgBowlWall*)this->actor.parent; - - if ((wall != NULL) && (wall->dyna.actor.update != NULL)) { - wall->isHit = true; - // "Hara" may stand for the developer name Kuzuhara - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆ やった原! ☆☆☆☆☆ \n", "☆☆☆☆ I did it! -Hara ☆☆☆☆☆ \n") VT_RST); - PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆ やった原! ☆☆☆☆☆ \n", "☆☆☆☆ I did it! -Hara ☆☆☆☆☆ \n") VT_RST); - PRINTF(VT_FGCOL(BLUE) T("☆☆☆☆ やった原! ☆☆☆☆☆ \n", "☆☆☆☆ I did it! -Hara ☆☆☆☆☆ \n") VT_RST); - PRINTF(VT_FGCOL(MAGENTA) T("☆☆☆☆ やった原! ☆☆☆☆☆ \n", "☆☆☆☆ I did it! -Hara ☆☆☆☆☆ \n") VT_RST); - PRINTF(VT_FGCOL(CYAN) T("☆☆☆☆ やった原! ☆☆☆☆☆ \n", "☆☆☆☆ I did it! -Hara ☆☆☆☆☆ \n") VT_RST); + if (this->unk150 == 0) { + temp_v0 = this->actor.parent; + if ((temp_v0 != NULL) && (temp_v0->update != NULL)) { + ((BgBowlWall*)temp_v0)->unk180 = 1; + PRINTF("\x1b[32m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); + PRINTF("\x1b[33m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); + PRINTF("\x1b[34m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); + PRINTF("\x1b[35m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); + PRINTF("\x1b[36m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); } - Actor_Kill(&this->actor); } } @@ -150,13 +147,11 @@ void EnWallTubo_SetWallFall(EnWallTubo* this, PlayState* play) { void EnWallTubo_Update(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; - if (this->timer != 0) { - this->timer--; + if (this->unk150 != 0) { + this->unk150--; } - - this->actionFunc(this, play); - - if (DEBUG_FEATURES && BREG(0) != 0) { + this->unk14C(this, play); + if (DEBUG_FEATURES && gRegEditor->data[0x960] != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h index 5cbbb878e73..05005234ed5 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h @@ -3,19 +3,19 @@ #include "ultra64.h" #include "actor.h" -#include "overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h" struct EnWallTubo; typedef void (*EnWallTuboActionFunc)(struct EnWallTubo*, struct PlayState*); typedef struct EnWallTubo { - /* 0x0000 */ Actor actor; - /* 0x014C */ EnWallTuboActionFunc actionFunc; - /* 0x0150 */ s16 timer; - /* 0x0154 */ Vec3f explosionCenter; - /* 0x0160 */ EnBomBowlMan* chuGirl; - /* 0x0164 */ Vec3f unk_164; + /* 0x000 */ Actor actor; + /* 0x14C */ EnWallTuboActionFunc unk14C; + /* 0x150 */ s16 unk150; + /* 0x152 */ char pad152[2]; + /* 0x154 */ Vec3f unk154; + /* 0x160 */ struct EnBomBowlMan* unk160; + /* 0x164 */ Vec3f unk164; } EnWallTubo; // size = 0x0170 #endif 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 fbae4f022b1..35f99b7b877 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -1,11 +1,10 @@ /* * File: z_en_wf.c * Overlay: ovl_En_Wf - * Description: Wolfos (Normal and White) + * Description: Wolfos */ #include "z_en_wf.h" -#include "overlays/actors/ovl_En_Encount1/z_en_encount1.h" #include "libc64/qrand.h" #include "array_count.h" @@ -18,8 +17,6 @@ #include "sequence.h" #include "sfx.h" #include "sys_matrix.h" -#include "terminal.h" -#include "translation.h" #include "z_en_item00.h" #include "z_lib.h" #include "audio.h" @@ -27,8 +24,6 @@ #include "play_state.h" #include "player.h" -#include "assets/objects/object_wf/object_wf.h" - #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) void EnWf_Init(Actor* thisx, PlayState* play); @@ -36,34 +31,45 @@ void EnWf_Destroy(Actor* thisx, PlayState* play); void EnWf_Update(Actor* thisx, PlayState* play); void EnWf_Draw(Actor* thisx, PlayState* play); -void EnWf_SetupWaitToAppear(EnWf* this); -void EnWf_WaitToAppear(EnWf* this, PlayState* play); -void EnWf_SetupWait(EnWf* this); -void EnWf_Wait(EnWf* this, PlayState* play); -void EnWf_SetupRunAtPlayer(EnWf* this, PlayState* play); -void EnWf_RunAtPlayer(EnWf* this, PlayState* play); -void EnWf_SetupSearchForPlayer(EnWf* this); -void EnWf_SearchForPlayer(EnWf* this, PlayState* play); -void EnWf_SetupRunAroundPlayer(EnWf* this); -void EnWf_RunAroundPlayer(EnWf* this, PlayState* play); -void EnWf_SetupSlash(EnWf* this); -void EnWf_Slash(EnWf* this, PlayState* play); -void EnWf_RecoilFromBlockedSlash(EnWf* this, PlayState* play); -void EnWf_SetupBackflipAway(EnWf* this); -void EnWf_BackflipAway(EnWf* this, PlayState* play); -void EnWf_Stunned(EnWf* this, PlayState* play); -void EnWf_Damaged(EnWf* this, PlayState* play); -void EnWf_SetupSomersaultAndAttack(EnWf* this); -void EnWf_SomersaultAndAttack(EnWf* this, PlayState* play); -void EnWf_SetupBlocking(EnWf* this); -void EnWf_Blocking(EnWf* this, PlayState* play); -void EnWf_SetupSidestep(EnWf* this, PlayState* play); -void EnWf_Sidestep(EnWf* this, PlayState* play); -void EnWf_SetupDie(EnWf* this); -void EnWf_Die(EnWf* this, PlayState* play); -s32 EnWf_DodgeRanged(PlayState* play, EnWf* this); - -static ColliderJntSphElementInit sJntSphElementsInit[] = { +void func_80B34380(EnWf* this); +void func_80B34428(EnWf* this, PlayState* play); +void func_80B3455C(EnWf* this); +void func_80B345E4(EnWf* this, PlayState* play); +void func_80B347FC(EnWf* this, PlayState* play); +void func_80B3487C(EnWf* this, PlayState* play); +void func_80B34CFC(EnWf* this); +void func_80B34D48(EnWf* this, PlayState* play); +void func_80B34F28(EnWf* this); +void func_80B35024(EnWf* this, PlayState* play); +void func_80B35540(EnWf* this); +void func_80B355BC(EnWf* this, PlayState* play); +void func_80B359A8(EnWf* this, PlayState* play); +void func_80B35B94(EnWf* this); +void func_80B35C10(EnWf* this, PlayState* play); +void func_80B35D90(EnWf* this, PlayState* play); +void func_80B35EE4(EnWf* this, PlayState* play); +void func_80B360E8(EnWf* this); +void func_80B361A0(EnWf* this, PlayState* play); +void func_80B36288(EnWf* this); +void func_80B36328(EnWf* this, PlayState* play); +void func_80B365A8(EnWf* this, PlayState* play); +void func_80B36740(EnWf* this, PlayState* play); +void func_80B36C8C(EnWf* this); +void func_80B36D3C(EnWf* this, PlayState* play); +s32 func_80B37830(PlayState* play, EnWf* this); + +extern FlexSkeletonHeader D_6003BC0; +extern AnimationHeader D_6004638; +extern AnimationHeader D_6004AD0; +extern AnimationHeader D_6004CA4; +extern AnimationHeader D_6005430; +extern AnimationHeader D_60057A0; +extern FlexSkeletonHeader D_6009690; +extern AnimationHeader D_60098C8; +extern AnimationHeader D_6009B20; +extern AnimationHeader D_600A4AC; + +static ColliderJntSphElementInit D_80B37990[4] = { { { ELEM_MATERIAL_UNK0, @@ -73,7 +79,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_NONE, OCELEM_NONE, }, - { WOLFOS_LIMB_FRONT_RIGHT_CLAW, { { 0, 0, 0 }, 15 }, 100 }, + { 15, { { 0, 0, 0 }, 15 }, 100 }, }, { { @@ -84,7 +90,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_NONE, OCELEM_NONE, }, - { WOLFOS_LIMB_FRONT_LEFT_CLAW, { { 0, 0, 0 }, 15 }, 100 }, + { 21, { { 0, 0, 0 }, 15 }, 100 }, }, { { @@ -95,7 +101,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, - { WOLFOS_LIMB_HEAD, { { 800, 0, 0 }, 25 }, 100 }, + { 17, { { 800, 0, 0 }, 25 }, 100 }, }, { { @@ -106,11 +112,11 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, - { WOLFOS_LIMB_THORAX, { { 0, 0, 0 }, 30 }, 100 }, + { 12, { { 0, 0, 0 }, 30 }, 100 }, }, }; -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit D_80B37A20 = { { COL_MATERIAL_METAL, AT_ON | AT_TYPE_ENEMY, @@ -119,11 +125,11 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, + 4, + D_80B37990, }; -static ColliderCylinderInit sBodyCylinderInit = { +static ColliderCylinderInit D_80B37A30 = { { COL_MATERIAL_HIT5, AT_NONE, @@ -143,7 +149,7 @@ static ColliderCylinderInit sBodyCylinderInit = { { 20, 50, 0, { 0, 0, 0 } }, }; -static ColliderCylinderInit sTailCylinderInit = { +static ColliderCylinderInit D_80B37A5C = { { COL_MATERIAL_HIT5, AT_NONE, @@ -163,48 +169,11 @@ static ColliderCylinderInit sTailCylinderInit = { { 15, 20, -15, { 0, 0, 0 } }, }; -typedef enum EnWfDamageReaction { - /* 0 */ ENWF_DMG_REACT_NONE, - /* 1 */ ENWF_DMG_REACT_STUN, - /* 6 */ ENWF_DMG_REACT_ICE_MAGIC = 6, - /* 13 */ ENWF_DMG_REACT_LIGHT_MAGIC = 13, - /* 14 */ ENWF_DMG_REACT_FIRE, - /* 15 */ ENWF_DMG_REACT_UNDEF // used like STUN in the code, but not in the table -} EnWfDamageReaction; - -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, ENWF_DMG_REACT_STUN), - /* Deku stick */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Slingshot */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), - /* Explosive */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(0, ENWF_DMG_REACT_STUN), - /* Normal arrow */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Hookshot */ DMG_ENTRY(0, ENWF_DMG_REACT_STUN), - /* Kokiri sword */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), - /* Master sword */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Giant's Knife */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), - /* Fire arrow */ DMG_ENTRY(4, ENWF_DMG_REACT_FIRE), - /* Ice arrow */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Light arrow */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Unk arrow 1 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Unk arrow 2 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Unk arrow 3 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Fire magic */ DMG_ENTRY(4, ENWF_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(0, ENWF_DMG_REACT_ICE_MAGIC), - /* Light magic */ DMG_ENTRY(3, ENWF_DMG_REACT_LIGHT_MAGIC), - /* Shield */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), - /* Giant spin */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), - /* Master spin */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Kokiri jump */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), - /* Giant jump */ DMG_ENTRY(8, ENWF_DMG_REACT_NONE), - /* Master jump */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), - /* Unknown 1 */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), +static DamageTable D_80B37A88 = { + { + 0x10, 2, 1, 2, 0x10, 2, 2, 0x10, 1, 2, 4, 0xE4, 2, 2, 2, 2, + 2, 0xE4, 0x60, 0xD3, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, + }, }; ActorProfile En_Wf_Profile = { @@ -219,282 +188,278 @@ ActorProfile En_Wf_Profile = { /**/ EnWf_Draw, }; -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80B37AC8[2] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3000, ICHAIN_STOP), }; - -void EnWf_SetupAction(EnWf* this, EnWfActionFunc actionFunc) { - this->actionFunc = actionFunc; +static Vec3f D_80B37AD0 = { 0.0f, 0.5f, 0.0f }; +static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; +static Vec3f D_80B37AE8 = { 0.0f, 0.0f, 0.0f }; +static s32 D_80B37AF4[4] = { 0x06007B68, 0x06008368, 0x06008568, 0x06008368 }; +static s32 D_80B37B04[7] = { 0x06000300, 0x060027D8, 0x060029D8, 0x060027D8, 0, 0, 0 }; + +void func_80B33CB0(EnWf* this, void (*arg1)(EnWf*, PlayState*)) { + this->unk2DC = arg1; } void EnWf_Init(Actor* thisx, PlayState* play) { - s32 pad; EnWf* this = (EnWf*)thisx; + s32 pad; - Actor_ProcessInitChain(thisx, sInitChain); - thisx->colChkInfo.damageTable = &sDamageTable; - ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 0.0f); - thisx->focus.pos = thisx->world.pos; - thisx->colChkInfo.mass = MASS_HEAVY; - thisx->colChkInfo.health = 8; - thisx->colChkInfo.cylRadius = 50; - thisx->colChkInfo.cylHeight = 100; - this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); - thisx->params &= 0xFF; - this->eyeIndex = 0; - this->unk_2F4 = 10.0f; // Set and not used - - Collider_InitJntSph(play, &this->colliderJntSph); - Collider_SetJntSph(play, &this->colliderJntSph, thisx, &sJntSphInit, this->colliderJntSphElements); - Collider_InitCylinder(play, &this->bodyColliderCylinder); - Collider_SetCylinder(play, &this->bodyColliderCylinder, thisx, &sBodyCylinderInit); - Collider_InitCylinder(play, &this->tailColliderCylinder); - Collider_SetCylinder(play, &this->tailColliderCylinder, thisx, &sTailCylinderInit); - - if (thisx->params == WOLFOS_NORMAL) { - SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosNormalSkel, &gWolfosWaitingAnim, this->jointTable, - this->morphTable, WOLFOS_LIMB_MAX); - Actor_SetScale(thisx, 0.0075f); - thisx->naviEnemyId = NAVI_ENEMY_WOLFOS; - } else { // WOLFOS_WHITE - SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosWaitingAnim, this->jointTable, - this->morphTable, WOLFOS_LIMB_MAX); - Actor_SetScale(thisx, 0.01f); - this->colliderJntSph.elements[0].base.atDmgInfo.damage = - this->colliderJntSph.elements[1].base.atDmgInfo.damage = 8; - thisx->naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; + Actor_ProcessInitChain(&this->actor, D_80B37AC8); + this->actor.colChkInfo.damageTable = &D_80B37A88; + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); + this->actor.focus.pos = this->actor.world.pos; + this->actor.colChkInfo.mass = MASS_HEAVY; + this->actor.colChkInfo.health = 8; + this->actor.colChkInfo.cylRadius = 50; + this->actor.colChkInfo.cylHeight = 100; + this->unk2FC = PARAMS_GET_U(thisx->params, 8, 8); + this->actor.params &= 0xFF; + this->unk302 = 0; + this->unk2F4 = 10.0f; + Collider_InitJntSph(play, &this->unk304); + Collider_SetJntSph(play, &this->unk304, &this->actor, &D_80B37A20, this->unk324); + Collider_InitCylinder(play, &this->unk424); + Collider_SetCylinder(play, &this->unk424, &this->actor, &D_80B37A30); + Collider_InitCylinder(play, &this->unk470); + Collider_SetCylinder(play, &this->unk470, &this->actor, &D_80B37A5C); + if (this->actor.params == 0) { + SkelAnime_InitFlex(play, &this->unk188, &D_6009690, &D_600A4AC, this->unk1CC, this->unk250, 22); + Actor_SetScale(&this->actor, 0.0075f); + this->actor.naviEnemyId = NAVI_ENEMY_WOLFOS; + } else { + SkelAnime_InitFlex(play, &this->unk188, &D_6003BC0, &D_600A4AC, this->unk1CC, this->unk250, 22); + Actor_SetScale(&this->actor, 0.01f); + this->unk304.elements[0].base.atDmgInfo.damage = this->unk304.elements[1].base.atDmgInfo.damage = 8; + this->actor.naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; } - - EnWf_SetupWaitToAppear(this); - - if ((this->switchFlag != 0xFF) && Flags_GetSwitch(play, this->switchFlag)) { - Actor_Kill(thisx); + func_80B34380(this); + if ((this->unk2FC != 0xFF) && Flags_GetSwitch(play, this->unk2FC)) { + Actor_Kill(&this->actor); } } +typedef struct UnkActor { + Actor actor; + char pad14C[0x152 - 0x14C]; + s16 unk152; +} UnkActor; + void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; + UnkActor* temp_v1; - Collider_DestroyJntSph(play, &this->colliderJntSph); - Collider_DestroyCylinder(play, &this->bodyColliderCylinder); - Collider_DestroyCylinder(play, &this->tailColliderCylinder); - - if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF)) { + Collider_DestroyJntSph(play, &this->unk304); + Collider_DestroyCylinder(play, &this->unk424); + Collider_DestroyCylinder(play, &this->unk470); + if ((this->actor.params != 0) && (this->unk2FC != 0xFF)) { func_800F5B58(); } + if ((this->actor.parent != NULL)) { + temp_v1 = (UnkActor*)this->actor.parent; + if ((temp_v1->actor.update != NULL)) { - if (this->actor.parent != NULL) { - EnEncount1* parent = (EnEncount1*)this->actor.parent; - - if (parent->actor.update != NULL) { - if (parent->curNumSpawn > 0) { - parent->curNumSpawn--; + if (temp_v1->unk152 > 0) { + temp_v1->unk152 -= 1; } - PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) T("☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n", "☆☆☆☆☆ Number of simultaneous spawns ☆☆☆☆☆%d\n") - VT_RST, - parent->curNumSpawn); + PRINTF("\x1b[32m☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n\x1b[m", temp_v1->unk152); PRINTF("\n\n"); } } } -s32 EnWf_ChangeAction(PlayState* play, EnWf* this, s16 mustChoose) { - Player* player = GET_PLAYER(play); +s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { + Player* player; s32 pad; - s16 wallYawDiff; - s16 playerYawDiff; + s16 var_t0; + s16 var_v1; + + player = GET_PLAYER(play); - wallYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; - wallYawDiff = ABS(wallYawDiff); - playerYawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - playerYawDiff = ABS(playerYawDiff); + var_t0 = this->actor.wallYaw - this->actor.shape.rot.y; + if (var_t0 < 0) { + var_t0 *= -1; + } + var_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (var_v1 < 0) { + var_v1 *= -1; + } - if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y) != 0) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnWf_SetupBlocking(this); - return true; + func_80B36288(this); + return 1; } - - if ((play->gameplayFrames % 2) != 0) { - EnWf_SetupBlocking(this); - return true; + if (play->gameplayFrames & 1) { + func_80B36288(this); + return 1; } } - if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y) != 0) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(wallYawDiff) < 0x2EE0) && - (this->actor.xzDistToPlayer < 120.0f)) { - EnWf_SetupSomersaultAndAttack(this); - return true; - } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnWf_SetupBlocking(this); - return true; - } else if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames % 2) != 0) { - EnWf_SetupBlocking(this); - return true; - } else { - EnWf_SetupBackflipAway(this); - return true; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if ((ABS(var_t0) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { + func_80B360E8(this); + return 1; + } + } + if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { + func_80B36288(this); + return 1; } + if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames & 1)) { + func_80B36288(this); + return 1; + } + func_80B35B94(this); + return 1; } else { - Actor* explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + Actor* temp_v0_2; - if (explosive != NULL) { + temp_v0_2 = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (temp_v0_2 != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (wallYawDiff < 0x2EE0)) || - (explosive->id == ACTOR_EN_BOM_CHU)) { - if ((explosive->id == ACTOR_EN_BOM_CHU) && - (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && - (s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80) { - EnWf_SetupSomersaultAndAttack(this); - return true; - } else { - EnWf_SetupSidestep(this, play); - return true; + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_t0 < 0x2EE0)) || + (temp_v0_2->id == ACTOR_EN_BOM_CHU)) { + if (temp_v0_2->id == ACTOR_EN_BOM_CHU) { + if ((Actor_WorldDistXYZToActor(&this->actor, temp_v0_2) < 80.0f) && + ((s16)(this->actor.shape.rot.y - temp_v0_2->world.rot.y + 0x8000) < 0x3E80)) { + func_80B360E8(this); + return 1; + } } - } else { - EnWf_SetupBackflipAway(this); - return true; + func_80B365A8(this, play); + return 1; } + func_80B35B94(this); + return 1; } } - if (mustChoose) { - s16 playerFacingAngleDiff; + if (arg2 != 0) { + s16 temp_v1_3; - if (playerYawDiff >= 0x1B58) { - EnWf_SetupSidestep(this, play); - return true; + if (var_v1 >= 0x1B58) { + func_80B365A8(this, play); + return 1; } + temp_v1_3 = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (this->actor.xzDistToPlayer <= 80.0f) { + if (Actor_OtherIsLockedOn(play, &this->actor) == 0) { - playerFacingAngleDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; - - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - (((play->gameplayFrames % 8) != 0) || (ABS(playerFacingAngleDiff) < 0x38E0))) { - EnWf_SetupSlash(this); - return true; + if ((play->gameplayFrames & 7) || (ABS(temp_v1_3) < 0x38E0)) { + func_80B35540(this); + return 1; + } + } } + func_80B34F28(this); - EnWf_SetupRunAroundPlayer(this); - return true; + return 1; } - return false; + return 0; } -void EnWf_SetupWaitToAppear(EnWf* this) { - Animation_Change(&this->skelAnime, &gWolfosRearingUpFallingOverAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); +void func_80B34380(EnWf* this) { + Animation_Change(&this->unk188, &D_6005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; - this->actionTimer = 20; - this->unk_300 = false; - this->action = WOLFOS_ACTION_WAIT_TO_APPEAR; + this->unk2E8 = 0x14; + this->unk300 = 0; + this->unk2D4 = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.scale.y = 0.0f; this->actor.gravity = 0.0f; - EnWf_SetupAction(this, EnWf_WaitToAppear); + func_80B33CB0(this, func_80B34428); } -void EnWf_WaitToAppear(EnWf* this, PlayState* play) { - if (this->actionTimer >= 6) { - this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; +void func_80B34428(EnWf* this, PlayState* play) { + if (this->unk2E8 >= 6) { + this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; if (this->actor.xzDistToPlayer < 240.0f) { - this->actionTimer = 5; + this->unk2E8 = 5; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - - if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF)) { + if ((this->actor.params != 0) && (this->unk2FC != 0xFF)) { func_800F5ACC(NA_BGM_MINI_BOSS); } } - } else if (this->actionTimer != 0) { + } else if (this->unk2E8 != 0) { this->actor.scale.y += this->actor.scale.x * 0.2f; this->actor.world.pos.y += 0.5f; Math_SmoothStepToF(&this->actor.shape.shadowScale, 70.0f, 1.0f, 14.0f, 0.0f); - this->actionTimer--; - - if (this->actionTimer == 0) { + this->unk2E8 -= 1; + if (this->unk2E8 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); } - } else { // actionTimer == 0 - if (SkelAnime_Update(&this->skelAnime)) { - this->actor.scale.y = this->actor.scale.x; - this->actor.gravity = -2.0f; - EnWf_SetupWait(this); - } + } else if (SkelAnime_Update(&this->unk188)) { + this->actor.scale.y = this->actor.scale.x; + this->actor.gravity = -2.0f; + func_80B3455C(this); } } -void EnWf_SetupWait(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosWaitingAnim, -4.0f); - this->action = WOLFOS_ACTION_WAIT; - this->actionTimer = (Rand_ZeroOne() * 10.0f) + 2.0f; +void func_80B3455C(EnWf* this) { + Animation_MorphToLoop(&this->unk188, &D_600A4AC, -4.0f); + this->unk2D4 = 6; + this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 2.0f; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - EnWf_SetupAction(this, EnWf_Wait); + func_80B33CB0(this, func_80B345E4); } -void EnWf_Wait(EnWf* this, PlayState* play) { +void func_80B345E4(EnWf* this, PlayState* play) { Player* player; s32 pad; - s16 angle; + s16 var_v1_sp26; player = GET_PLAYER(play); - SkelAnime_Update(&this->skelAnime); - - if (this->unk_2E2 != 0) { - angle = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_4D4.y; - - if (ABS(angle) > 0x2000) { - this->unk_2E2--; + SkelAnime_Update(&this->unk188); + if (this->unk2E2 != 0) { + var_v1_sp26 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk4D6; + if (ABS(var_v1_sp26) >= 0x2001) { + this->unk2E2 -= 1; return; } - - this->unk_2E2 = 0; + this->unk2E2 = 0; } - - angle = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - angle = ABS(angle); - - if (!EnWf_DodgeRanged(play, this)) { - // Only use of unk_2E0: never not zero, so this if block never runs - if (this->unk_2E0 != 0) { - this->unk_2E0--; - - if (angle >= 0x1FFE) { - return; - } - this->unk_2E0 = 0; - } else { - if (EnWf_ChangeAction(play, this, false)) { + var_v1_sp26 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (var_v1_sp26 < 0) { + var_v1_sp26 *= -1; + } + if (func_80B37830(play, this) == 0) { + if (this->unk2E0 != 0) { + this->unk2E0 -= 1; + if (var_v1_sp26 < 0x1FFE) { + this->unk2E0 = 0; + } else { return; } + } else if (func_80B33FB0(play, this, 0) != 0) { + return; } - - angle = player->actor.shape.rot.y - this->actor.shape.rot.y; - angle = ABS(angle); - - if ((this->actor.xzDistToPlayer < 80.0f) && (player->meleeWeaponState != 0) && (angle >= 0x1F40)) { + var_v1_sp26 = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (var_v1_sp26 < 0) { + var_v1_sp26 *= -1; + } + if ((this->actor.xzDistToPlayer < 80.0f) && (player->meleeWeaponState != 0) && (var_v1_sp26 >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); } else { - this->actionTimer--; - - if (this->actionTimer == 0) { + this->unk2E8 -= 1; + if (this->unk2E8 == 0) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.3f) { - EnWf_SetupRunAtPlayer(this, play); + func_80B347FC(this, play); } else { - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); } } else { - EnWf_SetupSearchForPlayer(this); + func_80B34CFC(this); } - if ((play->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } @@ -502,83 +467,84 @@ void EnWf_Wait(EnWf* this, PlayState* play) { } } -void EnWf_SetupRunAtPlayer(EnWf* this, PlayState* play) { - f32 lastFrame = Animation_GetLastFrame(&gWolfosRunningAnim); - - Animation_Change(&this->skelAnime, &gWolfosRunningAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); - this->action = WOLFOS_ACTION_RUN_AT_PLAYER; - EnWf_SetupAction(this, EnWf_RunAtPlayer); +void func_80B347FC(EnWf* this, PlayState* play) { + Animation_Change(&this->unk188, &D_60057A0, 1.0f, 0.0f, Animation_GetLastFrame(&D_60057A0), ANIMMODE_LOOP_INTERP, + -4.0f); + this->unk2D4 = 9; + func_80B33CB0(this, func_80B3487C); } -void EnWf_RunAtPlayer(EnWf* this, PlayState* play) { +void func_80B3487C(EnWf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad; - f32 baseRange = 0.0f; - s16 playerFacingAngleDiff; - Player* player = GET_PLAYER(play); - s32 absPlaySpeed; - - if (!EnWf_DodgeRanged(play, this)) { + f32 sp50_real; + s32 pad2; + Player* sp48_real; + s32 pad3; + s16 temp_v1_real; + s16 var_v0_real; + f32 absPlaySpeed; + s32 pad4; + + sp50_real = 0.0f; + sp48_real = GET_PLAYER(play); + if (func_80B37830(play, this) == 0) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_OtherIsLockedOn(play, &this->actor)) { - baseRange = 150.0f; + sp50_real = 150.0f; } - - if (this->actor.xzDistToPlayer <= (50.0f + baseRange)) { + if (this->actor.xzDistToPlayer <= (50.0f + sp50_real)) { Math_SmoothStepToF(&this->actor.speed, -8.0f, 1.0f, 1.5f, 0.0f); - } else if ((65.0f + baseRange) < this->actor.xzDistToPlayer) { + } else if (this->actor.xzDistToPlayer > (65.0f + sp50_real)) { Math_SmoothStepToF(&this->actor.speed, 8.0f, 1.0f, 1.5f, 0.0f); } else { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 6.65f, 0.0f); } - - this->skelAnime.playSpeed = this->actor.speed * 0.175f; - playerFacingAngleDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; - playerFacingAngleDiff = ABS(playerFacingAngleDiff); - - if ((this->actor.xzDistToPlayer < (150.0f + baseRange)) && (player->meleeWeaponState != 0) && - (playerFacingAngleDiff >= 8000)) { + this->unk188.playSpeed = this->actor.speed * 0.175f; + var_v0_real = sp48_real->actor.shape.rot.y - this->actor.shape.rot.y; + if (var_v0_real < 0) { + var_v0_real *= -1; + } + if ((this->actor.xzDistToPlayer < (150.0f + sp50_real)) && (sp48_real->meleeWeaponState != 0) && + (var_v0_real >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); return; } } - - prevFrame = (s32)this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - - if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { + prevFrame = (s32)this->unk188.curFrame; + SkelAnime_Update(&this->unk188); + absPlaySpeed = ABS(this->unk188.playSpeed); + beforeCurFrame = (s32)(this->unk188.curFrame - absPlaySpeed); + absPlaySpeed = ABS(this->unk188.playSpeed); + if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { if (Rand_ZeroOne() > 0.5f) { - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); } else { - EnWf_SetupWait(this); + func_80B3455C(this); } - } else if (this->actor.xzDistToPlayer < (90.0f + baseRange)) { - s16 temp_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; - + } else if (this->actor.xzDistToPlayer < (90.0f + sp50_real)) { + temp_v1_real = sp48_real->actor.shape.rot.y - this->actor.shape.rot.y; if (!Actor_OtherIsLockedOn(play, &this->actor) && - ((Rand_ZeroOne() > 0.03f) || ((this->actor.xzDistToPlayer <= 80.0f) && (ABS(temp_v1) < 0x38E0)))) { - EnWf_SetupSlash(this); - } else if (Actor_OtherIsLockedOn(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { - EnWf_SetupBackflipAway(this); + ((Rand_ZeroOne() > 0.03f) || ((this->actor.xzDistToPlayer <= 80.0f) && (ABS(temp_v1_real) < 0x38E0)))) { + func_80B35540(this); } else { - EnWf_SetupRunAroundPlayer(this); + if ((Actor_OtherIsLockedOn(play, &this->actor)) && (Rand_ZeroOne() > 0.5f)) { + func_80B35B94(this); + } else { + func_80B34F28(this); + } } } - - if (!EnWf_ChangeAction(play, this, false)) { - if ((play->gameplayFrames & 95) == 0) { + if (func_80B33FB0(play, this, 0) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } - if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && - ((absPlaySpeed + prevFrame) > 0)) { + if ((prevFrame != (s32)this->unk188.curFrame) && (beforeCurFrame <= 0) && + (((s32)absPlaySpeed + prevFrame) > 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } @@ -586,734 +552,681 @@ void EnWf_RunAtPlayer(EnWf* this, PlayState* play) { } } -void EnWf_SetupSearchForPlayer(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &gWolfosSidesteppingAnim, -4.0f); - this->action = WOLFOS_ACTION_SEARCH_FOR_PLAYER; - EnWf_SetupAction(this, EnWf_SearchForPlayer); +void func_80B34CFC(EnWf* this) { + Animation_MorphToLoop(&this->unk188, &D_60098C8, -4.0f); + this->unk2D4 = 0xA; + func_80B33CB0(this, func_80B34D48); } -void EnWf_SearchForPlayer(EnWf* this, PlayState* play) { - s16 yawDiff; - s16 phi_v1; - f32 phi_f2; +void func_80B34D48(EnWf* this, PlayState* play) { + f32 var_fv1; + s16 temp_v0; + s16 temp_v1; - if (!EnWf_DodgeRanged(play, this) && !EnWf_ChangeAction(play, this, false)) { - yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - phi_v1 = (yawDiff > 0) ? (yawDiff * 0.25f) + 2000.0f : (yawDiff * 0.25f) - 2000.0f; - this->actor.shape.rot.y += phi_v1; + if ((func_80B37830(play, this) == 0) && (func_80B33FB0(play, this, 0) == 0)) { + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (temp_v0 > 0) { + temp_v1 = (temp_v0 * 0.25f) + 2000.0f; + } else { + temp_v1 = (temp_v0 * 0.25f) - 2000.0f; + } + this->actor.shape.rot.y += temp_v1; this->actor.world.rot.y = this->actor.shape.rot.y; - - if (yawDiff > 0) { - phi_f2 = phi_v1 * 0.5f; - phi_f2 = CLAMP_MAX(phi_f2, 1.0f); + if (temp_v0 > 0) { + var_fv1 = temp_v1 * 0.5f; + if (var_fv1 > 1.0f) { + var_fv1 = 1.0f; + } } else { - phi_f2 = phi_v1 * 0.5f; - phi_f2 = CLAMP_MIN(phi_f2, -1.0f); + var_fv1 = temp_v1 * 0.5f; + if (var_fv1 < -1.0f) { + var_fv1 = -1.0f; + } } - - this->skelAnime.playSpeed = -phi_f2; - SkelAnime_Update(&this->skelAnime); - + this->unk188.playSpeed = -var_fv1; + SkelAnime_Update(&this->unk188); if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.8f) { - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); } else { - EnWf_SetupRunAtPlayer(this, play); + func_80B347FC(this, play); } } - - if ((play->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } } -void EnWf_SetupRunAroundPlayer(EnWf* this) { - f32 lastFrame = Animation_GetLastFrame(&gWolfosRunningAnim); - - Animation_Change(&this->skelAnime, &gWolfosRunningAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); - +void func_80B34F28(EnWf* this) { + Animation_Change(&this->unk188, &D_60057A0, 1.0f, 0.0f, Animation_GetLastFrame(&D_60057A0), ANIMMODE_LOOP_INTERP, + -4.0f); if (Rand_ZeroOne() > 0.5f) { - this->runAngle = 16000; + this->unk2FE = 0x3E80; } else { - this->runAngle = -16000; + this->unk2FE = -0x3E80; } - - this->skelAnime.playSpeed = this->actor.speed = 6.0f; - this->skelAnime.playSpeed *= 0.175f; + this->actor.speed = 6.0f; + this->unk188.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->actionTimer = (Rand_ZeroOne() * 30.0f) + 30.0f; - this->action = WOLFOS_ACTION_RUN_AROUND_PLAYER; - this->runSpeed = 0.0f; - - EnWf_SetupAction(this, EnWf_RunAroundPlayer); + this->unk2E8 = (Rand_ZeroOne() * 30.0f) + 30.0f; + this->unk2D4 = 0xB; + this->unk2EC = 0.0f; + func_80B33CB0(this, func_80B35024); } -void EnWf_RunAroundPlayer(EnWf* this, PlayState* play) { - s16 angle1; - s16 angle2; - s32 pad; - f32 baseRange = 0.0f; +void func_80B35024(EnWf* this, PlayState* play) { + s16 sp56_real; + s32 new_var; + f32 sp4C_real; s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; - Player* player = GET_PLAYER(play); - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->runAngle, 1, 4000, 1); + Player* player; + s16 var_v0_2_real; - if (!EnWf_DodgeRanged(play, this) && !EnWf_ChangeAction(play, this, false)) { + sp4C_real = 0.0f; + player = GET_PLAYER(play); + Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->unk2FE), 1, 0xFA0, 1); + if ((func_80B37830(play, this) == 0) && (func_80B33FB0(play, this, 0) == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; - angle1 = player->actor.shape.rot.y + this->runAngle + 0x8000; - - // Actor_TestFloorInDirection is useless here (see comment below) + sp56_real = player->actor.shape.rot.y + this->unk2FE + 0x8000; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y)) { - angle2 = (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) - ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle - : 0; - - // This is probably meant to reverse direction if the edge of a floor is encountered, but does nothing - // unless bgCheckFlags & BGCHECKFLAG_WALL anyway, since angle2 = 0 otherwise - if (ABS(angle2) > 0x2EE0) { - this->runAngle = -this->runAngle; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + var_v0_2_real = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk2FE; + } else { + var_v0_2_real = 0; + } + if (ABS(var_v0_2_real) > 0x2EE0) { + this->unk2FE = -this->unk2FE; } } - if (Actor_OtherIsLockedOn(play, &this->actor)) { - baseRange = 150.0f; + sp4C_real = 150.0f; } - - if (this->actor.xzDistToPlayer <= (60.0f + baseRange)) { - Math_SmoothStepToF(&this->runSpeed, -4.0f, 1.0f, 1.5f, 0.0f); - } else if ((80.0f + baseRange) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->runSpeed, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (60.0f + sp4C_real)) { + Math_SmoothStepToF(&this->unk2EC, -4.0f, 1.0f, 1.5f, 0.0f); + } else if (this->actor.xzDistToPlayer > (80.0f + sp4C_real)) { + Math_SmoothStepToF(&this->unk2EC, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->runSpeed, 0.0f, 1.0f, 6.65f, 0.0f); + Math_SmoothStepToF(&this->unk2EC, 0.0f, 1.0f, 6.65f, 0.0f); } - - if (this->runSpeed != 0.0f) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->runSpeed; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->runSpeed; + if (this->unk2EC != 0.0f) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk2EC; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk2EC; } - - if (ABS(this->runSpeed) < ABS(this->actor.speed)) { - this->skelAnime.playSpeed = this->actor.speed * 0.175f; + if (ABS(this->unk2EC) < ABS(this->actor.speed)) { + this->unk188.playSpeed = this->actor.speed * 0.175f; } else { - this->skelAnime.playSpeed = this->runSpeed * 0.175f; + this->unk188.playSpeed = this->unk2EC * 0.175f; } - this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); - - prevFrame = (s32)this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - - if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && (absPlaySpeed + prevFrame > 0)) { + this->unk188.playSpeed = CLAMP(this->unk188.playSpeed, -3.0f, 3.0f); + prevFrame = (s32)this->unk188.curFrame; + SkelAnime_Update(&this->unk188); + beforeCurFrame = (s32)(this->unk188.curFrame - ABS(this->unk188.playSpeed)); + absPlaySpeed = new_var = (s32)ABS(this->unk188.playSpeed); + if ((prevFrame != (s32)this->unk188.curFrame) && (beforeCurFrame <= 0) && ((absPlaySpeed + prevFrame) > 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } - - if ((play->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } - - if ((Math_CosS(angle1 - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsLockedOn(play, &this->actor) && + if ((Math_CosS(sp56_real - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsLockedOn(play, &this->actor) && (this->actor.xzDistToPlayer <= 80.0f)) { - EnWf_SetupSlash(this); + func_80B35540(this); } else { - this->actionTimer--; - - if (this->actionTimer == 0) { + this->unk2E8 -= 1; + if (this->unk2E8 == 0) { if (Actor_OtherIsLockedOn(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { - EnWf_SetupBackflipAway(this); + func_80B35B94(this); } else { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 3.0f) + 1.0f; + func_80B3455C(this); + this->unk2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; } } } } } -void EnWf_SetupSlash(EnWf* this) { - Animation_PlayOnce(&this->skelAnime, &gWolfosSlashingAnim); - this->colliderJntSph.base.atFlags &= ~AT_BOUNCED; +void func_80B35540(EnWf* this) { + Animation_PlayOnce(&this->unk188, &D_6004638); + this->unk304.base.atFlags &= ~4; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->action = WOLFOS_ACTION_SLASH; - this->unk_2FA = 0; // Set and not used - this->actionTimer = 7; - this->skelAnime.endFrame = 20.0f; + this->unk2D4 = 8; + this->unk2FA = 0; + this->unk2E8 = 7; + this->unk188.endFrame = 20.0f; this->actor.speed = 0.0f; - - EnWf_SetupAction(this, EnWf_Slash); + func_80B33CB0(this, func_80B355BC); } -void EnWf_Slash(EnWf* this, PlayState* play) { +void func_80B355BC(EnWf* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 shapeAngleDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; - s16 yawAngleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - s32 curFrame = this->skelAnime.curFrame; - - shapeAngleDiff = ABS(shapeAngleDiff); - yawAngleDiff = ABS(yawAngleDiff); + s16 sp42; + s16 sp40; + s32 var_a2_sp3C; + + sp42 = player->actor.shape.rot.y - this->actor.shape.rot.y; + sp40 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + var_a2_sp3C = (s32)this->unk188.curFrame; + sp42 = ABS(sp42); + sp40 = ABS(sp40); this->actor.speed = 0.0f; - - if (((curFrame >= 9) && (curFrame <= 12)) || ((curFrame >= 17) && (curFrame <= 19))) { - if (this->slashStatus == 0) { + if (((var_a2_sp3C >= 9) && (var_a2_sp3C <= 12)) || ((var_a2_sp3C >= 17) && (var_a2_sp3C <= 19))) { + if (this->unk2F8 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_ATTACK); } - - this->slashStatus = 1; + this->unk2F8 = 1; } else { - this->slashStatus = 0; + this->unk2F8 = 0; } - - if (((curFrame == 15) && !Actor_IsLockedOn(play, &this->actor) && + if (((var_a2_sp3C == 0xF) && !Actor_IsLockedOn(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || - SkelAnime_Update(&this->skelAnime)) { - if ((curFrame != 15) && (this->actionTimer != 0)) { - this->actor.shape.rot.y += (s16)(3276.0f * (1.5f + (this->actionTimer - 4) * 0.4f)); + SkelAnime_Update(&this->unk188)) { + if ((var_a2_sp3C != 0xF) && (this->unk2E8 != 0)) { + this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->unk2E8 - 4) * 0.4f))); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); - this->actionTimer--; - } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (curFrame != 15)) { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 5.0f) + 5.0f; - - if (yawAngleDiff > 13000) { - this->unk_2E2 = 7; + this->unk2E8 -= 1; + } else if ((Actor_IsFacingPlayer(&this->actor, 0x1554) == 0) && (var_a2_sp3C != 0xF)) { + func_80B3455C(this); + this->unk2E8 = (s32)((Rand_ZeroOne() * 5.0f) + 5.0f); + if (sp40 > 0x32C8) { + this->unk2E2 = 7; } - } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupSidestep(this, play); - } else if (shapeAngleDiff <= 10000) { - if (yawAngleDiff > 16000) { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnWf_SetupRunAroundPlayer(this); + if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { + func_80B3455C(this); + this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + } else { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + if (Rand_ZeroOne() > 0.7f) { + func_80B365A8(this, play); } else { - EnWf_ChangeAction(play, this, true); + if (sp42 <= 0x2710) { + if (sp40 > 0x3E80) { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + func_80B34F28(this); + } else { + func_80B33FB0(play, this, 1); + } + } else { + func_80B34F28(this); + } } - } else { - EnWf_SetupRunAroundPlayer(this); } } } } -void EnWf_SetupRecoilFromBlockedSlash(EnWf* this) { - f32 endFrame = 1.0f; +void func_80B3590C(EnWf* this) { + f32 var_fv0; - if ((s32)this->skelAnime.curFrame >= 16) { - endFrame = 15.0f; + var_fv0 = 1.0f; + if ((s32)this->unk188.curFrame >= 16) { + var_fv0 = 15.0f; } - - Animation_Change(&this->skelAnime, &gWolfosSlashingAnim, -0.5f, this->skelAnime.curFrame - 1.0f, endFrame, - ANIMMODE_ONCE_INTERP, 0.0f); - this->action = WOLFOS_ACTION_RECOIL_FROM_BLOCKED_SLASH; - this->slashStatus = 0; - EnWf_SetupAction(this, EnWf_RecoilFromBlockedSlash); + Animation_Change(&this->unk188, &D_6004638, -0.5f, this->unk188.curFrame - 1.0f, var_fv0, ANIMMODE_ONCE_INTERP, + 0.0f); + this->unk2D4 = 0xC; + this->unk2F8 = 0; + func_80B33CB0(this, func_80B359A8); } -void EnWf_RecoilFromBlockedSlash(EnWf* this, PlayState* play) { +void func_80B359A8(EnWf* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 angle1 = player->actor.shape.rot.y - this->actor.shape.rot.y; - s16 angle2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + s16 var_a2; + s16 var_a3; - angle1 = ABS(angle1); - angle2 = ABS(angle2); - - if (SkelAnime_Update(&this->skelAnime)) { + var_a2 = player->actor.shape.rot.y - this->actor.shape.rot.y; + var_a3 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (var_a2 < 0) { + var_a2 *= -1; + } + if (var_a3 < 0) { + var_a3 *= -1; + } + if (SkelAnime_Update(&this->unk188)) { if (!Actor_IsFacingPlayer(&this->actor, 0x1554)) { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 5.0f) + 5.0f; - - if (angle2 > 0x32C8) { - this->unk_2E2 = 30; + func_80B3455C(this); + this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + if (var_a3 > 0x32C8) { + this->unk2E2 = 0x1E; } + } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { + func_80B3455C(this); + this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { - if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 5.0f) + 5.0f; - } else { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if (Rand_ZeroOne() > 0.7f) { - EnWf_SetupSidestep(this, play); - } else if (angle1 <= 0x2710) { - if (angle2 > 0x3E80) { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnWf_SetupRunAroundPlayer(this); - } else { - EnWf_ChangeAction(play, this, true); - } + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + if (Rand_ZeroOne() > 0.7f) { + func_80B365A8(this, play); + } else if (var_a2 <= 0x2710) { + if (var_a3 > 0x3E80) { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + func_80B34F28(this); } else { - EnWf_SetupRunAroundPlayer(this); + func_80B33FB0(play, this, 1); } + } else { + func_80B34F28(this); } } } } -void EnWf_SetupBackflipAway(EnWf* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosBackflippingAnim, -3.0f); +void func_80B35B94(EnWf* this) { + Animation_MorphToPlayOnce(&this->unk188, &D_6004AD0, -3.0f); + this->unk2E8 = 0; + this->unk300 = 1; + this->unk2D4 = 5; this->actor.speed = -6.0f; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - this->actionTimer = 0; - this->unk_300 = true; - this->action = WOLFOS_ACTION_BACKFLIP_AWAY; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); - EnWf_SetupAction(this, EnWf_BackflipAway); + func_80B33CB0(this, func_80B35C10); } -void EnWf_BackflipAway(EnWf* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime)) { +void func_80B35C10(EnWf* this, PlayState* play) { + if (SkelAnime_Update(&this->unk188)) { if (!Actor_OtherIsLockedOn(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { - EnWf_SetupRunAtPlayer(this, play); - } else if ((play->gameplayFrames % 2) != 0) { - EnWf_SetupSidestep(this, play); + func_80B347FC(this, play); + } else if (play->gameplayFrames & 1) { + func_80B365A8(this, play); } else { - EnWf_SetupWait(this); + func_80B3455C(this); } } - if ((play->state.frames & 95) == 0) { + if ((play->state.frames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } -void EnWf_SetupStunned(EnWf* this) { +void func_80B35D18(EnWf* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = 0.0f; } - Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - Animation_PlayOnceSetSpeed(&this->skelAnime, &gWolfosDamagedAnim, 0.0f); - this->action = WOLFOS_ACTION_STUNNED; - EnWf_SetupAction(this, EnWf_Stunned); + Animation_PlayOnceSetSpeed(&this->unk188, &D_6009B20, 0.0f); + this->unk2D4 = 0xF; + func_80B33CB0(this, func_80B35D90); } -void EnWf_Stunned(EnWf* this, PlayState* play) { +void func_80B35D90(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - - this->unk_300 = false; + this->unk300 = 0; } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - EnWf_SetupDie(this); + func_80B36C8C(this); } else { - EnWf_ChangeAction(play, this, true); + func_80B33FB0(play, this, 1); } } } -void EnWf_SetupDamaged(EnWf* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosDamagedAnim, -4.0f); - +void func_80B35E4C(EnWf* this) { + Animation_MorphToPlayOnce(&this->unk188, &D_6009B20, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_300 = false; + this->unk300 = 0; this->actor.speed = -4.0f; } else { - this->unk_300 = true; + this->unk300 = 1; } - - this->unk_2E2 = 0; + this->unk2E2 = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DAMAGE); - this->action = WOLFOS_ACTION_DAMAGED; - EnWf_SetupAction(this, EnWf_Damaged); + this->unk2D4 = 3; + func_80B33CB0(this, func_80B35EE4); } -void EnWf_Damaged(EnWf* this, PlayState* play) { - s16 angleToWall; +void func_80B35EE4(EnWf* this, PlayState* play) { + s16 var_v1; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - - this->unk_300 = false; + this->unk300 = 0; } - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); - - if (!EnWf_ChangeAction(play, this, false) && SkelAnime_Update(&this->skelAnime)) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; - angleToWall = ABS(angleToWall); - - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 12000) && - (this->actor.xzDistToPlayer < 120.0f)) { - EnWf_SetupSomersaultAndAttack(this); - } else if (!EnWf_DodgeRanged(play, this)) { - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - ((play->gameplayFrames % 8) != 0)) { - EnWf_SetupSlash(this); - } else if (Rand_ZeroOne() > 0.5f) { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 5.0f) + 5.0f; - this->unk_2E2 = 30; - } else { - EnWf_SetupBackflipAway(this); - } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); + if ((func_80B33FB0(play, this, 0) == 0) && SkelAnime_Update(&this->unk188) && + (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) != 0))) { + var_v1 = this->actor.wallYaw - this->actor.shape.rot.y; + if (var_v1 < 0) { + var_v1 *= -1; + } + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_v1) < 0x2EE0) && + (this->actor.xzDistToPlayer < 120.0f)) { + func_80B360E8(this); + } else if (func_80B37830(play, this) == 0) { + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && + ((play->gameplayFrames & 7) != 0)) { + func_80B35540(this); + } else if (Rand_ZeroOne() > 0.5f) { + func_80B3455C(this); + this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->unk2E2 = 0x1E; + } else { + func_80B35B94(this); } } } } -void EnWf_SetupSomersaultAndAttack(EnWf* this) { - f32 lastFrame = Animation_GetLastFrame(&gWolfosBackflippingAnim); - - Animation_Change(&this->skelAnime, &gWolfosBackflippingAnim, -1.0f, lastFrame, 0.0f, ANIMMODE_ONCE, -3.0f); - this->actionTimer = 0; - this->unk_300 = false; - this->action = WOLFOS_ACTION_TURN_TOWARDS_PLAYER; +void func_80B360E8(EnWf* this) { + Animation_Change(&this->unk188, &D_6004AD0, -1.0f, Animation_GetLastFrame(&D_6004AD0), 0.0f, ANIMMODE_ONCE, -3.0f); + this->unk2E8 = 0; + this->unk300 = 0; + this->unk2D4 = 4; this->actor.speed = 6.5f; this->actor.velocity.y = 15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; - EnWf_SetupAction(this, EnWf_SomersaultAndAttack); + func_80B33CB0(this, func_80B361A0); } -void EnWf_SomersaultAndAttack(EnWf* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); - +void func_80B361A0(EnWf* this, PlayState* play) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { - //! @bug unk_4C8 and unk_4BC are used but not set (presumably intended to be feet positions like other actors) - func_800355B8(play, &this->unk_4C8); - func_800355B8(play, &this->unk_4BC); + func_800355B8(play, &this->unk4C8); + func_800355B8(play, &this->unk4BC); } - - if (SkelAnime_Update(&this->skelAnime) && + if (SkelAnime_Update(&this->unk188) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { - this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.shape.rot.x = 0; - this->actor.speed = this->actor.velocity.y = 0.0f; + this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + this->actor.velocity.y = 0.0f; + this->actor.speed = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - if (!Actor_OtherIsLockedOn(play, &this->actor)) { - EnWf_SetupSlash(this); + func_80B35540(this); } else { - EnWf_SetupWait(this); + func_80B3455C(this); } } } -void EnWf_SetupBlocking(EnWf* this) { - f32 lastFrame = Animation_GetLastFrame(&gWolfosBlockingAnim); +void func_80B36288(EnWf* this) { + f32 temp_fv1; - if (this->slashStatus != 0) { - this->slashStatus = -1; + temp_fv1 = (f32)Animation_GetLastFrame(&D_6004CA4); + if (this->unk2F8 != 0) { + this->unk2F8 = -1; } - this->actor.speed = 0.0f; - this->action = WOLFOS_ACTION_BLOCKING; - this->actionTimer = 10; - - Animation_Change(&this->skelAnime, &gWolfosBlockingAnim, 0.0f, 0.0f, lastFrame, ANIMMODE_ONCE_INTERP, -4.0f); - EnWf_SetupAction(this, EnWf_Blocking); + this->unk2D4 = 7; + this->unk2E8 = 0xA; + Animation_Change(&this->unk188, &D_6004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); + func_80B33CB0(this, func_80B36328); } -void EnWf_Blocking(EnWf* this, PlayState* play) { - Player* player = GET_PLAYER(play); +void func_80B36328(EnWf* this, PlayState* play) { + Player* player; s32 pad; + s16 pad2; + s16 temp_a2_sp2C; + s16 temp_v0_2; - if (this->actionTimer != 0) { - this->actionTimer--; + player = GET_PLAYER(play); + if (this->unk2E8 != 0) { + this->unk2E8 -= 1; } else { - this->skelAnime.playSpeed = 1.0f; + this->unk188.playSpeed = 1.0f; } - - if (SkelAnime_Update(&this->skelAnime)) { - s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - - if ((ABS(yawDiff) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && + if (SkelAnime_Update(&this->unk188)) { + temp_v0_2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(temp_v0_2) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { - if (func_800354B4(play, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnWf_SetupBlocking(this); - } else if ((play->gameplayFrames % 2) != 0) { - EnWf_SetupBlocking(this); + func_80B36288(this); + } else if (play->gameplayFrames & 1) { + func_80B36288(this); } else { - EnWf_SetupBackflipAway(this); + func_80B35B94(this); } - } else { - s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; - + temp_a2_sp2C = player->actor.shape.rot.y - this->actor.shape.rot.y; if (!Actor_OtherIsLockedOn(play, &this->actor) && - (((play->gameplayFrames % 2) != 0) || (ABS(angleFacingLink) < 0x38E0))) { - EnWf_SetupSlash(this); + ((play->gameplayFrames & 1) || (ABS(temp_a2_sp2C) < 0x38E0))) { + func_80B35540(this); } else { - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); } } } else { - EnWf_SetupRunAroundPlayer(this); + func_80B34F28(this); } - } else if (this->actionTimer == 0) { - if (func_800354B4(play, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) { - if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - EnWf_SetupBlocking(this); - } else if ((play->gameplayFrames % 2) != 0) { - EnWf_SetupBlocking(this); - } else { - EnWf_SetupBackflipAway(this); - } + } else if ((this->unk2E8 == 0) && + ((func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0))) { + if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { + func_80B36288(this); + } else if (play->gameplayFrames & 1) { + func_80B36288(this); + } else { + func_80B35B94(this); } } } -void EnWf_SetupSidestep(EnWf* this, PlayState* play) { - s16 angle; +void func_80B365A8(EnWf* this, PlayState* play) { + s16 temp_v1_sp36; Player* player; - f32 lastFrame = Animation_GetLastFrame(&gWolfosRunningAnim); - - Animation_Change(&this->skelAnime, &gWolfosRunningAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->unk188, &D_60057A0, 1.0f, 0.0f, Animation_GetLastFrame(&D_60057A0), ANIMMODE_LOOP_INTERP, + -4.0f); player = GET_PLAYER(play); - angle = player->actor.shape.rot.y + this->runAngle; - - if (Math_SinS(angle - this->actor.yawTowardsPlayer) > 0.0f) { - this->runAngle = 16000; - } else if (Math_SinS(angle - this->actor.yawTowardsPlayer) < 0.0f) { - this->runAngle = -16000; + temp_v1_sp36 = player->actor.shape.rot.y + this->unk2FE; + if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) > 0.0f) { + this->unk2FE = 0x3E80; + } else if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) < 0.0f) { + this->unk2FE = -0x3E80; } else if (Rand_ZeroOne() > 0.5f) { - this->runAngle = 16000; + this->unk2FE = 0x3E80; } else { - this->runAngle = -16000; + this->unk2FE = -0x3E80; } - - this->skelAnime.playSpeed = this->actor.speed = 6.0f; - this->skelAnime.playSpeed *= 0.175f; + this->actor.speed = 6.0f; + this->unk188.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->runSpeed = 0.0f; - this->actionTimer = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->action = WOLFOS_ACTION_SIDESTEP; - - EnWf_SetupAction(this, EnWf_Sidestep); + this->unk2EC = 0.0f; + this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->unk2D4 = 0xE; + func_80B33CB0(this, func_80B36740); } -void EnWf_Sidestep(EnWf* this, PlayState* play) { - s16 angleDiff1; - Player* player = GET_PLAYER(play); +void func_80B36740(EnWf* this, PlayState* play) { + Player* player2; + Player* player; s32 prevFrame; s32 beforeCurFrame; + s32 new_var; + f32 sp58_real; s32 absPlaySpeed; - f32 baseRange = 0.0f; + s16 var_v0_probreal; + s16 var_v0_2_probreal; + s16 temp_a2_sp4E; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->runAngle, 1, 3000, 1); - - // Actor_TestFloorInDirection is useless here (see comment below) + player = GET_PLAYER(play); + sp58_real = 0.0f; + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk2FE, 1, 0xBB8, 1); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y)) { - s16 angle = (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) - ? (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->runAngle - : 0; - - // This is probably meant to reverse direction if the edge of a floor is encountered, but does nothing - // unless bgCheckFlags & 8 anyway, since angle = 0 otherwise - if (ABS(angle) > 0x2EE0) { - this->runAngle = -this->runAngle; + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + var_v0_probreal = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk2FE; + } else { + var_v0_probreal = 0; + } + if (ABS(var_v0_probreal) > 0x2EE0) { + this->unk2FE = -this->unk2FE; } } - this->actor.world.rot.y = this->actor.shape.rot.y; - if (Actor_OtherIsLockedOn(play, &this->actor)) { - baseRange = 150.0f; + sp58_real = 150.0f; } - - if (this->actor.xzDistToPlayer <= (60.0f + baseRange)) { - Math_SmoothStepToF(&this->runSpeed, -4.0f, 1.0f, 1.5f, 0.0f); - } else if ((80.0f + baseRange) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->runSpeed, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (60.0f + sp58_real)) { + Math_SmoothStepToF(&this->unk2EC, -4.0f, 1.0f, 1.5f, 0.0f); + } else if (this->actor.xzDistToPlayer > (80.0f + sp58_real)) { + Math_SmoothStepToF(&this->unk2EC, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->runSpeed, 0.0f, 1.0f, 6.65f, 0.0f); + Math_SmoothStepToF(&this->unk2EC, 0.0f, 1.0f, 6.65f, 0.0f); } - - if (this->runSpeed != 0.0f) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->runSpeed; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->runSpeed; + if (this->unk2EC != 0.0f) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk2EC; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk2EC; } - - if (ABS(this->runSpeed) < ABS(this->actor.speed)) { - this->skelAnime.playSpeed = this->actor.speed * 0.175f; + if (ABS(this->unk2EC) < ABS(this->actor.speed)) { + this->unk188.playSpeed = this->actor.speed * 0.175f; } else { - this->skelAnime.playSpeed = this->runSpeed * 0.175f; + this->unk188.playSpeed = this->unk2EC * 0.175f; } - this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); - - prevFrame = (s32)this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - - if (!EnWf_ChangeAction(play, this, false)) { - this->actionTimer--; - - if (this->actionTimer == 0) { - angleDiff1 = player->actor.shape.rot.y - this->actor.yawTowardsPlayer; - angleDiff1 = ABS(angleDiff1); - - if (angleDiff1 >= 0x3A98) { - EnWf_SetupWait(this); - this->actionTimer = (Rand_ZeroOne() * 3.0f) + 1.0f; + this->unk188.playSpeed = CLAMP(this->unk188.playSpeed, -3.0f, 3.0f); + prevFrame = (s32)this->unk188.curFrame; + SkelAnime_Update(&this->unk188); + beforeCurFrame = (s32)(this->unk188.curFrame - ABS(this->unk188.playSpeed)); + absPlaySpeed = new_var = ABS(this->unk188.playSpeed); + if (func_80B33FB0(play, this, 0) == 0) { + this->unk2E8 -= 1; + if (this->unk2E8 == 0) { + var_v0_2_probreal = player->actor.shape.rot.y - this->actor.yawTowardsPlayer; + if (var_v0_2_probreal < 0) { + var_v0_2_probreal *= -1; + } + if (var_v0_2_probreal >= 0x3A98) { + func_80B3455C(this); + this->unk2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { - Player* player2 = GET_PLAYER(play); - s16 angleDiff2 = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; - + player2 = GET_PLAYER(play); + temp_a2_sp4E = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - (((play->gameplayFrames % 4) == 0) || (ABS(angleDiff2) < 0x38E0))) { - EnWf_SetupSlash(this); + (((play->gameplayFrames & 3) == 0) || (ABS(temp_a2_sp4E) < 0x38E0))) { + func_80B35540(this); } else { - EnWf_SetupRunAtPlayer(this, play); + func_80B347FC(this, play); } } } - - if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && ((absPlaySpeed + prevFrame) > 0)) { + if ((prevFrame != (s32)this->unk188.curFrame) && (beforeCurFrame <= 0) && + (((s32)absPlaySpeed + prevFrame) > 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } - - if ((play->gameplayFrames & 95) == 0) { + if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } } } -void EnWf_SetupDie(EnWf* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosRearingUpFallingOverAnim, -4.0f); +void func_80B36C8C(EnWf* this) { + Animation_MorphToPlayOnce(&this->unk188, &D_6005430, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_300 = false; + this->unk300 = 0; this->actor.speed = -6.0f; } else { - this->unk_300 = true; + this->unk300 = 1; } - - this->action = WOLFOS_ACTION_DIE; + this->unk2D4 = 2; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->actionTimer = this->skelAnime.animLength; + this->unk2E8 = this->unk188.animLength; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); - EnWf_SetupAction(this, EnWf_Die); + func_80B33CB0(this, func_80B36D3C); } -void EnWf_Die(EnWf* this, PlayState* play) { +void func_80B36D3C(EnWf* this, PlayState* play) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); - this->unk_300 = false; + this->unk300 = 0; } - - if (SkelAnime_Update(&this->skelAnime)) { + if (SkelAnime_Update(&this->unk188)) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_13, false)); - - if (this->switchFlag != 0xFF) { - Flags_SetSwitch(play, this->switchFlag); + if (this->unk2FC != 0xFF) { + Flags_SetSwitch(play, (s32)this->unk2FC); } - Actor_Kill(&this->actor); } else { - s32 i; - Vec3f pos; - Vec3f velAndAccel = { 0.0f, 0.5f, 0.0f }; - - this->actionTimer--; - - for (i = ((s32)this->skelAnime.animLength - this->actionTimer) >> 1; i >= 0; i--) { - pos.x = Rand_CenteredFloat(60.0f) + this->actor.world.pos.x; - pos.z = Rand_CenteredFloat(60.0f) + this->actor.world.pos.z; - pos.y = Rand_CenteredFloat(50.0f) + (this->actor.world.pos.y + 20.0f); - EffectSsDeadDb_Spawn(play, &pos, &velAndAccel, &velAndAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, - true); + s32 var_s0; + Vec3f sp88; + Vec3f sp7C; + + sp7C = D_80B37AD0; + this->unk2E8 -= 1; + for (var_s0 = ((s32)this->unk188.animLength - this->unk2E8) >> 1; var_s0 >= 0; var_s0--) { + sp88.x = this->actor.world.pos.x + Rand_CenteredFloat(60.0f); + sp88.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); + sp88.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); + EffectSsDeadDb_Spawn(play, &sp88, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); } } } void func_80B36F40(EnWf* this, PlayState* play) { - if ((this->action == WOLFOS_ACTION_WAIT) && (this->unk_2E2 != 0)) { - this->unk_4D4.y = Math_SinS(this->unk_2E2 * 4200) * 8920.0f; - } else if (this->action != WOLFOS_ACTION_STUNNED) { - if (this->action != WOLFOS_ACTION_SLASH) { - Math_SmoothStepToS(&this->unk_4D4.y, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 1, 1500, 0); - this->unk_4D4.y = CLAMP(this->unk_4D4.y, -0x3127, 0x3127); + if ((this->unk2D4 == 6) && (this->unk2E2 != 0)) { + this->unk4D6 = Math_SinS(this->unk2E2 * 0x1068) * 8920.0f; + } else if (this->unk2D4 != 0xF) { + if (this->unk2D4 != 8) { + Math_SmoothStepToS(&this->unk4D6, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 1, 0x5DC, 0); + this->unk4D6 = CLAMP(this->unk4D6, -0x3127, 0x3127); } else { - this->unk_4D4.y = 0; + this->unk4D6 = 0; } } } -void EnWf_UpdateDamage(EnWf* this, PlayState* play) { - if (this->colliderJntSph.base.acFlags & AC_BOUNCED) { - this->colliderJntSph.base.acFlags &= ~(AC_HIT | AC_BOUNCED); - this->bodyColliderCylinder.base.acFlags &= ~AC_HIT; - this->tailColliderCylinder.base.acFlags &= ~AC_HIT; - } else if ((this->bodyColliderCylinder.base.acFlags & AC_HIT) || - (this->tailColliderCylinder.base.acFlags & AC_HIT)) { - if (this->action >= WOLFOS_ACTION_WAIT) { - s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - - if ((!(this->bodyColliderCylinder.base.acFlags & AC_HIT) && - (this->tailColliderCylinder.base.acFlags & AC_HIT)) || - (ABS(yawDiff) > 19000)) { - this->actor.colChkInfo.damage *= 4; - } - - this->bodyColliderCylinder.base.acFlags &= ~AC_HIT; - this->tailColliderCylinder.base.acFlags &= ~AC_HIT; - - if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_ICE_MAGIC) { - this->damageReaction = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->bodyColliderCylinder.elem, true); +void func_80B37038(EnWf* this, PlayState* play) { + s16 temp_v1; + + if (this->unk304.base.acFlags & AC_BOUNCED) { + this->unk304.base.acFlags &= ~(AC_HIT | AC_BOUNCED); + this->unk424.base.acFlags &= ~AC_HIT; + this->unk470.base.acFlags &= ~AC_HIT; + } else if (((this->unk424.base.acFlags & AC_HIT) || (this->unk470.base.acFlags & AC_HIT)) && (this->unk2D4 >= 6)) { + temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (!((this->unk424.base.acFlags & AC_HIT) || !(this->unk470.base.acFlags & AC_HIT)) || + (ABS(temp_v1) > 0x4A38)) { + this->actor.colChkInfo.damage *= 4; + } + this->unk424.base.acFlags &= ~AC_HIT; + this->unk470.base.acFlags &= ~AC_HIT; + if (this->actor.colChkInfo.damageReaction != 6) { + this->unk2E6 = this->actor.colChkInfo.damageReaction; + Actor_SetDropFlag(&this->actor, &this->unk424.elem, true); #if OOT_VERSION >= PAL_1_0 - this->slashStatus = 0; + this->unk2F8 = 0; #endif - - if ((this->actor.colChkInfo.damageReaction == ENWF_DMG_REACT_STUN) || - (this->actor.colChkInfo.damageReaction == ENWF_DMG_REACT_UNDEF)) { - if (this->action != WOLFOS_ACTION_STUNNED) { - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, - 80); - Actor_ApplyDamage(&this->actor); - EnWf_SetupStunned(this); - } - } else { // LIGHT_MAGIC, FIRE, NONE - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - - if (this->damageReaction == ENWF_DMG_REACT_FIRE) { - this->fireTimer = 40; - } - - if (Actor_ApplyDamage(&this->actor) == 0) { - EnWf_SetupDie(this); - Enemy_StartFinishingBlow(play, &this->actor); - } else { - EnWf_SetupDamaged(this); - } + if ((this->actor.colChkInfo.damageReaction == 1) || (this->actor.colChkInfo.damageReaction == 0xF)) { + if (this->unk2D4 != 0xF) { + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); + Actor_ApplyDamage(&this->actor); + func_80B35D18(this); + } + } else { + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); + if (this->unk2E6 == 0xE) { + this->unk2E4 = 0x28; + } + if (Actor_ApplyDamage(&this->actor) == 0) { + func_80B36C8C(this); + Enemy_StartFinishingBlow(play, &this->actor); + } else { + func_80B35E4C(this); } } } @@ -1321,201 +1234,166 @@ void EnWf_UpdateDamage(EnWf* this, PlayState* play) { } void EnWf_Update(Actor* thisx, PlayState* play) { - s32 pad; EnWf* this = (EnWf*)thisx; + s32 pad; - EnWf_UpdateDamage(this, play); - - if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_ICE_MAGIC) { + func_80B37038(this, play); + if (this->actor.colChkInfo.damageReaction != 6) { Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->actionFunc(this, play); + this->unk2DC(this, play); func_80B36F40(this, play); } - if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { func_800359B8(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); } else { - Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 1000, 0); - Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 1000, 0); + Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x3E8, 0); + Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0x3E8, 0); } - - CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base); - - if (this->action >= WOLFOS_ACTION_WAIT) { - if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - Collider_UpdateCylinder(&this->actor, &this->bodyColliderCylinder); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->tailColliderCylinder.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyColliderCylinder.base); - } + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk304.base); + if ((this->unk2D4 >= 6) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { + Collider_UpdateCylinder(&this->actor, &this->unk424); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk470.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk424.base); } - - if (this->action == WOLFOS_ACTION_BLOCKING) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base); + if (this->unk2D4 == 7) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk304.base); } - - if (this->slashStatus > 0) { - if (!(this->colliderJntSph.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); + if (this->unk2F8 > 0) { + if (!(this->unk304.base.atFlags & AT_BOUNCED)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk304.base); } else { - EnWf_SetupRecoilFromBlockedSlash(this); + func_80B3590C(this); } } - this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 25.0f; - - if (this->eyeIndex == 0) { - if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames % 4) == 0) && (this->actor.colorFilterTimer == 0)) { - this->eyeIndex++; + if (this->unk302 == 0) { + if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { + this->unk302 += 1; } } else { - this->eyeIndex = (this->eyeIndex + 1) & 3; + this->unk302 = (this->unk302 + 1) & 3; } } -s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnWf* this = (EnWf*)thisx; +s32 func_80B37454(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { + EnWf* this = thisx; - if ((limbIndex == WOLFOS_LIMB_HEAD) || (limbIndex == WOLFOS_LIMB_EYES)) { - rot->y -= this->unk_4D4.y; + if ((arg1 == 0x11) || (arg1 == 0x12)) { + arg4->y -= this->unk4D6; } - - return false; + return 0; } -void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - static Vec3f colliderVec = { 1200.0f, 0.0f, 0.0f }; - static Vec3f bodyPartVec = { 0.0f, 0.0f, 0.0f }; - EnWf* this = (EnWf*)thisx; - s32 bodyPartIndex = -1; - - Collider_UpdateSpheres(limbIndex, &this->colliderJntSph); - - if (limbIndex == WOLFOS_LIMB_TAIL) { - Vec3f colliderPos; - - bodyPartIndex = -1; - Matrix_MultVec3f(&colliderVec, &colliderPos); - this->tailColliderCylinder.dim.pos.x = colliderPos.x; - this->tailColliderCylinder.dim.pos.y = colliderPos.y; - this->tailColliderCylinder.dim.pos.z = colliderPos.z; +void func_80B37494(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { + EnWf* this = thisx; + s32 var_v1_sp30; + Vec3f sp24; + Vec3f sp18; + + var_v1_sp30 = -1; + Collider_UpdateSpheres(arg1, &this->unk304); + if (arg1 == 6) { + Matrix_MultVec3f(&D_80B37ADC, &sp24); + this->unk470.dim.pos.x = sp24.x; + this->unk470.dim.pos.y = sp24.y; + this->unk470.dim.pos.z = sp24.z; } - - if ((this->fireTimer != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { - switch (limbIndex) { - case WOLFOS_LIMB_EYES: - bodyPartIndex = 0; + if ((this->unk2E4 != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { + switch (arg1) { + case 18: + var_v1_sp30 = 0; break; - case WOLFOS_LIMB_FRONT_RIGHT_LOWER_LEG: - bodyPartIndex = 1; + case 14: + var_v1_sp30 = 1; break; - case WOLFOS_LIMB_FRONT_LEFT_LOWER_LEG: - bodyPartIndex = 2; + case 20: + var_v1_sp30 = 2; break; - case WOLFOS_LIMB_THORAX: - bodyPartIndex = 3; + case 12: + var_v1_sp30 = 3; break; - case WOLFOS_LIMB_ABDOMEN: - bodyPartIndex = 4; + case 7: + var_v1_sp30 = 4; break; - case WOLFOS_LIMB_TAIL: - bodyPartIndex = 5; + case 6: + var_v1_sp30 = 5; break; - case WOLFOS_LIMB_BACK_RIGHT_SHIN: - bodyPartIndex = 6; + case 9: + var_v1_sp30 = 6; break; case 37: - //! @bug There is no limb with index this large, so bodyPartsPos[7] is uninitialised. Thus a flame will - //! be drawn at 0,0,0 when the Wolfos is on fire. - bodyPartIndex = 7; + var_v1_sp30 = 7; break; - case WOLFOS_LIMB_BACK_RIGHT_PASTERN: - bodyPartIndex = 8; + case 10: + var_v1_sp30 = 8; break; - case WOLFOS_LIMB_BACK_LEFT_PAW: - bodyPartIndex = 9; + case 5: + var_v1_sp30 = 9; break; } - - if (bodyPartIndex >= 0) { - Vec3f bodyPartPos; - - Matrix_MultVec3f(&bodyPartVec, &bodyPartPos); - this->bodyPartsPos[bodyPartIndex].x = bodyPartPos.x; - this->bodyPartsPos[bodyPartIndex].y = bodyPartPos.y; - this->bodyPartsPos[bodyPartIndex].z = bodyPartPos.z; + if (var_v1_sp30 >= 0) { + Matrix_MultVec3f(&D_80B37AE8, &sp18); + this->unk14C[var_v1_sp30].x = sp18.x; + this->unk14C[var_v1_sp30].y = sp18.y; + this->unk14C[var_v1_sp30].z = sp18.z; } } } -static void* sWolfosNormalEyeTextures[] = { gWolfosNormalEyeOpenTex, gWolfosNormalEyeHalfTex, gWolfosNormalEyeNarrowTex, - gWolfosNormalEyeHalfTex }; -static void* sWolfosWhiteEyeTextures[] = { gWolfosWhiteEyeOpenTex, gWolfosWhiteEyeHalfTex, gWolfosWhiteEyeNarrowTex, - gWolfosWhiteEyeHalfTex }; - void EnWf_Draw(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2157); - - // This conditional will always evaluate to true, since unk_300 is false whenever action is - // WOLFOS_ACTION_WAIT_TO_APPEAR. - if ((this->action != WOLFOS_ACTION_WAIT_TO_APPEAR) || !this->unk_300) { + if ((this->unk2D4 != 0) || (this->unk300 == 0)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - - if (this->actor.params == WOLFOS_NORMAL) { - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sWolfosNormalEyeTextures[this->eyeIndex])); + if (this->actor.params == 0) { + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37AF4[this->unk302])); } else { - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sWolfosWhiteEyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37B04[this->unk302])); } - - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, &this->actor); - - if (this->fireTimer != 0) { + SkelAnime_DrawFlexOpa(play, this->unk188.skeleton, this->unk188.jointTable, this->unk188.dListCount, + func_80B37454, func_80B37494, this); + if (this->unk2E4 != 0) { this->actor.colorFilterTimer++; if (1) {} - this->fireTimer--; - - if ((this->fireTimer % 4) == 0) { - s32 fireIndex = this->fireTimer >> 2; + this->unk2E4 -= 1; + if ((this->unk2E4 & 3) == 0) { + s32 v = this->unk2E4 >> 2; - EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->bodyPartsPos[fireIndex], 75, 0, 0, fireIndex); + EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->unk14C[v], 75, 0, 0, v); } } } - CLOSE_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2190); } -s32 EnWf_DodgeRanged(PlayState* play, EnWf* this) { - Actor* actor = Actor_GetProjectileActor(play, &this->actor, 600.0f); - - if (actor != NULL) { - s16 angleToFacing; - s16 pad; - f32 dist; - - angleToFacing = Actor_WorldYawTowardActor(&this->actor, actor) - this->actor.shape.rot.y; - this->actor.world.rot.y = (u16)this->actor.shape.rot.y & 0xFFFF; - dist = Actor_WorldDistXYZToPoint(&this->actor, &actor->world.pos); - - if ((ABS(angleToFacing) < 0x2EE0) && (sqrt(dist) < 400.0)) { - EnWf_SetupBlocking(this); +s32 func_80B37830(PlayState* play, EnWf* this) { + Actor* temp_v0_sp24_real; + s16 temp_a2_sp22; + f32 temp_fv1; + + temp_v0_sp24_real = Actor_GetProjectileActor(play, &this->actor, 600.0f); + if (temp_v0_sp24_real != NULL) { + temp_a2_sp22 = Actor_WorldYawTowardActor(&this->actor, temp_v0_sp24_real) - this->actor.shape.rot.y; + this->actor.world.rot.y = (u16)(s16)(this->actor.shape.rot.y + 0); + temp_fv1 = Actor_WorldDistXYZToPoint(&this->actor, &temp_v0_sp24_real->world.pos); + //! @bug Using sqrt on a non-squared distance + if ((ABS(temp_a2_sp22) < 0x2EE0) && (sqrt((f64)temp_fv1) < 400.0)) { + func_80B36288(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - if ((ABS(angleToFacing) < 0x2000) || (ABS(angleToFacing) > 0x5FFF)) { - EnWf_SetupSidestep(this, play); + if ((ABS(temp_a2_sp22) < 0x2000) || (ABS(temp_a2_sp22) >= 0x6000)) { + func_80B365A8(this, play); this->actor.speed *= 2.0f; - } else if (ABS(angleToFacing) < 0x5FFF) { - EnWf_SetupBackflipAway(this); + } else if (ABS(temp_a2_sp22) < 0x5FFF) { + func_80B35B94(this); } } - return true; + return 1; } - - return false; + return 0; } 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 cc69df8ad49..fc16aa59938 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -6,86 +6,40 @@ struct EnWf; -typedef void (*EnWfActionFunc)(struct EnWf*, struct PlayState*); - -typedef enum EnWfLimb { - /* 0 */ WOLFOS_LIMB_NONE, - /* 1 */ WOLFOS_LIMB_ROOT, - /* 2 */ WOLFOS_LIMB_BACK_LEFT_THIGH, - /* 3 */ WOLFOS_LIMB_BACK_LEFT_SHIN, - /* 4 */ WOLFOS_LIMB_BACK_LEFT_PASTERN, - /* 5 */ WOLFOS_LIMB_BACK_LEFT_PAW, - /* 6 */ WOLFOS_LIMB_TAIL, - /* 7 */ WOLFOS_LIMB_ABDOMEN, - /* 8 */ WOLFOS_LIMB_BACK_RIGHT_THIGH, - /* 9 */ WOLFOS_LIMB_BACK_RIGHT_SHIN, - /* 10 */ WOLFOS_LIMB_BACK_RIGHT_PASTERN, - /* 11 */ WOLFOS_LIMB_BACK_RIGHT_PAW, - /* 12 */ WOLFOS_LIMB_THORAX, - /* 13 */ WOLFOS_LIMB_FRONT_RIGHT_UPPER_LEG, - /* 14 */ WOLFOS_LIMB_FRONT_RIGHT_LOWER_LEG, - /* 15 */ WOLFOS_LIMB_FRONT_RIGHT_CLAW, - /* 16 */ WOLFOS_LIMB_HEAD_ROOT, - /* 17 */ WOLFOS_LIMB_HEAD, - /* 18 */ WOLFOS_LIMB_EYES, - /* 19 */ WOLFOS_LIMB_FRONT_LEFT_UPPER_LEG, - /* 20 */ WOLFOS_LIMB_FRONT_LEFT_LOWER_LEG, - /* 21 */ WOLFOS_LIMB_FRONT_LEFT_CLAW, - /* 22 */ WOLFOS_LIMB_MAX -} EnWfLimb; - -typedef enum EnWfAction { - /* 0 */ WOLFOS_ACTION_WAIT_TO_APPEAR, - /* 2 */ WOLFOS_ACTION_DIE = 2, - /* 3 */ WOLFOS_ACTION_DAMAGED, - /* 4 */ WOLFOS_ACTION_TURN_TOWARDS_PLAYER, - /* 5 */ WOLFOS_ACTION_BACKFLIP_AWAY, - /* 6 */ WOLFOS_ACTION_WAIT, - /* 7 */ WOLFOS_ACTION_BLOCKING, - /* 8 */ WOLFOS_ACTION_SLASH, - /* 9 */ WOLFOS_ACTION_RUN_AT_PLAYER, - /* 10 */ WOLFOS_ACTION_SEARCH_FOR_PLAYER, - /* 11 */ WOLFOS_ACTION_RUN_AROUND_PLAYER, - /* 12 */ WOLFOS_ACTION_RECOIL_FROM_BLOCKED_SLASH, - /* 14 */ WOLFOS_ACTION_SIDESTEP = 14, - /* 15 */ WOLFOS_ACTION_STUNNED -} EnWfAction; - typedef struct EnWf { - /* 0x0000 */ Actor actor; - /* 0x014C */ Vec3s bodyPartsPos[10]; - /* 0x0188 */ SkelAnime skelAnime; - /* 0x01CC */ Vec3s jointTable[WOLFOS_LIMB_MAX]; - /* 0x0250 */ Vec3s morphTable[WOLFOS_LIMB_MAX]; - /* 0x02D4 */ s32 action; // Used instead of checking the actionFunc directly (but also in range comparisons) - /* 0x02D8 */ char unk_2D8[4]; // Unused - /* 0x02DC */ EnWfActionFunc actionFunc; - /* 0x02E0 */ s16 unk_2E0; // Used, but has no effect - /* 0x02E2 */ s16 unk_2E2; - /* 0x02E4 */ s16 fireTimer; - /* 0x02E6 */ u8 damageReaction; - /* 0x02E8 */ s32 actionTimer; // Used to make an action last for a certain amount of time - /* 0x02EC */ f32 runSpeed; - /* 0x02F0 */ char unk_2F0[4]; - /* 0x02F4 */ f32 unk_2F4; // Set and not used - /* 0x02F8 */ s16 slashStatus; // Whether to slash again or not, and whether to cry - /* 0x02FA */ s16 unk_2FA; // Set and not used - /* 0x02FC */ s16 switchFlag; - /* 0x02FE */ s16 runAngle; - /* 0x0300 */ s16 unk_300; // Set, but ineffectual (see comment in Draw) - /* 0x0302 */ u8 eyeIndex; - /* 0x0304 */ ColliderJntSph colliderJntSph; - /* 0x0324 */ ColliderJntSphElement colliderJntSphElements[4]; - /* 0x0424 */ ColliderCylinder bodyColliderCylinder; - /* 0x0470 */ ColliderCylinder tailColliderCylinder; - /* 0x04BC */ Vec3f unk_4BC; - /* 0x04C8 */ Vec3f unk_4C8; - /* 0x04D4 */ Vec3s unk_4D4; -} EnWf; // size = 0x04DC - -typedef enum EnWfType { - /* 0 */ WOLFOS_NORMAL, - /* 1 */ WOLFOS_WHITE -} EnWfType; + /* 0x000 */ Actor actor; + /* 0x14C */ Vec3s unk14C[10]; + /* 0x188 */ SkelAnime unk188; + /* 0x1CC */ Vec3s unk1CC[22]; + /* 0x250 */ Vec3s unk250[22]; + /* 0x2D4 */ s32 unk2D4; + /* 0x2D8 */ char pad2D8[4]; + /* 0x2DC */ void (*unk2DC)(struct EnWf*, struct PlayState*); + /* 0x2E0 */ s16 unk2E0; + /* 0x2E2 */ s16 unk2E2; + /* 0x2E4 */ s16 unk2E4; + /* 0x2E6 */ u8 unk2E6; + /* 0x2E7 */ char pad2E7[1]; + /* 0x2E8 */ s32 unk2E8; + /* 0x2EC */ f32 unk2EC; + /* 0x2F0 */ char pad2F0[4]; + /* 0x2F4 */ f32 unk2F4; + /* 0x2F8 */ s16 unk2F8; + /* 0x2FA */ s16 unk2FA; + /* 0x2FC */ s16 unk2FC; + /* 0x2FE */ s16 unk2FE; + /* 0x300 */ s16 unk300; + /* 0x302 */ u8 unk302; + /* 0x303 */ char pad303[1]; + /* 0x304 */ ColliderJntSph unk304; + /* 0x324 */ ColliderJntSphElement unk324[4]; + /* 0x424 */ ColliderCylinder unk424; + /* 0x470 */ ColliderCylinder unk470; + /* 0x4BC */ Vec3f unk4BC; + /* 0x4C8 */ Vec3f unk4C8; + /* 0x4D4 */ char pad4D4[2]; + /* 0x4D6 */ s16 unk4D6; + /* 0x4D8 */ char pad4D8[4]; +} EnWf; // size = 0x4DC #endif 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 af5cdcaa347..61d3c457809 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -1,7 +1,7 @@ /* * File: z_en_wood02.c * Overlay: ovl_En_Wood02 - * Description: Trees, bushes, leaves + * Description: Trees & Bushes */ #include "z_en_wood02.h" @@ -24,29 +24,19 @@ #define FLAGS 0 -void EnWood02_Init(Actor* thisx, PlayState* play2); +void EnWood02_Init(Actor* thisx, PlayState* play); void EnWood02_Destroy(Actor* thisx, PlayState* play); -void EnWood02_Update(Actor* thisx, PlayState* play2); +void EnWood02_Update(Actor* thisx, PlayState* play); 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 WoodSpawnType { - /* 0 */ WOOD_SPAWN_NORMAL, - /* 1 */ WOOD_SPAWN_SPAWNED, - /* 2 */ WOOD_SPAWN_SPAWNER -} WoodSpawnType; +s32 EnWood02_IsInUncullZone(EnWood02* this, PlayState* play, Vec3f* pos); +void EnWood02_SpawnUnculledChildren(EnWood02* this, PlayState* play); -typedef enum WoodDrawType { - /* 0 */ WOOD_DRAW_TREE_CONICAL, - /* 1 */ WOOD_DRAW_TREE_OVAL, - /* 2 */ WOOD_DRAW_TREE_KAKARIKO_ADULT, - /* 3 */ WOOD_DRAW_BUSH_GREEN, - /* 4 */ WOOD_DRAW_4, // Used for black bushes and green leaves - /* 5 */ WOOD_DRAW_LEAF_YELLOW -} WoodDrawType; +extern Gfx D_6000090[]; +extern Gfx D_6000340[]; +extern Gfx D_6000440[]; +extern Gfx D_6000700[]; +extern Gfx D_6007E20[]; ActorProfile En_Wood02_Profile = { /**/ ACTOR_EN_WOOD02, @@ -59,41 +49,21 @@ ActorProfile En_Wood02_Profile = { /**/ EnWood02_Update, /**/ EnWood02_Draw, }; - -static ColliderCylinderInit sCylinderInit = { - { - COL_MATERIAL_TREE, - AT_NONE, - AC_ON | AC_HARD | AC_TYPE_PLAYER, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK5, - { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x0FC0074A, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_NONE, - ACELEM_ON, - OCELEM_ON, - }, - { 18, 60, 0, { 0, 0, 0 } }, +static ColliderCylinderInit D_80B3BF00 = { + { 0xD, 0, 0xD, 0x39, 0x10, 1 }, + { 5, { 0, 0, 0 }, { 0x0FC0074A, 0, 0 }, 0, 1, 1 }, + { 0x12, 0x3C, 0, { 0, 0, 0 } }, }; - -static f32 sSpawnDistance[] = { 707.0f, 525.0f, 510.0f, 500.0f, 566.0f, 141.0f }; - -static s16 sSpawnAngle[] = { 0x1FFF, 0x4C9E, 0x77F5, 0xA5C9, 0xD6C3, 0xA000 }; - +static f32 sSpawnDistances[] = { 707.0f, 525.0f, 510.0f, 500.0f, 566.0f, 141.0f }; +static s16 sSpawnAngles[] = { 0x1FFF, 0x4C9E, 0x77F5, 0xA5C9, -0x293D, 0xA000 }; static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 5600, ICHAIN_STOP), }; - -static Gfx* D_80B3BF54[] = { +static Gfx* D_80B3BF54[7] = { object_wood02_DL_0078D0, object_wood02_DL_007CA0, object_wood02_DL_0080D0, object_wood02_DL_000090, object_wood02_DL_000340, object_wood02_DL_000340, object_wood02_DL_000700, }; - -static Gfx* D_80B3BF70[] = { +static Gfx* D_80B3BF70[0xC] = { object_wood02_DL_007968, object_wood02_DL_007D38, object_wood02_DL_0081A8, @@ -107,196 +77,189 @@ static Gfx* D_80B3BF70[] = { object_wood02_DL_000440, object_wood02_DL_000700, }; +static f32 sCos; +static f32 sSin; -static f32 sSpawnCos; - -static f32 sSpawnSin; - -s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* pos) { - f32 phi_f12; +s32 EnWood02_IsInUncullZone(EnWood02* this, PlayState* play, Vec3f* pos) { + f32 invW; SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, pos, &this->actor.projectedPos, &this->actor.projectedW); - - phi_f12 = ((this->actor.projectedW == 0.0f) ? 1000.0f : fabsf(1.0f / this->actor.projectedW)); - + if (this->actor.projectedW == 0.0f) { + invW = 1000.0f; + } else { + invW = fabsf(1.0f / this->actor.projectedW); + } if ((-this->actor.cullingVolumeScale < this->actor.projectedPos.z) && (this->actor.projectedPos.z < (this->actor.cullingVolumeDistance + this->actor.cullingVolumeScale)) && - (((fabsf(this->actor.projectedPos.x) - this->actor.cullingVolumeScale) * phi_f12) < 1.0f) && - (((this->actor.projectedPos.y + this->actor.cullingVolumeDownward) * phi_f12) > -1.0f) && - (((this->actor.projectedPos.y - this->actor.cullingVolumeScale) * phi_f12) < 1.0f)) { - return true; + (((fabsf(this->actor.projectedPos.x) - this->actor.cullingVolumeScale) * invW) < 1.0f)) { + if ((((this->actor.projectedPos.y + this->actor.cullingVolumeDownward) * invW) > -1.0f) && + (((this->actor.projectedPos.y - this->actor.cullingVolumeScale) * invW) < 1.0f)) { + return true; + } } return false; } -/** Spawns similar-looking trees or bushes only when the player is sufficiently close. Presumably done this way to keep - * memory usage down in Hyrule Field. */ -void EnWood02_SpawnOffspring(EnWood02* this, PlayState* play) { - EnWood02* childWood; - s16* childSpawnAngle; - Vec3f childPos; - s16 extraRot; - s16 childParams; +void EnWood02_SpawnUnculledChildren(EnWood02* this, PlayState* play) { + s32 pad[2]; + Vec3f newEnWood02Pos; + EnWood02* newEnWood02; + s16 spawnAngleModifier; + s16 newEnWood02Params; s32 i; for (i = 4; i >= 0; i--) { - if ((this->unk_14E[i] & 0x7F) == 0) { - extraRot = 0; - if (this->actor.params == WOOD_BUSH_GREEN_LARGE_SPAWNER) { - extraRot = 0x4000; + if ((this->unk14E[i] & 0x7F) == 0) { + spawnAngleModifier = 0; + if (this->actor.params == EN_WOOD_02_TYPE_15) { + spawnAngleModifier = 0x4000; } - childSpawnAngle = &sSpawnAngle[i]; - sSpawnCos = Math_CosS(*childSpawnAngle + this->actor.world.rot.y + extraRot); - sSpawnSin = Math_SinS(*childSpawnAngle + this->actor.world.rot.y + extraRot); - childPos.x = (sSpawnDistance[i] * sSpawnSin) + this->actor.home.pos.x; - childPos.y = this->actor.home.pos.y; - childPos.z = (sSpawnDistance[i] * sSpawnCos) + this->actor.home.pos.z; - if (EnWood02_SpawnZoneCheck(this, play, &childPos)) { - if ((this->unk_14E[i] & 0x80) != 0) { - childParams = (0xFF00 | (this->actor.params + 1)); + sCos = Math_CosS(sSpawnAngles[i] + this->actor.world.rot.y + spawnAngleModifier); + sSin = Math_SinS(sSpawnAngles[i] + this->actor.world.rot.y + spawnAngleModifier); + newEnWood02Pos.x = (sSpawnDistances[i] * sSin) + this->actor.home.pos.x; + newEnWood02Pos.y = this->actor.home.pos.y; + newEnWood02Pos.z = (sSpawnDistances[i] * sCos) + this->actor.home.pos.z; + if (EnWood02_IsInUncullZone(this, play, &newEnWood02Pos)) { + if (this->unk14E[i] & 0x80) { + newEnWood02Params = ((this->actor.params + 1) | 0xFF00); } else { - childParams = (((this->drawType & 0xF0) << 4) | (this->actor.params + 1)); + newEnWood02Params = (((this->unk154 & 0xF0) * 0x10) | (this->actor.params + 1)); } - childWood = (EnWood02*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_WOOD02, - childPos.x, childPos.y, childPos.z, this->actor.world.rot.x, - *childSpawnAngle, 0, childParams); - if (childWood != NULL) { - childWood->unk_14E[0] = i; - this->unk_14E[i] |= 1; - childWood->actor.projectedPos = this->actor.projectedPos; + newEnWood02 = (EnWood02*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_WOOD02, newEnWood02Pos.x, newEnWood02Pos.y, + newEnWood02Pos.z, this->actor.world.rot.x, sSpawnAngles[i], 0, newEnWood02Params); + if (newEnWood02 != NULL) { + newEnWood02->unk14E[0] = i; + this->unk14E[i] |= 1; + newEnWood02->actor.projectedPos = this->actor.projectedPos; } else { - this->unk_14E[i] &= 0x80; + this->unk14E[i] &= 0x80; } } } } } -void EnWood02_Init(Actor* thisx, PlayState* play2) { - s16 spawnType; - f32 actorScale; - PlayState* play = play2; +void EnWood02_Init(Actor* thisx, PlayState* play) { + s16 var_t0_sp4E; + f32 scale; EnWood02* this = (EnWood02*)thisx; - CollisionPoly* poly; - s32 bgId; f32 floorY; - s16 extraRot; - - spawnType = WOOD_SPAWN_NORMAL; - actorScale = 1.0f; - this->unk_14C = PARAMS_GET_U(this->actor.params, 8, 8); - + CollisionPoly* floorPoly; + s32 floorBgId; + s32 pad; + s16 spawnAngleModifier; + + scale = 1.0f; + var_t0_sp4E = 0; + this->unk14C = 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; - this->unk_14C = -1; - this->actor.world.rot.z = this->actor.shape.rot.z = 0; - } else if (this->unk_14C & 0x80) { - this->unk_14C = -1; + this->actor.shape.rot.z = 0; + this->actor.home.rot.z = (this->actor.home.rot.z << 8) | this->unk14C; + this->unk14C = -1; + this->actor.world.rot.z = this->actor.shape.rot.z; + } else if (this->unk14C & 0x80) { + this->unk14C = -1; } - - this->actor.params &= 0xFF; + this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8); Actor_ProcessInitChain(&this->actor, sInitChain); - - if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + if (this->actor.params < EN_WOOD_02_TYPE_11) { + Collider_InitCylinder(play, &this->unk158); + Collider_SetCylinder(play, &this->unk158, &this->actor, &D_80B3BF00); + var_t0_sp4E = 0; } - switch (this->actor.params) { - case WOOD_BUSH_GREEN_LARGE_SPAWNER: - case WOOD_BUSH_BLACK_LARGE_SPAWNER: - spawnType = 1; + case EN_WOOD_02_TYPE_15: + case EN_WOOD_02_TYPE_21: + var_t0_sp4E = 1; FALLTHROUGH; - case WOOD_BUSH_GREEN_LARGE_SPAWNED: - case WOOD_BUSH_BLACK_LARGE_SPAWNED: - spawnType++; + case EN_WOOD_02_TYPE_16: + case EN_WOOD_02_TYPE_22: + var_t0_sp4E += 1; FALLTHROUGH; - case WOOD_TREE_CONICAL_LARGE: - case WOOD_BUSH_GREEN_LARGE: - case WOOD_BUSH_BLACK_LARGE: - actorScale = 1.5f; + case EN_WOOD_02_TYPE_0: + case EN_WOOD_02_TYPE_12: + case EN_WOOD_02_TYPE_18: + scale = 1.5f; this->actor.cullingVolumeDistance = 4000.0f; this->actor.cullingVolumeScale = 2000.0f; this->actor.cullingVolumeDownward = 2400.0f; break; - case WOOD_TREE_CONICAL_SPAWNER: - case WOOD_TREE_OVAL_YELLOW_SPAWNER: - case WOOD_TREE_OVAL_GREEN_SPAWNER: - case WOOD_BUSH_GREEN_SMALL_SPAWNER: - case WOOD_BUSH_BLACK_SMALL_SPAWNER: - spawnType = 1; + + case EN_WOOD_02_TYPE_3: + case EN_WOOD_02_TYPE_6: + case EN_WOOD_02_TYPE_8: + case EN_WOOD_02_TYPE_13: + case EN_WOOD_02_TYPE_19: + var_t0_sp4E = 1; FALLTHROUGH; - case WOOD_TREE_CONICAL_SPAWNED: - case WOOD_TREE_OVAL_YELLOW_SPAWNED: - case WOOD_TREE_OVAL_GREEN_SPAWNED: - case WOOD_BUSH_GREEN_SMALL_SPAWNED: - case WOOD_BUSH_BLACK_SMALL_SPAWNED: - spawnType++; + case EN_WOOD_02_TYPE_4: + case EN_WOOD_02_TYPE_7: + case EN_WOOD_02_TYPE_9: + case EN_WOOD_02_TYPE_14: + case EN_WOOD_02_TYPE_20: + var_t0_sp4E += 1; FALLTHROUGH; - case WOOD_TREE_CONICAL_MEDIUM: - case WOOD_TREE_OVAL_GREEN: - case WOOD_TREE_KAKARIKO_ADULT: - case WOOD_BUSH_GREEN_SMALL: - case WOOD_BUSH_BLACK_SMALL: + case EN_WOOD_02_TYPE_1: + case EN_WOOD_02_TYPE_5: + case EN_WOOD_02_TYPE_10: + case EN_WOOD_02_TYPE_11: + case EN_WOOD_02_TYPE_17: this->actor.cullingVolumeDistance = 4000.0f; this->actor.cullingVolumeScale = 800.0f; this->actor.cullingVolumeDownward = 1800.0f; break; - case WOOD_TREE_CONICAL_SMALL: - actorScale = 0.6f; + + case EN_WOOD_02_TYPE_2: + scale = 0.6f; this->actor.cullingVolumeDistance = 4000.0f; this->actor.cullingVolumeScale = 400.0f; this->actor.cullingVolumeDownward = 1000.0f; break; - case WOOD_LEAF_GREEN: - case WOOD_LEAF_YELLOW: - this->unk_14E[0] = 0x4B; - actorScale = 0.02f; + + case EN_WOOD_02_TYPE_23: + case EN_WOOD_02_TYPE_24: + this->unk14E[0] = 0x4B; + scale = 0.02f; this->actor.velocity.x = Rand_CenteredFloat(6.0f); this->actor.velocity.z = Rand_CenteredFloat(6.0f); + var_t0_sp4E = 0; this->actor.velocity.y = (Rand_ZeroOne() * 1.25f) + -3.1f; break; } - - if (this->actor.params <= WOOD_TREE_CONICAL_SPAWNED) { - this->drawType = WOOD_DRAW_TREE_CONICAL; - } else if (this->actor.params <= WOOD_TREE_OVAL_GREEN_SPAWNED) { - this->drawType = WOOD_DRAW_TREE_OVAL; - } else if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - this->drawType = WOOD_DRAW_TREE_KAKARIKO_ADULT; - } else if (this->actor.params <= WOOD_BUSH_GREEN_LARGE_SPAWNED) { - this->drawType = WOOD_DRAW_BUSH_GREEN; - } else if (this->actor.params <= WOOD_LEAF_GREEN) { // Black bushes and green leaves - this->drawType = WOOD_DRAW_4; + if (this->actor.params <= EN_WOOD_02_TYPE_4) { + this->unk154 = 0; + } else if (this->actor.params <= EN_WOOD_02_TYPE_9) { + this->unk154 = 1; + } else if (this->actor.params <= EN_WOOD_02_TYPE_10) { + this->unk154 = 2; + } else if (this->actor.params <= EN_WOOD_02_TYPE_16) { + this->unk154 = 3; + } else if (this->actor.params <= EN_WOOD_02_TYPE_23) { + this->unk154 = 4; } else { - this->drawType = WOOD_DRAW_LEAF_YELLOW; + this->unk154 = 5; } - - Actor_SetScale(&this->actor, actorScale); - this->spawnType = spawnType; - - if (spawnType != WOOD_SPAWN_NORMAL) { - extraRot = 0; - - if (this->actor.params == WOOD_BUSH_GREEN_LARGE_SPAWNER) { - extraRot = 0x4000; + Actor_SetScale(&this->actor, scale); + this->unk153 = var_t0_sp4E; + if (var_t0_sp4E != 0) { + spawnAngleModifier = 0; + if (this->actor.params == EN_WOOD_02_TYPE_15) { + spawnAngleModifier = 0x4000; } - - if (spawnType == WOOD_SPAWN_SPAWNER) { - this->drawType |= this->unk_14C << 4; - EnWood02_SpawnOffspring(this, play); - sSpawnCos = Math_CosS(sSpawnAngle[5] + this->actor.world.rot.y + extraRot); - sSpawnSin = Math_SinS(sSpawnAngle[5] + this->actor.world.rot.y + extraRot); - this->actor.world.pos.x += (sSpawnSin * sSpawnDistance[5]); - this->actor.world.pos.z += (sSpawnCos * sSpawnDistance[5]); + if (var_t0_sp4E == 2) { + this->unk154 |= this->unk14C * 0x10; + EnWood02_SpawnUnculledChildren(this, play); + sCos = Math_CosS(sSpawnAngles[5] + this->actor.world.rot.y + spawnAngleModifier); + sSin = Math_SinS(sSpawnAngles[5] + this->actor.world.rot.y + spawnAngleModifier); + this->actor.world.pos.x += sSin * sSpawnDistances[5]; + this->actor.world.pos.z += sCos * sSpawnDistances[5]; } else { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; } - - // Snap to floor, or remove if over void this->actor.world.pos.y += 200.0f; - floorY = BgCheck_EntityRaycastDown4(&play->colCtx, &poly, &bgId, &this->actor, &this->actor.world.pos); - + floorY = + BgCheck_EntityRaycastDown4(&play->colCtx, &floorPoly, &floorBgId, &this->actor, &this->actor.world.pos); if (floorY > BGCHECK_Y_MIN) { this->actor.world.pos.y = floorY; } else { @@ -312,163 +275,148 @@ void EnWood02_Init(Actor* thisx, PlayState* play2) { void EnWood02_Destroy(Actor* thisx, PlayState* play) { EnWood02* this = (EnWood02*)thisx; - if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - Collider_DestroyCylinder(play, &this->collider); + if (this->actor.params < EN_WOOD_02_TYPE_11) { + Collider_DestroyCylinder(play, &this->unk158); } } -void EnWood02_Update(Actor* thisx, PlayState* play2) { - PlayState* play = play2; +void EnWood02_Update(Actor* thisx, PlayState* play) { + s32 pad2; EnWood02* this = (EnWood02*)thisx; - f32 wobbleAmplitude; + f32 sp6C; + u8 v; + u8 var_v0; + s32 pad; - // Despawn extra trees in a group if out of range - if ((this->spawnType == WOOD_SPAWN_SPAWNED) && (this->actor.parent != NULL)) { + if ((this->unk153 == 1) && (this->actor.parent != NULL)) { if (!(this->actor.flags & ACTOR_FLAG_INSIDE_CULLING_VOLUME)) { - u8 new_var = this->unk_14E[0]; - u8 phi_v0 = 0; - s32 pad; - - if (this->unk_14C < 0) { - phi_v0 = 0x80; + v = this->unk14E[0]; + var_v0 = 0; + if (this->unk14C < 0) { + var_v0 = 0x80; } - - ((EnWood02*)this->actor.parent)->unk_14E[new_var] = phi_v0; + ((EnWood02*)this->actor.parent)->unk14E[v] = var_v0; Actor_Kill(&this->actor); return; } - } else if (this->spawnType == WOOD_SPAWN_SPAWNER) { - EnWood02_SpawnOffspring(this, play); + } else if (this->unk153 == 2) { + EnWood02_SpawnUnculledChildren(this, play); } - - if (this->actor.params <= WOOD_TREE_KAKARIKO_ADULT) { - if (this->collider.base.acFlags & AC_HIT) { - this->collider.base.acFlags &= ~AC_HIT; + if (thisx->params < EN_WOOD_02_TYPE_11) { + if (this->unk158.base.acFlags & AC_HIT) { + this->unk158.base.acFlags &= ~AC_HIT; Actor_PlaySfx(&this->actor, NA_SE_IT_REFLECTION_WOOD); } - if (this->actor.home.rot.y != 0) { - Vec3f dropsSpawnPt = this->actor.world.pos; - - dropsSpawnPt.y += 200.0f; - - if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { - Item_DropCollectibleRandom(play, &this->actor, &dropsSpawnPt, - COLLECTIBLE_DROP_RANDOM_PARAMS(this->unk_14C, false)); - } else { - if (this->actor.home.rot.z != 0) { - this->actor.home.rot.z &= 0x1FFF; - this->actor.home.rot.z |= 0xE000; - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, 0, - this->actor.world.rot.y, 0, this->actor.home.rot.z); - this->actor.home.rot.z = 0; - } + Vec3f sp58; + s32 var_s0; + s32 var_v1_sp44_or_sp50; + + sp58 = this->actor.world.pos; + sp58.y += 200.0f; + if ((this->unk14C >= 0) && (this->unk14C < 0x64)) { + Item_DropCollectibleRandom(play, &this->actor, &sp58, + COLLECTIBLE_DROP_RANDOM_PARAMS(this->unk14C, false)); + } else if (this->actor.home.rot.z != 0) { + this->actor.home.rot.z &= 0x1FFF; + this->actor.home.rot.z |= 0xE000; + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, sp58.x, sp58.y, sp58.z, 0, this->actor.world.rot.y, 0, + this->actor.home.rot.z); + this->actor.home.rot.z = 0; } - - // Spawn falling leaves - if (this->unk_14C >= -1) { - s32 i; - s32 leavesParams = WOOD_LEAF_GREEN; - - if ((this->actor.params == WOOD_TREE_OVAL_YELLOW_SPAWNER) || - (this->actor.params == WOOD_TREE_OVAL_YELLOW_SPAWNED)) { - leavesParams = WOOD_LEAF_YELLOW; + var_v1_sp44_or_sp50 = EN_WOOD_02_TYPE_23; + if (this->unk14C >= -1) { + if ((this->actor.params == EN_WOOD_02_TYPE_6) || (this->actor.params == EN_WOOD_02_TYPE_7)) { + var_v1_sp44_or_sp50 = EN_WOOD_02_TYPE_24; } Actor_PlaySfx(&this->actor, NA_SE_EV_TREE_SWING); - - for (i = 3; i >= 0; i--) { - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, dropsSpawnPt.x, dropsSpawnPt.y, dropsSpawnPt.z, - 0, Rand_CenteredFloat(65535.0f), 0, leavesParams); + for (var_s0 = 3; var_s0 >= 0; var_s0--) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WOOD02, sp58.x, sp58.y, sp58.z, 0, + (s16)(s32)Rand_CenteredFloat(65535.0f), 0, var_v1_sp44_or_sp50); } } - this->unk_14C = -0x15; + this->unk14C = -21; this->actor.home.rot.y = 0; } - if (this->actor.xzDistToPlayer < 600.0f) { - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk158); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk158.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk158.base); } - } else if (this->actor.params < 0x17) { // Bush - Player* player = GET_PLAYER(play); - - if (this->unk_14C >= -1) { - if (((player->rideActor == NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 20.0) && - (player->speedXZ != 0.0f)) || - ((player->rideActor != NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 60.0) && - (player->rideActor->speed != 0.0f))) { - if ((this->unk_14C >= 0) && (this->unk_14C < 0x64)) { - Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, - COLLECTIBLE_DROP_RANDOM_PARAMS(this->unk_14C, true)); - } - this->unk_14C = -0x15; - Actor_PlaySfx(&this->actor, NA_SE_EV_TREE_SWING); + } else if (this->actor.params < EN_WOOD_02_TYPE_23) { + Player* player; + + player = GET_PLAYER(play); + if ((this->unk14C >= (-1)) && + (((((player->rideActor == NULL)) && (sqrt(this->actor.xyzDistToPlayerSq) < 20.0)) && + (player->speedXZ != 0.0f)) || + (((player->rideActor != NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 60.0)) && + (player->rideActor->speed != 0.0f)))) { + if ((this->unk14C >= 0) && (this->unk14C < 0x64)) { + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, + COLLECTIBLE_DROP_RANDOM_PARAMS(this->unk14C, true)); } + this->unk14C = -21; + Actor_PlaySfx(&this->actor, NA_SE_EV_TREE_SWING); } - } else { // Leaves - this->unk_14C++; - Math_ApproachF(&this->actor.velocity.x, 0.0f, 1.0f, 5 * 0.01f); - Math_ApproachF(&this->actor.velocity.z, 0.0f, 1.0f, 5 * 0.01f); + } else { + this->unk14C += 1; + Math_ApproachF(&this->actor.velocity.x, 0.0f, 1.0f, 0.049999997f); + Math_ApproachF(&this->actor.velocity.z, 0.0f, 1.0f, 0.049999997f); Actor_UpdatePos(&this->actor); - this->actor.shape.rot.z = Math_SinS(3000 * this->unk_14C) * 0x4000; - this->unk_14E[0]--; - - if (this->unk_14E[0] == 0) { + this->actor.shape.rot.z = (s16)(s32)(Math_SinS((s16)(this->unk14C * 0xBB8)) * 16384.0f); + this->unk14E[0] -= 1; + if (this->unk14E[0] == 0) { Actor_Kill(&this->actor); } } - - // Wobble from impact - if (this->unk_14C < -1) { - this->unk_14C++; - wobbleAmplitude = Math_SinS((this->unk_14C ^ 0xFFFF) * 0x3332) * 250.0f; - this->actor.shape.rot.x = (Math_CosS(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) * wobbleAmplitude); - this->actor.shape.rot.z = (Math_SinS(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) * wobbleAmplitude); + if (this->unk14C < -1) { + this->unk14C += 1; + sp6C = Math_SinS((this->unk14C ^ 0xFFFF) * 0x3332) * 250.0f; + this->actor.shape.rot.x = Math_CosS(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) * sp6C; + this->actor.shape.rot.z = Math_SinS(this->actor.yawTowardsPlayer - this->actor.shape.rot.y) * sp6C; } } void EnWood02_Draw(Actor* thisx, PlayState* play) { - EnWood02* this = (EnWood02*)thisx; + GraphicsContext* gfxCtx; s16 type; - GraphicsContext* gfxCtx = play->state.gfxCtx; - u8 red; - u8 green; - u8 blue; + EnWood02* this = (EnWood02*)thisx; + u8 r; + u8 g; + u8 b; + gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx, "../z_en_wood02.c", 775); type = this->actor.params; - - if ((type == WOOD_TREE_OVAL_GREEN_SPAWNER) || (type == WOOD_TREE_OVAL_GREEN_SPAWNED) || - (type == WOOD_TREE_OVAL_GREEN) || (type == WOOD_LEAF_GREEN)) { - red = 50; - green = 170; - blue = 70; - } else if ((type == WOOD_TREE_OVAL_YELLOW_SPAWNER) || (type == WOOD_TREE_OVAL_YELLOW_SPAWNED) || - (type == WOOD_LEAF_YELLOW)) { - red = 180; - green = 155; - blue = 0; + if ((type == EN_WOOD_02_TYPE_8) || (type == EN_WOOD_02_TYPE_9) || (type == EN_WOOD_02_TYPE_5) || + (type == EN_WOOD_02_TYPE_23)) { + r = 50; + g = 170; + b = 70; + } else if ((type == EN_WOOD_02_TYPE_6) || (type == EN_WOOD_02_TYPE_7) || ((type == EN_WOOD_02_TYPE_24))) { + r = 180; + g = 155; + b = 0; } else { - red = green = blue = 255; + r = g = b = 255; } - Gfx_SetupDL_25Xlu(gfxCtx); - - if ((this->actor.params == WOOD_LEAF_GREEN) || (this->actor.params == WOOD_LEAF_YELLOW)) { + if ((this->actor.params == EN_WOOD_02_TYPE_23) || (this->actor.params == EN_WOOD_02_TYPE_24)) { Gfx_SetupDL_25Opa(gfxCtx); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, red, green, blue, 127); + gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, r, g, b, 127); Gfx_DrawDListOpa(play, object_wood02_DL_000700); - } else if (D_80B3BF70[this->drawType & 0xF] != NULL) { - Gfx_DrawDListOpa(play, D_80B3BF54[this->drawType & 0xF]); - gDPSetEnvColor(POLY_XLU_DISP++, red, green, blue, 0); - MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_wood02.c", 808); - gSPDisplayList(POLY_XLU_DISP++, D_80B3BF70[this->drawType & 0xF]); } else { - Gfx_SetupDL_25Xlu(gfxCtx); - MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_wood02.c", 814); - gSPDisplayList(POLY_XLU_DISP++, D_80B3BF54[this->drawType & 0xF]); + if (D_80B3BF70[this->unk154 & 0xF] != NULL) { + Gfx_DrawDListOpa(play, D_80B3BF54[this->unk154 & 0xF]); + gDPSetEnvColor(POLY_XLU_DISP++, r, g, b, 0); + MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_wood02.c", 808); + gSPDisplayList(POLY_XLU_DISP++, D_80B3BF70[this->unk154 & 0xF]); + } else { + Gfx_SetupDL_25Xlu(gfxCtx); + MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_en_wood02.c", 814); + gSPDisplayList(POLY_XLU_DISP++, D_80B3BF54[this->unk154 & 0xF]); + } } - CLOSE_DISPS(gfxCtx, "../z_en_wood02.c", 840); } 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 d9ebab697a6..61466f818a3 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h @@ -4,45 +4,45 @@ #include "ultra64.h" #include "actor.h" +typedef enum EnWood02Type { + /* 0 */ EN_WOOD_02_TYPE_0, + /* 1 */ EN_WOOD_02_TYPE_1, + /* 2 */ EN_WOOD_02_TYPE_2, + /* 3 */ EN_WOOD_02_TYPE_3, + /* 4 */ EN_WOOD_02_TYPE_4, + /* 5 */ EN_WOOD_02_TYPE_5, + /* 6 */ EN_WOOD_02_TYPE_6, + /* 7 */ EN_WOOD_02_TYPE_7, + /* 8 */ EN_WOOD_02_TYPE_8, + /* 9 */ EN_WOOD_02_TYPE_9, + /* 10 */ EN_WOOD_02_TYPE_10, + /* 11 */ EN_WOOD_02_TYPE_11, + /* 12 */ EN_WOOD_02_TYPE_12, + /* 13 */ EN_WOOD_02_TYPE_13, + /* 14 */ EN_WOOD_02_TYPE_14, + /* 15 */ EN_WOOD_02_TYPE_15, + /* 16 */ EN_WOOD_02_TYPE_16, + /* 17 */ EN_WOOD_02_TYPE_17, + /* 18 */ EN_WOOD_02_TYPE_18, + /* 19 */ EN_WOOD_02_TYPE_19, + /* 20 */ EN_WOOD_02_TYPE_20, + /* 21 */ EN_WOOD_02_TYPE_21, + /* 22 */ EN_WOOD_02_TYPE_22, + /* 23 */ EN_WOOD_02_TYPE_23, + /* 24 */ EN_WOOD_02_TYPE_24, + /* 25 */ EN_WOOD_02_TYPE_MAX +} EnWood02Type; + struct EnWood02; typedef struct EnWood02 { - /* 0x0000 */ Actor actor; - /* 0x014C */ s16 unk_14C; - /* 0x014E */ u8 unk_14E[5]; - /* 0x0153 */ u8 spawnType; - /* 0x0154 */ u8 drawType; - /* 0x0158 */ ColliderCylinder collider; -} EnWood02; // size = 0x01A4 - -// 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 WoodType { - /* 0x00 */ WOOD_TREE_CONICAL_LARGE, - /* 0x01 */ WOOD_TREE_CONICAL_MEDIUM, - /* 0x02 */ WOOD_TREE_CONICAL_SMALL, - /* 0x03 */ WOOD_TREE_CONICAL_SPAWNER, - /* 0x04 */ WOOD_TREE_CONICAL_SPAWNED, - /* 0x05 */ WOOD_TREE_OVAL_GREEN, - /* 0x06 */ WOOD_TREE_OVAL_YELLOW_SPAWNER, - /* 0x07 */ WOOD_TREE_OVAL_YELLOW_SPAWNED, - /* 0x08 */ WOOD_TREE_OVAL_GREEN_SPAWNER, - /* 0x09 */ WOOD_TREE_OVAL_GREEN_SPAWNED, - /* 0x0A */ WOOD_TREE_KAKARIKO_ADULT, - /* 0x0B */ WOOD_BUSH_GREEN_SMALL, - /* 0x0C */ WOOD_BUSH_GREEN_LARGE, - /* 0x0D */ WOOD_BUSH_GREEN_SMALL_SPAWNER, - /* 0x0E */ WOOD_BUSH_GREEN_SMALL_SPAWNED, - /* 0x0F */ WOOD_BUSH_GREEN_LARGE_SPAWNER, - /* 0x10 */ WOOD_BUSH_GREEN_LARGE_SPAWNED, - /* 0x11 */ WOOD_BUSH_BLACK_SMALL, - /* 0x12 */ WOOD_BUSH_BLACK_LARGE, - /* 0x13 */ WOOD_BUSH_BLACK_SMALL_SPAWNER, - /* 0x14 */ WOOD_BUSH_BLACK_SMALL_SPAWNED, - /* 0x15 */ WOOD_BUSH_BLACK_LARGE_SPAWNER, - /* 0x16 */ WOOD_BUSH_BLACK_LARGE_SPAWNED, - /* 0x17 */ WOOD_LEAF_GREEN, - /* 0x18 */ WOOD_LEAF_YELLOW -} WoodType; + /* 0x000 */ Actor actor; + /* 0x14C */ s16 unk14C; + /* 0x14E */ u8 unk14E[5]; + /* 0x153 */ u8 unk153; + /* 0x154 */ u8 unk154; + /* 0x155 */ char pad155[3]; + /* 0x158 */ ColliderCylinder unk158; +} EnWood02; // size = 0x1A4 #endif diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index b2aa276ec77..2c8a2a880ff 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -33,8 +33,8 @@ #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/dungeons/ice_doukutu/ice_doukutu_scene.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED 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 2f68851c97d..21c8bc81bf9 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -32,88 +32,52 @@ void EnZf_Destroy(Actor* thisx, PlayState* play); void EnZf_Update(Actor* thisx, PlayState* play); void EnZf_Draw(Actor* thisx, PlayState* play); -s16 EnZf_FindPlatform(Vec3f* pos, s16 preferredIndex); -void EnZf_SetupDropIn(EnZf* this); -void EnZf_DropIn(EnZf* this, PlayState* play); +s16 func_80B446A8(Vec3f* arg0, s16 arg1); +void func_80B450AC(EnZf* this); +void func_80B45174(EnZf* this, PlayState* play); void func_80B45384(EnZf* this); void func_80B4543C(EnZf* this, PlayState* play); -void EnZf_SetupApproachPlayer(EnZf* this, PlayState* play); -void EnZf_ApproachPlayer(EnZf* this, PlayState* play); -void EnZf_SetupJumpForward(EnZf* this); -void EnZf_JumpForward(EnZf* this, PlayState* play); +void func_80B456B4(EnZf* this, PlayState* play); +void func_80B45748(EnZf* this, PlayState* play); +void func_80B45E30(EnZf* this); +void func_80B45EF0(EnZf* this, PlayState* play); void func_80B4604C(EnZf* this); void func_80B46098(EnZf* this, PlayState* play); void func_80B462E4(EnZf* this, PlayState* play); void func_80B463E4(EnZf* this, PlayState* play); -void EnZf_SetupSlash(EnZf* this); -void EnZf_Slash(EnZf* this, PlayState* play); -void EnZf_RecoilFromBlockedSlash(EnZf* this, PlayState* play); -void EnZf_SetupJumpBack(EnZf* this); -void EnZf_JumpBack(EnZf* this, PlayState* play); -void EnZf_Stunned(EnZf* this, PlayState* play); -void EnZf_SetupSheatheSword(EnZf* this, PlayState* play); -void EnZf_SheatheSword(EnZf* this, PlayState* play); -void EnZf_HopAndTaunt(EnZf* this, PlayState* play); -void EnZf_SetupHopAway(EnZf* this, PlayState* play); -void EnZf_HopAway(EnZf* this, PlayState* play); -void EnZf_DrawSword(EnZf* this, PlayState* play); -void EnZf_Damaged(EnZf* this, PlayState* play); -void EnZf_SetupJumpUp(EnZf* this); -void EnZf_JumpUp(EnZf* this, PlayState* play); +void func_80B46A24(EnZf* this); +void func_80B46AE0(EnZf* this, PlayState* play); +void func_80B46DD4(EnZf* this, PlayState* play); +void func_80B46E8C(EnZf* this); +void func_80B46F2C(EnZf* this, PlayState* play); +void func_80B47120(EnZf* this, PlayState* play); +void func_80B47360(EnZf* this, PlayState* play); +void func_80B4743C(EnZf* this, PlayState* play); +void func_80B47544(EnZf* this, PlayState* play); +void func_80B4779C(EnZf* this, PlayState* play); +void func_80B4781C(EnZf* this, PlayState* play); +void func_80B47CF8(EnZf* this, PlayState* play); +void func_80B47EB4(EnZf* this, PlayState* play); +void func_80B48210(EnZf* this); +void func_80B482B8(EnZf* this, PlayState* play); void func_80B483E4(EnZf* this, PlayState* play); -void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play); -void EnZf_SetupDie(EnZf* this); -void EnZf_Die(EnZf* this, PlayState* play); -void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speedXZ); -s32 EnZf_DodgeRangedEngaging(PlayState* play, EnZf* this); -s32 EnZf_DodgeRangedWaiting(PlayState* play, EnZf* this); - -#define PLATFORM_INDEX_DOWNSTAIRS_MIN 0 -#define PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX 5 -#define PLATFORM_INDEX_DOWNSTAIRS_MAX 7 -#define PLATFORM_INDEX_UPSTAIRS_MIN (PLATFORM_INDEX_DOWNSTAIRS_MAX + 1) -#define PLATFORM_INDEX_UPSTAIRS_INNER_MAX 15 - -/** - * Array of platform positions in Dodongo's Cavern miniboss room. - * 0 - 7 : Downstairs - * 8 - 15 : Upstairs inner platforms - * 16 - 23 : Upstairs outer platforms (including several points on the long thin one) - */ -static Vec3f sPlatformPositions[] = { - // Downstairs - { 3560.0f, 100.0f, -1517.0f }, - { 3170.0f, 100.0f, -1767.0f }, - { 3165.0f, 100.0f, -2217.0f }, - { 3563.0f, 100.0f, -2437.0f }, - { 3946.0f, 100.0f, -2217.0f }, - { 3942.0f, 100.0f, -1765.0f }, - // Westmost downstairs two - { 2861.0f, 100.0f, -2394.0f }, - { 2776.0f, 100.0f, -1987.0f }, - - // Upstairs inner - { 4527.0f, 531.0f, -1146.0f }, - { 4442.0f, 531.0f, -1405.0f }, - { 4170.0f, 531.0f, -1395.0f }, - { 4030.0f, 531.0f, -1162.0f }, - { 4010.0f, 531.0f, -883.0f }, - { 4270.0f, 531.0f, -810.0f }, - { 4520.0f, 531.0f, -880.0f }, - { 4260.0f, 531.0f, -1035.0f }, - - // Upstairs outer - { 4757.0f, 531.0f, -1146.0f }, - { 3850.0f, 531.0f, -883.0f }, - { 4380.0f, 531.0f, -690.0f }, - { 4197.0f, 531.0f, -646.0f }, - { 4070.0f, 531.0f, -1575.0f }, - { 3930.0f, 531.0f, -1705.0f }, - { 3780.0f, 531.0f, -1835.0f }, - { 3560.0f, 531.0f, -1985.0f }, +void func_80B48578(EnZf* this, PlayState* play); +void func_80B48CEC(EnZf* this); +void func_80B48E50(EnZf* this, PlayState* play); +void func_80B49B60(EnZf* this, f32 arg1); +s32 func_80B49C2C(PlayState* play, EnZf* this); +s32 func_80B49E4C(PlayState* play, EnZf* this); + +static Vec3f D_80B4A090[0x18] = { + { 3560.0f, 100.0f, -1517.0f }, { 3170.0f, 100.0f, -1767.0f }, { 3165.0f, 100.0f, -2217.0f }, + { 3563.0f, 100.0f, -2437.0f }, { 3946.0f, 100.0f, -2217.0f }, { 3942.0f, 100.0f, -1765.0f }, + { 2861.0f, 100.0f, -2394.0f }, { 2776.0f, 100.0f, -1987.0f }, { 4527.0f, 531.0f, -1146.0f }, + { 4442.0f, 531.0f, -1405.0f }, { 4170.0f, 531.0f, -1395.0f }, { 4030.0f, 531.0f, -1162.0f }, + { 4010.0f, 531.0f, -883.0f }, { 4270.0f, 531.0f, -810.0f }, { 4520.0f, 531.0f, -880.0f }, + { 4260.0f, 531.0f, -1035.0f }, { 4757.0f, 531.0f, -1146.0f }, { 3850.0f, 531.0f, -883.0f }, + { 4380.0f, 531.0f, -690.0f }, { 4197.0f, 531.0f, -646.0f }, { 4070.0f, 531.0f, -1575.0f }, + { 3930.0f, 531.0f, -1705.0f }, { 3780.0f, 531.0f, -1835.0f }, { 3560.0f, 531.0f, -1985.0f }, }; - -// These seem to relate to the tagging in/out the minibosses do static s16 D_80B4A1B0 = 0; static s16 D_80B4A1B4 = 1; @@ -129,7 +93,7 @@ ActorProfile En_Zf_Profile = { /**/ EnZf_Draw, }; -static ColliderCylinderInit sBodyCylinderInit = { +static ColliderCylinderInit D_80B4A1D8 = { { COL_MATERIAL_HIT0, AT_NONE, @@ -149,7 +113,7 @@ static ColliderCylinderInit sBodyCylinderInit = { { 20, 70, 0, { 0, 0, 0 } }, }; -static ColliderQuadInit sSwordQuadInit = { +static ColliderQuadInit D_80B4A204 = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_ENEMY, @@ -169,206 +133,166 @@ 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 EnZfDamageReaction { - /* 0x0 */ ENZF_DMG_REACT_NONE, - /* 0x1 */ ENZF_DMG_REACT_STUN, - /* 0x6 */ ENZF_DMG_REACT_IMMUNE = 6, // Skips damage code, but also skips the top half of Update - /* 0xD */ ENZF_DMG_REACT_PROJECTILE = 0xD, // Projectiles that don't have another damageeffect - /* 0xF */ ENZF_DMG_REACT_ICE = 0xF -} EnZfDamageReaction; - -static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, ENZF_DMG_REACT_STUN), - /* Deku stick */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Slingshot */ DMG_ENTRY(1, ENZF_DMG_REACT_PROJECTILE), - /* Explosive */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Boomerang */ DMG_ENTRY(0, ENZF_DMG_REACT_STUN), - /* Normal arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Hammer swing */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Hookshot */ DMG_ENTRY(0, ENZF_DMG_REACT_STUN), - /* Kokiri sword */ DMG_ENTRY(1, ENZF_DMG_REACT_NONE), - /* Master sword */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Giant's Knife */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), - /* Fire arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_PROJECTILE), - /* Ice arrow */ DMG_ENTRY(4, ENZF_DMG_REACT_ICE), - /* Light arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_PROJECTILE), - /* Unk arrow 1 */ DMG_ENTRY(2, ENZF_DMG_REACT_PROJECTILE), - /* Unk arrow 2 */ DMG_ENTRY(2, ENZF_DMG_REACT_PROJECTILE), - /* Unk arrow 3 */ DMG_ENTRY(2, ENZF_DMG_REACT_PROJECTILE), - /* Fire magic */ DMG_ENTRY(0, ENZF_DMG_REACT_IMMUNE), - /* Ice magic */ DMG_ENTRY(3, ENZF_DMG_REACT_ICE), - /* Light magic */ DMG_ENTRY(0, ENZF_DMG_REACT_IMMUNE), - /* Shield */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), - /* Mirror Ray */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), - /* Kokiri spin */ DMG_ENTRY(1, ENZF_DMG_REACT_NONE), - /* Giant spin */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), - /* Master spin */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Kokiri jump */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), - /* Giant jump */ DMG_ENTRY(8, ENZF_DMG_REACT_NONE), - /* Master jump */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), - /* Unknown 1 */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), - /* Unblockable */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), - /* Hammer jump */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), - /* Unknown 2 */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), +static DamageTable D_80B4A254 = { + { + 0x10, 2, 0xD1, 2, 0x10, 2, 2, 0x10, 1, 2, 4, 0xD2, 0xF4, 0xD2, 0xD2, 0xD2, + 0xD2, 0x60, 0xF3, 0x60, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, + }, }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80B4A274[3] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP), }; +static AnimationHeader* D_80B4A280[] = { + &object_zf_Anim_01081C, + &object_zf_Anim_010CAC, + &object_zf_Anim_011070, +}; +static Vec3f D_80B4A28C = { 1100.0f, -700.0f, 0.0f }; +static Vec3f D_80B4A298 = { 300.0f, 0.0f, 0.0f }; +static Vec3f D_80B4A2A4 = { 300.0f, -1700.0f, 0.0f }; +static Vec3f D_80B4A2B0 = { -600.0f, 300.0f, 0.0f }; +static Vec3f D_80B4A2BC = { 0.0f, 1500.0f, 0.0f }; +static Vec3f D_80B4A2C8 = { -600.0f, -3000.0f, 1000.0f }; +static Vec3f D_80B4A2D4 = { -600.0f, -3000.0f, -1000.0f }; +static Vec3f D_80B4A2E0 = { 1500.0f, -3000.0f, 0.0f }; +static Vec3f D_80B4A2EC = { 0.0f, 0.0f, 0.0f }; +static Gfx D_80B4A2F8[] = { + gsSPTexture(0xA00, 0xA00, 0, G_TX_RENDERTILE, G_ON), + gsSPEndDisplayList(), +}; +static s32 D_80B4AB30; -static AnimationHeader* sHoppingAnims[] = { &gZfHopCrouchingAnim, &gZfHopLeapingAnim, &gZfHopLandingAnim }; - -static s32 D_80B4AB30; // Set to 0 and incremented in EnZf_HopAway, but not actually used - -void EnZf_SetupAction(EnZf* this, EnZfActionFunc actionFunc) { - this->actionFunc = actionFunc; +void func_80B44050(EnZf* this, void (*arg1)(EnZf*, PlayState*)) { + this->unk3E8 = arg1; } -/** - * Tests if it will still be on a floor after moving forwards a distance determined by dist, in the shape forward - * direction. If `dist` is 0, it defaults to a dist depending on speed direction, and params. - */ -s32 EnZf_PrimaryFloorCheck(EnZf* this, PlayState* play, f32 dist) { - s16 ret; - s16 curBgCheckFlags; - f32 sin; - f32 cos; - Vec3f curPos; - - if (dist == 0.0f) { - dist = ((this->actor.speed >= 0.0f) ? 1.0f : -1.0f); - dist = ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) ? dist * 45.0f : dist * 30.0f); +s32 func_80B44058(EnZf* this, PlayState* play, f32 arg2) { + s16 temp_v1; + s16 sp44; + f32 sp40; + f32 temp_ft2; + Vec3f sp30; + + if (arg2 == 0.0f) { + if (this->actor.speed >= 0.0f) { + arg2 = 1.0f; + } else { + arg2 = -1.0f; + } + if (this->actor.params >= 0) { + arg2 = arg2 * 45.0f; + } else { + arg2 = arg2 * 30.0f; + } } - - // Save currents to restore later - curPos = this->actor.world.pos; - curBgCheckFlags = this->actor.bgCheckFlags; - - sin = Math_SinS(this->actor.world.rot.y) * dist; - cos = Math_CosS(this->actor.world.rot.y) * dist; - - this->actor.world.pos.x += sin; - this->actor.world.pos.z += cos; - + sp30 = this->actor.world.pos; + sp44 = this->actor.bgCheckFlags; + sp40 = Math_SinS(this->actor.world.rot.y) * arg2; + temp_ft2 = Math_CosS(this->actor.world.rot.y) * arg2; + this->actor.world.pos.x += sp40; + this->actor.world.pos.z += temp_ft2; Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->actor.world.pos = curPos; - ret = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - this->actor.bgCheckFlags = curBgCheckFlags; - return ret; + this->actor.world.pos = sp30; + temp_v1 = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + this->actor.bgCheckFlags = sp44; + return temp_v1; } -/** - * Supplementary floor test. - */ -s16 EnZf_SecondaryFloorCheck(EnZf* this, PlayState* play, f32 dist) { - s16 ret; - s16 curBgCheckFlags; - f32 sin; - f32 cos; - Vec3f curPos; - - if ((this->actor.speed != 0.0f) && EnZf_PrimaryFloorCheck(this, play, this->actor.speed)) { +s16 func_80B441C4(EnZf* this, PlayState* play, f32 arg2) { + s16 temp_v0; + s16 sp44; + f32 sp40; + f32 temp_fv0_2; + Vec3f sp30; + + if ((this->actor.speed != 0.0f) && func_80B44058(this, play, this->actor.speed)) { return true; } - - // Save currents to restore later - curPos = this->actor.world.pos; - curBgCheckFlags = this->actor.bgCheckFlags; - - sin = Math_SinS(this->actor.shape.rot.y) * dist; - cos = Math_CosS(this->actor.shape.rot.y) * dist; - - this->actor.world.pos.x += sin; - this->actor.world.pos.z += cos; - + sp30 = this->actor.world.pos; + sp44 = this->actor.bgCheckFlags; + sp40 = Math_SinS(this->actor.shape.rot.y) * arg2; + temp_fv0_2 = Math_CosS(this->actor.shape.rot.y) * arg2; + this->actor.world.pos.x += sp40; + this->actor.world.pos.z += temp_fv0_2; Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->actor.world.pos = curPos; - ret = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - this->actor.bgCheckFlags = curBgCheckFlags; - return ret; + this->actor.world.pos = sp30; + temp_v0 = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + this->actor.bgCheckFlags = sp44; + return temp_v0; } void EnZf_Init(Actor* thisx, PlayState* play) { + f32 temp_fv0; s32 pad; + Player* player; + EffectBlureInit1 sp4C; EnZf* this = (EnZf*)thisx; - Player* player = GET_PLAYER(play); - EffectBlureInit1 blureInit; - f32 posDiff; - - Actor_ProcessInitChain(thisx, sInitChain); - thisx->attentionRangeType = ATTENTION_RANGE_3; - 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 (PARAMS_GET_NOSHIFT(thisx->params, 7, 1)) { - thisx->params |= 0xFF00; - } - - ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawFeet, 90.0f); - this->unk_3E0 = 0; - thisx->colChkInfo.mass = MASS_HEAVY; - thisx->colChkInfo.damageTable = &sDamageTable; - - blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = - blureInit.p2StartColor[0] = blureInit.p2StartColor[1] = blureInit.p2StartColor[2] = blureInit.p1EndColor[0] = - blureInit.p1EndColor[1] = blureInit.p1EndColor[2] = blureInit.p2EndColor[0] = blureInit.p2EndColor[1] = - blureInit.p2EndColor[2] = 255; - blureInit.p2StartColor[3] = 64; - blureInit.p1EndColor[3] = blureInit.p2EndColor[3] = 0; - blureInit.elemDuration = 8; - blureInit.unkFlag = 0; - blureInit.calcMode = 2; - - Effect_Add(play, &this->blureIndex, EFFECT_BLURE1, 0, 0, &blureInit); - - Actor_UpdateBgCheckInfo(play, thisx, 75.0f, 45.0f, 45.0f, + + player = GET_PLAYER(play); + Actor_ProcessInitChain(&this->actor, D_80B4A274); + this->actor.attentionRangeType = ATTENTION_RANGE_3; + this->unk3FC = PARAMS_GET_S(thisx->params, 8, 8); + this->actor.params &= 0xFF; + if (this->actor.params & 0x80) { + this->actor.params |= 0xFF00; + } + ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); + this->unk3E0 = 0; + this->actor.colChkInfo.mass = MASS_HEAVY; + this->actor.colChkInfo.damageTable = &D_80B4A254; + sp4C.p1StartColor[0] = sp4C.p1StartColor[1] = sp4C.p1StartColor[2] = sp4C.p1StartColor[3] = sp4C.p2StartColor[0] = + sp4C.p2StartColor[1] = sp4C.p2StartColor[2] = sp4C.p1EndColor[0] = sp4C.p1EndColor[1] = sp4C.p1EndColor[2] = + sp4C.p2EndColor[0] = sp4C.p2EndColor[1] = sp4C.p2EndColor[2] = 255; + sp4C.p2StartColor[3] = 64; + sp4C.p1EndColor[3] = 0; + sp4C.p2EndColor[3] = 0; + sp4C.elemDuration = 8; + sp4C.unkFlag = 0; + sp4C.calcMode = 2; + Effect_Add(play, &this->unk414, EFFECT_BLURE1, 0U, 0U, &sp4C); + Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 45.0f, 45.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - - this->alpha = 255; - thisx->colChkInfo.cylRadius = 40; - thisx->colChkInfo.cylHeight = 100; - Collider_InitCylinder(play, &this->bodyCollider); - Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylinderInit); - Collider_InitQuad(play, &this->swordCollider); - Collider_SetQuad(play, &this->swordCollider, thisx, &sSwordQuadInit); - - if (thisx->params == ENZF_TYPE_DINOLFOS) { - thisx->colChkInfo.health = 12; - thisx->naviEnemyId = NAVI_ENEMY_DINOLFOS; - SkelAnime_Init(play, &this->skelAnime, &gZfDinolfosSkel, &gZfCryingAnim, this->jointTable, this->morphTable, - ENZF_LIMB_MAX); - } else { // Lizalfos - thisx->colChkInfo.health = 6; - thisx->naviEnemyId = NAVI_ENEMY_LIZALFOS; - SkelAnime_Init(play, &this->skelAnime, &gZfLizalfosSkel, &gZfCryingAnim, this->jointTable, this->morphTable, - ENZF_LIMB_MAX); - } - - if (thisx->params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // Not minibosses - this->homePlatform = this->curPlatform = -1; + this->unk404 = 0xFF; + this->actor.colChkInfo.cylRadius = 40; + this->actor.colChkInfo.cylHeight = 100; + Collider_InitCylinder(play, &this->unk418); + Collider_SetCylinder(play, &this->unk418, &this->actor, &D_80B4A1D8); + Collider_InitQuad(play, &this->unk464); + Collider_SetQuad(play, &this->unk464, &this->actor, &D_80B4A204); + if (this->actor.params == -2) { + this->actor.colChkInfo.health = 12; + this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; + SkelAnime_Init(play, &this->unk14C, &object_zf_Skel_006690, &object_zf_Anim_00B10C, this->unk190, this->unk2B6, + 0x31); + } else { + this->actor.colChkInfo.health = 6; + this->actor.naviEnemyId = NAVI_ENEMY_LIZALFOS; + SkelAnime_Init(play, &this->unk14C, &object_zf_Skel_0104B8, &object_zf_Anim_00B10C, this->unk190, this->unk2B6, + 0x31); + } + if (this->actor.params < 0) { + this->unk3FE = -1; + this->unk400 = this->unk3FE; D_80B4A1B4 = -1; - this->hopAnimIndex = 1; - if (thisx->params == ENZF_TYPE_LIZALFOS_LONE) { - EnZf_SetupDropIn(this); - } else { // Dinolfos + this->unk3E4 = 1; + if (this->actor.params == (-1)) { + func_80B450AC(this); + } else { func_80B45384(this); } - } else { // Minibosses - posDiff = player->actor.world.pos.y - thisx->world.pos.y; - - if ((ABS(posDiff) <= 100.0f) && !Flags_GetSwitch(play, this->clearFlag)) { - this->homePlatform = this->curPlatform = EnZf_FindPlatform(&thisx->world.pos, 0); - EnZf_SetupDropIn(this); + } else { + temp_fv0 = player->actor.world.pos.y - this->actor.world.pos.y; + if ((ABS(temp_fv0) <= 100.0f) && !Flags_GetSwitch(play, this->unk3FC)) { + this->unk400 = this->unk3FE = func_80B446A8(&this->actor.world.pos, 0); + func_80B450AC(this); D_80B4A1B4 = 1; } else { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } } } @@ -376,406 +300,390 @@ void EnZf_Init(Actor* thisx, PlayState* play) { void EnZf_Destroy(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; - if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && + if ((this->actor.params >= 0) && (Actor_FindNearby(play, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { func_800F5B58(); } - - Effect_Delete(play, this->blureIndex); - Collider_DestroyCylinder(play, &this->bodyCollider); - Collider_DestroyQuad(play, &this->swordCollider); + Effect_Delete(play, this->unk414); + Collider_DestroyCylinder(play, &this->unk418); + Collider_DestroyQuad(play, &this->unk464); } -/** - * Finds the index of the platform position in `sPlatformPositions` that is sufficiently close to `pos`. - * Returns `preferedIndex` if the associated position is close enough. - */ -s16 EnZf_FindPlatform(Vec3f* pos, s16 preferredIndex) { - f32 rangeXZ; - s16 i; - - rangeXZ = 210.0f; - - // Upstairs has a smaller range - if (pos->y >= 420.0f) { - rangeXZ = 110.0f; - } - - if (preferredIndex != -1) { - i = preferredIndex; - if (((sPlatformPositions[i].y - 150.0f) <= pos->y) && (pos->y <= (sPlatformPositions[i].y + 150.0f)) && - ((sPlatformPositions[i].x - rangeXZ) <= pos->x) && (pos->x <= (sPlatformPositions[i].x + rangeXZ)) && - ((sPlatformPositions[i].z - rangeXZ) <= pos->z) && (pos->z <= (sPlatformPositions[i].z + rangeXZ))) { - return preferredIndex; - } - } - - for (i = ARRAY_COUNT(sPlatformPositions) - 1; i > -1; i--) { - if (((sPlatformPositions[i].y - 150.0f) <= pos->y) && (pos->y <= (sPlatformPositions[i].y + 150.0f)) && - ((sPlatformPositions[i].x - rangeXZ) <= pos->x) && (pos->x <= (sPlatformPositions[i].x + rangeXZ)) && - ((sPlatformPositions[i].z - rangeXZ) <= pos->z) && (pos->z <= (sPlatformPositions[i].z + rangeXZ))) { +s16 func_80B446A8(Vec3f* arg0, s16 arg1) { + Vec3f* temp_v0; + Vec3f* temp_v0_2; + f32 var_fv0_real; + s16 var_v1; + + var_fv0_real = 210.0f; + if (arg0->y >= 420.0f) { + var_fv0_real = 110.0f; + } + if (arg1 != -1) { + temp_v0 = &D_80B4A090[arg1]; + if (((temp_v0->y - 150.0f) <= arg0->y) && (arg0->y <= (temp_v0->y + 150.0f)) && + ((temp_v0->x - var_fv0_real) <= arg0->x) && (arg0->x <= (temp_v0->x + var_fv0_real)) && + ((temp_v0->z - var_fv0_real) <= arg0->z) && (arg0->z <= (temp_v0->z + var_fv0_real))) { + return arg1; + } + } + for (var_v1 = 0x17; var_v1 >= 0; var_v1--) { + temp_v0_2 = &D_80B4A090[var_v1]; + if (((temp_v0_2->y - 150.0f) <= arg0->y) && (arg0->y <= (temp_v0_2->y + 150.0f)) && + ((temp_v0_2->x - var_fv0_real) <= arg0->x) && (arg0->x <= (temp_v0_2->x + var_fv0_real)) && + ((temp_v0_2->z - var_fv0_real) <= arg0->z) && (arg0->z <= (temp_v0_2->z + var_fv0_real))) { break; } } - return i; + return var_v1; } -s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, PlayState* play) { - f32 distToCurLoopPlatform; - f32 platformMinDist = 585.0f; +s16 func_80B44870(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { + Vec3f* temp_s0; + f32 temp_fv0; + f32 var_fs0; + f32 var_fs1; + f32 var_fs2; + f32 var_fs3; + s16 temp_s0_2; + s16 temp_s3; + s16 temp_v1; + s16 var_s0; + s16 var_s4; + s16 var_s5; + s32 var_s7; // s6 in gc-eu-mq Player* player = GET_PLAYER(play); - s16 initialPlatform = curPlatform; - f32 playerMaxDist = 400.0f; - f32 smallMaxRange = 99998.0f; - s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_INNER_MAX; // Will never retreat to the last two - s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; - f32 largeMaxRange = 99999.0f; - s16 nextPlatform; - s16 altNextPlatform; - s16 playerPlatform; - - altNextPlatform = nextPlatform = -1; - playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, initialPlatform); - - // Set up search constraints - // Upstairs - if (pos->y > 420.0f) { - minIndex = PLATFORM_INDEX_UPSTAIRS_MIN; - playerMaxDist = 50.0f; - - // Upstairs outer - if (initialPlatform >= PLATFORM_INDEX_UPSTAIRS_INNER_MAX) { - curLoopPlatform = ARRAY_COUNT(sPlatformPositions) - 1; - platformMinDist = 400.0f; - } else { // upstairs inner - curLoopPlatform = PLATFORM_INDEX_UPSTAIRS_INNER_MAX - 1; - platformMinDist = 380.0f; - } - } - - for (; curLoopPlatform >= minIndex; curLoopPlatform--) { - if ((curLoopPlatform == initialPlatform) || (curLoopPlatform == playerPlatform)) { + + var_fs2 = 585.0f; + var_fs3 = 400.0f; + var_fs0 = 99998.0f; + var_s0 = 5; + var_s7 = 0; + var_fs1 = 99999.0f; + var_s4 = var_s5 = -1; + temp_s3 = func_80B446A8(&player->actor.world.pos, arg1); + if (arg0->y > 420.0f) { + var_fs3 = 50.0f; + var_s7 = 8; + if (arg1 >= 0xF) { + var_fs2 = 400.0f; + var_s0 = 0x17; + } else { + var_fs2 = 380.0f; + var_s0 = 0xE; + } + } + for (; var_s0 >= var_s7; var_s0--) { +#if !DEBUG_FEATURES + if (0) {} +#endif + if (var_s0 == arg1) { continue; } - if (playerPlatform == -1) { - s16 pad; - - if (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]) < playerMaxDist) { - continue; - } + if (var_s0 == temp_s3) { + continue; } - distToCurLoopPlatform = Math_Vec3f_DistXYZ(pos, &sPlatformPositions[curLoopPlatform]); - - if (platformMinDist < distToCurLoopPlatform) { + if (((temp_s3 == (-1)) && ((Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s0]) < var_fs3)))) { + continue; + } + temp_fv0 = Math_Vec3f_DistXYZ(arg0, &D_80B4A090[var_s0]); + if ((var_fs2 < temp_fv0)) { continue; } - if (distToCurLoopPlatform < smallMaxRange) { - largeMaxRange = smallMaxRange; - altNextPlatform = nextPlatform; - smallMaxRange = distToCurLoopPlatform; - nextPlatform = curLoopPlatform; - } else if (distToCurLoopPlatform < largeMaxRange) { - largeMaxRange = distToCurLoopPlatform; - altNextPlatform = curLoopPlatform; + if (temp_fv0 < var_fs0) { + var_fs1 = var_fs0; + var_s4 = var_s5; + var_fs0 = temp_fv0; + var_s5 = var_s0; + } else if (temp_fv0 < var_fs1) { + var_fs1 = temp_fv0; + var_s4 = var_s0; } } - //! @bug `altNextPlatform` can be -1 in certain conditions and cause an out of bounds access. - //! Under normal conditions, this doesn't cause problems because the data before `sPlatformPositions` + temp_s0 = &D_80B4A090[var_s5]; + + //! @bug `var_s4` can be -1 in certain conditions and cause an out of bounds access. + //! Under normal conditions, this doesn't cause problems because the data before `D_80B4A090` //! is section padding between .text and .data, so 0 gets read as a float. // These two function calls do nothing. Their return values aren't used and they have no side effects. #ifndef AVOID_UB - Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[nextPlatform]); - Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[altNextPlatform]); + Math_Vec3f_DistXYZ(&player->actor.world.pos, temp_s0); + Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s4]); #endif - if (altNextPlatform > 0) { - s16 nextPlatformToPlayerYaw = - Math_Vec3f_Yaw(pos, &sPlatformPositions[nextPlatform]) - Math_Vec3f_Yaw(pos, &player->actor.world.pos); - - if (ABS(nextPlatformToPlayerYaw) < 0x36B0) { - nextPlatform = altNextPlatform; + if (var_s4 > 0) { + temp_s0_2 = Math_Vec3f_Yaw(arg0, temp_s0); + temp_v1 = temp_s0_2 - Math_Vec3f_Yaw(arg0, &player->actor.world.pos); + if (ABS(temp_v1) < 0x36B0) { + var_s5 = var_s4; } } - - if (nextPlatform < 0) { - nextPlatform = arg2; + if (var_s5 < 0) { + var_s5 = arg2; } - return nextPlatform; + return var_s5; } -s16 EnZf_FindNextPlatformTowardsPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, PlayState* play) { - s16 curLoopPlatform = PLATFORM_INDEX_DOWNSTAIRS_MAX; - s16 minIndex = PLATFORM_INDEX_DOWNSTAIRS_MIN; +s32 func_80B44B14(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { + Vec3f* temp_s0; + f32 temp_fv0; + f32 var_fs0; + f32 var_fs1; + f32 var_fs2; + s16 temp_fp; + s16 var_s1; + s16 var_s2; + s16 var_s3; + s16 var_fp; + s32 var_s4; Player* player = GET_PLAYER(play); - s16 nextPlatform = EnZf_FindPlatform(&player->actor.world.pos, -1); - f32 minRange = 500.0f; - f32 smallMaxRange = 99998.0f; - f32 largeMaxRange = 99999.0f; - s16 phi_s2 = curPlatform; - s16 phi_s3 = arg2; - f32 curPlatformDistToPlayer; - - // Upstairs - if (pos->y > 200.0f) { - curLoopPlatform = ARRAY_COUNT(sPlatformPositions) - 1; - minIndex = PLATFORM_INDEX_UPSTAIRS_MIN; - minRange = 290.0f; - } - - for (; curLoopPlatform >= minIndex; curLoopPlatform--) { - if (minRange < Math_Vec3f_DistXYZ(pos, &sPlatformPositions[curLoopPlatform])) { + + var_s1 = 7; + var_s4 = 0; + var_fp = func_80B446A8(&player->actor.world.pos, -1); + var_fs2 = 500.0f; + var_fs0 = 99998.0f; + var_fs1 = 99999.0f; + var_s2 = arg1; + var_s3 = arg2; + if (arg0->y > 200.0f) { + var_fs2 = 290.0f; + var_s1 = 0x17; + var_s4 = 8; + } + for (; var_s1 >= var_s4; var_s1--) { + if (var_fs2 < Math_Vec3f_DistXYZ(arg0, &D_80B4A090[var_s1])) { continue; } - if (curLoopPlatform != nextPlatform) { - curPlatformDistToPlayer = - Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[curLoopPlatform]); - - if (curPlatformDistToPlayer < smallMaxRange) { - largeMaxRange = smallMaxRange; - phi_s3 = phi_s2; - smallMaxRange = curPlatformDistToPlayer; - phi_s2 = curLoopPlatform; - } else if (curPlatformDistToPlayer < largeMaxRange) { - largeMaxRange = curPlatformDistToPlayer; - phi_s3 = curLoopPlatform; + if (var_s1 != var_fp) { + temp_fv0 = Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s1]); + if (temp_fv0 < var_fs0) { + var_fs1 = var_fs0; + var_s3 = var_s2; + var_fs0 = temp_fv0; + var_s2 = var_s1; + } else if (temp_fv0 < var_fs1) { + var_fs1 = temp_fv0; + var_s3 = var_s1; } } else { - phi_s2 = nextPlatform; + var_s2 = var_fp; break; } } - if (phi_s3 != nextPlatform) { - nextPlatform = phi_s2; + if (var_s3 != var_fp) { + var_fp = var_s2; } else { - nextPlatform = phi_s3; + var_fp = var_s3; } - - return nextPlatform; + return var_fp; } -// Player not targeting this or another EnZf? -s32 EnZf_CanAttack(PlayState* play, EnZf* this) { +s32 func_80B44CF0(PlayState* play, EnZf* this) { + s32 pad; + Player* player; Actor* playerFocusActor; - Player* player = GET_PLAYER(play); - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - if (player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { // Hanging or climbing + player = GET_PLAYER(play); + if (this->actor.params >= 0) { + if (player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { return false; } else { return true; } - } else { - if (!Actor_OtherIsLockedOn(play, &this->actor)) { + } + if (!Actor_OtherIsLockedOn(play, &this->actor)) { + return true; + } + if (this->actor.params == -2) { + playerFocusActor = player->focusActor; + if (playerFocusActor == NULL) { + return false; + } + if (playerFocusActor->category != ACTORCAT_ENEMY) { return true; } - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - playerFocusActor = player->focusActor; - if (playerFocusActor == NULL) { - return false; - } else { - if (playerFocusActor->category != ACTORCAT_ENEMY) { - return true; - } - if (playerFocusActor->id != ACTOR_EN_ZF) { - return false; - } else if (playerFocusActor->colorFilterTimer != 0) { - return true; - } - } + if (playerFocusActor->id != ACTOR_EN_ZF) { + return false; + } + if (playerFocusActor->colorFilterTimer != 0) { + return true; } } return false; } void func_80B44DC4(EnZf* this, PlayState* play) { - s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + s16 var_v0; - if (angleDiff < 0) { - angleDiff = -angleDiff; - } - - if (angleDiff >= 0x1B58) { + var_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + var_v0 = ABS(var_v0); + if (var_v0 >= 0x1B58) { func_80B483E4(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && - EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + func_80B44CF0(play, this)) { + func_80B46A24(this); } else { func_80B45384(this); } } -s32 EnZf_ChooseAction(PlayState* play, EnZf* this) { - s16 angleToWall; - Actor* explosive; - - angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; - angleToWall = ABS(angleToWall); +s32 func_80B44E8C(PlayState* play, EnZf* this) { + s16 var_t0_sp2E; + Actor* temp_v0_2_sp28; - if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { + var_t0_sp2E = this->actor.wallYaw - this->actor.shape.rot.y; + var_t0_sp2E = ABS(var_t0_sp2E); + if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y) != 0) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(angleToWall) < 0x2EE0) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_t0_sp2E) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { - EnZf_SetupJumpUp(this); - return true; + func_80B48210(this); } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { - EnZf_SetupJumpUp(this); - return true; + func_80B48210(this); } else { - EnZf_SetupJumpBack(this); - return true; + func_80B46E8C(this); } + return true; } - - explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); - - if (explosive != NULL) { + temp_v0_2_sp28 = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (temp_v0_2_sp28 != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || - (explosive->id == ACTOR_EN_BOM_CHU)) { - if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && - ((s16)((this->actor.shape.rot.y - explosive->world.rot.y) + 0x8000) < 0x3E80)) { - EnZf_SetupJumpUp(this); - return true; + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_t0_sp2E < 0x2EE0)) || + (temp_v0_2_sp28->id == ACTOR_EN_BOM_CHU)) { + if ((temp_v0_2_sp28->id == ACTOR_EN_BOM_CHU) && + (Actor_WorldDistXYZToActor(&this->actor, temp_v0_2_sp28) < 80.0f) && + ((s16)(this->actor.shape.rot.y - temp_v0_2_sp28->world.rot.y + 0x8000) < 0x3E80)) { + func_80B48210(this); } else { - EnZf_SetupCircleAroundPlayer(this, 4.0f); - return true; + func_80B49B60(this, 4.0f); } } else { - EnZf_SetupJumpBack(this); - return true; + func_80B46E8C(this); } + return true; } return false; } -// Setup functions and action functions - -/** - * Set position 300 units above ground and invisible, fade in and drop to ground, fully solid when on ground - */ -void EnZf_SetupDropIn(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfJumpingAnim, 0.0f, 9.0f, Animation_GetLastFrame(&gZfJumpingAnim), +void func_80B450AC(EnZf* this) { + Animation_Change(&this->unk14C, &object_zf_Anim_009530, 0.0f, 9.0f, Animation_GetLastFrame(&object_zf_Anim_009530), ANIMMODE_LOOP, 0.0f); - this->actor.world.pos.y = this->actor.floorHeight + 300.0f; - this->alpha = this->actor.shape.shadowAlpha = 0; - this->unk_3F0 = 10; - this->hopAnimIndex = 1; - this->action = ENZF_ACTION_DROP_IN; + this->unk404 = this->actor.shape.shadowAlpha = 0; + this->unk3F0 = 0xA; + this->unk3E4 = 1; + this->unk3DC = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupAction(this, EnZf_DropIn); + func_80B44050(this, func_80B45174); } -void EnZf_DropIn(EnZf* this, PlayState* play) { - if (this->unk_3F0 == 1) { +void func_80B45174(EnZf* this, PlayState* play) { + if (this->unk3F0 == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - - if (this->actor.params == ENZF_TYPE_LIZALFOS_MINIBOSS_A) { + if (this->actor.params == 0) { func_800F5ACC(NA_BGM_MINI_BOSS); } } - - if (this->unk_3F0 != 0) { - if (this->actor.params != ENZF_TYPE_LIZALFOS_LONE) { - this->unk_3F0--; + if (this->unk3F0 != 0) { + if (this->actor.params != -1) { + this->unk3F0 -= 1; } else if (this->actor.xzDistToPlayer <= 160.0f) { - this->unk_3F0 = 0; + this->unk3F0 = 0; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - this->actor.world.pos.y = this->actor.floorHeight + 300.0f; - } else if (this->alpha < 255) { - this->alpha += 255 / 5; + } else { + if (this->unk404 < 0xFF) { + this->unk404 += 0x33; + } } - - if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->hopAnimIndex != 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->unk3E4 != 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ONGND); - Animation_Change(&this->skelAnime, &gZfLandingAnim, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); - this->hopAnimIndex = 0; + Animation_Change(&this->unk14C, &object_zf_Anim_008C6C, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); + this->unk3E4 = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4F0, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); } - - if (SkelAnime_Update(&this->skelAnime)) { - this->alpha = 255; - if (this->actor.params > ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // Only miniboss B - EnZf_SetupSheatheSword(this, play); + if (SkelAnime_Update(&this->unk14C)) { + this->unk404 = 0xFF; + if (this->actor.params > 0) { + func_80B47360(this, play); } else { func_80B45384(this); } } - this->actor.shape.shadowAlpha = this->alpha; + this->actor.shape.shadowAlpha = this->unk404; } -// stop? and choose an action void func_80B45384(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfCryingAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZfCryingAnim), + Animation_Change(&this->unk14C, &object_zf_Anim_00B10C, 1.0f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_00B10C), ANIMMODE_LOOP_INTERP, -4.0f); - this->action = ENZF_ACTION_3; - this->unk_3F0 = Rand_ZeroOne() * 10.0f + 5.0f; + this->unk3DC = 3; + this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, func_80B4543C); + func_80B44050(this, func_80B4543C); } void func_80B4543C(EnZf* this, PlayState* play) { - Player* player = GET_PLAYER(play); + Player* player; s32 pad; - s16 angleToPlayer = (this->actor.yawTowardsPlayer - this->headRot) - this->actor.shape.rot.y; - - angleToPlayer = ABS(angleToPlayer); - SkelAnime_Update(&this->skelAnime); - - if (!EnZf_DodgeRangedEngaging(play, this)) { - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (this->unk_3F4 != 0) { - this->unk_3F4--; - if (angleToPlayer >= 0x1FFE) { + s16 var_v1_sp26; + s16 var_v1_2; + + player = GET_PLAYER(play); + var_v1_sp26 = (this->actor.yawTowardsPlayer - this->unk3EC) - this->actor.shape.rot.y; + var_v1_sp26 = ABS(var_v1_sp26); + SkelAnime_Update(&this->unk14C); + if (!func_80B49C2C(play, this)) { + if (this->actor.params == -2) { + if (this->unk3F4 != 0) { + this->unk3F4 -= 1; + if (var_v1_sp26 < 0x1FFE) { + this->unk3F4 = 0; + } else { return; } - this->unk_3F4 = 0; - - } else if (EnZf_ChooseAction(play, this)) { + } else if (func_80B44E8C(play, this)) { return; } } - angleToPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; - angleToPlayer = ABS(angleToPlayer); - - if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != 0) && (angleToPlayer >= 0x1F40)) { + var_v1_2 = player->actor.shape.rot.y - this->actor.shape.rot.y; + var_v1_2 = ABS(var_v1_2); + if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != 0) && (var_v1_2 >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; + if (var_v1_2) {} func_80B483E4(this, play); - } else if (this->unk_3F0 != 0) { - this->unk_3F0--; + } else if (this->unk3F0 != 0) { + this->unk3F0 -= 1; } else { - if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) { + if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 100.0f) && (Rand_ZeroOne() < 0.3f)) { - if (this->actor.params == ENZF_TYPE_DINOLFOS) { + if (this->actor.params == -2) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupJumpForward(this); + func_80B45E30(this); } else { func_80B483E4(this, play); } } else if (Rand_ZeroOne() > 0.3f) { - EnZf_SetupApproachPlayer(this, play); + func_80B456B4(this, play); } else { func_80B483E4(this, play); } } else { func_80B4604C(this); } - if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } @@ -783,69 +691,64 @@ void func_80B4543C(EnZf* this, PlayState* play) { } } -void EnZf_SetupApproachPlayer(EnZf* this, PlayState* play) { - Animation_MorphToLoop(&this->skelAnime, &gZfWalkingAnim, -4.0f); - this->action = ENZF_ACTION_APPROACH_PLAYER; - - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - this->nextPlatform = - EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); - this->hopAnimIndex = 0; +void func_80B456B4(EnZf* this, PlayState* play) { + Animation_MorphToLoop(&this->unk14C, &object_zf_Anim_008138, -4.0f); + this->unk3DC = 5; + if (this->actor.params >= 0) { + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + this->unk402 = func_80B44B14(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unk3E4 = 0; } this->actor.speed = 0.0f; - EnZf_SetupAction(this, EnZf_ApproachPlayer); + func_80B44050(this, func_80B45748); } -void EnZf_ApproachPlayer(EnZf* this, PlayState* play) { +void func_80B45748(EnZf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; - s32 afterPrevFrame; - s16 temp_v1; - s16 sp48 = -1; - f32 sp44 = 350.0f; - f32 sp40 = 0.0f; - Player* player = GET_PLAYER(play); - s32 absPlaySpeed; - - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - sp48 = EnZf_FindPlatform(&player->actor.world.pos, sp48); - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, sp48); - + s32 pad1; + s16 var_v1; + s16 sp48; + f32 sp44; + f32 sp40; + Player* player; + f32 absPlaySpeed; + + sp48 = -1; + sp44 = 350.0f; + sp40 = 0.0f; + player = GET_PLAYER(play); + if (this->actor.params >= 0) { + sp48 = func_80B446A8(&player->actor.world.pos, -1); + this->unk3FE = func_80B446A8(&this->actor.world.pos, sp48); if (this->actor.world.pos.y >= 420.0f) { sp44 = 270.0f; } } - - if (!EnZf_DodgeRangedEngaging(play, this)) { - if (sp48 != this->curPlatform) { - this->nextPlatform = - EnZf_FindNextPlatformTowardsPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); - - if ((sp48 < 0) && (this->nextPlatform == this->curPlatform)) { - sp48 = this->curPlatform; + if (!func_80B49C2C(play, this)) { + if (sp48 != this->unk3FE) { + this->unk402 = func_80B44B14(&this->actor.world.pos, this->unk3FE, this->unk400, play); + if ((sp48 < 0) && (this->unk402 == this->unk3FE)) { + sp48 = this->unk3FE; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { - this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer = - Actor_WorldYawTowardPoint(&this->actor, &sPlatformPositions[this->nextPlatform]); - - temp_v1 = this->actor.wallYaw - this->actor.shape.rot.y; - temp_v1 = ABS(temp_v1); - - if ((this->unk_3F8 && (this->actor.speed > 0.0f)) || - ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (temp_v1 >= 0x5C19))) { - if ((Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) < sp44) && - !EnZf_PrimaryFloorCheck(this, play, 191.9956f)) { - EnZf_SetupJumpForward(this); - + this->actor.world.rot.y = this->actor.yawTowardsPlayer = this->actor.shape.rot.y = + Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]); + var_v1 = this->actor.wallYaw - this->actor.shape.rot.y; + if (var_v1 < 0) { + var_v1 *= -1; + } + if ((this->unk3F8 && (this->actor.speed > 0.0f)) || + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_v1 >= 0x5C19))) { + if ((Actor_WorldDistXZToPoint(&this->actor, &D_80B4A090[this->unk402]) < sp44) && + !func_80B44058(this, play, 191.9956f)) { + func_80B45E30(this); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 20.0f; } - return; } else { - this->actor.world.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sPlatformPositions[this->curPlatform]); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk3FE]); } } else { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -853,139 +756,123 @@ void EnZf_ApproachPlayer(EnZf* this, PlayState* play) { } } } - - if (Actor_OtherIsLockedOn(play, &this->actor)) { + if (Actor_OtherIsLockedOn(play, &this->actor) != 0) { sp40 = 100.0f; } - if (this->actor.xzDistToPlayer <= (70.0f + sp40)) { Math_SmoothStepToF(&this->actor.speed, -8.0f, 1.0f, 0.5f, 0.0f); } else { Math_SmoothStepToF(&this->actor.speed, 8.0f, 1.0f, 0.5f, 0.0f); } - - this->skelAnime.playSpeed = this->actor.speed * 1.2f; - - temp_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; - temp_v1 = ABS(temp_v1); - - if ((sp48 == this->curPlatform) && (this->actor.xzDistToPlayer < 150.0f) && (player->meleeWeaponState != 0) && - (temp_v1 >= 0x1F40)) { + this->unk14C.playSpeed = this->actor.speed * 1.2f; + var_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (var_v1 < 0) { + var_v1 *= -1; + } + if ((sp48 == this->unk3FE) && (this->actor.xzDistToPlayer < 150.0f) && (player->meleeWeaponState != 0) && + (var_v1 >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (Rand_ZeroOne() > 0.7f) { func_80B483E4(this, play); return; } } - - prevFrame = (s32)this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - - if (sp48 == this->curPlatform) { - if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { + prevFrame = (s32)this->unk14C.curFrame; + SkelAnime_Update(&this->unk14C); + beforeCurFrame = (s32)(this->unk14C.curFrame - ABS(this->unk14C.playSpeed)); + absPlaySpeed = ((void)0, ABS(this->unk14C.playSpeed)); //! FAKE + if (sp48 == this->unk3FE) { + if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { if (Rand_ZeroOne() > 0.5f) { func_80B462E4(this, play); } else { func_80B45384(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { - if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + if ((Rand_ZeroOne() > 0.05f) && func_80B44CF0(play, this)) { + func_80B46A24(this); } else if (Rand_ZeroOne() > 0.5f) { func_80B483E4(this, play); } else { func_80B45384(this); } - } else { - if (this->unk_3F8) { - func_80B462E4(this, play); - } else if (Rand_ZeroOne() < 0.1f) { - func_80B45384(this); - } + } else if (this->unk3F8) { + func_80B462E4(this, play); + } else if (Rand_ZeroOne() < 0.1f) { + func_80B45384(this); } } - - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (EnZf_ChooseAction(play, this)) { - return; - } - - if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && - Actor_IsFacingPlayer(&this->actor, 0x71C)) { - if (Actor_IsLockedOn(play, &this->actor)) { - if (Rand_ZeroOne() < 0.1f) { - this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupJumpForward(this); + if (this->actor.params == -2) { + if (!func_80B44E8C(play, this)) { + if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && + Actor_IsFacingPlayer(&this->actor, 0x71C)) { + if (Actor_IsLockedOn(play, &this->actor)) { + if (Rand_ZeroOne() < 0.1f) { + this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + func_80B45E30(this); + return; + } + } else { + func_80B483E4(this, play); return; } - } else { - func_80B483E4(this, play); - return; } + } else { + return; } } - if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - - if (prevFrame != (s32)this->skelAnime.curFrame) { - afterPrevFrame = absPlaySpeed + prevFrame; - - if (((beforeCurFrame < 2) && (afterPrevFrame >= 4)) || ((beforeCurFrame < 32) && (afterPrevFrame >= 34))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); - } + if ((prevFrame != (s32)this->unk14C.curFrame) && + (((beforeCurFrame < 2) && (((s32)absPlaySpeed + prevFrame) >= 4)) || + ((beforeCurFrame < 0x20) && (((s32)absPlaySpeed + prevFrame) >= 0x22)))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } } -void EnZf_SetupJumpForward(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfJumpingAnim, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); - this->unk_3F0 = 0; - this->hopAnimIndex = 1; +void func_80B45E30(EnZf* this) { + Animation_Change(&this->unk14C, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); + this->unk3F0 = 0; + this->unk3E4 = 1; this->actor.velocity.y = 15.0f; - - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss + if (this->actor.params >= 0) { this->actor.speed = 16.0f; } else { this->actor.speed = 10.0f; } - - this->action = ENZF_ACTION_JUMP_FORWARD; + this->unk3DC = 0xD; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - EnZf_SetupAction(this, EnZf_JumpForward); + func_80B44050(this, func_80B45EF0); } -void EnZf_JumpForward(EnZf* this, PlayState* play) { - if ((this->unk_3F0 != 0) && (this->actor.world.pos.y <= this->actor.floorHeight)) { - this->actor.world.pos.y = this->actor.floorHeight; - this->hopAnimIndex = 0; - this->actor.velocity.y = 0.0f; - this->actor.speed = 0.0f; +void func_80B45EF0(EnZf* this, PlayState* play) { + if (this->unk3F0 != 0) { + if (this->actor.world.pos.y <= this->actor.floorHeight) { + this->actor.world.pos.y = this->actor.floorHeight; + this->unk3E4 = 0; + this->actor.velocity.y = 0.0f; + this->actor.speed = 0.0f; + } } - - if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk_3F0 == 0) { - Animation_Change(&this->skelAnime, &gZfLandingAnim, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); - this->unk_3F0 = 10; + if (SkelAnime_Update(&this->unk14C)) { + if (this->unk3F0 == 0) { + Animation_Change(&this->unk14C, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + this->unk3F0 = 0xA; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else { this->actor.speed = 0.0f; - this->hopAnimIndex = 0; - EnZf_SetupApproachPlayer(this, play); + this->unk3E4 = 0; + func_80B456B4(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && - (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { - if (EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + if ((this->actor.params == -2) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { + if (func_80B44CF0(play, this)) { + func_80B46A24(this); } else { func_80B483E4(this, play); } @@ -993,263 +880,234 @@ void EnZf_JumpForward(EnZf* this, PlayState* play) { } void func_80B4604C(EnZf* this) { - Animation_MorphToLoop(&this->skelAnime, &gZfWalkingAnim, -4.0f); - this->action = ENZF_ACTION_6; - EnZf_SetupAction(this, func_80B46098); + Animation_MorphToLoop(&this->unk14C, &object_zf_Anim_008138, -4.0f); + this->unk3DC = 6; + func_80B44050(this, func_80B46098); } void func_80B46098(EnZf* this, PlayState* play) { s32 pad; - f32 phi_f2; - Player* player = GET_PLAYER(play); s16 temp_v0; - s16 phi_v1; - - if (!EnZf_DodgeRangedEngaging(play, this)) { - if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - - if (temp_v0 > 0) { - phi_v1 = temp_v0 * 0.25f + 2000.0f; - } else { - phi_v1 = temp_v0 * 0.25f - 2000.0f; - } - - this->actor.shape.rot.y += phi_v1; - this->actor.world.rot.y = this->actor.shape.rot.y; + s16 var_v1; + Player* player; + f32 var_fv1; - if (temp_v0 > 0) { - phi_f2 = phi_v1 * 1.5f; - if (phi_f2 > 2.0f) { - phi_f2 = 2.0f; - } - } else { - phi_f2 = phi_v1 * 1.5f; - if (phi_f2 < -2.0f) { - phi_f2 = -2.0f; - } + player = GET_PLAYER(play); + if (!func_80B49C2C(play, this) && ((this->actor.params != -2) || !func_80B44E8C(play, this))) { + temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (temp_v0 > 0) { + var_v1 = (temp_v0 * 0.25f) + 2000.0f; + } else { + var_v1 = (temp_v0 * 0.25f) - 2000.0f; + } + this->actor.shape.rot.y += var_v1; + this->actor.world.rot.y = this->actor.shape.rot.y; + if (temp_v0 > 0) { + var_fv1 = var_v1 * 1.5f; + if (var_fv1 > 2.0f) { + var_fv1 = 2.0f; } - - this->skelAnime.playSpeed = -phi_f2; - SkelAnime_Update(&this->skelAnime); - - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - if (this->curPlatform != EnZf_FindPlatform(&player->actor.world.pos, -1)) { - EnZf_SetupApproachPlayer(this, play); - return; - } + } else { + var_fv1 = var_v1 * 1.5f; + if (var_fv1 < -2.0f) { + var_fv1 = -2.0f; } - - if (Actor_IsFacingPlayer(&this->actor, 30 * 0x10000 / 360)) { - if (Rand_ZeroOne() > 0.8f) { - func_80B462E4(this, play); - } else { - EnZf_SetupApproachPlayer(this, play); - } + } + this->unk14C.playSpeed = -var_fv1; + SkelAnime_Update(&this->unk14C); + if (this->actor.params >= 0) { + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + if (func_80B446A8(&player->actor.world.pos, -1) != this->unk3FE) { + func_80B456B4(this, play); + return; } - if ((play->gameplayFrames & 0x5F) == 0) { - Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); + } + if (Actor_IsFacingPlayer(&this->actor, 0x1555) != 0) { + if (Rand_ZeroOne() > 0.8f) { + func_80B462E4(this, play); + } else { + func_80B456B4(this, play); } } + if ((play->gameplayFrames & 0x5F) == 0) { + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); + } } } -// Conditional setup function void func_80B462E4(EnZf* this, PlayState* play) { - if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ || - Actor_TestFloorInDirection(&this->actor, play, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || - Actor_TestFloorInDirection(&this->actor, play, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { - Animation_PlayLoop(&this->skelAnime, &gZfSidesteppingAnim); + if ((this->actor.params < 0) || + Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || + Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { + Animation_PlayLoop(&this->unk14C, &object_zf_Anim_016388); this->actor.speed = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_3F0 = Rand_ZeroOne() * 10.0f + 20.0f; - this->hopAnimIndex = 0; - this->action = ENZF_ACTION_7; - this->unk_408 = 0.0f; - EnZf_SetupAction(this, func_80B463E4); + this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 20.0f; + this->unk3E4 = 0; + this->unk3DC = 7; + this->unk408 = 0.0f; + func_80B44050(this, func_80B463E4); } else { - EnZf_SetupApproachPlayer(this, play); + func_80B456B4(this, play); } } void func_80B463E4(EnZf* this, PlayState* play) { - s16 angleBehindPlayer; - s16 phi_v0_3; - s32 pad; - s32 prevFrame; + s16 sp56; s32 beforeCurFrame; - s32 absPlaySpeed; - Player* player = GET_PLAYER(play); - f32 baseRange = 0.0f; - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); + s32 prevFrame; + s32 pad; + f32 absPlaySpeed; + Player* player; + f32 sp3C; + s16 var_v0_3_real; - if (!EnZf_DodgeRangedEngaging(play, this) && - ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this))) { + player = GET_PLAYER(play); + sp3C = 0.0f; + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); + if (!func_80B49C2C(play, this) && ((this->actor.params != -2) || !func_80B44E8C(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; - angleBehindPlayer = player->actor.shape.rot.y + 0x8000; - - if (Math_SinS(angleBehindPlayer - this->actor.shape.rot.y) >= 0.0f) { + sp56 = player->actor.shape.rot.y + 0x8000; + if (Math_SinS(sp56 - this->actor.shape.rot.y) >= 0.0f) { this->actor.speed -= 0.25f; if (this->actor.speed < -8.0f) { this->actor.speed = -8.0f; } - } else if (Math_SinS(angleBehindPlayer - this->actor.shape.rot.y) < 0.0f) { // Superfluous check + } else if (Math_SinS(sp56 - this->actor.shape.rot.y) < 0.0f) { this->actor.speed += 0.25f; if (this->actor.speed > 8.0f) { this->actor.speed = 8.0f; } } - - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - if (this->unk_3F8) { + if (this->actor.params >= 0) { + if (this->unk3F8) { this->actor.speed = -this->actor.speed; } - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || - !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, - this->actor.shape.rot.y + 0x3FFF)) { - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if (this->actor.speed >= 0.0f) { - phi_v0_3 = this->actor.shape.rot.y + 0x3FFF; + } else { + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || + !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { + if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { + if (this->actor.speed >= 0.0f) { + var_v0_3_real = (this->actor.shape.rot.y + 0x3FFF); + } else { + var_v0_3_real = (this->actor.shape.rot.y - 0x3FFF); + } + var_v0_3_real = this->actor.wallYaw - var_v0_3_real; } else { - phi_v0_3 = this->actor.shape.rot.y - 0x3FFF; + var_v0_3_real = 0; + this->actor.speed *= -0.8f; } - phi_v0_3 = this->actor.wallYaw - phi_v0_3; - } else { - this->actor.speed *= -0.8f; - phi_v0_3 = 0; - } - - if (ABS(phi_v0_3) > 0x4000) { - this->actor.speed *= -0.8f; - if (this->actor.speed < 0.0f) { - this->actor.speed -= 0.5f; - } else { - this->actor.speed += 0.5f; + if (ABS(var_v0_3_real) > 0x4000) { + this->actor.speed *= -0.8f; + if (this->actor.speed < 0.0f) { + this->actor.speed -= 0.5f; + } else { + this->actor.speed += 0.5f; + } } } } - - if (Actor_OtherIsLockedOn(play, &this->actor)) { - baseRange = 100.0f; + if (Actor_OtherIsLockedOn(play, &this->actor) != 0) { + sp3C = 100.0f; } - - if (this->actor.xzDistToPlayer <= (70.0f + baseRange)) { - Math_SmoothStepToF(&this->unk_408, -4.0f, 1.0f, 1.5f, 0.0f); - } else if ((90.0f + baseRange) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->unk_408, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (70.0f + sp3C)) { + Math_SmoothStepToF(&this->unk408, -4.0f, 1.0f, 1.5f, 0.0f); + } else if ((90.0f + sp3C) < this->actor.xzDistToPlayer) { + Math_SmoothStepToF(&this->unk408, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk_408, 0.0f, 1.0f, 5.65f, 0.0f); + Math_SmoothStepToF(&this->unk408, 0.0f, 1.0f, 5.65f, 0.0f); } - - if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, play, this->unk_408)) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_408; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_408; + if ((this->unk408 != 0.0f) && !func_80B441C4(this, play, this->unk408)) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk408; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk408; } - - if (ABS(this->actor.speed) >= ABS(this->unk_408)) { - this->skelAnime.playSpeed = this->actor.speed * 0.75f; - } else if (this->skelAnime.playSpeed < 0.0f) { - this->skelAnime.playSpeed = this->unk_408 * -0.75f; + if (ABS(this->actor.speed) >= ABS(this->unk408)) { + this->unk14C.playSpeed = this->actor.speed * 0.75f; + } else if (this->unk14C.playSpeed < 0.0f) { + this->unk14C.playSpeed = this->unk408 * -0.75f; } else { - this->skelAnime.playSpeed = this->unk_408 * 0.75f; + this->unk14C.playSpeed = this->unk408 * 0.75f; } - - prevFrame = (s32)this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - - if (prevFrame != (s32)this->skelAnime.curFrame) { - s32 afterPrevFrame = absPlaySpeed + prevFrame; - - if (((beforeCurFrame < 14) && (afterPrevFrame >= 16)) || - ((beforeCurFrame < 27) && (afterPrevFrame >= 29))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); - } + prevFrame = (s32)this->unk14C.curFrame; + SkelAnime_Update(&this->unk14C); + beforeCurFrame = (s32)(this->unk14C.curFrame - ABS(this->unk14C.playSpeed)); + absPlaySpeed = ABS(this->unk14C.playSpeed); + if ((prevFrame != (s32)this->unk14C.curFrame) && + (((beforeCurFrame < 0xE) && (((s32)absPlaySpeed + prevFrame) >= 0x10)) || + ((beforeCurFrame < 0x1B) && (((s32)absPlaySpeed + prevFrame) >= 0x1D)))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } - if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - - if ((Math_CosS(angleBehindPlayer - this->actor.shape.rot.y) < -0.85f) || (this->unk_3F0 == 0)) { + if ((Math_CosS(sp56 - this->actor.shape.rot.y) < -0.85f) || (this->unk3F0 == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + func_80B44CF0(play, this)) { + func_80B46A24(this); } else { func_80B45384(this); } - } else if (this->unk_3F0 != 0) { - this->unk_3F0--; + } else if (this->unk3F0 != 0) { + this->unk3F0 -= 1; } } } -void EnZf_SetupSlash(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfSlashAnim, 1.25f, 0.0f, Animation_GetLastFrame(&gZfSlashAnim), ANIMMODE_ONCE, - -4.0f); - - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - this->skelAnime.playSpeed = 1.75f; +void func_80B46A24(EnZf* this) { + Animation_Change(&this->unk14C, &object_zf_Anim_00A3D4, 1.25f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_00A3D4), + ANIMMODE_ONCE, -4.0f); + if (this->actor.params == -2) { + this->unk14C.playSpeed = 1.75f; } - - this->swordCollider.base.atFlags &= ~AT_BOUNCED; - this->action = ENZF_ACTION_SLASH; + this->unk464.base.atFlags &= ~AT_BOUNCED; + this->unk3DC = 9; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.speed = 0.0f; - EnZf_SetupAction(this, EnZf_Slash); + func_80B44050(this, func_80B46AE0); } -void EnZf_Slash(EnZf* this, PlayState* play) { - Player* player = GET_PLAYER(play); - s16 rotDiff; - s16 yawDiff; +void func_80B46AE0(EnZf* this, PlayState* play) { + Player* player; + s16 var_v0; + s16 var_v0_2; + player = GET_PLAYER(play); this->actor.speed = 0.0f; - - if ((s32)this->skelAnime.curFrame == 10) { + if ((s32)this->unk14C.curFrame == 10) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } - - if (SkelAnime_Update(&this->skelAnime)) { - EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); - - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && !Actor_IsFacingPlayer(&this->actor, 5460)) { + if (SkelAnime_Update(&this->unk14C)) { + EffectBlure_AddSpace(Effect_GetByIndex(this->unk414)); + if ((this->actor.params == -2) && !Actor_IsFacingPlayer(&this->actor, 0x1554)) { func_80B45384(this); - this->unk_3F0 = Rand_ZeroOne() * 5.0f + 5.0f; - this->unk_3F4 = Rand_ZeroOne() * 20.0f + 100.0f; + this->unk3F0 = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->unk3F4 = (Rand_ZeroOne() * 20.0f) + 100.0f; } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { func_80B45384(this); - this->unk_3F0 = Rand_ZeroOne() * 5.0f + 5.0f; + this->unk3F0 = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (Rand_ZeroOne() > 0.7f) { func_80B483E4(this, play); } else { - rotDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; - rotDiff = ABS(rotDiff); - - if (rotDiff <= 10000) { - yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - yawDiff = ABS(yawDiff); - - if (yawDiff > 16000) { + var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; + var_v0 = ABS(var_v0); + if (var_v0 <= 0x2710) { + var_v0_2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + var_v0_2 = ABS(var_v0_2); + if (var_v0_2 > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B483E4(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_HOSTILE_LOCK_ON | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { - if (this->actor.isLockedOn) { - EnZf_SetupSlash(this); + if (this->actor.isLockedOn != 0) { + func_80B46A24(this); } else { func_80B483E4(this, play); } } else { - EnZf_SetupSlash(this); + func_80B46A24(this); } } else { func_80B483E4(this, play); @@ -1259,49 +1117,50 @@ void EnZf_Slash(EnZf* this, PlayState* play) { } } -void EnZf_SetupRecoilFromBlockedSlash(EnZf* this) { - f32 frame = this->skelAnime.curFrame - 3.0f; +void func_80B46D64(EnZf* this) { + f32 f = this->unk14C.curFrame - 3.0f; - Animation_Change(&this->skelAnime, &gZfSlashAnim, -1.0f, frame, 0.0f, ANIMMODE_ONCE, 0.0f); - this->action = ENZF_ACTION_RECOIL_FROM_BLOCKED_SLASH; - EnZf_SetupAction(this, EnZf_RecoilFromBlockedSlash); + Animation_Change(&this->unk14C, &object_zf_Anim_00A3D4, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); + this->unk3DC = 8; + func_80B44050(this, func_80B46DD4); } -void EnZf_RecoilFromBlockedSlash(EnZf* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime)) { +void func_80B46DD4(EnZf* this, PlayState* play) { + if (SkelAnime_Update(&this->unk14C)) { if (Rand_ZeroOne() > 0.7f) { func_80B45384(this); - } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + } else if ((Rand_ZeroOne() > 0.2f) && func_80B44CF0(play, this)) { + func_80B46A24(this); } else { func_80B483E4(this, play); } } } -void EnZf_SetupJumpBack(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfJumpingAnim, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); - this->unk_3F0 = 0; - this->hopAnimIndex = 1; - this->action = ENZF_ACTION_JUMP_BACK; +void func_80B46E8C(EnZf* this) { + Animation_Change(&this->unk14C, &object_zf_Anim_009530, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); + this->unk3F0 = 0; + this->unk3E4 = 1; + this->unk3DC = 0xB; this->actor.velocity.y = 15.0f; this->actor.speed = -15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - EnZf_SetupAction(this, EnZf_JumpBack); + func_80B44050(this, func_80B46F2C); } -void EnZf_JumpBack(EnZf* this, PlayState* play) { - if ((this->unk_3F0 != 0) && (this->actor.world.pos.y <= this->actor.floorHeight)) { - this->actor.world.pos.y = this->actor.floorHeight; - this->hopAnimIndex = 0; - this->actor.velocity.y = 0.0f; - this->actor.speed = 0.0f; +void func_80B46F2C(EnZf* this, PlayState* play) { + if (this->unk3F0 != 0) { + if (this->actor.world.pos.y <= this->actor.floorHeight) { + this->actor.world.pos.y = this->actor.floorHeight; + this->unk3E4 = 0; + this->actor.velocity.y = 0.0f; + this->actor.speed = 0.0f; + } } - - if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk_3F0 == 0) { - Animation_Change(&this->skelAnime, &gZfLandingAnim, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); - this->unk_3F0 = 10; + if (SkelAnime_Update(&this->unk14C)) { + if (this->unk3F0 == 0) { + Animation_Change(&this->unk14C, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + this->unk3F0 = 0xA; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else if ((play->gameplayFrames % 2) != 0) { func_80B483E4(this, play); @@ -1309,66 +1168,60 @@ void EnZf_JumpBack(EnZf* this, PlayState* play) { func_80B45384(this); } } - if ((play->state.frames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } } -void EnZf_SetupStunned(EnZf* this) { +void func_80B47050(EnZf* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { + (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; - this->hopAnimIndex = 0; + this->unk3E4 = 0; } else { - this->hopAnimIndex = 1; + this->unk3E4 = 1; } - - if (this->damageReaction == ENZF_DMG_REACT_ICE) { - this->iceTimer = 36; + if (this->unk410 == 0xF) { + this->unk3F6 = 0x24; } else { - Animation_PlayOnceSetSpeed(&this->skelAnime, &gZfKnockedBackAnim, 0.0f); + Animation_PlayOnceSetSpeed(&this->unk14C, &object_zf_Anim_0157F8, 0.0f); } - Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->action = ENZF_ACTION_STUNNED; - EnZf_SetupAction(this, EnZf_Stunned); + this->unk3DC = 0xE; + func_80B44050(this, func_80B47120); } -void EnZf_Stunned(EnZf* this, PlayState* play) { - s16 angleToWall; +void func_80B47120(EnZf* this, PlayState* play) { + s16 var_v0; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->hopAnimIndex = 0; + this->unk3E4 = 0; } - if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - EnZf_SetupDie(this); - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { + func_80B48CEC(this); + } else if ((this->actor.params != -2) || !func_80B44E8C(play, this)) { if (D_80B4A1B4 != -1) { func_80B44DC4(this, play); } else { - angleToWall = this->actor.wallYaw - this->actor.shape.rot.y; - angleToWall = ABS(angleToWall); - - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && - (ABS(angleToWall) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { + var_v0 = this->actor.wallYaw - this->actor.shape.rot.y; + var_v0 = ABS(var_v0); + if ((this->actor.params == -2) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + (ABS(var_v0) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupJumpUp(this); - } else if (!EnZf_DodgeRangedEngaging(play, this)) { - if (this->actor.params != ENZF_TYPE_DINOLFOS) { + func_80B48210(this); + } else if (!func_80B49C2C(play, this)) { + if (this->actor.params != -2) { func_80B44DC4(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && - EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + func_80B44CF0(play, this)) { + func_80B46A24(this); } else { func_80B44DC4(this, play); } @@ -1378,169 +1231,149 @@ void EnZf_Stunned(EnZf* this, PlayState* play) { } } -void EnZf_SetupSheatheSword(EnZf* this, PlayState* play) { - f32 morphFrames = 0.0f; - f32 lastFrame = Animation_GetLastFrame(&gZfSheathingSwordAnim); +void func_80B47360(EnZf* this, PlayState* play) { + f32 var_fv0; + f32 temp_fv1; - if (this->action <= ENZF_ACTION_DAMAGED) { - morphFrames = -4.0f; + var_fv0 = 0.0f; + temp_fv1 = Animation_GetLastFrame(&object_zf_Anim_0119F4); + if (this->unk3DC < 0x11) { + var_fv0 = -4.0f; } - - Animation_Change(&this->skelAnime, &gZfSheathingSwordAnim, 2.0f, 0.0f, lastFrame, ANIMMODE_ONCE, morphFrames); - this->action = ENZF_ACTION_SHEATHE_SWORD; + Animation_Change(&this->unk14C, &object_zf_Anim_0119F4, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); + this->unk3DC = 0x12; this->actor.speed = 0.0f; - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_SheatheSword); + func_80B44050(this, func_80B4743C); } -void EnZf_SheatheSword(EnZf* this, PlayState* play) { - s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &sPlatformPositions[this->nextPlatform]) + 0x8000; +void func_80B4743C(EnZf* this, PlayState* play) { + s16 temp_v1; - Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 1000, 0); + temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]) + 0x8000; + Math_SmoothStepToS(&this->actor.world.rot.y, temp_v1, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; - - if (SkelAnime_Update(&this->skelAnime)) { - this->actor.world.rot.y = yaw - 0x8000; - EnZf_SetupHopAway(this, play); - this->swordSheathed = true; + if (SkelAnime_Update(&this->unk14C)) { + this->actor.world.rot.y = temp_v1 - 0x8000; + func_80B4779C(this, play); + this->unk3FA = 1; } } -void EnZf_SetupHopAndTaunt(EnZf* this) { - this->hopAnimIndex = 0; - Animation_MorphToPlayOnce(&this->skelAnime, sHoppingAnims[0], -4.0f); - this->action = ENZF_ACTION_HOP_AND_TAUNT; +void func_80B474E4(EnZf* this) { + this->unk3E4 = 0; + Animation_MorphToPlayOnce(&this->unk14C, D_80B4A280[0], -4.0f); + this->unk3DC = 0x14; this->actor.speed = 0.0f; - this->unk_40C = 0.0f; - this->unk_408 = 0.0f; - EnZf_SetupAction(this, EnZf_HopAndTaunt); + this->unk40C = 0.0f; + this->unk408 = 0.0f; + func_80B44050(this, func_80B47544); } -void EnZf_HopAndTaunt(EnZf* this, PlayState* play) { - f32 lastFrame; - f32 maxDist = 400.0f; +void func_80B47544(EnZf* this, PlayState* play) { + f32 var_fv0; + f32 sp40; + sp40 = 400.0f; Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 4000, 0); - - // Upstairs + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0xFA0, 0); if (this->actor.world.pos.y >= 420.0f) { - maxDist = 250.0f; + sp40 = 250.0f; } - - // If player gets too close, run away - if ((this->actor.xzDistToPlayer < maxDist) && (this->hopAnimIndex != 1)) { + if ((this->actor.xzDistToPlayer < sp40) && (this->unk3E4 != 1)) { this->actor.shape.rot.y = this->actor.world.rot.y; - EnZf_SetupSheatheSword(this, play); + func_80B47360(this, play); } else { - if (this->hopAnimIndex != 1) { - EnZf_DodgeRangedWaiting(play, this); + if (this->unk3E4 != 1) { + func_80B49E4C(play, this); } - - if (SkelAnime_Update(&this->skelAnime)) { - this->hopAnimIndex++; // move on to next animation - - // Loop back to beginning - if (this->hopAnimIndex >= ARRAY_COUNT(sHoppingAnims)) { - this->hopAnimIndex = 0; + if (SkelAnime_Update(&this->unk14C)) { + this->unk3E4 += 1; + if (this->unk3E4 >= 3) { + this->unk3E4 = 0; } - - if ((this->unk_408 != 0.0f) || (this->unk_40C != 0.0f)) { - this->hopAnimIndex = 1; + if ((this->unk408 != 0.0f) || (this->unk40C != 0.0f)) { + this->unk3E4 = 1; } - - lastFrame = Animation_GetLastFrame(sHoppingAnims[this->hopAnimIndex]); - - switch (this->hopAnimIndex) { + var_fv0 = Animation_GetLastFrame(D_80B4A280[this->unk3E4]); + switch (this->unk3E4) { case 0: this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; break; case 1: - this->actor.velocity.y = this->unk_40C + 10.0f; - this->actor.speed = this->unk_408; - this->unk_408 = 0.0f; - this->unk_40C = 0.0f; + this->actor.velocity.y = this->unk40C + 10.0f; + this->actor.speed = this->unk408; + this->unk408 = 0.0f; + this->unk40C = 0.0f; break; case 2: + var_fv0 = 3.0f; this->actor.world.pos.y = this->actor.floorHeight; - lastFrame = 3.0f; - break; - - default: break; } - - Animation_Change(&this->skelAnime, sHoppingAnims[this->hopAnimIndex], 1.5f, 0.0f, lastFrame, ANIMMODE_ONCE, - 0.0f); + Animation_Change(&this->unk14C, D_80B4A280[this->unk3E4], 1.5f, 0.0f, var_fv0, ANIMMODE_ONCE, 0.0f); } - if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } } } -void EnZf_SetupHopAway(EnZf* this, PlayState* play) { - this->hopAnimIndex = 0; - Animation_PlayOnce(&this->skelAnime, sHoppingAnims[0]); - this->action = ENZF_ACTION_HOP_AWAY; - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); - EnZf_SetupAction(this, EnZf_HopAway); +void func_80B4779C(EnZf* this, PlayState* play) { + this->unk3E4 = 0; + Animation_PlayOnce(&this->unk14C, D_80B4A280[0]); + this->unk3DC = 0x13; + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); + func_80B44050(this, func_80B4781C); } -void EnZf_HopAway(EnZf* this, PlayState* play) { +void func_80B4781C(EnZf* this, PlayState* play) { f32 sp74; - f32 sp70 = 1.0f; - f32 phi_f20 = 550.0f; + f32 sp70; + f32 var_fs0; + f32 var_fs0_2; s32 pad; - f32 phi_f20_2; - f32 phi_f0; + f32 var_fv0_sp60; s32 pad2; s16 sp5A; s32 sp54; - s32 temp_v1_2; - s32 phi_v1; - - sp74 = Actor_WorldDistXZToPoint(&this->actor, &sPlatformPositions[this->nextPlatform]); - sp54 = this->hopAnimIndex; + s32 temp_v1_sp50; + s32 var_v1_real_sp4C; + sp70 = 1.0f; + var_fs0 = 550.0f; + sp74 = Actor_WorldDistXZToPoint(&this->actor, &D_80B4A090[this->unk402]); + sp54 = this->unk3E4; if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - - // Upstairs if (this->actor.world.pos.y >= 420.0f) { - phi_f20 = 280.0f; + var_fs0 = 280.0f; } - - sp5A = Actor_WorldYawTowardPoint(&this->actor, &sPlatformPositions[this->nextPlatform]); - - switch (this->hopAnimIndex) { + sp5A = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]); + switch (this->unk3E4) { case 0: this->actor.world.rot.y = sp5A; this->actor.shape.rot.y = sp5A + 0x8000; D_80B4AB30 = 0; - this->homePlatform = this->curPlatform; - temp_v1_2 = !EnZf_PrimaryFloorCheck(this, play, 107.0f); - temp_v1_2 |= !EnZf_PrimaryFloorCheck(this, play, 220.0f) << 1; - this->hopAnimIndex++; - - switch (temp_v1_2) { + this->unk400 = this->unk3FE; + temp_v1_sp50 = 0; + temp_v1_sp50 |= !func_80B44058(this, play, 107.0f) << 0; + temp_v1_sp50 |= !func_80B44058(this, play, 220.0f) << 1; + this->unk3E4 += 1; + switch (temp_v1_sp50) { case 1: - case 1 | 2: + case 3: this->actor.velocity.y = 12.0f; if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y += 8.0f; } - this->actor.speed = 8.0f; break; @@ -1549,23 +1382,24 @@ void EnZf_HopAway(EnZf* this, PlayState* play) { this->actor.speed = 20.0f; break; - default: // 0 - phi_f20_2 = 107.0f; - phi_f20_2 += 10.0f; - phi_f0 = 8.0f; - phi_f0 += 1.2f; - - for (phi_v1 = 20; phi_v1 >= 0; phi_v1--, phi_f20_2 += 10.0f, phi_f0 += 1.2f) { - - if (!EnZf_PrimaryFloorCheck(this, play, phi_f20_2)) { - this->actor.speed = phi_f0; + default: + if (play) {} + var_fs0_2 = 107.0f; + var_fs0_2 += 10.0f; + var_fv0_sp60 = 8.0f; + var_fv0_sp60 += 1.2f; + for (var_v1_real_sp4C = 0x14; var_v1_real_sp4C >= 0; + var_v1_real_sp4C -= 1, var_fs0_2 += 10.0f, var_fv0_sp60 += 1.2f) { + if (!func_80B44058(this, play, var_fs0_2)) { + this->actor.speed = var_fv0_sp60; this->actor.velocity.y = 12.0f; break; } } if (this->actor.speed == 0.0f) { - EnZf_SetupHopAndTaunt(this); + func_80B474E4(this); } + break; } break; @@ -1576,150 +1410,133 @@ void EnZf_HopAway(EnZf* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; this->actor.speed = 0.0f; - Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); - - if (phi_f20 <= this->actor.xzDistToPlayer) { - EnZf_SetupHopAndTaunt(this); - } else if (sp74 < 80.0f) { - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - this->nextPlatform = EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, - this->homePlatform, play); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4F0, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); + if (var_fs0 <= this->actor.xzDistToPlayer) { + func_80B474E4(this); + } else { + if (sp74 < 80.0f) { + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); + } } - - this->hopAnimIndex = 0; + this->unk3E4 = 0; sp70 = 2.0f; } else { Math_SmoothStepToS(&this->actor.world.rot.y, sp5A, 1, 0xFA0, 0); this->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; - D_80B4AB30++; + D_80B4AB30 += 1; } break; case 2: - if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - this->hopAnimIndex = 0; + if (this->unk14C.curFrame == this->unk14C.endFrame) { + this->unk3E4 = 0; } break; } - - if (sp54 != this->hopAnimIndex) { - Animation_PlayOnceSetSpeed(&this->skelAnime, sHoppingAnims[this->hopAnimIndex], sp70); + if (sp54 != this->unk3E4) { + Animation_PlayOnceSetSpeed(&this->unk14C, D_80B4A280[this->unk3E4], sp70); } - - SkelAnime_Update(&this->skelAnime); + SkelAnime_Update(&this->unk14C); } -void EnZf_SetupDrawSword(EnZf* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &gZfDrawingSwordAnim); +void func_80B47C64(EnZf* this, PlayState* play) { + Animation_PlayOnce(&this->unk14C, &object_zf_Anim_01366C); this->actor.world.rot.y += 0x8000; - this->action = ENZF_ACTION_DRAW_SWORD; + this->unk3DC = 0x15; this->actor.speed = 0.0f; - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - this->nextPlatform = - EnZf_FindNextPlatformAwayFromPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); - EnZf_SetupAction(this, EnZf_DrawSword); + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); + func_80B44050(this, func_80B47CF8); } -void EnZf_DrawSword(EnZf* this, PlayState* play) { - s16 yawTowardsPlayer = this->actor.yawTowardsPlayer; +void func_80B47CF8(EnZf* this, PlayState* play) { + s16 sp2E; - if (this->skelAnime.curFrame >= 26.0f) { - Math_SmoothStepToS(&this->actor.shape.rot.y, yawTowardsPlayer, 1, 6000, 0); + sp2E = this->actor.yawTowardsPlayer; + if (this->unk14C.curFrame >= 26.0f) { + Math_SmoothStepToS(&this->actor.shape.rot.y, sp2E, 1, 0x1770, 0); } - - if (SkelAnime_Update(&this->skelAnime)) { + if (SkelAnime_Update(&this->unk14C)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); - this->actor.world.rot.y = yawTowardsPlayer; - this->hopAnimIndex = -1; + this->actor.world.rot.y = sp2E; + this->unk3E4 = -1; func_80B45384(this); } - - if (this->skelAnime.curFrame == 22.0f) { - this->swordSheathed = false; + if (this->unk14C.curFrame == 22.0f) { + this->unk3FA = 0; } } -void EnZf_SetupDamaged(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfKnockedBackAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfKnockedBackAnim), +void func_80B47DA8(EnZf* this) { + Animation_Change(&this->unk14C, &object_zf_Anim_0157F8, 1.5f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_0157F8), ANIMMODE_ONCE, -4.0f); - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { + (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = -4.0f; - this->hopAnimIndex = 0; + this->unk3E4 = 0; } else { - this->hopAnimIndex = 1; + this->unk3E4 = 1; } - - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - this->skelAnime.playSpeed = 4.5f; + if (this->actor.params == -2) { + this->unk14C.playSpeed = 4.5f; } - - if (this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // not miniboss + if (this->actor.params < 0) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; } - Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DAMAGE); - this->action = ENZF_ACTION_DAMAGED; - EnZf_SetupAction(this, EnZf_Damaged); + this->unk3DC = 0x10; + func_80B44050(this, func_80B47EB4); } -void EnZf_Damaged(EnZf* this, PlayState* play) { - s16 wallYawDiff; +void func_80B47EB4(EnZf* this, PlayState* play) { + s16 var_v0; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->hopAnimIndex = 0; + this->unk3E4 = 0; } - - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4500, 0); - - if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) && - SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); + if (((this->actor.params != -2) || !func_80B44E8C(play, this)) && SkelAnime_Update(&this->unk14C) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (D_80B4A1B4 != -1) { - if (this->damageReaction == ENZF_DMG_REACT_PROJECTILE) { - D_80B4A1B0++; + if (this->unk410 == 0xD) { + D_80B4A1B0 += 1; } else { this->actor.world.rot.y = this->actor.shape.rot.y; - - if (!EnZf_PrimaryFloorCheck(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_SetupJumpUp(this); + if (!func_80B44058(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + func_80B48210(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { - EnZf_SetupSlash(this); + func_80B46A24(this); } else { func_80B44DC4(this, play); } } } else { - - wallYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; - wallYawDiff = ABS(wallYawDiff); - - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && - (ABS(wallYawDiff) < 12000) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_SetupJumpUp(this); - } else if (!EnZf_DodgeRangedEngaging(play, this)) { - if (this->actor.params != ENZF_TYPE_DINOLFOS) { + var_v0 = this->actor.wallYaw - this->actor.shape.rot.y; + var_v0 = ABS(var_v0); + if ((this->actor.params == -2) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_v0) < 0x2EE0) && + (this->actor.xzDistToPlayer < 90.0f)) { + func_80B48210(this); + } else if (!func_80B49C2C(play, this)) { + if (this->actor.params != -2) { this->actor.world.rot.y = this->actor.shape.rot.y; - - if (!EnZf_PrimaryFloorCheck(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_SetupJumpUp(this); + if (!func_80B44058(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + func_80B48210(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { - EnZf_SetupSlash(this); + func_80B46A24(this); } else { func_80B44DC4(this, play); } } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); + func_80B44CF0(play, this)) { + func_80B46A24(this); } else { func_80B44DC4(this, play); } @@ -1728,106 +1545,101 @@ void EnZf_Damaged(EnZf* this, PlayState* play) { } } -void EnZf_SetupJumpUp(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfJumpingAnim, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); - this->unk_3F0 = 0; - this->hopAnimIndex = 1; - this->action = ENZF_ACTION_JUMP_UP; +void func_80B48210(EnZf* this) { + Animation_Change(&this->unk14C, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); + this->unk3F0 = 0; + this->unk3E4 = 1; + this->unk3DC = 0x16; this->actor.velocity.y = 22.0f; this->actor.speed = 7.5f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_JumpUp); + func_80B44050(this, func_80B482B8); } -void EnZf_JumpUp(EnZf* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); +void func_80B482B8(EnZf* this, PlayState* play) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(play, &this->leftFootPos); - func_800355B8(play, &this->rightFootPos); + func_800355B8(play, &this->unk4F0); + func_800355B8(play, &this->unk4E4); } - - if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk_3F0 == 0) { - Animation_Change(&this->skelAnime, &gZfSlashAnim, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); - this->unk_3F0 = 10; + if (SkelAnime_Update(&this->unk14C)) { + if (this->unk3F0 == 0) { + Animation_Change(&this->unk14C, &object_zf_Anim_00A3D4, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); + this->unk3F0 = 0xA; } else if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { - this->actor.velocity.y = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; + this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - EnZf_SetupSlash(this); + func_80B46A24(this); Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); - this->skelAnime.curFrame = 13.0f; + this->unk14C.curFrame = 13.0f; } } } -// Conditional setup function void func_80B483E4(EnZf* this, PlayState* play) { - s16 playerRotY; + s16 temp_v1_sp2E; Player* player; + f32 temp_ft3; - if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* not miniboss */ || - Actor_TestFloorInDirection(&this->actor, play, 40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF)) || - Actor_TestFloorInDirection(&this->actor, play, -40.0f, (s16)(this->actor.shape.rot.y + 0x3FFF))) { - Animation_PlayLoop(&this->skelAnime, &gZfSidesteppingAnim); + if ((this->actor.params < 0) || + Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || + Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { + Animation_PlayLoop(&this->unk14C, &object_zf_Anim_016388); player = GET_PLAYER(play); - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 4000, 1); - playerRotY = player->actor.shape.rot.y; - - if (Math_SinS(playerRotY - this->actor.shape.rot.y) >= 0.0f) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); + temp_v1_sp2E = player->actor.shape.rot.y; + if (Math_SinS(temp_v1_sp2E - this->actor.shape.rot.y) >= 0.0f) { this->actor.speed = -6.0f; - } else if (Math_SinS(playerRotY - this->actor.shape.rot.y) < 0.0f) { // Superfluous check + } else if (Math_SinS(temp_v1_sp2E - this->actor.shape.rot.y) < 0.0f) { this->actor.speed = 6.0f; } - - this->unk_408 = 0.0f; - this->hopAnimIndex = 0; + this->unk408 = 0.0f; + this->unk3E4 = 0; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - this->unk_3F0 = Rand_ZeroOne() * 10.0f + 5.0f; - this->action = ENZF_ACTION_CIRCLE_AROUND_PLAYER; - EnZf_SetupAction(this, EnZf_CircleAroundPlayer); + this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->unk3DC = 0xC; + func_80B44050(this, func_80B48578); } else { - EnZf_SetupApproachPlayer(this, play); + func_80B456B4(this, play); } } -void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { - s16 playerRot; - s16 phi_v0_4; - Player* player = GET_PLAYER(play); +void func_80B48578(EnZf* this, PlayState* play) { + s16 temp_t0_sp56; + s16 var_v0; + Player* player; s32 prevFrame; s32 beforeCurFrame; - s32 absPlaySpeed; - f32 baseRange = 0.0f; + s32 pad; + f32 sp40; + f32 absPlaySpeed; + player = GET_PLAYER(play); + sp40 = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); - playerRot = player->actor.shape.rot.y; - - if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - if (this->unk_3F8) { + temp_t0_sp56 = player->actor.shape.rot.y; + if (this->actor.params >= 0) { + if (this->unk3F8) { this->actor.speed = -this->actor.speed; } } else { - s16 pad; - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speed >= 0.0f) { - phi_v0_4 = this->actor.shape.rot.y + 0x3FFF; + var_v0 = this->actor.shape.rot.y + 0x3FFF; } else { - phi_v0_4 = this->actor.shape.rot.y - 0x3FFF; + var_v0 = this->actor.shape.rot.y - 0x3FFF; } - - phi_v0_4 = this->actor.wallYaw - phi_v0_4; + var_v0 = this->actor.wallYaw - var_v0; } else { + var_v0 = 0; this->actor.speed *= -0.8f; - phi_v0_4 = 0; } - - if (ABS(phi_v0_4) > 0x4000) { + if (ABS(var_v0) > 0x4000) { this->actor.speed *= -0.8f; if (this->actor.speed < 0.0f) { this->actor.speed -= 0.5f; @@ -1836,95 +1648,88 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { } } } +#if !DEBUG_FEATURES + if (1) {} //! FAKE +#endif } - - if (Math_SinS(playerRot - this->actor.shape.rot.y) >= 0.0f) { + if (Math_SinS(temp_t0_sp56 - this->actor.shape.rot.y) >= 0.0f) { this->actor.speed += 0.125f; } else { this->actor.speed -= 0.125f; } - this->actor.world.rot.y = this->actor.shape.rot.y + 0x4000; - - if (Actor_OtherIsLockedOn(play, &this->actor)) { - baseRange = 100.0f; + if (Actor_OtherIsLockedOn(play, &this->actor) != 0) { + sp40 = 100.0f; } - - if (this->actor.xzDistToPlayer <= (70.0f + baseRange)) { - Math_SmoothStepToF(&this->unk_408, -4.0f, 1.0f, 1.5f, 0.0f); - } else if ((90.0f + baseRange) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->unk_408, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (70.0f + sp40)) { + Math_SmoothStepToF(&this->unk408, -4.0f, 1.0f, 1.5f, 0.0f); + } else if ((90.0f + sp40) < this->actor.xzDistToPlayer) { + Math_SmoothStepToF(&this->unk408, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk_408, 0.0f, 1.0f, 5.65f, 0.0f); + Math_SmoothStepToF(&this->unk408, 0.0f, 1.0f, 5.65f, 0.0f); } - - if ((this->unk_408 != 0.0f) && !EnZf_SecondaryFloorCheck(this, play, this->unk_408)) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_408; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_408; + if ((this->unk408 != 0.0f) && !func_80B441C4(this, play, this->unk408)) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk408; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk408; } - - if (ABS(this->actor.speed) >= ABS(this->unk_408)) { - this->skelAnime.playSpeed = -this->actor.speed * 0.75f; - } else if (this->skelAnime.playSpeed < 0.0f) { - this->skelAnime.playSpeed = this->unk_408 * -0.75f; + if (ABS(this->actor.speed) >= ABS(this->unk408)) { + this->unk14C.playSpeed = -this->actor.speed * 0.75f; } else { - this->skelAnime.playSpeed = this->unk_408 * 0.75f; + if (this->unk14C.playSpeed < 0.0f) { + this->unk14C.playSpeed = this->unk408 * -0.75f; + } else { + this->unk14C.playSpeed = this->unk408 * 0.75f; + } } - - prevFrame = (s32)this->skelAnime.curFrame; - SkelAnime_Update(&this->skelAnime); - beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); - absPlaySpeed = (s32)(f32)ABS(this->skelAnime.playSpeed); - - this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); - - if (EnZf_FindPlatform(&player->actor.world.pos, -1) != this->curPlatform) { + prevFrame = (s32)this->unk14C.curFrame; + SkelAnime_Update(&this->unk14C); + beforeCurFrame = (s32)(this->unk14C.curFrame - ABS(this->unk14C.playSpeed)); + absPlaySpeed = ((void)0, ABS(this->unk14C.playSpeed)); //! FAKE + this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); + if (func_80B446A8(&player->actor.world.pos, -1) != this->unk3FE) { this->actor.speed = 0.0f; - - if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && - (D_80B4A1B4 == this->actor.params)) { - EnZf_SetupHopAndTaunt(this); + if ((this->actor.params >= 0) && (D_80B4A1B4 == this->actor.params)) { + func_80B474E4(this); } else { - EnZf_SetupApproachPlayer(this, play); + func_80B456B4(this, play); } - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_ChooseAction(play, this)) { - if (this->unk_3F0 == 0) { - phi_v0_4 = player->actor.shape.rot.y - this->actor.shape.rot.y; - - phi_v0_4 = ABS(phi_v0_4); - - if (phi_v0_4 >= 0x3A98) { - if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) && (D_80B4A1B4 == this->actor.params)) { - EnZf_SetupHopAndTaunt(this); + } else if ((this->actor.params != -2) || !func_80B44E8C(play, this)) { + if (this->unk3F0 == 0) { + var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (var_v0 < 0) { + var_v0 *= -1; + } + if (var_v0 >= 0x3A98) { + if ((this->actor.params >= 0) && (D_80B4A1B4 == this->actor.params)) { + func_80B474E4(this); } else { func_80B45384(this); - this->unk_3F0 = Rand_ZeroOne() * 5.0f + 1.0f; + this->unk3F0 = (Rand_ZeroOne() * 5.0f) + 1.0f; } - } else if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) && (D_80B4A1B4 == this->actor.params)) { - EnZf_SetupHopAndTaunt(this); + } else if ((this->actor.params >= 0) && (D_80B4A1B4 == this->actor.params)) { + func_80B474E4(this); } else { - s16 pad; - this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_CanAttack(play, this)) { - EnZf_SetupSlash(this); - } else if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && - !EnZf_PrimaryFloorCheck(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { - EnZf_SetupJumpForward(this); + (func_80B44CF0(play, this) != 0)) { + func_80B46A24(this); } else { - EnZf_SetupApproachPlayer(this, play); + if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && + !func_80B44058(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { + func_80B45E30(this); + } else { + func_80B456B4(this, play); + } } } + y:; //! FAKE } else { - this->unk_3F0--; + this->unk3F0 -= 1; } - if (prevFrame != (s32)this->skelAnime.curFrame) { - if (((beforeCurFrame < 14) && (absPlaySpeed + prevFrame >= 16)) || - ((beforeCurFrame < 27) && (absPlaySpeed + prevFrame >= 29))) { - Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); - } + if ((prevFrame != (s32)this->unk14C.curFrame) && + (((beforeCurFrame < 0xE) && (((s32)absPlaySpeed + prevFrame) >= 0x10)) || + ((beforeCurFrame < 0x1B) && (((s32)absPlaySpeed + prevFrame) >= 0x1D)))) { + Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1932,134 +1737,131 @@ void EnZf_CircleAroundPlayer(EnZf* this, PlayState* play) { } } -void EnZf_SetupDie(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfDyingAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDyingAnim), ANIMMODE_ONCE, - -4.0f); +// this is probably just EnZf? +typedef struct UnkActor { + Actor actor; + char pad14C[0x3F4 - 0x14C]; + UNK_TYPE2 unk3F4; +} UnkActor; + +void func_80B48CEC(EnZf* this) { + Actor* temp_v0; + Animation_Change(&this->unk14C, &object_zf_Anim_014E60, 1.5f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_014E60), + ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; - this->hopAnimIndex = 0; + this->unk3E4 = 0; } else { - this->hopAnimIndex = 1; + this->unk3E4 = 1; } - - this->action = ENZF_ACTION_DIE; + this->unk3DC = 0xF; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (D_80B4A1B4 != -1) { - if (this->actor.prev != NULL) { - ((EnZf*)this->actor.prev)->unk_3F4 = 90; - - if (this->actor.prev->colChkInfo.health < 3) { - this->actor.prev->colChkInfo.health = 3; + temp_v0 = this->actor.prev; + if (temp_v0 != NULL) { + ((UnkActor*)temp_v0)->unk3F4 = 0x5A; + temp_v0 = this->actor.prev; + if (temp_v0->colChkInfo.health < 3) { + temp_v0->colChkInfo.health = 3; } } else { - ((EnZf*)this->actor.next)->unk_3F4 = 90; - - if (this->actor.next->colChkInfo.health < 3) { - this->actor.next->colChkInfo.health = 3; + ((UnkActor*)this->actor.next)->unk3F4 = 0x5A; + temp_v0 = this->actor.next; + if (temp_v0->colChkInfo.health < 3) { + temp_v0->colChkInfo.health = 3; } } } - D_80B4A1B0 = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); - EnZf_SetupAction(this, EnZf_Die); + func_80B44050(this, func_80B48E50); } -void EnZf_Die(EnZf* this, PlayState* play) { +void func_80B48E50(EnZf* this, PlayState* play) { + s32 temp_ft1; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } - if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.15f, 0.0f); - this->hopAnimIndex = 0; + this->unk3E4 = 0; } - - if (SkelAnime_Update(&this->skelAnime)) { + if (SkelAnime_Update(&this->unk14C)) { if (this->actor.category != ACTORCAT_PROP) { - if ((this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* miniboss */ && (D_80B4A1B4 == -1)) { - Flags_SetSwitch(play, this->clearFlag); + if ((this->actor.params >= 0) && (D_80B4A1B4 == -1)) { + Flags_SetSwitch(play, this->unk3FC); func_800F5B58(); } else { D_80B4A1B4 = -1; } Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } - - if (this->alpha != 0) { - this->actor.shape.shadowAlpha = this->alpha -= 5; - + if (this->unk404 != 0) { + this->unk404 -= 5; + this->actor.shape.shadowAlpha = this->unk404; } else { Actor_Kill(&this->actor); } } else { - s32 curFrame = this->skelAnime.curFrame; - - if ((curFrame == 10) || (curFrame == 18)) { + temp_ft1 = (s32)this->unk14C.curFrame; + if ((temp_ft1 == 10) || (temp_ft1 == 18)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DOWN); } } } -void EnZf_UpdateHeadRotation(EnZf* this, PlayState* play) { - s16 angleTemp; +void func_80B48F90(EnZf* this, PlayState* play) { + s16 temp_v0_2; - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->action == ENZF_ACTION_3) && (this->unk_3F4 != 0)) { - this->headRot = Math_SinS(this->unk_3F4 * 1400) * 0x2AA8; + if ((this->actor.params == -2) && (this->unk3DC == 3) && (this->unk3F4 != 0)) { + this->unk3EC = Math_SinS(this->unk3F4 * 0x578) * 10920.0f; } else { - angleTemp = this->actor.yawTowardsPlayer; - angleTemp -= (s16)(this->headRot + this->actor.shape.rot.y); - this->headRotTemp = CLAMP(angleTemp, -0x7D0, 0x7D0); - this->headRot += this->headRotTemp; - this->headRot = CLAMP(this->headRot, -0x1CD7, 0x1CD7); + temp_v0_2 = this->actor.yawTowardsPlayer; + temp_v0_2 -= (s16)(this->unk3EC + this->actor.shape.rot.y); + this->unk3EE = CLAMP(temp_v0_2, -0x7D0, 0x7D0); + this->unk3EC += this->unk3EE; + this->unk3EC = CLAMP(this->unk3EC, -0x1CD7, 0x1CD7); } } -void EnZf_UpdateDamage(EnZf* this, PlayState* play) { +void func_80B490B4(EnZf* this, PlayState* play) { s32 pad; - s16 dropParams; - - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action <= ENZF_ACTION_STUNNED)) { - this->bodyCollider.base.acFlags &= ~AC_HIT; - - if (((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* not miniboss */ || - (D_80B4A1B4 != this->actor.params)) && - (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_IMMUNE)) { - this->damageReaction = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, false); - - if ((this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_STUN) || - (this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_ICE)) { - if (this->action != ENZF_ACTION_STUNNED) { + s16 var_a3; + + if ((this->unk418.base.acFlags & AC_HIT) && (this->unk3DC < 0xF)) { + this->unk418.base.acFlags &= ~AC_HIT; + if ((((this->actor.params < 0)) || (D_80B4A1B4 != this->actor.params)) && + ((this->actor.colChkInfo.damageReaction != 6))) { + this->unk410 = this->actor.colChkInfo.damageReaction; + Actor_SetDropFlag(&this->actor, &this->unk418.elem, false); + if ((this->actor.colChkInfo.damageReaction == 1) || (this->actor.colChkInfo.damageReaction == 0xF)) { + if (this->unk3DC != 0xE) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); Actor_ApplyDamage(&this->actor); - EnZf_SetupStunned(this); + func_80B47050(this); } } else { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - if (Actor_ApplyDamage(&this->actor) == 0) { - dropParams = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_4, false); - EnZf_SetupDie(this); - - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - dropParams = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false); + var_a3 = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_4, false); + func_80B48CEC(this); + if (this->actor.params == -2) { + var_a3 = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false); } - - Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, dropParams); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, var_a3); Enemy_StartFinishingBlow(play, &this->actor); } else { - if ((D_80B4A1B4 != -1) && ((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && - (this->actor.colChkInfo.health < 4)) { - this->damageReaction = ENZF_DMG_REACT_PROJECTILE; + if (D_80B4A1B4 != -1) { + if (((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && + (this->actor.colChkInfo.health < 4)) { + this->unk410 = 0xD; + } } - - EnZf_SetupDamaged(this); + func_80B47DA8(this); } } } @@ -2067,405 +1869,343 @@ void EnZf_UpdateDamage(EnZf* this, PlayState* play) { } void EnZf_Update(Actor* thisx, PlayState* play) { - s32 pad; EnZf* this = (EnZf*)thisx; - s32 pad2; + s32 pad[2]; - EnZf_UpdateDamage(this, play); - if (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_IMMUNE) { - this->unk_3F8 = false; - if ((this->hopAnimIndex != 1) && (this->action != ENZF_ACTION_HOP_AWAY)) { + func_80B490B4(this, play); + if (this->actor.colChkInfo.damageReaction != 6) { + this->unk3F8 = false; + if ((this->unk3E4 != 1) && (this->unk3DC != 0x13)) { if (this->actor.speed != 0.0f) { - this->unk_3F8 = EnZf_PrimaryFloorCheck(this, play, this->actor.speed * 1.5f); + this->unk3F8 = func_80B44058(this, play, this->actor.speed * 1.5f); } - if (!this->unk_3F8) { - this->unk_3F8 = EnZf_PrimaryFloorCheck(this, play, 0.0f); + if (!this->unk3F8) { + this->unk3F8 = func_80B44058(this, play, 0.0f); } } - - if (!this->unk_3F8) { + if (!this->unk3F8) { Actor_MoveXZGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->hopAnimIndex = 1; + this->unk3E4 = 1; } - - this->actionFunc(this, play); + this->unk3E8(this, play); } - if (this->actor.colChkInfo.health > 0) { - if ((this->action != ENZF_ACTION_SLASH) && (this->action != ENZF_ACTION_STUNNED)) { - EnZf_UpdateHeadRotation(this, play); + if ((this->unk3DC != 9) && (this->unk3DC != 0xE)) { + func_80B48F90(this, play); } - if ((D_80B4A1B0 != 0) && (D_80B4A1B4 != this->actor.params)) { - EnZf_SetupSheatheSword(this, play); + func_80B47360(this, play); D_80B4A1B4 = this->actor.params; D_80B4A1B0 = 0; - if (this->actor.prev != NULL) { - ((EnZf*)this->actor.prev)->unk_3F4 = 90; + ((UnkActor*)this->actor.prev)->unk3F4 = 0x5A; } else { - ((EnZf*)this->actor.next)->unk_3F4 = 90; + ((UnkActor*)this->actor.next)->unk3F4 = 0x5A; } } } - - if (this->action >= ENZF_ACTION_DIE) { - Math_SmoothStepToS(&this->headRot, 0, 1, 2000, 0); - - if (this->action <= ENZF_ACTION_HOP_AND_TAUNT) { - if ((this->unk_3F4 == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (this->actor.colChkInfo.health > 0) { - EnZf_SetupDrawSword(this, play); - } - this->unk_3F4--; + if (this->unk3DC >= 0xF) { + Math_SmoothStepToS(&this->unk3EC, 0, 1, 0x7D0, 0); + if ((this->unk3DC < 0x15) && (this->unk3F4 == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (this->actor.colChkInfo.health > 0) { + func_80B47C64(this, play); } + this->unk3F4 -= 1; } - - if (this->unk_3F4 >= 2) { - this->unk_3F4--; + if (this->unk3F4 >= 2) { + this->unk3F4 -= 1; } } - this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 40.0f; - - if ((this->actor.colChkInfo.health > 0) && (this->alpha == 255)) { - Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - - if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_DAMAGED)) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); - } - - if ((this->actor.params < ENZF_TYPE_LIZALFOS_MINIBOSS_A) /* not miniboss */ || - (D_80B4A1B4 != this->actor.params)) { - if ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); + if (this->actor.colChkInfo.health > 0) { + if (this->unk404 == 0xFF) { + Collider_UpdateCylinder(&this->actor, &this->unk418); + if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->unk3DC < 0x11)) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk418.base); + } + if (((this->actor.params < 0) || (D_80B4A1B4 != this->actor.params)) && + ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk418.base); } } } - - if ((this->action == ENZF_ACTION_SLASH) && (this->skelAnime.curFrame >= 14.0f) && - (this->skelAnime.curFrame <= 20.0f)) { - if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && !(this->swordCollider.base.acFlags & AC_HIT)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); + if ((this->unk3DC == 9) && ((this->unk14C.curFrame >= 14.0f)) && (this->unk14C.curFrame <= 20.0f)) { + if (!(this->unk464.base.atFlags & AT_BOUNCED) && !(this->unk464.base.acFlags & AC_HIT)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk464.base); } else { - this->swordCollider.base.atFlags &= ~AT_BOUNCED; - this->swordCollider.base.acFlags &= ~AC_HIT; - EnZf_SetupRecoilFromBlockedSlash(this); + this->unk464.base.atFlags &= ~AT_BOUNCED; + this->unk464.base.acFlags &= ~AC_HIT; + func_80B46D64(this); } } } -s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - EnZf* this = (EnZf*)thisx; +s32 func_80B495FC(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx) { + EnZf* this = thisx; - switch (limbIndex) { - case ENZF_LIMB_HEAD_ROOT: - rot->y -= this->headRot; + switch (arg1) { + case 5: + arg4->y -= this->unk3EC; break; - case ENZF_LIMB_SWORD: - if (this->swordSheathed) { - *dList = gZfEmptyHandDL; + + case 15: + if (this->unk3FA != 0) { + *arg2 = object_zf_DL_00E198; } break; - case ENZF_LIMB_SCABBARD: - if (this->swordSheathed) { - *dList = gZfSheathedSwordDL; + + case 33: + if (this->unk3FA != 0) { + *arg2 = object_zf_DL_010060; } break; - default: - break; } - - return false; + return 0; } -void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { - static Vec3f sUnused = { 1100.0f, -700.0f, 0.0f }; - static Vec3f footOffset = { 300.0f, 0.0f, 0.0f }; - static Vec3f D_80B4A2A4 = { 300.0f, -1700.0f, 0.0f }; // Sword tip? - static Vec3f D_80B4A2B0 = { -600.0f, 300.0f, 0.0f }; // Sword hilt? - static Vec3f swordQuadOffset1 = { 0.0f, 1500.0f, 0.0f }; - static Vec3f swordQuadOffset0 = { -600.0f, -3000.0f, 1000.0f }; - static Vec3f swordQuadOffset3 = { -600.0f, -3000.0f, -1000.0f }; - static Vec3f swordQuadOffset2 = { 1500.0f, -3000.0f, 0.0f }; - static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; +void func_80B49688(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx, Gfx** gfx) { Vec3f sp54; Vec3f sp48; - EnZf* this = (EnZf*)thisx; - s32 bodyPart = -1; - - if (limbIndex == ENZF_LIMB_SWORD) { - Matrix_MultVec3f(&swordQuadOffset1, &this->swordCollider.dim.quad[1]); - Matrix_MultVec3f(&swordQuadOffset0, &this->swordCollider.dim.quad[0]); - Matrix_MultVec3f(&swordQuadOffset3, &this->swordCollider.dim.quad[3]); - Matrix_MultVec3f(&swordQuadOffset2, &this->swordCollider.dim.quad[2]); - Collider_SetQuadVertices(&this->swordCollider, &this->swordCollider.dim.quad[0], - &this->swordCollider.dim.quad[1], &this->swordCollider.dim.quad[2], - &this->swordCollider.dim.quad[3]); + s32 var_s1; + EnZf* this = thisx; + + var_s1 = -1; + if (arg1 == 0xF) { + Matrix_MultVec3f(&D_80B4A2BC, &this->unk464.dim.quad[1]); + Matrix_MultVec3f(&D_80B4A2C8, &this->unk464.dim.quad[0]); + Matrix_MultVec3f(&D_80B4A2D4, &this->unk464.dim.quad[3]); + Matrix_MultVec3f(&D_80B4A2E0, &this->unk464.dim.quad[2]); + Collider_SetQuadVertices(&this->unk464, &this->unk464.dim.quad[0], &this->unk464.dim.quad[1], + &this->unk464.dim.quad[2], &this->unk464.dim.quad[3]); Matrix_MultVec3f(&D_80B4A2A4, &sp54); Matrix_MultVec3f(&D_80B4A2B0, &sp48); - - if (this->action == ENZF_ACTION_SLASH) { - if (this->skelAnime.curFrame < 14.0f) { - EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); - } else if (this->skelAnime.curFrame < 20.0f) { - EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &sp54, &sp48); + if (this->unk3DC == 9) { + if (this->unk14C.curFrame < 14.0f) { + EffectBlure_AddSpace(Effect_GetByIndex(this->unk414)); + } else if (this->unk14C.curFrame < 20.0f) { + EffectBlure_AddVertex(Effect_GetByIndex(this->unk414), &sp54, &sp48); } } } else { - Actor_SetFeetPos(&this->actor, limbIndex, ENZF_LIMB_LEFT_FOOT, &footOffset, ENZF_LIMB_RIGHT_FOOT, &footOffset); + Actor_SetFeetPos(&this->actor, arg1, 0x2D, &D_80B4A298, 0x26, &D_80B4A298); } - - switch (limbIndex) { - case ENZF_LIMB_LEFT_FOOT: - Matrix_MultVec3f(&footOffset, &this->leftFootPos); + switch (arg1) { + case 0x2D: + Matrix_MultVec3f(&D_80B4A298, &this->unk4F0); break; - case ENZF_LIMB_RIGHT_FOOT: - Matrix_MultVec3f(&footOffset, &this->rightFootPos); + case 0x26: + Matrix_MultVec3f(&D_80B4A298, &this->unk4E4); break; } - - if (this->iceTimer != 0) { - switch (limbIndex) { - case ENZF_LIMB_HEAD: - bodyPart = 0; + if (this->unk3F6 != 0) { + switch (arg1) { + case 9: + var_s1 = 0; break; - case ENZF_LIMB_NECK: - bodyPart = 1; + case 10: + var_s1 = 1; break; - case ENZF_LIMB_CHEST_ARMOR: - bodyPart = 2; + case 25: + var_s1 = 2; break; - case ENZF_LIMB_RIGHT_FOREARM: - bodyPart = 3; + case 16: + var_s1 = 3; break; - case ENZF_LIMB_LEFT_FOREARM: - bodyPart = 4; + case 23: + var_s1 = 4; break; - case ENZF_LIMB_TRUNK: - bodyPart = 5; + case 48: + var_s1 = 5; break; - case ENZF_LIMB_SWORD_ROOT: - bodyPart = 6; + case 14: + var_s1 = 6; break; - case ENZF_LIMB_RIGHT_SHIN: - bodyPart = 7; + case 39: + var_s1 = 7; break; - case ENZF_LIMB_LEFT_SHIN_ROOT: - bodyPart = 8; - break; - default: + case 43: + var_s1 = 8; break; } - if (bodyPart >= 0) { - Matrix_MultVec3f(&zeroVec, &this->bodyPartsPos[bodyPart]); + if (var_s1 >= 0) { + Matrix_MultVec3f(&D_80B4A2EC, &this->unk4FC[var_s1]); } } } -static Gfx D_80B4A2F8[] = { - gsSPTexture(0x0A00, 0x0A00, 0, G_TX_RENDERTILE, G_ON), - gsSPEndDisplayList(), -}; - void EnZf_Draw(Actor* thisx, PlayState* play) { - s32 pad; EnZf* this = (EnZf*)thisx; + s32 v; OPEN_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3533); - - func_8002EBCC(thisx, play, 1); - - gSPTexture(D_80B4A2F8, IREG(0), IREG(1), 0, G_TX_RENDERTILE, G_ON); - - gSPSegment(POLY_OPA_DISP++, 0x08, D_80B4A2F8); - - if (this->alpha == 255) { + func_8002EBCC(&this->actor, play, 1); + gSPTexture(D_80B4A2F8, gRegEditor->data[0x360], gRegEditor->data[0x361], 0, G_TX_RENDERTILE, G_ON); + gSPSegment(POLY_OPA_DISP++, 8, D_80B4A2F8); + if (this->unk404 == 255) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); - gSPSegment(POLY_OPA_DISP++, 0x09, &D_80116280[2]); - - POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_OPA_DISP); - - if (this->iceTimer != 0) { - thisx->colorFilterTimer++; - this->iceTimer--; - - if ((this->iceTimer % 4) == 0) { - s32 icePosIndex = this->iceTimer >> 2; - - EffectSsEnIce_SpawnFlyingVec3f(play, thisx, &this->bodyPartsPos[icePosIndex], 150, 150, 150, 250, 235, - 245, 255, 1.4f); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk404); + gSPSegment(POLY_OPA_DISP++, 9, &D_80116280[2]); + POLY_OPA_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80B495FC, + func_80B49688, this, POLY_OPA_DISP); + if (this->unk3F6 != 0) { + thisx->colorFilterTimer += 1; + this->unk3F6 -= 1; + if (!(this->unk3F6 & 3)) { + v = this->unk3F6 >> 2; + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &this->unk4FC[v], 150, 150, 150, 250, 235, 245, 255, + 1.4f); } - if (1) {} } - } else { // fades out when dead + } else { Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); - gSPSegment(POLY_XLU_DISP++, 0x09, &D_80116280[0]); - POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, - EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_XLU_DISP); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk404); + gSPSegment(POLY_XLU_DISP++, 9, D_80116280); + POLY_XLU_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80B495FC, + func_80B49688, this, POLY_XLU_DISP); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3601); } -void EnZf_SetupCircleAroundPlayer(EnZf* this, f32 speedXZ) { - Animation_MorphToLoop(&this->skelAnime, &gZfSidesteppingAnim, -1.0f); - this->unk_3F0 = Rand_ZeroOne() * 10.0f + 8.0f; - - if (this->actor.params == ENZF_TYPE_DINOLFOS) { - this->actor.speed = 2.0f * speedXZ; - this->unk_3F0 /= 2; +void func_80B49B60(EnZf* this, f32 arg1) { + Animation_MorphToLoop(&this->unk14C, &object_zf_Anim_016388, -1.0f); + this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 8.0f; + if (this->actor.params == -2) { + this->actor.speed = 2.0f * arg1; + this->unk3F0 /= 2; } else { - this->actor.speed = speedXZ; + this->actor.speed = arg1; } - - this->hopAnimIndex = 0; + this->unk3E4 = 0; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - this->action = ENZF_ACTION_CIRCLE_AROUND_PLAYER; - EnZf_SetupAction(this, EnZf_CircleAroundPlayer); + this->unk3DC = 0xC; + func_80B44050(this, func_80B48578); } -s32 EnZf_DodgeRangedEngaging(PlayState* play, EnZf* this) { - Actor* projectileActor; - s16 yawToProjectile; - s16 phi_t0; - s16 phi_v1; +s32 func_80B49C2C(PlayState* play, EnZf* this) { + Actor* temp_v0_sp1C; + s16 sp1A; + s16 var_t0_sp18; + s16 var_v1; - projectileActor = Actor_GetProjectileActor(play, &this->actor, 600.0f); - - if (projectileActor != NULL) { - yawToProjectile = - Actor_WorldYawTowardActor(&this->actor, projectileActor) - (s16)(u16)(this->actor.shape.rot.y); + temp_v0_sp1C = Actor_GetProjectileActor(play, &this->actor, 600.0f); + if (temp_v0_sp1C != NULL) { + sp1A = Actor_WorldYawTowardActor(&this->actor, temp_v0_sp1C) - (s16)(this->actor.shape.rot.y + 0); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - - phi_t0 = 0; - - if (EnZf_PrimaryFloorCheck(this, play, -8.0f)) { - phi_t0 = 1; + var_t0_sp18 = 0; + if (func_80B44058(this, play, -8.0f)) { + var_t0_sp18 |= 1; } - - if (EnZf_PrimaryFloorCheck(this, play, 8.0f)) { - phi_t0 |= 2; + if (func_80B44058(this, play, 8.0f)) { + var_t0_sp18 |= 2; } - this->actor.world.rot.y = this->actor.shape.rot.y; - - if ((((this->actor.xzDistToPlayer < 90.0f) || (phi_t0 == 3)) && !EnZf_PrimaryFloorCheck(this, play, 135.0f)) || - (projectileActor->id == ACTOR_ARMS_HOOK)) { - EnZf_SetupJumpUp(this); - return true; - } - - this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - - if (phi_t0 == 0) { - phi_v1 = play->gameplayFrames % 2; + if ((((this->actor.xzDistToPlayer < 90.0f) || (var_t0_sp18 == 3)) && !func_80B44058(this, play, 135.0f)) || + (temp_v0_sp1C->id == ACTOR_ARMS_HOOK)) { + func_80B48210(this); } else { - phi_v1 = phi_t0; - } - - if ((ABS(yawToProjectile) < 0x2000) || (ABS(yawToProjectile) >= 0x6000)) { - if (phi_v1 & 1) { - EnZf_SetupCircleAroundPlayer(this, 8.0f); - return true; + this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; + if (var_t0_sp18 == 0) { + var_v1 = play->gameplayFrames & 1; + } else { + var_v1 = var_t0_sp18; } - EnZf_SetupCircleAroundPlayer(this, -8.0f); - return true; - } - if (ABS(yawToProjectile) < 0x5FFF) { - if (phi_v1 & 1) { - EnZf_SetupCircleAroundPlayer(this, 4.0f); - return true; + if ((ABS(sp1A) < 0x2000) || (ABS(sp1A) >= 0x6000)) { + if (var_v1 & 1) { + func_80B49B60(this, 8.0f); + } else { + func_80B49B60(this, -8.0f); + } + } else if (ABS(sp1A) < 0x5FFF) { + if (var_v1 & 1) { + func_80B49B60(this, 4.0f); + } else { + func_80B49B60(this, -4.0f); + } } - EnZf_SetupCircleAroundPlayer(this, -4.0f); } return true; } return false; } -s32 EnZf_DodgeRangedWaiting(PlayState* play, EnZf* this) { - Actor* projectileActor; - s16 yawToProjectile; - s16 phi_t0; +s32 func_80B49E4C(PlayState* play, EnZf* this) { + Actor* temp_v0; + s16 sp22; + s16 sp20; s16 sp1E; - s16 sp1C = 0; + s16 sp1C; - projectileActor = Actor_GetProjectileActor(play, &this->actor, 600.0f); - if (projectileActor != NULL) { - yawToProjectile = Actor_WorldYawTowardActor(&this->actor, projectileActor) - (s16)(u16)this->actor.shape.rot.y; - this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; // Set to move sideways - - phi_t0 = 0; - - if (EnZf_PrimaryFloorCheck(this, play, -70.0f)) { - phi_t0 = 1; + sp1C = 0; + temp_v0 = Actor_GetProjectileActor(play, &this->actor, 600.0f); + if (temp_v0 != NULL) { + sp22 = Actor_WorldYawTowardActor(&this->actor, temp_v0) - (s16)(this->actor.shape.rot.y + 0); + this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; + sp20 = 0; + if (func_80B44058(this, play, -70.0f)) { + sp20 |= 1; } - - if (EnZf_PrimaryFloorCheck(this, play, 70.0f)) { - phi_t0 |= 2; + if (func_80B44058(this, play, 70.0f)) { + sp20 |= 2; } - this->actor.speed = 0.0f; - - if ((ABS(yawToProjectile) < 0x2000) || (ABS(yawToProjectile) >= 0x6000)) { - if (phi_t0 == 0) { + if ((ABS(sp22) < 0x2000 || ABS(sp22) > 0x5FFF)) { + if (sp20 == 0) { if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; } } else { - switch (phi_t0) { + switch (sp20) { case 1: sp1E = 6; break; + case 2: sp1E = -6; break; - case 1 | 2: + + case 3: sp1C = 5; sp1E = 0; break; } } - } else if (ABS(yawToProjectile) < 0x5FFF) { - if (phi_t0 == 0) { + } else if (ABS(sp22) < 0x5FFF) { + if (sp20 == 0) { if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; } } else { - switch (phi_t0) { + switch (sp20) { case 1: sp1E = 6; break; + case 2: sp1E = -6; break; - case 1 | 2: - sp1C = 10; + + case 3: + sp1C = 0xA; sp1E = 0; break; } } } - - this->unk_408 = sp1E; - this->unk_40C = sp1C; - return true; + //! @bug if sp22 is exactly 0x5FFF, sp1E is used uninitialized + this->unk408 = sp1E; + this->unk40C = sp1C; + return 1; } - return false; + return 0; } 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 1ecd0b646b6..f0776da3788 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -6,119 +6,38 @@ struct EnZf; -typedef void (*EnZfActionFunc)(struct EnZf*, struct PlayState*); - -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 EnZfAction { - /* 0 */ ENZF_ACTION_DROP_IN, - /* 3 */ ENZF_ACTION_3 = 3, // stop and choose action? - /* 5 */ ENZF_ACTION_APPROACH_PLAYER = 5, - /* 6 */ ENZF_ACTION_6, - /* 7 */ ENZF_ACTION_7, // more sidestepping? - /* 8 */ ENZF_ACTION_RECOIL_FROM_BLOCKED_SLASH, - /* 9 */ ENZF_ACTION_SLASH, - /* 11 */ ENZF_ACTION_JUMP_BACK = 11, - /* 12 */ ENZF_ACTION_CIRCLE_AROUND_PLAYER, - /* 13 */ ENZF_ACTION_JUMP_FORWARD, - /* 14 */ ENZF_ACTION_STUNNED, - /* 15 */ ENZF_ACTION_DIE, - /* 16 */ ENZF_ACTION_DAMAGED, - /* 18 */ ENZF_ACTION_SHEATHE_SWORD = 18, - /* 19 */ ENZF_ACTION_HOP_AWAY, - /* 20 */ ENZF_ACTION_HOP_AND_TAUNT, - /* 21 */ ENZF_ACTION_DRAW_SWORD, - /* 22 */ ENZF_ACTION_JUMP_UP -} EnZfAction; - -typedef enum EnZfLimb { - /* 0x00 */ ENZF_LIMB_NONE, - /* 0x01 */ ENZF_LIMB_ROOT, - /* 0x02 */ ENZF_LIMB_BODY_ROOT, - /* 0x03 */ ENZF_LIMB_UPPER_BODY_ROOT, - /* 0x04 */ ENZF_LIMB_NECK_ROOT, - /* 0x05 */ ENZF_LIMB_HEAD_ROOT, - /* 0x06 */ ENZF_LIMB_JAW_ROOT_ROOT, - /* 0x07 */ ENZF_LIMB_JAW_ROOT, - /* 0x08 */ ENZF_LIMB_JAW, - /* 0x09 */ ENZF_LIMB_HEAD, - /* 0x0A */ ENZF_LIMB_NECK, - /* 0x0B */ ENZF_LIMB_RIGHT_ARM_ROOT, - /* 0x0C */ ENZF_LIMB_RIGHT_UPPER_ARM_ROOT, - /* 0x0D */ ENZF_LIMB_RIGHT_FOREARM_ROOT, - /* 0x0E */ ENZF_LIMB_SWORD_ROOT, - /* 0x0F */ ENZF_LIMB_SWORD, - /* 0x10 */ ENZF_LIMB_RIGHT_FOREARM, - /* 0x11 */ ENZF_LIMB_RIGHT_UPPER_ARM, - /* 0x12 */ ENZF_LIMB_LEFT_ARM_ROOT, - /* 0x13 */ ENZF_LIMB_LEFT_UPPER_ARM_ROOT, - /* 0x14 */ ENZF_LIMB_LEFT_FOREARM_ROOT, - /* 0x15 */ ENZF_LIMB_LEFT_HAND_ROOT, - /* 0x16 */ ENZF_LIMB_LEFT_HAND, - /* 0x17 */ ENZF_LIMB_LEFT_FOREARM, - /* 0x18 */ ENZF_LIMB_LEFT_UPPER_ARM, - /* 0x19 */ ENZF_LIMB_CHEST_ARMOR, - /* 0x1A */ ENZF_LIMB_TAIL_ROOT, - /* 0x1B */ ENZF_LIMB_TAIL_BASE_ROOT, - /* 0x1C */ ENZF_LIMB_TAIL_TIP_ROOT, - /* 0x1D */ ENZF_LIMB_TAIL_TIP, - /* 0x1E */ ENZF_LIMB_TAIL_BASE, - /* 0x1F */ ENZF_LIMB_SCABBARD_ROOT_ROOT, - /* 0x20 */ ENZF_LIMB_SCABBARD_ROOT, - /* 0x21 */ ENZF_LIMB_SCABBARD, - /* 0x22 */ ENZF_LIMB_RIGHT_LEG_ROOT, - /* 0x23 */ ENZF_LIMB_RIGHT_THIGH_ROOT, - /* 0x24 */ ENZF_LIMB_RIGHT_SHIN_ROOT, - /* 0x25 */ ENZF_LIMB_RIGHT_FOOT_ROOT, - /* 0x26 */ ENZF_LIMB_RIGHT_FOOT, - /* 0x27 */ ENZF_LIMB_RIGHT_SHIN, - /* 0x28 */ ENZF_LIMB_RIGHT_THIGH, - /* 0x29 */ ENZF_LIMB_LEFT_LEG_ROOT, - /* 0x2A */ ENZF_LIMB_LEFT_THIGH_ROOT, - /* 0x2B */ ENZF_LIMB_LEFT_SHIN_ROOT, - /* 0x2C */ ENZF_LIMB_LEFT_FOOT_ROOT, - /* 0x2D */ ENZF_LIMB_LEFT_FOOT, - /* 0x2E */ ENZF_LIMB_LEFT_SHIN, - /* 0x2F */ ENZF_LIMB_LEFT_THIGH, - /* 0x30 */ ENZF_LIMB_TRUNK, - /* 0x31 */ ENZF_LIMB_MAX -} EnZfLimb; // used for both Lizalfos and Dinalfos - typedef struct EnZf { - /* 0x0000 */ Actor actor; - /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[ENZF_LIMB_MAX]; - /* 0x02B6 */ Vec3s morphTable[ENZF_LIMB_MAX]; - /* 0x03DC */ s32 action; - /* 0x03E0 */ s32 unk_3E0; // Set but unused - /* 0x03E4 */ s32 hopAnimIndex; - /* 0x03E8 */ EnZfActionFunc actionFunc; - /* 0x03EC */ s16 headRot; - /* 0x03EE */ s16 headRotTemp; - /* 0x03F0 */ s32 unk_3F0; // attack timer? - /* 0x03F4 */ s16 unk_3F4; // tag timer? - /* 0x03F6 */ s16 iceTimer; - /* 0x03F8 */ s16 unk_3F8; // boolean, to do with movement - /* 0x03FA */ s16 swordSheathed; // boolean - /* 0x03FC */ s16 clearFlag; - /* 0x03FE */ s16 curPlatform; - /* 0x0400 */ s16 homePlatform; // Platform to return to, changed by some functions? - /* 0x0402 */ s16 nextPlatform; - /* 0x0404 */ u8 alpha; - /* 0x0408 */ f32 unk_408; // related to XZ speeds - /* 0x040C */ f32 unk_40C; // related to y velocity - /* 0x0410 */ u8 damageReaction; - /* 0x0414 */ s32 blureIndex; - /* 0x0418 */ ColliderCylinder bodyCollider; - /* 0x0464 */ ColliderQuad swordCollider; - /* 0x04E4 */ Vec3f rightFootPos; - /* 0x04F0 */ Vec3f leftFootPos; - /* 0x04FC */ Vec3f bodyPartsPos[9]; -} EnZf; // size = 0x0568 + /* 0x000 */ Actor actor; + /* 0x14C */ SkelAnime unk14C; + /* 0x190 */ Vec3s unk190[49]; + /* 0x2B6 */ Vec3s unk2B6[49]; + /* 0x3DC */ s32 unk3DC; + /* 0x3E0 */ s32 unk3E0; + /* 0x3E4 */ s32 unk3E4; + /* 0x3E8 */ void (*unk3E8)(struct EnZf*, struct PlayState*); + /* 0x3EC */ s16 unk3EC; + /* 0x3EE */ s16 unk3EE; + /* 0x3F0 */ s32 unk3F0; + /* 0x3F4 */ s16 unk3F4; + /* 0x3F6 */ s16 unk3F6; + /* 0x3F8 */ s16 unk3F8; + /* 0x3FA */ s16 unk3FA; + /* 0x3FC */ s16 unk3FC; + /* 0x3FE */ s16 unk3FE; + /* 0x400 */ s16 unk400; + /* 0x402 */ s16 unk402; + /* 0x404 */ u8 unk404; + /* 0x405 */ char pad405[3]; + /* 0x408 */ f32 unk408; + /* 0x40C */ f32 unk40C; + /* 0x410 */ u8 unk410; + /* 0x411 */ char pad411[3]; + /* 0x414 */ s32 unk414; + /* 0x418 */ ColliderCylinder unk418; + /* 0x464 */ ColliderQuad unk464; + /* 0x4E4 */ Vec3f unk4E4; + /* 0x4F0 */ Vec3f unk4F0; + /* 0x4FC */ Vec3f unk4FC[9]; +} EnZf; // size = 0x568 #endif diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index a1cca466a62..c378b684731 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -106,11 +106,11 @@ void EnZl1_Init(Actor* thisx, PlayState* play) { Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->unk_1E6 = 0; this->actionFunc = func_80B4BC78; - } else if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) && - Flags_GetEventChkInf(EVENTCHKINF_37)) { + } else if ((Flags_GetEventChkInf(EVENTCHKINF_09)) && (Flags_GetEventChkInf(EVENTCHKINF_25)) && + (Flags_GetEventChkInf(EVENTCHKINF_37))) { Actor_Kill(&this->actor); - } else if ((Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25)) || - (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_37))) { + } else if (((Flags_GetEventChkInf(EVENTCHKINF_09)) && (Flags_GetEventChkInf(EVENTCHKINF_25))) || + ((Flags_GetEventChkInf(EVENTCHKINF_09)) && (Flags_GetEventChkInf(EVENTCHKINF_37)))) { frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438); Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); this->actor.textId = 0x703D; @@ -613,7 +613,7 @@ void EnZl1_Update(Actor* thisx, PlayState* play) { func_80B4AE18(this); } -s32 EnZl1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 func_80B4C340(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnZl1* this = (EnZl1*)thisx; if ((limbIndex == 4) || (limbIndex == 3) || (limbIndex == 6) || (limbIndex == 5)) { @@ -634,7 +634,7 @@ s32 EnZl1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p return 0; } -void EnZl1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { +void func_80B4C400(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Vec3f vec = { 0.0f, 0.0f, 0.0f }; EnZl1* this = (EnZl1*)thisx; @@ -654,7 +654,7 @@ void EnZl1_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - EnZl1_OverrideLimbDraw, EnZl1_PostLimbDraw, this); + func_80B4C340, func_80B4C400, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_girlB.c", 2046); } 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 1896521e5e2..bc774b0a614 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -2769,11 +2769,11 @@ void func_80B59FF4(EnZl3* this, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x8, SEGMENTED_TO_VIRTUAL(eyeTex)); - gSPSegment(POLY_OPA_DISP++, 0x9, SEGMENTED_TO_VIRTUAL(eyeTex)); - gSPSegment(POLY_OPA_DISP++, 0xA, SEGMENTED_TO_VIRTUAL(mouthTex)); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(eyeTex)); + gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(eyeTex)); + gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(mouthTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); - gSPSegment(POLY_OPA_DISP++, 0xB, &D_80116280[2]); + gSPSegment(POLY_OPA_DISP++, 11, &D_80116280[2]); POLY_OPA_DISP = SkelAnime_DrawFlex(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, EnZl3_OverrideLimbDraw, EnZl3_PostLimbDraw, this, POLY_OPA_DISP); diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index f1e41b80e70..5eb99d4ef7d 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -38,8 +38,8 @@ #include "cic6105.h" #endif -#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" \ - "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED 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 99db32656c8..9bc9d05f9df 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -121,25 +121,25 @@ void ItemEtcetera_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.25f); ItemEtcetera_SetupAction(this, ItemEtcetera_WaitForObject); switch (type) { - case ITEM_ETC_LETTER: + case ITEM_ETCETERA_LETTER: Actor_SetScale(&this->actor, 0.5f); this->futureActionFunc = func_80B858B4; if (GET_EVENTCHKINF(EVENTCHKINF_31)) { Actor_Kill(&this->actor); } break; - case ITEM_ETC_ARROW_FIRE: + case ITEM_ETCETERA_ARROW_FIRE: this->futureActionFunc = ItemEtcetera_UpdateFireArrow; Actor_SetScale(&this->actor, 0.5f); this->actor.draw = NULL; this->actor.shape.yOffset = 50.0f; break; - case ITEM_ETC_RUPEE_GREEN_CHEST_GAME: - case ITEM_ETC_RUPEE_BLUE_CHEST_GAME: - case ITEM_ETC_RUPEE_RED_CHEST_GAME: - case ITEM_ETC_RUPEE_PURPLE_CHEST_GAME: - case ITEM_ETC_HEART_PIECE_CHEST_GAME: - case ITEM_ETC_KEY_SMALL_CHEST_GAME: + case ITEM_ETCETERA_RUPEE_GREEN_CHEST_GAME: + case ITEM_ETCETERA_RUPEE_BLUE_CHEST_GAME: + case ITEM_ETCETERA_RUPEE_RED_CHEST_GAME: + case ITEM_ETCETERA_RUPEE_PURPLE_CHEST_GAME: + case ITEM_ETCETERA_HEART_PIECE_CHEST_GAME: + case ITEM_ETCETERA_KEY_SMALL_CHEST_GAME: Actor_SetScale(&this->actor, 0.5f); this->futureActionFunc = func_80B85B28; this->drawFunc = ItemEtcetera_DrawThroughLens; 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 dcae852df4c..39810139c5a 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h @@ -19,20 +19,20 @@ typedef struct ItemEtcetera { } ItemEtcetera; // size = 0x0160 typedef enum ItemEtceteraType { - /* 0x00 */ ITEM_ETC_BOTTLE, - /* 0x01 */ ITEM_ETC_LETTER, - /* 0x02 */ ITEM_ETC_SHIELD_HYLIAN, - /* 0x03 */ ITEM_ETC_QUIVER, - /* 0x04 */ ITEM_ETC_SCALE_SILVER, - /* 0x05 */ ITEM_ETC_SCALE_GOLD, - /* 0x06 */ ITEM_ETC_KEY_SMALL, - /* 0x07 */ ITEM_ETC_ARROW_FIRE, - /* 0x08 */ ITEM_ETC_RUPEE_GREEN_CHEST_GAME, - /* 0x09 */ ITEM_ETC_RUPEE_BLUE_CHEST_GAME, - /* 0x0A */ ITEM_ETC_RUPEE_RED_CHEST_GAME, - /* 0x0B */ ITEM_ETC_RUPEE_PURPLE_CHEST_GAME, - /* 0x0C */ ITEM_ETC_HEART_PIECE_CHEST_GAME, - /* 0x0D */ ITEM_ETC_KEY_SMALL_CHEST_GAME + /* 0x00 */ ITEM_ETCETERA_BOTTLE, + /* 0x01 */ ITEM_ETCETERA_LETTER, + /* 0x02 */ ITEM_ETCETERA_SHIELD_HYLIAN, + /* 0x03 */ ITEM_ETCETERA_QUIVER, + /* 0x04 */ ITEM_ETCETERA_SCALE_SILVER, + /* 0x05 */ ITEM_ETCETERA_SCALE_GOLD, + /* 0x06 */ ITEM_ETCETERA_KEY_SMALL, + /* 0x07 */ ITEM_ETCETERA_ARROW_FIRE, + /* 0x08 */ ITEM_ETCETERA_RUPEE_GREEN_CHEST_GAME, + /* 0x09 */ ITEM_ETCETERA_RUPEE_BLUE_CHEST_GAME, + /* 0x0A */ ITEM_ETCETERA_RUPEE_RED_CHEST_GAME, + /* 0x0B */ ITEM_ETCETERA_RUPEE_PURPLE_CHEST_GAME, + /* 0x0C */ ITEM_ETCETERA_HEART_PIECE_CHEST_GAME, + /* 0x0D */ ITEM_ETCETERA_KEY_SMALL_CHEST_GAME } ItemEtceteraType; #endif 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 a16c32a0d57..23117954e06 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -136,7 +136,7 @@ void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play) { if (this->actionTimer > 0) { this->actionTimer--; } else { - this->actor.update = MagicFire_Update; + this->actor.update = &MagicFire_Update; Player_PlaySfx(player, NA_SE_PL_MAGIC_FIRE); } this->actor.world.pos = player->actor.world.pos; diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index aff6fcd55a9..c6e3ee9f6b5 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -12,10 +12,11 @@ #include "printf.h" #include "sfx.h" #include "translation.h" -#include "curve.h" #include "play_state.h" #include "player.h" +#include "functions.h" + #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicWind_Init(Actor* thisx, PlayState* play); @@ -55,7 +56,7 @@ void MagicWind_Init(Actor* thisx, PlayState* play) { MagicWind* this = (MagicWind*)thisx; Player* player = GET_PLAYER(play); - if (!SkelCurve_Init(play, &this->skelCurve, &sSkel, &sAnim)) { + if (SkelCurve_Init(play, &this->skelCurve, &sSkel, &sAnim) == 0) { PRINTF(T("Magic_Wind_Actor_ct():コンストラクト失敗\n", "Magic_Wind_Actor_ct(): Construct failed\n")); } this->actor.room = -1; @@ -149,8 +150,8 @@ void MagicWind_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } -s32 MagicWind_OverrideLimbDraw(PlayState* play, SkelCurve* skelCurve, s32 limbIndex, void* thisx) { - s32 pad; +s32 MagicWind_OverrideLimbDraw(PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) { + MagicWind* this = (MagicWind*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_magic_wind.c", 615); @@ -182,7 +183,7 @@ void MagicWind_Draw(Actor* thisx, PlayState* play) { if (this->actionFunc != MagicWind_WaitForTimer) { POLY_XLU_DISP = Gfx_SetupDL(POLY_XLU_DISP, SETUPDL_25); - SkelCurve_Draw(&this->actor, play, &this->skelCurve, MagicWind_OverrideLimbDraw, NULL, 1, NULL); + SkelCurve_Draw(thisx, play, &this->skelCurve, MagicWind_OverrideLimbDraw, NULL, 1, NULL); } CLOSE_DISPS(gfxCtx, "../z_magic_wind.c", 673); diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h index 6a186dcb560..1839c8d4845 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h @@ -3,7 +3,6 @@ #include "ultra64.h" #include "actor.h" -#include "curve.h" struct MagicWind; @@ -11,7 +10,7 @@ typedef void (*MagicWindFunc)(struct MagicWind* this, struct PlayState* play); typedef struct MagicWind { /* 0x0000 */ Actor actor; - /* 0x014C */ SkelCurve skelCurve; + /* 0x014C */ SkelAnimeCurve skelCurve; /* 0x016C */ s16 timer; /* 0x0170 */ MagicWindFunc actionFunc; } MagicWind; // size = 0x0174 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 0ed454941f2..80c0f5ffecf 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -1,7 +1,7 @@ /* * File: z_mir_ray.c * Overlay: ovl_Mir_Ray - * Description: Reflectable Light Beam and reflections + * Description: Reflectable Light Beam */ #include "z_mir_ray.h" @@ -30,21 +30,14 @@ void MirRay_Destroy(Actor* thisx, PlayState* play); void MirRay_Update(Actor* thisx, PlayState* play); 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 MirRayBeamLocations { - /* 0 */ MIRRAY_SPIRIT_BOMBCHUIWAROOM_DOWNLIGHT, - /* 1 */ MIRRAY_SPIRIT_SUNBLOCKROOM_DOWNLIGHT, - /* 2 */ MIRRAY_SPIRIT_SINGLECOBRAROOM_DOWNLIGHT, - /* 3 */ MIRRAY_SPIRIT_ARMOSROOM_DOWNLIGHT, - /* 4 */ MIRRAY_SPIRIT_TOPROOM_DOWNLIGHT, - /* 5 */ MIRRAY_SPIRIT_TOPROOM_CEILINGMIRROR, - /* 6 */ MIRRAY_SPIRIT_SINGLECOBRAROOM_COBRA, - /* 7 */ MIRRAY_SPIRIT_TOPROOM_COBRA1, - /* 8 */ MIRRAY_SPIRIT_TOPROOM_COBRA2, - /* 9 */ MIRRAY_GANONSCASTLE_SPIRITTRIAL_DOWNLIGHT -} MirRayBeamLocations; +typedef struct struct_80B8D8A0 { + /* 0x00 */ Vec3f reflectionPos; + /* 0x0C */ MtxF reflectionTransform; + /* 0x4C */ CollisionPoly* unk4C; + /* 0x50 */ u8 unk50; +} struct_80B8D8A0; // size = 0x54 + +s32 MirRay_IsInConeFrustum(Vec3f* centerTop, Vec3f* centerBase, f32 x, f32 y, f32 z, s16 radiusTop, s16 radiusBase); ActorProfile Mir_Ray_Profile = { /**/ ACTOR_MIR_RAY, @@ -58,183 +51,267 @@ ActorProfile Mir_Ray_Profile = { /**/ MirRay_Draw, }; -static u8 D_80B8E670 = 0; - -static ColliderQuadInit sQuadInit = { +static u8 D_80B8E670 = false; +static ColliderQuadInit D_80B8E674 = { + { 0xA, 9, 0, 0, 0, 3 }, + { 0, { 0x200000, 0, 0 }, { 0xFFCFFFFF, 0, 0 }, 1, 0, 0 }, + { { + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 0.0f }, + } }, +}; +static ColliderJntSphElementInit D_80B8E6C4[1] = { { - COL_MATERIAL_NONE, - AT_ON | AT_TYPE_PLAYER, - AC_NONE, - OC1_NONE, - OC2_NONE, - COLSHAPE_QUAD, + { 0, { 0x200000, 0, 0 }, { 0, 0, 0 }, 1, 0, 0 }, + { 0, { { 0, 0, 0 }, 0x32 }, 0x64 }, }, +}; +static ColliderJntSphInit D_80B8E6E8 = { { 0xA, 9, 0, 0, 0, 0 }, 1, D_80B8E6C4 }; +typedef struct struct_80B8E6F8 { + /* 0x00 */ Vec3s coneFrustumCenterTop; + /* 0x06 */ Vec3s coneFrustumCenterBase; + /* 0x0C */ s16 coneFrustumRadiusTop; + /* 0x0E */ s16 coneFrustumRadiusBase; + /* 0x10 */ f32 unk10_sphereColliderPosRatioTowardsBase; + /* 0x14 */ s16 unk14_sphereColliderRadiusModel; + /* 0x16 */ s16 unk16_pointLightRadius; + /* 0x18 */ f32 unk18_pointLightPosRatio; + /* 0x1C */ Color_RGB8 unk1C_lightColor; +#define UNK1F_0 (1 << 0) +#define UNK1F_1 (1 << 1) +#define UNK1F_2 (1 << 2) +#define UNK1F_POINTLIGHTPOS_TO_PLAYER (1 << 3) + /* 0x1F */ u8 unk1F; +} struct_80B8E6F8; +static struct_80B8E6F8 D_80B8E6F8[0xA] = { { - ELEM_MATERIAL_UNK0, - { 0x00200000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NORMAL, - ACELEM_NONE, - OCELEM_NONE, + { -1160, 686, -880 }, + { -920, 480, -889 }, + 30, + 50, + 1.0f, + 50, + 150, + 0.8f, + { 255, 255, 255 }, + UNK1F_1, }, - { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, -}; - -static ColliderJntSphElementInit sJntSphElementsInit[] = { { - { - ELEM_MATERIAL_UNK0, - { 0x00200000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, - { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, - ATELEM_ON | ATELEM_SFX_NORMAL, - ACELEM_NONE, - OCELEM_NONE, - }, - { 0, { { 0, 0, 0 }, 50 }, 100 }, + { -1856, 1092, -190 }, + { -1703, 841, -186 }, + 30, + 70, + 0.88f, + 54, + 150, + 0.8f, + { 255, 255, 255 }, + UNK1F_1, }, -}; - -static ColliderJntSphInit sJntSphInit = { { - COL_MATERIAL_NONE, - AT_ON | AT_TYPE_PLAYER, - AC_NONE, - OC1_NONE, - OC2_NONE, - COLSHAPE_JNTSPH, + { 1367, 738, -860 }, + { 1091, 476, -860 }, + 30, + 85, + 0.0f, + 0, + 150, + 0.8f, + { 255, 255, 255 }, + 0, + }, + { + { 2200, 1103, -220 }, + { 2040, 843, -220 }, + 30, + 60, + 0.0f, + 0, + 150, + 0.8f, + { 255, 255, 255 }, + UNK1F_0, + }, + { + { -560, 2169, -310 }, + { -560, 1743, -310 }, + 30, + 70, + 0.0f, + 0, + 150, + 0.8f, + { 255, 255, 255 }, + 0, + }, + { + { 60, 1802, -1090 }, + { 60, 973, -1090 }, + 30, + 70, + 0.0f, + 0, + 150, + 0.9f, + { 255, 255, 255 }, + UNK1F_0 | UNK1F_2 | UNK1F_POINTLIGHTPOS_TO_PLAYER, + }, + { + { 1140, 480, -860 }, + { 1140, 480, -860 }, + 30, + 30, + 1.0f, + 10, + 100, + 0.9f, + { 255, 255, 255 }, + UNK1F_1 | UNK1F_2 | UNK1F_POINTLIGHTPOS_TO_PLAYER, + }, + { + { -560, 1743, -310 }, + { -560, 1743, -310 }, + 30, + 30, + 0.0f, + 0, + 100, + 0.94f, + { 255, 255, 255 }, + UNK1F_2 | UNK1F_POINTLIGHTPOS_TO_PLAYER, + }, + { + { 60, 1743, -310 }, + { 60, 1743, -310 }, + 30, + 30, + 0.0f, + 0, + 100, + 0.94f, + { 255, 255, 255 }, + UNK1F_2 | UNK1F_POINTLIGHTPOS_TO_PLAYER, + }, + { + { -1174, 448, 1194 }, + { -1174, 148, 1194 }, + 50, + 100, + 1.0f, + 50, + 150, + 0.8f, + { 255, 255, 255 }, + UNK1F_0 | UNK1F_1, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, -}; - -static MirRayDataEntry sMirRayData[] = { - { { -1160, 686, -880 }, { -920, 480, -889 }, 30, 50, 1.0f, 50, 150, 0.8f, 255, 255, 255, 0x02 }, - { { -1856, 1092, -190 }, { -1703, 841, -186 }, 30, 70, 0.88f, 54, 150, 0.8f, 255, 255, 255, 0x02 }, - { { 1367, 738, -860 }, { 1091, 476, -860 }, 30, 85, 0.0f, 0, 150, 0.8f, 255, 255, 255, 0x00 }, - { { 2200, 1103, -220 }, { 2040, 843, -220 }, 30, 60, 0.0f, 0, 150, 0.8f, 255, 255, 255, 0x01 }, - { { -560, 2169, -310 }, { -560, 1743, -310 }, 30, 70, 0.0f, 0, 150, 0.8f, 255, 255, 255, 0x00 }, - { { 60, 1802, -1090 }, { 60, 973, -1090 }, 30, 70, 0.0f, 0, 150, 0.9f, 255, 255, 255, 0x0D }, - { { 1140, 480, -860 }, { 1140, 480, -860 }, 30, 30, 1.0f, 10, 100, 0.9f, 255, 255, 255, 0x0E }, - { { -560, 1743, -310 }, { -560, 1743, -310 }, 30, 30, 0.0f, 0, 100, 0.94f, 255, 255, 255, 0x0C }, - { { 60, 1743, -310 }, { 60, 1743, -310 }, 30, 30, 0.0f, 0, 100, 0.94f, 255, 255, 255, 0x0C }, - { { -1174, 448, 1194 }, { -1174, 148, 1194 }, 50, 100, 1.0f, 50, 150, 0.8f, 255, 255, 255, 0x03 } }; - -static InitChainEntry sInitChain[] = { +static InitChainEntry D_80B8E838[] = { ICHAIN_VEC3F_DIV1000(scale, 0, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 4000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 1000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 1000, ICHAIN_STOP), }; -void MirRay_SetupCollider(MirRay* this) { - Vec3f colliderOffset; - MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; - - colliderOffset.x = (this->poolPt.x - this->sourcePt.x) * dataEntry->unk_10; - colliderOffset.y = (this->poolPt.y - this->sourcePt.y) * dataEntry->unk_10; - colliderOffset.z = (this->poolPt.z - this->sourcePt.z) * dataEntry->unk_10; - this->colliderJntSph.elements[0].dim.worldSphere.center.x = colliderOffset.x + this->sourcePt.x; - this->colliderJntSph.elements[0].dim.worldSphere.center.y = colliderOffset.y + this->sourcePt.y; - this->colliderJntSph.elements[0].dim.worldSphere.center.z = colliderOffset.z + this->sourcePt.z; - this->colliderJntSph.elements[0].dim.worldSphere.radius = - dataEntry->unk_14 * this->colliderJntSph.elements->dim.scale; +void MirRay_UpdateColliderSphereShape(MirRay* this) { + Vec3f vec; + struct_80B8E6F8* temp_v0; + ColliderJntSphElement* new_var; + + temp_v0 = &D_80B8E6F8[this->actor.params]; + vec.x = (this->coneFrustumCenterBase.x - this->coneFrustumCenterTop.x) * + temp_v0->unk10_sphereColliderPosRatioTowardsBase; + vec.y = (this->coneFrustumCenterBase.y - this->coneFrustumCenterTop.y) * + temp_v0->unk10_sphereColliderPosRatioTowardsBase; + vec.z = (this->coneFrustumCenterBase.z - this->coneFrustumCenterTop.z) * + temp_v0->unk10_sphereColliderPosRatioTowardsBase; + this->unk14C.elements[0].dim.worldSphere.center.x = this->coneFrustumCenterTop.x + vec.x; + this->unk14C.elements[0].dim.worldSphere.center.y = this->coneFrustumCenterTop.y + vec.y; + this->unk14C.elements[0].dim.worldSphere.center.z = this->coneFrustumCenterTop.z + vec.z; + new_var = &this->unk14C.elements[0]; + new_var->dim.worldSphere.radius = temp_v0->unk14_sphereColliderRadiusModel * new_var->dim.scale; } -// Set up a light point between source point and reflection point. Reflection point is the pool point (for windows) or -// at the player position (for mirrors) -void MirRay_MakeShieldLight(MirRay* this, PlayState* play) { - Player* player = GET_PLAYER(play); - MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; - Vec3f reflectionPt; - Vec3s lightPt; - - if (MirRay_CheckInFrustum(&this->sourcePt, &this->poolPt, player->actor.world.pos.x, - player->actor.world.pos.y + 30.0f, player->actor.world.pos.z, this->sourceEndRad, - this->poolEndRad)) { - - 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); +void MirRay_UpdateLight(MirRay* this, PlayState* play) { + Player* player; + struct_80B8E6F8* temp_s1; + Vec3f sp44; + Vec3s pointLightPos; + + player = GET_PLAYER(play); + temp_s1 = &D_80B8E6F8[this->actor.params]; + if (MirRay_IsInConeFrustum(&this->coneFrustumCenterTop, &this->coneFrustumCenterBase, player->actor.world.pos.x, + player->actor.world.pos.y + 30.0f, player->actor.world.pos.z, this->coneFrustumRadiusTop, + this->coneFrustumRadiusBase)) { + if (temp_s1->unk1F & UNK1F_POINTLIGHTPOS_TO_PLAYER) { + Math_Vec3f_Diff(&player->actor.world.pos, &this->coneFrustumCenterTop, &sp44); + } else { + Math_Vec3f_Diff(&this->coneFrustumCenterBase, &this->coneFrustumCenterTop, &sp44); } - - lightPt.x = (dataEntry->unk_18 * reflectionPt.x) + this->sourcePt.x; - lightPt.y = (dataEntry->unk_18 * reflectionPt.y) + this->sourcePt.y; - lightPt.z = (dataEntry->unk_18 * reflectionPt.z) + this->sourcePt.z; - - // Fade up - Math_StepToS(&this->lightPointRad, dataEntry->lgtPtMaxRad, 6); - Lights_PointNoGlowSetInfo(&this->lightInfo, lightPt.x, lightPt.y, lightPt.z, dataEntry->color.r, - dataEntry->color.g, dataEntry->color.b, this->lightPointRad); + pointLightPos.x = (temp_s1->unk18_pointLightPosRatio * sp44.x) + this->coneFrustumCenterTop.x; + pointLightPos.y = (temp_s1->unk18_pointLightPosRatio * sp44.y) + this->coneFrustumCenterTop.y; + pointLightPos.z = (temp_s1->unk18_pointLightPosRatio * sp44.z) + this->coneFrustumCenterTop.z; + Math_StepToS(&this->pointLightRadius, temp_s1->unk16_pointLightRadius, 6); + Lights_PointNoGlowSetInfo(&this->lightInfo, pointLightPos.x, pointLightPos.y, pointLightPos.z, + temp_s1->unk1C_lightColor.r, temp_s1->unk1C_lightColor.g, temp_s1->unk1C_lightColor.b, + this->pointLightRadius); } else { - // Fade down - Math_StepToS(&this->lightPointRad, 0, 6); - Lights_PointSetColorAndRadius(&this->lightInfo, dataEntry->color.r, dataEntry->color.g, dataEntry->color.b, - this->lightPointRad); + Math_StepToS(&this->pointLightRadius, 0, 6); + Lights_PointSetColorAndRadius(&this->lightInfo, temp_s1->unk1C_lightColor.r, temp_s1->unk1C_lightColor.g, + temp_s1->unk1C_lightColor.b, this->pointLightRadius); } } void MirRay_Init(Actor* thisx, PlayState* play) { s32 pad; + struct_80B8E6F8* temp_s1; MirRay* this = (MirRay*)thisx; - MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; - Actor_ProcessInitChain(&this->actor, sInitChain); + temp_s1 = &D_80B8E6F8[this->actor.params]; + Actor_ProcessInitChain(&this->actor, D_80B8E838); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); - PRINTF(T("反射用 光の発生!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n", - "Spawn of reflectable light!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")); - LOG_NUM("this->actor.arg_data", this->actor.params, "../z_mir_ray.c", 518); - - if (this->actor.params >= 0xA) { - LOG_STRING_T("反射光 発生失敗", "Reflected light failed to spawn", "../z_mir_ray.c", 521); + PRINTF("反射用 光の発生!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); +#if DEBUG_FEATURES + LogUtils_LogThreadId("../z_mir_ray.c", 518); + PRINTF("this->actor.arg_data = %d\n", this->actor.params); +#endif + if (this->actor.params >= ARRAY_COUNT(D_80B8E6F8)) { + LOG_STRING("反射光 発生失敗", "../z_mir_ray.c", 521); Actor_Kill(&this->actor); } - - this->sourcePt.x = dataEntry->sourcePoint.x; - this->sourcePt.y = dataEntry->sourcePoint.y; - this->sourcePt.z = dataEntry->sourcePoint.z; - this->sourceEndRad = dataEntry->sourceEndRadius; - - this->poolPt.x = dataEntry->poolPoint.x; - this->poolPt.y = dataEntry->poolPoint.y; - this->poolPt.z = dataEntry->poolPoint.z; - this->poolEndRad = dataEntry->poolEndRadius; - - Lights_PointNoGlowSetInfo(&this->lightInfo, this->sourcePt.x, this->sourcePt.y, this->sourcePt.z, 255, 255, 255, - 100); + this->coneFrustumCenterTop.x = temp_s1->coneFrustumCenterTop.x; + this->coneFrustumCenterTop.y = temp_s1->coneFrustumCenterTop.y; + this->coneFrustumCenterTop.z = temp_s1->coneFrustumCenterTop.z; + this->coneFrustumRadiusTop = temp_s1->coneFrustumRadiusTop; + this->coneFrustumCenterBase.x = temp_s1->coneFrustumCenterBase.x; + this->coneFrustumCenterBase.y = temp_s1->coneFrustumCenterBase.y; + this->coneFrustumCenterBase.z = temp_s1->coneFrustumCenterBase.z; + this->coneFrustumRadiusBase = temp_s1->coneFrustumRadiusBase; + Lights_PointNoGlowSetInfo(&this->lightInfo, this->coneFrustumCenterTop.x, this->coneFrustumCenterTop.y, + this->coneFrustumCenterTop.z, 255, 255, 255, 100); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); - - this->shieldCorners[0].x = -536.0f; - this->shieldCorners[0].y = -939.0f; - - this->shieldCorners[1].x = -1690.0f; - this->shieldCorners[1].y = 0.0f; - - this->shieldCorners[2].x = -536.0f; - this->shieldCorners[2].y = 938.0f; - - this->shieldCorners[3].x = 921.0f; - this->shieldCorners[3].y = 0.0f; - - this->shieldCorners[4].x = 758.0f; - this->shieldCorners[4].y = 800.0f; - - this->shieldCorners[5].x = 758.0f; - this->shieldCorners[5].y = -800.0f; - - if (PARAMS_GET_NOSHIFT(dataEntry->params, 1, 1)) { - Collider_InitJntSph(play, &this->colliderJntSph); - Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); - if (!PARAMS_GET_NOSHIFT(dataEntry->params, 2, 1)) { // Beams not from mirrors - MirRay_SetupCollider(this); + this->reflectionOriginModelPositions[0].x = -536.0f; + this->reflectionOriginModelPositions[0].y = -939.0f; + this->reflectionOriginModelPositions[1].x = -1690.0f; + this->reflectionOriginModelPositions[1].y = 0.0f; + this->reflectionOriginModelPositions[2].x = -536.0f; + this->reflectionOriginModelPositions[2].y = 938.0f; + this->reflectionOriginModelPositions[3].x = 921.0f; + this->reflectionOriginModelPositions[3].y = 0.0f; + this->reflectionOriginModelPositions[4].x = 758.0f; + this->reflectionOriginModelPositions[4].y = 800.0f; + this->reflectionOriginModelPositions[5].x = 758.0f; + this->reflectionOriginModelPositions[5].y = -800.0f; + if (temp_s1->unk1F & UNK1F_1) { + Collider_InitJntSph(play, &this->unk14C); + Collider_SetJntSph(play, &this->unk14C, &this->actor, &D_80B8E6E8, &this->unk16C); + if (!(temp_s1->unk1F & UNK1F_2)) { + MirRay_UpdateColliderSphereShape(this); } } - - Collider_InitQuad(play, &this->shieldRay); - Collider_SetQuad(play, &this->shieldRay, &this->actor, &sQuadInit); - - // Spirit Temple top room mirrors + Collider_InitQuad(play, &this->unk1AC); + Collider_SetQuad(play, &this->unk1AC, &this->actor, &D_80B8E674); if ((this->actor.params == 5) || (this->actor.params == 7) || (this->actor.params == 8)) { this->actor.room = -1; } @@ -244,239 +321,247 @@ void MirRay_Destroy(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; LightContext_RemoveLight(play, &play->lightCtx, this->lightNode); - - if (sMirRayData[this->actor.params].params & 2) { - Collider_DestroyJntSph(play, &this->colliderJntSph); + if (D_80B8E6F8[this->actor.params].unk1F & UNK1F_1) { + Collider_DestroyJntSph(play, &this->unk14C); } - - Collider_DestroyQuad(play, &this->shieldRay); + Collider_DestroyQuad(play, &this->unk1AC); } void MirRay_Update(Actor* thisx, PlayState* play) { - s32 pad; + s32 pad[2]; + Player* player; MirRay* this = (MirRay*)thisx; - Player* player = GET_PLAYER(play); - D_80B8E670 = 0; - - if (!this->unLit) { - if (sMirRayData[this->actor.params].params & 2) { - if (sMirRayData[this->actor.params].params & 4) { // Beams from mirrors - MirRay_SetupCollider(this); + player = GET_PLAYER(play); + D_80B8E670 = false; + if (this->unk2AE == 0) { + if (D_80B8E6F8[this->actor.params].unk1F & UNK1F_1) { + if (D_80B8E6F8[this->actor.params].unk1F & UNK1F_2) { + MirRay_UpdateColliderSphereShape(this); } - CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk14C.base); } - if (this->reflectIntensity > 0.0f) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->shieldRay.base); + if (this->lightReflectionFactor > 0.0f) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1AC.base); } - MirRay_MakeShieldLight(this, play); - - if (this->reflectIntensity > 0.0f) { + MirRay_UpdateLight(this, play); + if (this->lightReflectionFactor > 0.0f) { Actor_PlaySfx_Flagged2(&player->actor, NA_SE_IT_SHIELD_BEAM - SFX_FLAG); } } } -void MirRay_SetIntensity(MirRay* this, PlayState* play) { - f32 sp4C[3]; - f32 temp_f0; - f32 temp_f0_2; - f32 temp_f2_2; - s32 pad; - Player* player = GET_PLAYER(play); - MtxF* shieldMtx = &player->shieldMf; - - this->reflectIntensity = 0.0f; - - if (MirRay_CheckInFrustum(&this->sourcePt, &this->poolPt, shieldMtx->xw, shieldMtx->yw, shieldMtx->zw, - this->sourceEndRad, this->poolEndRad)) { - - temp_f0 = sqrtf(SQ(shieldMtx->zz) + (SQ(shieldMtx->xz) + SQ(shieldMtx->yz))); - - if (temp_f0 == 0.0f) { - this->reflectRange = 1.0f; +void func_80B8D6F0(MirRay* this, PlayState* play) { + Vec3f sp4C_lightShineDirection; + f32 temp_fv0; + f32 temp_fv0_2; + f32 temp_fv1_2; + MtxF* shieldMf; + Player* player; + + player = GET_PLAYER(play); + this->lightReflectionFactor = 0.0f; + shieldMf = &player->shieldMf; + if (MirRay_IsInConeFrustum(&this->coneFrustumCenterTop, &this->coneFrustumCenterBase, shieldMf->xw, shieldMf->yw, + shieldMf->zw, this->coneFrustumRadiusTop, this->coneFrustumRadiusBase)) { + temp_fv0 = sqrtf(SQ(shieldMf->zz) + (SQ(shieldMf->xz) + SQ(shieldMf->yz))); + if (temp_fv0 == 0.0f) { + this->shieldForwardNormalizeFactor = 1.0f; } else { - this->reflectRange = 1.0f / temp_f0; + this->shieldForwardNormalizeFactor = 1.0f / temp_fv0; } - - // If light beam is adirectional, always reflect, else only reflect if shield is pointing in correct direction - if (sMirRayData[this->actor.params].params & 1) { - this->reflectIntensity = 1.0f; + if (D_80B8E6F8[this->actor.params].unk1F & UNK1F_0) { + this->lightReflectionFactor = 1.0f; } else { - sp4C[0] = this->poolPt.x - this->sourcePt.x; - sp4C[1] = this->poolPt.y - this->sourcePt.y; - sp4C[2] = this->poolPt.z - this->sourcePt.z; - - temp_f2_2 = -shieldMtx->xz * sp4C[0] - shieldMtx->yz * sp4C[1] - shieldMtx->zz * sp4C[2]; - - if (temp_f2_2 < 0.0f) { - temp_f0_2 = sqrtf(SQ(sp4C[0]) + SQ(sp4C[1]) + SQ(sp4C[2])); - if ((temp_f0 != 0.0f) && (temp_f0_2 != 0.0f)) { - this->reflectIntensity = -temp_f2_2 / (temp_f0 * temp_f0_2); + sp4C_lightShineDirection.x = this->coneFrustumCenterBase.x - this->coneFrustumCenterTop.x; + sp4C_lightShineDirection.y = this->coneFrustumCenterBase.y - this->coneFrustumCenterTop.y; + sp4C_lightShineDirection.z = this->coneFrustumCenterBase.z - this->coneFrustumCenterTop.z; + sp4C_lightShineDirection = sp4C_lightShineDirection; //! FAKE + // The shield's forward direction is -z in model space + temp_fv1_2 = (-shieldMf->xz * sp4C_lightShineDirection.x) - (shieldMf->yz * sp4C_lightShineDirection.y) - + (sp4C_lightShineDirection.z * shieldMf->zz); + if (temp_fv1_2 < 0.0f) { + temp_fv0_2 = sqrtf(SQ(sp4C_lightShineDirection.z) + + (SQ(sp4C_lightShineDirection.x) + SQ(sp4C_lightShineDirection.y))); + if ((temp_fv0 != 0.0f) && (temp_fv0_2 != 0.0f)) { + this->lightReflectionFactor = -temp_fv1_2 / (temp_fv0 * temp_fv0_2); } } } } } -// Draws six images, one for each corner of the shield, by finding the intersection of a line segment from the corner -// perpendicular to the shield with the nearest collision (if any). -void MirRay_SetupReflectionPolys(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { - Player* player = GET_PLAYER(play); - MtxF* shieldMtx; +void func_80B8D8A0(MirRay* this, PlayState* play, struct_80B8D8A0* arg2) { + Player* player; // v0 + MtxF* shieldMf; // s0 s32 i; - Vec3f posA; - Vec3f posB; - Vec3f posResult; - CollisionPoly* outPoly; - f32 sp60[3]; - - shieldMtx = &player->shieldMf; - - sp60[0] = -((*shieldMtx).xz * this->reflectRange) * this->reflectIntensity * 400.0f; - sp60[1] = -((*shieldMtx).yz * this->reflectRange) * this->reflectIntensity * 400.0f; - sp60[2] = -((*shieldMtx).zz * this->reflectRange) * this->reflectIntensity * 400.0f; - + Vec3f reflectionOriginPos; // sp88 + Vec3f reflectionMaxPos; // sp7C + Vec3f sp70; // sp70 + CollisionPoly* sp6C; // sp6C + Vec3f forwards; // sp60 + + player = GET_PLAYER(play); + shieldMf = &player->shieldMf; + forwards.x = -(shieldMf->xz * this->shieldForwardNormalizeFactor) * this->lightReflectionFactor * 400.0f; + forwards.y = -(shieldMf->yz * this->shieldForwardNormalizeFactor) * this->lightReflectionFactor * 400.0f; + forwards.z = -(shieldMf->zz * this->shieldForwardNormalizeFactor) * this->lightReflectionFactor * 400.0f; for (i = 0; i < 6; i++) { - posA.x = ((*shieldMtx).xw + (this->shieldCorners[i].x * (*shieldMtx).xx)) + - (this->shieldCorners[i].y * (*shieldMtx).xy); - posA.y = ((*shieldMtx).yw + (this->shieldCorners[i].x * (*shieldMtx).yx)) + - (this->shieldCorners[i].y * (*shieldMtx).yy); - posA.z = ((*shieldMtx).zw + (this->shieldCorners[i].x * (*shieldMtx).zx)) + - (this->shieldCorners[i].y * (*shieldMtx).zy); - posB.x = sp60[0] + posA.x; - posB.y = sp60[1] + posA.y; - posB.z = sp60[2] + posA.z; - if (BgCheck_AnyLineTest1(&play->colCtx, &posA, &posB, &posResult, &outPoly, 1)) { - reflection[i].reflectionPoly = outPoly; + if (!(&forwards) != 0) {} //! FAKE + //! FAKE (*shieldMf) + reflectionOriginPos.x = shieldMf->xw + (this->reflectionOriginModelPositions[i].x * shieldMf->xx) + + (this->reflectionOriginModelPositions[i].y * (*shieldMf).xy); + reflectionOriginPos.y = shieldMf->yw + (this->reflectionOriginModelPositions[i].x * shieldMf->yx) + + (this->reflectionOriginModelPositions[i].y * (*shieldMf).yy); + reflectionOriginPos.z = shieldMf->zw + (this->reflectionOriginModelPositions[i].x * shieldMf->zx) + + (this->reflectionOriginModelPositions[i].y * (*shieldMf).zy); + reflectionMaxPos.x = forwards.x + reflectionOriginPos.x; + reflectionMaxPos.y = forwards.y + reflectionOriginPos.y; + reflectionMaxPos.z = forwards.z + reflectionOriginPos.z; + if (BgCheck_AnyLineTest1(&play->colCtx, &reflectionOriginPos, &reflectionMaxPos, &sp70, &sp6C, 1) != 0) { + arg2[i].unk4C = sp6C; } else { - reflection[i].reflectionPoly = NULL; + arg2[i].unk4C = NULL; } } } -// Remove reflections that are in the same position and are sufficiently near to the same plane -void MirRay_RemoveSimilarReflections(MirRayShieldReflection* reflection) { +void func_80B8DA78(struct_80B8D8A0* arg0) { s32 i; s32 j; for (i = 0; i < 6; i++) { for (j = i + 1; j < 6; j++) { - if (reflection[i].reflectionPoly != NULL) { - if ((reflection[j].reflectionPoly != NULL) && - (ABS(reflection[i].reflectionPoly->normal.x - reflection[j].reflectionPoly->normal.x) < 100) && - (ABS(reflection[i].reflectionPoly->normal.y - reflection[j].reflectionPoly->normal.y) < 100) && - (ABS(reflection[i].reflectionPoly->normal.z - reflection[j].reflectionPoly->normal.z) < 100) && - (reflection[i].reflectionPoly->dist == reflection[j].reflectionPoly->dist)) { - reflection[j].reflectionPoly = NULL; - } + if ((arg0[i].unk4C != NULL) && (arg0[j].unk4C != NULL) && + (ABS(arg0[i].unk4C->normal.x - arg0[j].unk4C->normal.x) < 100) && + (ABS(arg0[i].unk4C->normal.y - arg0[j].unk4C->normal.y) < 100) && + (ABS(arg0[i].unk4C->normal.z - arg0[j].unk4C->normal.z) < 100) && + (arg0[i].unk4C->dist == arg0[j].unk4C->dist)) { + arg0[j].unk4C = NULL; } } } } -// Creates the reflected beam's collider (to interact with objects) and places and orients the shield images -void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* reflection) { - Player* player = GET_PLAYER(play); - s32 i; - f32 temp_f0; - Vec3f vecB; - Vec3f vecD; - Vec3f sp118; - Vec3f sp10C; - Vec3f sp100; - Vec3f intersection; - f32 spE8[3]; - f32 polyNormal[3]; - MtxF* shieldMtx; - - shieldMtx = &player->shieldMf; - - spE8[0] = -(shieldMtx->xz * this->reflectRange) * this->reflectIntensity * 400.0f; - spE8[1] = -(shieldMtx->yz * this->reflectRange) * this->reflectIntensity * 400.0f; - spE8[2] = -(shieldMtx->zz * this->reflectRange) * this->reflectIntensity * 400.0f; - - vecB.x = shieldMtx->xw; - vecB.y = shieldMtx->yw; - vecB.z = shieldMtx->zw; - - vecD.x = spE8[0] + vecB.x; - vecD.y = spE8[1] + vecB.y; - vecD.z = spE8[2] + vecB.z; +void func_80B8DB7C(MirRay* this, PlayState* play, struct_80B8D8A0* arg2) { + MirRay* new_var4 = this; + float new_var2; + MtxF* shieldMf; // s1 + Vec3f originPos; // sp130 + Vec3f inFrontPos; // sp124 + Vec3f intersect; // sp118 + Vec3f originPosWithOffset; // sp10C + Vec3f inFrontPosWithOffset; // sp100 + Vec3f intersectWithOffset; // spF4 + Vec3f forwards; // spE8 + Vec3f spDC; // spDC + Player* player; // s3 + + player = GET_PLAYER(play); + shieldMf = &player->shieldMf; + forwards.x = -(shieldMf->xz * this->shieldForwardNormalizeFactor) * this->lightReflectionFactor * 400.0f; + new_var2 = 100.0f; + forwards.y = -(shieldMf->yz * this->shieldForwardNormalizeFactor) * new_var4->lightReflectionFactor * 400.0f; + forwards.z = -(shieldMf->zz * new_var4->shieldForwardNormalizeFactor) * new_var4->lightReflectionFactor * 400.0f; + // Where the mirror shield is located + originPos.x = shieldMf->xw; + originPos.y = shieldMf->yw; + originPos.z = shieldMf->zw; + // In front of the mirror shield + inFrontPos.x = forwards.x + originPos.x; + inFrontPos.y = forwards.y + originPos.y; + inFrontPos.z = forwards.z + originPos.z; { - Vec3f vecA; - Vec3f vecC; - - vecA.x = vecB.x + (shieldMtx->xx * 300.0f); - vecA.y = vecB.y + (shieldMtx->yx * 300.0f); - vecA.z = vecB.z + (shieldMtx->zx * 300.0f); - - vecC.x = vecD.x + (shieldMtx->xx * 300.0f); - vecC.y = vecD.y + (shieldMtx->yx * 300.0f); - vecC.z = vecD.z + (shieldMtx->zx * 300.0f); - - Collider_SetQuadVertices(&this->shieldRay, &vecA, &vecB, &vecC, &vecD); - + Vec3f upPos; // spCC + Vec3f upAndInFrontPos; // spC0 + s32 i; // s2 + struct_80B8D8A0* var_s0; // s0 + float new_var3; + f32* new_var; + f32 sp80; // sp80 + s32 pad2; + f32 temp_fv0; + + // Above the mirror shield origin + upPos.x = (shieldMf->xx * 300.0f) + originPos.x; + upPos.y = (shieldMf->yx * 300.0f) + originPos.y; + upPos.z = (shieldMf->zx * 300.0f) + originPos.z; + // Above and in front of the origin + upAndInFrontPos.x = (shieldMf->xx * 300.0f) + inFrontPos.x; + upAndInFrontPos.y = (shieldMf->yx * 300.0f) + inFrontPos.y; + upAndInFrontPos.z = (shieldMf->zx * 300.0f) + inFrontPos.z; + Collider_SetQuadVertices(&this->unk1AC, &upPos, &originPos, &upAndInFrontPos, &inFrontPos); for (i = 0; i < 6; i++) { - if (reflection[i].reflectionPoly != NULL) { - polyNormal[0] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.x); - polyNormal[1] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.y); - polyNormal[2] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.z); - - if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], - reflection[i].reflectionPoly->dist, &vecB, &vecD, &sp118, 1)) { - - reflection[i].pos.x = sp118.x; - reflection[i].pos.y = sp118.y; - reflection[i].pos.z = sp118.z; - - temp_f0 = sqrtf(SQ(sp118.x - vecB.x) + SQ(sp118.y - vecB.y) + SQ(sp118.z - vecB.z)); - - if (temp_f0 < (this->reflectIntensity * 600.0f)) { - reflection[i].opacity = 200; + new_var = &spDC.x; //! FAKE + var_s0 = &arg2[i]; + if (var_s0->unk4C != NULL) { + if (&forwards) {} //! FAKE + spDC.x = COLPOLY_GET_NORMAL(var_s0->unk4C->normal.x); + spDC.y = COLPOLY_GET_NORMAL(var_s0->unk4C->normal.y); + spDC.z = COLPOLY_GET_NORMAL(var_s0->unk4C->normal.z); + if (Math3D_LineSegVsPlane(*new_var, spDC.y, spDC.z, var_s0->unk4C->dist, &originPos, &inFrontPos, + &intersect, true)) { + var_s0->reflectionPos.x = intersect.x; + var_s0->reflectionPos.y = intersect.y; + var_s0->reflectionPos.z = intersect.z; + temp_fv0 = sqrtf(SQ(intersect.x - originPos.x) + SQ(intersect.y - originPos.y) + + SQ(intersect.z - originPos.z)); + //! @bug temp_fv0 is at most + //! norm(sp124_inFront - sp130_origin) = norm(spE8_forwards) = this->lightReflectionFactor * 400 + //! so this condition always passes. This logic was probably meant to fade the reflections with + //! distance. (TODO test in-game) + if (temp_fv0 < (this->lightReflectionFactor * 600.0f)) { + var_s0->unk50 = 200; } else { - reflection[i].opacity = (s32)(800.0f - temp_f0); + var_s0->unk50 = (u8)(s32)(800.0f - temp_fv0); } - sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->yx * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->zx * 100.0f) + vecB.z; - - sp100.x = (spE8[0] * 4.0f) + sp10C.x; - sp100.y = (spE8[1] * 4.0f) + sp10C.y; - sp100.z = (spE8[2] * 4.0f) + sp10C.z; - - reflection[i].mtx.zw = 0.0f; - - reflection[i].mtx.xx = reflection[i].mtx.yy = reflection[i].mtx.zz = reflection[i].mtx.ww = 1.0f; - reflection[i].mtx.yx = reflection[i].mtx.zx = reflection[i].mtx.wx = reflection[i].mtx.xy = - reflection[i].mtx.zy = reflection[i].mtx.wy = reflection[i].mtx.xz = reflection[i].mtx.yz = - reflection[i].mtx.wz = reflection[i].mtx.xw = reflection[i].mtx.yw = reflection[i].mtx.zw; - - if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], - reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { - reflection[i].mtx.xx = intersection.x - sp118.x; - reflection[i].mtx.yx = intersection.y - sp118.y; - reflection[i].mtx.zx = intersection.z - sp118.z; + // The rest of the function computes a transformation that transforms the XY plane (corresponding to + // the reflection in model space) into the surface plane. It does so by computing the same + // intersection as above but with an offset in the x direction, which gives the transformation for + // the x axis, then the same in the y direction. + + originPosWithOffset.x = (shieldMf->xx * new_var2) + originPos.x; + originPosWithOffset.y = (shieldMf->yx * new_var2) + originPos.y; + originPosWithOffset.z = (shieldMf->zx * 100.0f) + originPos.z; + inFrontPosWithOffset.x = (forwards.x * 4.0f) + originPosWithOffset.x; + inFrontPosWithOffset.y = (forwards.y * 4.0f) + originPosWithOffset.y; + inFrontPosWithOffset.z = (forwards.z * 4.0f) + originPosWithOffset.z; + var_s0->reflectionTransform.xx = var_s0->reflectionTransform.yy = var_s0->reflectionTransform.zz = + var_s0->reflectionTransform.ww = 1.0f; + + //! FAKE + sp80 = var_s0->reflectionTransform.zw = 0.0f; + new_var3 = var_s0->reflectionTransform.xz = var_s0->reflectionTransform.yz = + var_s0->reflectionTransform.wz = var_s0->reflectionTransform.xw = + var_s0->reflectionTransform.yw = sp80; + var_s0->reflectionTransform.yx = var_s0->reflectionTransform.zx = var_s0->reflectionTransform.wx = + var_s0->reflectionTransform.xy = var_s0->reflectionTransform.zy = + var_s0->reflectionTransform.wy = new_var3; + if (Math3D_LineSegVsPlane(spDC.x, spDC.y, spDC.z, var_s0->unk4C->dist, &originPosWithOffset, + &inFrontPosWithOffset, &intersectWithOffset, true)) { + do { + } while (0); //! FAKE + var_s0->reflectionTransform.xx = intersectWithOffset.x - intersect.x; + var_s0->reflectionTransform.yx = intersectWithOffset.y - intersect.y; + var_s0->reflectionTransform.zx = intersectWithOffset.z - intersect.z; } - - sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x; - sp10C.y = (shieldMtx->yy * 100.0f) + vecB.y; - sp10C.z = (shieldMtx->zy * 100.0f) + vecB.z; - - sp100.x = (spE8[0] * 4.0f) + sp10C.x; - sp100.y = (spE8[1] * 4.0f) + sp10C.y; - sp100.z = (spE8[2] * 4.0f) + sp10C.z; - - if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], - reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) { - reflection[i].mtx.xy = intersection.x - sp118.x; - reflection[i].mtx.yy = intersection.y - sp118.y; - reflection[i].mtx.zy = intersection.z - sp118.z; + originPosWithOffset.x = (shieldMf->xy * 100.0f) + originPos.x; + originPosWithOffset.y = (shieldMf->yy * 100.0f) + originPos.y; + originPosWithOffset.z = (shieldMf->zy * 100.0f) + originPos.z; + inFrontPosWithOffset.x = (forwards.x * 4.0f) + originPosWithOffset.x; + inFrontPosWithOffset.y = (forwards.y * 4.0f) + originPosWithOffset.y; + inFrontPosWithOffset.z = (forwards.z * 4.0f) + originPosWithOffset.z; + if (Math3D_LineSegVsPlane(spDC.x, spDC.y, spDC.z, var_s0->unk4C->dist, &originPosWithOffset, + &inFrontPosWithOffset, &intersectWithOffset, true)) { + if (!intersect.z) {} //! FAKE + var_s0->reflectionTransform.xy = intersectWithOffset.x - intersect.x; + var_s0->reflectionTransform.yy = intersectWithOffset.y - intersect.y; + var_s0->reflectionTransform.zy = intersectWithOffset.z - intersect.z; } } else { - reflection[i].reflectionPoly = NULL; + var_s0->unk4C = NULL; } } } @@ -485,113 +570,106 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection* void MirRay_Draw(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; - Player* player = GET_PLAYER(play); s32 i; - MirRayShieldReflection reflection[6]; s32 pad; + struct_80B8D8A0 sp7C[6]; + Player* player; - this->reflectIntensity = 0.0f; - if ((D_80B8E670 == 0) && !this->unLit && Player_HasMirrorShieldSetToDraw(play)) { + player = GET_PLAYER(play); + this->lightReflectionFactor = 0.0f; + if (!D_80B8E670 && (this->unk2AE == 0) && Player_HasMirrorShieldSetToDraw(play)) { Matrix_Mult(&player->shieldMf, MTXMODE_NEW); - MirRay_SetIntensity(this, play); - if (!(this->reflectIntensity <= 0.0f)) { + func_80B8D6F0(this, play); + if (!(this->lightReflectionFactor <= 0.0f)) { OPEN_DISPS(play->state.gfxCtx, "../z_mir_ray.c", 966); - Gfx_SetupDL_25Xlu(play->state.gfxCtx); - Matrix_Scale(1.0f, 1.0f, this->reflectIntensity * 5.0f, MTXMODE_APPLY); + Matrix_Scale(1.0f, 1.0f, this->lightReflectionFactor * 5.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_mir_ray.c", 972); - 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); - MirRay_ReflectedBeam(this, play, reflection); - - if (reflection[0].reflectionPoly == NULL) { - reflection[0].opacity = 0; + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 150, + (u8)(s32)(this->lightReflectionFactor * 100.0f)); + gSPDisplayList(POLY_XLU_DISP++, object_mir_ray_000C50_DL); + func_80B8D8A0(this, play, sp7C); + func_80B8DA78(sp7C); + func_80B8DB7C(this, play, sp7C); + if (sp7C[0].unk4C == NULL) { + sp7C[0].unk50 = 0; } - for (i = 1; i < 6; i++) { - if (reflection[i].reflectionPoly != NULL) { - if (reflection[0].opacity < reflection[i].opacity) { - reflection[0].opacity = reflection[i].opacity; + for (i = 1; i < ARRAY_COUNT(sp7C); i++) { + if (sp7C[i].unk4C != NULL) { + if (sp7C[0].unk50 < sp7C[i].unk50) { + sp7C[0].unk50 = sp7C[i].unk50; } } } - for (i = 0; i < 6; i++) { - if (reflection[i].reflectionPoly != NULL) { - Matrix_Translate(reflection[i].pos.x, reflection[i].pos.y, reflection[i].pos.z, MTXMODE_NEW); + for (i = 0; i < ARRAY_COUNT(sp7C); i++) { + if (sp7C[i].unk4C != NULL) { + Matrix_Translate(sp7C[i].reflectionPos.x, sp7C[i].reflectionPos.y, sp7C[i].reflectionPos.z, + MTXMODE_NEW); Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); - Matrix_Mult(&reflection[i].mtx, MTXMODE_APPLY); + Matrix_Mult(&sp7C[i].reflectionTransform, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_mir_ray.c", 1006); gDPSetRenderMode(POLY_XLU_DISP++, G_RM_FOG_SHADE_A, G_RM_AA_ZB_XLU_DECAL2); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 150, reflection[0].opacity); - gSPDisplayList(POLY_XLU_DISP++, gShieldBeamImageDL); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 150, sp7C[0].unk50); + gSPDisplayList(POLY_XLU_DISP++, object_mir_ray_0000B0_DL); } } - - D_80B8E670 = 1; - + D_80B8E670 = true; CLOSE_DISPS(play->state.gfxCtx, "../z_mir_ray.c", 1027); } } } -// Computes if the Point (pointx, pointy, pointz) lies within the right conical frustum with one end centred at vecA -// with radius radiusA, the other at vecB with radius radiusB -s32 MirRay_CheckInFrustum(Vec3f* vecA, Vec3f* vecB, f32 pointx, f32 pointy, f32 pointz, s16 radiusA, s16 radiusB) { - f32 coneRadius; - f32 closestPtx; - f32 closestPty; - f32 closestPtz; - Vec3f vecdiff; - f32 dist; - Vec3f sp5C; - Vec3f sp50; - Vec3f sp44; - - vecdiff.x = vecB->x - vecA->x; - vecdiff.y = vecB->y - vecA->y; - vecdiff.z = vecB->z - vecA->z; - - dist = SQ(vecdiff.x) + SQ(vecdiff.y) + SQ(vecdiff.z); - - if (dist == 0.0f) { - return 0; +/** + * Checks if coordinates (x,y,z) lie inside the cone frustum defined by the given top face (a disk centered on + * `centerTop` with radius `radiusTop`) and base face (a disk centered on `centerBase` with radius `radiusBase`). + */ +s32 MirRay_IsInConeFrustum(Vec3f* centerTop, Vec3f* centerBase, f32 x, f32 y, f32 z, s16 radiusTop, s16 radiusBase) { + f32 f; + f32 xProj; + f32 yProj; + f32 zProj; + Vec3f hVec; + f32 radiusLocal; + Vec3f hVec2; + Vec3f topToPos; + Vec3f baseToPos; + + hVec.x = centerBase->x - centerTop->x; + hVec.y = centerBase->y - centerTop->y; + hVec.z = centerBase->z - centerTop->z; + f = SQ(hVec.x) + SQ(hVec.y) + SQ(hVec.z); + if (f == 0.0f) { + return false; } - - dist = - (((pointx - vecA->x) * vecdiff.x) + ((pointy - vecA->y) * vecdiff.y) + ((pointz - vecA->z) * vecdiff.z)) / dist; - - // Closest point on line A-B to Point - closestPtx = (vecdiff.x * dist) + vecA->x; - closestPty = (vecdiff.y * dist) + vecA->y; - closestPtz = (vecdiff.z * dist) + vecA->z; - - // Diameter of the double cone on the perpendicular plane through the closest point - coneRadius = ((radiusB - radiusA) * dist) + radiusA; - - // If the Point is within the bounding double cone, check if it is in the frustum by checking whether it is between - // the bounding planes - if ((SQ(closestPtx - pointx) + SQ(closestPty - pointy) + SQ(closestPtz - pointz)) <= SQ(coneRadius)) { - - // Stores the vector difference again - Math_Vec3f_Diff(vecB, vecA, &sp5C); - - sp50.x = pointx - vecA->x; - sp50.y = pointy - vecA->y; - sp50.z = pointz - vecA->z; - - if (Math3D_Cos(&sp5C, &sp50) < 0.0f) { - return 0; + f = (((x - centerTop->x) * hVec.x) + ((y - centerTop->y) * hVec.y) + ((z - centerTop->z) * hVec.z)) / f; + // Project (x,y,z) onto the top-base line + xProj = (hVec.x * f) + centerTop->x; + yProj = (hVec.y * f) + centerTop->y; + zProj = (hVec.z * f) + centerTop->z; + // Lerp radius to get local radius + radiusLocal = ((radiusBase - radiusTop) * f) + radiusTop; + // If the point lies in the infinitely extended double cone containing the frustum of interest + if ((SQ(xProj - x) + SQ(yProj - y) + SQ(zProj - z)) <= SQ(radiusLocal)) { + Math_Vec3f_Diff(centerBase, centerTop, &hVec2); + + topToPos.x = x - centerTop->x; + topToPos.y = y - centerTop->y; + topToPos.z = z - centerTop->z; + // If the point lies above the top face + if (Math3D_Cos(&hVec2, &topToPos) < 0.0f) { + return false; } - sp44.x = pointx - vecB->x; - sp44.y = pointy - vecB->y; - sp44.z = pointz - vecB->z; - - if (Math3D_Cos(&sp5C, &sp44) > 0.0f) { - return 0; + baseToPos.x = x - centerBase->x; + baseToPos.y = y - centerBase->y; + baseToPos.z = z - centerBase->z; + // If the point lies below the base face + if (Math3D_Cos(&hVec2, &baseToPos) > 0.0f) { + return false; } - return 1; + + return true; + } else { + return false; } - return 0; } 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 ddc4a4708dc..7e000c9ef3c 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.h @@ -7,42 +7,24 @@ struct MirRay; -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 - /* 0x0E */ s16 poolEndRadius; // Radius of beam frustum at the pool end - /* 0x10 */ f32 unk_10; // placement of collider center along beam - /* 0x14 */ s16 unk_14; // collider radius before scaled - /* 0x16 */ s16 lgtPtMaxRad; // light point max radius - /* 0x18 */ f32 unk_18; // placement of light point between source and reflection point (pool point for windows, player for mirrors) - /* 0x1C */ Color_RGB8 color; - /* 0x1F */ u8 params; -} MirRayDataEntry; // size = 0x20 - -typedef struct MirRayShieldReflection { - /* 0x00 */ Vec3f pos; - /* 0x0C */ MtxF mtx; - /* 0x4C */ struct CollisionPoly* reflectionPoly; - /* 0x50 */ u8 opacity; -} MirRayShieldReflection; // size = 0x54 - typedef struct MirRay { - /* 0x0000 */ Actor actor; - /* 0x014C */ ColliderJntSph colliderJntSph; - /* 0x016C */ ColliderJntSphElement colliderJntSphElements[1]; - /* 0x01AC */ ColliderQuad shieldRay; - /* 0x022C */ f32 reflectIntensity; // Reflection occurs if it is positive, brightness depends on it - /* 0x0230 */ Vec3f shieldCorners[6]; - /* 0x0278 */ f32 reflectRange; - /* 0x027C */ Vec3f sourcePt; - /* 0x0288 */ Vec3f poolPt; - /* 0x0294 */ s16 sourceEndRad; - /* 0x0296 */ s16 poolEndRad; - /* 0x0298 */ s16 lightPointRad; - /* 0x029C */ LightNode* lightNode; - /* 0x02A0 */ LightInfo lightInfo; - /* 0x02AE */ u8 unLit; // Conditioned on. set in Cobra? + /* 0x000 */ Actor actor; + /* 0x14C */ ColliderJntSph unk14C; + /* 0x16C */ ColliderJntSphElement unk16C; + /* 0x1AC */ ColliderQuad unk1AC; + /* 0x22C */ f32 lightReflectionFactor; + /* 0x230 */ Vec3f reflectionOriginModelPositions[6]; + /* 0x278 */ f32 shieldForwardNormalizeFactor; + /* 0x27C */ Vec3f coneFrustumCenterTop; + /* 0x288 */ Vec3f coneFrustumCenterBase; + /* 0x294 */ s16 coneFrustumRadiusTop; + /* 0x296 */ s16 coneFrustumRadiusBase; + /* 0x298 */ s16 pointLightRadius; + /* 0x29A */ char pad29A[2]; + /* 0x29C */ LightNode* lightNode; + /* 0x2A0 */ LightInfo lightInfo; + /* 0x2AE */ u8 unk2AE; + /* 0x2AF */ char pad2AF[1]; } MirRay; // size = 0x02B0 #endif 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 5f76c6e02a5..6a5bf5ed575 100644 --- a/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c +++ b/src/overlays/actors/ovl_Obj_Blockstop/z_obj_blockstop.c @@ -44,18 +44,18 @@ void ObjBlockstop_Destroy(Actor* thisx, PlayState* play) { void ObjBlockstop_Update(Actor* thisx, PlayState* play) { ObjBlockstop* this = (ObjBlockstop*)thisx; - DynaPolyActor* dynaPolyActor; + DynaPolyActor* dynaActor; Vec3f sp4C; s32 bgId; s32 pad; if (BgCheck_EntityLineTest2(&play->colCtx, &this->actor.home.pos, &this->actor.world.pos, &sp4C, &this->actor.floorPoly, false, false, true, true, &bgId, &this->actor)) { - dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); + dynaActor = DynaPoly_GetActor(&play->colCtx, bgId); - if (dynaPolyActor != NULL && dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI) { - 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) { + if (dynaActor != NULL && dynaActor->actor.id == ACTOR_OBJ_OSHIHIKI) { + if (PARAMS_GET_U(dynaActor->actor.params, 0, 4) == PUSHBLOCK_HUGE_START_ON || + PARAMS_GET_U(dynaActor->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_Dekujr/z_obj_dekujr.c b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index cef0fe97cf4..8625bf4b308 100644 --- a/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -61,7 +61,7 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { if (gSaveContext.save.cutsceneIndex < CS_INDEX_0) { if (!LINK_IS_ADULT) { - Actor_Kill(thisx); + Actor_Kill(&this->actor); return; } this->unk_19C = 2; @@ -71,15 +71,15 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { this->unk_19B = 1; } if (!CHECK_QUEST_ITEM(QUEST_MEDALLION_FOREST)) { - Actor_Kill(thisx); + Actor_Kill(&this->actor); } else { - ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); Collider_InitCylinder(play, &this->collider); - sCylinderInit.base.actor = thisx; + sCylinderInit.base.actor = thisx; // thisx required to match here Collider_SetCylinderToActor(play, &this->collider, &sCylinderInit); - thisx->colChkInfo.mass = MASS_IMMOVABLE; - thisx->textId = func_80037C30(play, 0xF); - Actor_SetScale(thisx, 0.4f); + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + this->actor.textId = func_80037C30(play, 0xF); + Actor_SetScale(&this->actor, 0.4f); } } 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 a6c35ed9224..24baa4b044e 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -146,7 +146,7 @@ void ObjLift_Destroy(Actor* thisx, PlayState* play) { void ObjLift_SetupWait(ObjLift* this) { this->timer = sFallTimerDurations[PARAMS_GET_U(this->dyna.actor.params, 8, 3)]; - ObjLift_SetupAction(this, ObjLift_Wait); + ObjLift_SetupAction(this, &ObjLift_Wait); } void ObjLift_Wait(ObjLift* this, PlayState* play) { 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 b328e2b6c15..3ff562770e3 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -159,13 +159,13 @@ void ObjOshihiki_ResetFloors(ObjOshihiki* this) { } ObjOshihiki* ObjOshihiki_GetBlockUnder(ObjOshihiki* this, PlayState* play) { - DynaPolyActor* dynaPolyActor; + DynaPolyActor* dyna; if ((this->floorBgIds[this->highestFloor] != BGCHECK_SCENE) && (fabsf(this->dyna.actor.floorHeight - this->dyna.actor.world.pos.y) < 0.001f)) { - dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); - if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_OBJ_OSHIHIKI)) { - return (ObjOshihiki*)dynaPolyActor; + dyna = DynaPoly_GetActor(&play->colCtx, this->floorBgIds[this->highestFloor]); + if ((dyna != NULL) && (dyna->actor.id == ACTOR_OBJ_OSHIHIKI)) { + return (ObjOshihiki*)dyna; } } return NULL; @@ -387,7 +387,7 @@ s32 ObjOshihiki_CheckFloor(ObjOshihiki* this, PlayState* play) { } s32 ObjOshihiki_CheckGround(ObjOshihiki* this, PlayState* play) { - if (this->dyna.actor.world.pos.y <= BGCHECK_Y_MIN + 10.0f) { + if (this->dyna.actor.world.pos.y <= -31990.0f) { PRINTF(T("Warning : 押し引きブロック落ちすぎた(%s %d)(arg_data 0x%04x)\n", "Warning : Push/pull block fell too much (%s %d)(arg_data 0x%04x)\n"), "../z_obj_oshihiki.c", 809, this->dyna.actor.params); @@ -494,7 +494,7 @@ void ObjOshihiki_SetupOnActor(ObjOshihiki* this, PlayState* play) { void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { s32 bgId; Player* player = GET_PLAYER(play); - DynaPolyActor* dynaPolyActor; + DynaPolyActor* dynaActor; this->stateFlags |= PUSHBLOCK_ON_ACTOR; Actor_MoveXZGravity(&this->dyna.actor); @@ -504,13 +504,13 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { if (bgId == BGCHECK_SCENE) { ObjOshihiki_SetupOnScene(this, play); } else { - dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); - if (dynaPolyActor != NULL) { - DynaPolyActor_SetActorOnTop(dynaPolyActor); - DynaPolyActor_SetSwitchPressed(dynaPolyActor); + dynaActor = DynaPoly_GetActor(&play->colCtx, bgId); + if (dynaActor != NULL) { + DynaPolyActor_SetActorOnTop(dynaActor); + DynaPolyActor_SetSwitchPressed(dynaActor); if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { - if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaPolyActor, play) && + if (ObjOshihiki_StrongEnough(this) && ObjOshihiki_NoSwitchPress(this, dynaActor, play) && !ObjOshihiki_CheckWall(play, this->dyna.unk_158, this->dyna.unk_150, this)) { this->direction = this->dyna.unk_150; @@ -532,11 +532,11 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { if (bgId == BGCHECK_SCENE) { ObjOshihiki_SetupFall(this, play); } else { - dynaPolyActor = DynaPoly_GetActor(&play->colCtx, bgId); + dynaActor = DynaPoly_GetActor(&play->colCtx, bgId); - if ((dynaPolyActor != NULL) && (dynaPolyActor->transformFlags & DYNA_TRANSFORM_POS)) { - DynaPolyActor_SetActorOnTop(dynaPolyActor); - DynaPolyActor_SetSwitchPressed(dynaPolyActor); + if ((dynaActor != NULL) && (dynaActor->transformFlags & DYNA_TRANSFORM_POS)) { + DynaPolyActor_SetActorOnTop(dynaActor); + DynaPolyActor_SetSwitchPressed(dynaActor); this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; } else { ObjOshihiki_SetupFall(this, play); 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 2e3f6e01862..fc8578878df 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -31,16 +31,15 @@ void ObjTimeblock_Destroy(Actor* thisx, PlayState* play); void ObjTimeblock_Update(Actor* thisx, PlayState* play); void ObjTimeblock_Draw(Actor* thisx, PlayState* play); -void ObjTimeblock_SetupNormal(ObjTimeblock* this); -void ObjTimeblock_SetupAltBehaviorVisible(ObjTimeblock* this); -void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this); - -s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play); -s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, PlayState* play); -void ObjTimeblock_DoNothing(ObjTimeblock* this, PlayState* play); -void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play); -void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play); -void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play); +s32 func_80BA040C(ObjTimeblock*, PlayState*); +s32 func_80BA0480(ObjTimeblock*, PlayState*); +void func_80BA0508(ObjTimeblock* arg0, PlayState* arg1); +void func_80BA0514(ObjTimeblock* this); +void func_80BA0524(ObjTimeblock* this, PlayState* play); +void func_80BA0758(ObjTimeblock* this); +void func_80BA0768(ObjTimeblock* this, PlayState* play); +void func_80BA083C(ObjTimeblock* this); +void func_80BA084C(ObjTimeblock* this, PlayState* play); ActorProfile Obj_Timeblock_Profile = { /**/ ACTOR_OBJ_TIMEBLOCK, @@ -53,314 +52,319 @@ ActorProfile Obj_Timeblock_Profile = { /**/ ObjTimeblock_Update, /**/ ObjTimeblock_Draw, }; - -typedef struct ObjTimeblockSizeOptions { - /* 0x00 */ f32 scale; - /* 0x04 */ f32 height; - /* 0x08 */ s16 demoEffectParams; -} ObjTimeblockSizeOptions; // size = 0x0C - -static ObjTimeblockSizeOptions sSizeOptions[] = { - { 1.0, 60.0, 0x0018 }, - { 0.60, 40.0, 0x0019 }, -}; - -static f32 sRanges[] = { 60.0, 100.0, 140.0, 180.0, 220.0, 260.0, 300.0, 300.0 }; - -static InitChainEntry sInitChain[] = { +typedef struct struct_80BA0AF0 { + f32 unk0; + f32 unk4; + s16 unk8; +} struct_80BA0AF0; +struct_80BA0AF0 D_80BA0AF0[2] = { { 1.0f, 60.0f, 0x18 }, { 0.6f, 40.0f, 0x19 } }; +static f32 D_80BA0B08[8] = { 60.0f, 100.0f, 140.0f, 180.0f, 220.0f, 260.0f, 300.0f, 300.0f }; +static InitChainEntry D_80BA0B28[4] = { ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1800, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 300, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 1500, ICHAIN_STOP), }; - -static Color_RGB8 sPrimColors[] = { - { 100, 120, 140 }, { 80, 140, 200 }, { 100, 150, 200 }, { 100, 200, 240 }, - { 80, 110, 140 }, { 70, 160, 225 }, { 80, 100, 130 }, { 100, 110, 190 }, +static Color_RGB8 D_80BA0B38[8] = { + { 0x64, 0x78, 0x8C }, { 0x50, 0x8C, 0xC8 }, { 0x64, 0x96, 0xC8 }, { 0x64, 0xC8, 0xF0 }, + { 0x50, 0x6E, 0x8C }, { 0x46, 0xA0, 0xE1 }, { 0x50, 0x64, 0x82 }, { 0x64, 0x6E, 0xBE }, }; -u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) { +s32 func_80B9FFA0(ObjTimeblock* this) { + s32 var_a1; + s32 var_v1; + if (!PARAMS_GET_U(this->dyna.actor.params, 10, 1)) { - if (this->unk_177 == 0) { - return this->unk_175; + if (this->unk177 == 0) { + return this->unk175; + } + if (PARAMS_GET_U(this->dyna.actor.params, 15, 1)) { + var_a1 = 1; + } else { + var_a1 = 0; + } + if (this->unk177 == 1) { + return this->unk174 ^ var_a1; } else { - u8 temp = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false; + s32 var_v1_2; - if (this->unk_177 == 1) { - return this->unk_174 ^ temp; + if (LINK_AGE_IN_YEARS == 5) { + var_v1_2 = 1; } else { - u8 linkIsChild = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? true : false; - - return this->unk_174 ^ temp ^ linkIsChild; + var_v1_2 = 0; } + return this->unk174 ^ var_a1 ^ var_v1_2; } - } else { - return (PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false) ^ this->unk_174; } + return (PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? 1 : 0) ^ this->unk174; } -void ObjTimeblock_SpawnDemoEffect(ObjTimeblock* this, PlayState* play) { +void func_80BA0058(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[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].demoEffectParams); + this->dyna.actor.world.pos.z, 0, 0, 0, (D_80BA0AF0[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].unk8)); } -void ObjTimeblock_ToggleSwitchFlag(PlayState* play, s32 flag) { - if (Flags_GetSwitch(play, flag)) { - Flags_UnsetSwitch(play, flag); - } else { - Flags_SetSwitch(play, flag); +void func_80BA00CC(PlayState* play, s32 arg1) { + if (Flags_GetSwitch(play, arg1) != 0) { + Flags_UnsetSwitch(play, arg1); + return; } + Flags_SetSwitch(play, arg1); } void ObjTimeblock_Init(Actor* thisx, PlayState* play) { ObjTimeblock* this = (ObjTimeblock*)thisx; s32 pad; - CollisionHeader* colHeader = NULL; + CollisionHeader* sp2C; + sp2C = NULL; DynaPolyActor_Init(&this->dyna, 0); this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; - - CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &colHeader); - - 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[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].scale); - + CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &sp2C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp2C); + Actor_ProcessInitChain(&this->dyna.actor, D_80BA0B28); + Actor_SetScale(&this->dyna.actor, D_80BA0AF0[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].unk0); if (PARAMS_GET_U(this->dyna.actor.params, 6, 1)) { - this->unk_177 = 0; + this->unk177 = 0; + } else if (PARAMS_GET_U(this->dyna.actor.params, 0, 6) < 0x38) { + this->unk177 = 2; } else { - this->unk_177 = (PARAMS_GET_U(this->dyna.actor.params, 0, 6) < 0x38) ? 2 : 1; + this->unk177 = 1; } - - this->songObserverFunc = ObjTimeblock_WaitForOcarina; - - Actor_SetFocus(&this->dyna.actor, sSizeOptions[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].height); - - 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 (!PARAMS_GET_U(this->dyna.actor.params, 10, 1)) { - ObjTimeblock_SetupNormal(this); - } else if (this->isVisible) { - ObjTimeblock_SetupAltBehaviorVisible(this); + this->unk168 = func_80BA040C; + Actor_SetFocus(&this->dyna.actor, D_80BA0AF0[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].unk4); + if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) { + this->unk174 = 1; } else { - ObjTimeblock_SetupAltBehaviourNotVisible(this); + this->unk174 = 0; } - - PRINTF(T("時のブロック ( %04xH save:%d color:%d range:%d move:%d)\n", - "Time Block ( %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, - PARAMS_GET_U(this->dyna.actor.params, 11, 3), PARAMS_GET_U(this->dyna.actor.params, 10, 1)); + if (PARAMS_GET_U(this->dyna.actor.params, 15, 1)) { + this->unk175 = 1; + } else { + this->unk175 = 0; + } + this->unk178 = func_80B9FFA0(this); + if (PARAMS_GET_U(this->dyna.actor.params, 10, 1) == 0) { + func_80BA0514(this); + } else if (this->unk178 != 0) { + func_80BA0758(this); + } else { + func_80BA083C(this); + } + PRINTF("時のブロック ( %04xH save:%d color:%d range:%d move:%d)\n", this->dyna.actor.params & 0xFFFF, + this->unk177, 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) { - s32 pad; ObjTimeblock* this = (ObjTimeblock*)thisx; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, PlayState* play) { - if (this->isVisible && DynaPolyActor_IsPlayerAbove(&this->dyna)) { - return false; - } - - if (this->dyna.actor.xzDistToPlayer <= sRanges[PARAMS_GET_U(this->dyna.actor.params, 11, 3)]) { - Vec3f playerRelativePos; - f32 blockSize; +s32 func_80BA032C(ObjTimeblock* this, PlayState* play) { + Vec3f sp1C; + f32 temp_fv1; - Actor_WorldToActorCoords(&this->dyna.actor, &playerRelativePos, &GET_PLAYER(play)->actor.world.pos); - blockSize = this->dyna.actor.scale.x * 50.0f + 6.0f; - // Return true if player's xz position is not inside the block - if (blockSize < fabsf(playerRelativePos.x) || blockSize < fabsf(playerRelativePos.z)) { - return true; + if ((this->unk178 != 0) && (DynaPolyActor_IsPlayerAbove(&this->dyna) != 0)) { + return 0; + } + if ((this->dyna.actor.xzDistToPlayer <= D_80BA0B08[PARAMS_GET_U(this->dyna.actor.params, 11, 3)])) { + Actor_WorldToActorCoords(&this->dyna.actor, &sp1C, &GET_PLAYER(play)->actor.world.pos); + temp_fv1 = (this->dyna.actor.scale.x * 50.0f) + 6.0f; + if ((temp_fv1 < fabsf(sp1C.x)) || (temp_fv1 < fabsf(sp1C.z))) { + return 1; } } - - return false; + return 0; } -s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play) { - Player* player = GET_PLAYER(play); +s32 func_80BA040C(ObjTimeblock* this, PlayState* play) { + Player* temp_v1; - if (ObjTimeblock_PlayerIsInRange(this, play)) { - if (player->stateFlags2 & PLAYER_STATE2_24) { + temp_v1 = GET_PLAYER(play); + if (func_80BA032C(this, play) != 0) { + if (temp_v1->stateFlags2 & PLAYER_STATE2_24) { Message_StartOcarina(play, OCARINA_ACTION_FREE_PLAY); - this->songObserverFunc = ObjTimeblock_WaitForSong; + this->unk168 = func_80BA0480; } else { - player->stateFlags2 |= PLAYER_STATE2_23; + temp_v1->stateFlags2 |= PLAYER_STATE2_23; } } - return false; + return 0; } -s32 ObjTimeblock_WaitForSong(ObjTimeblock* this, PlayState* play) { +s32 func_80BA0480(ObjTimeblock* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { - this->songObserverFunc = ObjTimeblock_WaitForOcarina; + this->unk168 = func_80BA040C; } if (play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME) { - if (this->unk_172 == 254) { - this->songEndTimer = 110; + if (this->unk172 == 0xFE) { + this->unk16E = 0x6E; } else { - this->songEndTimer--; - if (this->songEndTimer == 0) { - return true; + this->unk16E -= 1; + if (this->unk16E == 0) { + return 1; } } } - return false; + return 0; } -void ObjTimeblock_SetupDoNothing(ObjTimeblock* this) { - this->actionFunc = ObjTimeblock_DoNothing; +void func_80BA04F8(ObjTimeblock* this) { + this->unk164 = func_80BA0508; } -void ObjTimeblock_DoNothing(ObjTimeblock* this, PlayState* play) { +void func_80BA0508(ObjTimeblock* this, PlayState* play) { } -void ObjTimeblock_SetupNormal(ObjTimeblock* this) { - this->actionFunc = ObjTimeblock_Normal; +void func_80BA0514(ObjTimeblock* this) { + this->unk164 = func_80BA0524; } -void ObjTimeblock_Normal(ObjTimeblock* this, PlayState* play) { - u32 newIsVisible; - - if (this->songObserverFunc(this, play) && this->demoEffectTimer <= 0) { - ObjTimeblock_SpawnDemoEffect(this, play); - this->demoEffectTimer = 160; +void func_80BA0524(ObjTimeblock* this, PlayState* play) { + s32 var_v1; - // Possibly points the camera to this actor + if ((this->unk168(this, play) != 0) && (this->unk16C <= 0)) { + func_80BA0058(this, play); + this->unk16C = 0xA0; OnePointCutscene_Attention(play, &this->dyna.actor); - PRINTF(T("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", - "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n"), - play->state.frames); - - this->demoEffectFirstPartTimer = 12; - - if (this->unk_177 == 0) { + PRINTF("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); + this->unk170 = 0xC; + if (this->unk177 == 0) { this->dyna.actor.params ^= 0x8000; } else { - ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); + func_80BA00CC(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } } - - this->unk_172 = play->msgCtx.lastPlayedSong; - if (this->demoEffectFirstPartTimer > 0) { - this->demoEffectFirstPartTimer--; - if (this->demoEffectFirstPartTimer == 0) { - if (this->unk_177 == 0) { - this->unk_175 = PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? true : false; + this->unk172 = play->msgCtx.lastPlayedSong; + if (this->unk170 > 0) { + this->unk170 -= 1; + if (this->unk170 == 0) { + if (this->unk177 == 0) { + if (PARAMS_GET_U(this->dyna.actor.params, 15, 1)) { + this->unk175 = 1; + } else { + this->unk175 = 0; + } + } else if (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)) != 0) { + this->unk174 = 1; } else { - this->unk_174 = (Flags_GetSwitch(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6))) ? true : false; + this->unk174 = 0; } } } - - newIsVisible = ObjTimeblock_CalculateIsVisible(this); - if (this->unk_177 == 1 && newIsVisible != this->isVisible) { - ObjTimeblock_SetupDoNothing(this); + var_v1 = func_80B9FFA0(this); + if ((this->unk177 == 1) && (var_v1 != this->unk178)) { + func_80BA04F8(this); } - this->isVisible = newIsVisible; - - if (this->demoEffectTimer == 50) { - Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); + this->unk178 = var_v1; + if (this->unk16C == 0x32) { + Sfx_PlaySfxCentered(0x4807U); } } void func_80BA06AC(ObjTimeblock* this, PlayState* play) { - s32 switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6); - - this->unk_172 = play->msgCtx.lastPlayedSong; - - if (this->demoEffectFirstPartTimer > 0 && --this->demoEffectFirstPartTimer == 0) { - this->unk_174 = (Flags_GetSwitch(play, switchFlag)) ? true : false; + s32 sp24; + s16 temp_v0; + + sp24 = PARAMS_GET_U(this->dyna.actor.params, 0, 6); + temp_v0 = this->unk170; + this->unk172 = play->msgCtx.lastPlayedSong; + if (temp_v0 > 0) { + this->unk170 = temp_v0 - 1; + if (this->unk170 == 0) { + if (Flags_GetSwitch(play, sp24) != 0) { + this->unk174 = 1; + } else { + this->unk174 = 0; + } + } } - - this->isVisible = ObjTimeblock_CalculateIsVisible(this); - this->unk_176 = (Flags_GetSwitch(play, switchFlag)) ? true : false; + this->unk178 = func_80B9FFA0(this); + if (Flags_GetSwitch(play, sp24) != 0) { + this->unk176 = 1; + return; + } + this->unk176 = 0; } -void ObjTimeblock_SetupAltBehaviorVisible(ObjTimeblock* this) { - this->actionFunc = ObjTimeblock_AltBehaviorVisible; +void func_80BA0758(ObjTimeblock* this) { + this->unk164 = func_80BA0768; } -void ObjTimeblock_AltBehaviorVisible(ObjTimeblock* this, PlayState* play) { - if (this->songObserverFunc(this, play) && this->demoEffectTimer <= 0) { - this->demoEffectFirstPartTimer = 12; - ObjTimeblock_SpawnDemoEffect(this, play); - this->demoEffectTimer = 160; +void func_80BA0768(ObjTimeblock* this, PlayState* play) { + if ((this->unk168(this, play) != 0) && (this->unk16C <= 0)) { + this->unk170 = 0xC; + func_80BA0058(this, play); + this->unk16C = 0xA0; OnePointCutscene_Attention(play, &this->dyna.actor); - PRINTF(T("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", - "◯◯◯◯ Time Block Attention Camera (frame counter %d)\n"), - play->state.frames); - ObjTimeblock_ToggleSwitchFlag(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); + PRINTF("◯◯◯◯ Time Block 注目カメラ (frame counter %d)\n", play->state.frames); + func_80BA00CC(play, PARAMS_GET_U(this->dyna.actor.params, 0, 6)); } - func_80BA06AC(this, play); - - if (this->demoEffectTimer == 50) { + if (this->unk16C == 0x32) { Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); } - - if (!this->isVisible && this->demoEffectTimer <= 0) { - ObjTimeblock_SetupAltBehaviourNotVisible(this); + if ((this->unk178 == 0) && (this->unk16C <= 0)) { + func_80BA083C(this); } } -void ObjTimeblock_SetupAltBehaviourNotVisible(ObjTimeblock* this) { - this->actionFunc = ObjTimeblock_AltBehaviourNotVisible; +void func_80BA083C(ObjTimeblock* this) { + this->unk164 = func_80BA084C; } -void ObjTimeblock_AltBehaviourNotVisible(ObjTimeblock* this, PlayState* play) { - s32 switchFlag = PARAMS_GET_U(this->dyna.actor.params, 0, 6); - s8 switchFlagIsSet = (Flags_GetSwitch(play, switchFlag)) ? true : false; +void func_80BA084C(ObjTimeblock* this, PlayState* play) { + s32 var_v1; + s32 flag = PARAMS_GET_U(this->dyna.actor.params, 0, 6); - 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; + if (Flags_GetSwitch(play, flag) != 0) { + var_v1 = 1; + } else { + var_v1 = 0; + } + if (this->unk176 ^ var_v1) { + if ((PARAMS_GET_U(this->dyna.actor.params, 15, 1) ? 1 : 0) ^ var_v1) { + if (this->unk16C <= 0) { + func_80BA0058(this, play); + this->unk16C = 0xA0; + } + this->unk170 = 0xC; } - this->demoEffectFirstPartTimer = 12; } - func_80BA06AC(this, play); - - if (this->isVisible && this->demoEffectTimer <= 0) { - ObjTimeblock_SetupAltBehaviorVisible(this); + if ((this->unk178 != 0) && (this->unk16C <= 0)) { + func_80BA0758(this); } } void ObjTimeblock_Update(Actor* thisx, PlayState* play) { + s16 temp_v0; ObjTimeblock* this = (ObjTimeblock*)thisx; - this->actionFunc(this, play); - - if (this->demoEffectTimer > 0) { - this->demoEffectTimer--; + this->unk164(this, play); + temp_v0 = this->unk16C; + if (temp_v0 > 0) { + this->unk16C = temp_v0 - 1; } - - if (this->isVisible) { + if (this->unk178 != 0) { DynaPoly_EnableCollision(play, &play->colCtx.dyna, this->dyna.bgId); - } else { - DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); + return; } + DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } void ObjTimeblock_Draw(Actor* thisx, PlayState* play) { - if (((ObjTimeblock*)thisx)->isVisible) { - Color_RGB8* primColor = &sPrimColors[thisx->home.rot.z & 7]; + Color_RGB8* sp44; + if (((ObjTimeblock*)thisx)->unk178 != 0) { + sp44 = &D_80BA0B38[thisx->home.rot.z & 7]; OPEN_DISPS(play->state.gfxCtx, "../z_obj_timeblock.c", 762); - Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_obj_timeblock.c", 766); - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, primColor->r, primColor->g, primColor->b, 255); + gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, sp44->r, sp44->g, sp44->b, 255); gSPDisplayList(POLY_OPA_DISP++, gSongOfTimeBlockDL); - CLOSE_DISPS(play->state.gfxCtx, "../z_obj_timeblock.c", 772); } } diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h index 1cd2a07644d..4d45d76b80d 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.h @@ -6,22 +6,23 @@ struct ObjTimeblock; -typedef s32 (*ObjTimeblockSongObserverFunc)(struct ObjTimeblock*, struct PlayState*); typedef void (*ObjTimeblockActionFunc)(struct ObjTimeblock*, struct PlayState*); +typedef s32 (*ObjTimeblockUnk168Func)(struct ObjTimeblock*, struct PlayState*); typedef struct ObjTimeblock { - /* 0x0000 */ DynaPolyActor dyna; - /* 0x0164 */ ObjTimeblockActionFunc actionFunc; - /* 0x0168 */ ObjTimeblockSongObserverFunc songObserverFunc; - /* 0x016C */ s16 demoEffectTimer; - /* 0x016E */ s16 songEndTimer; - /* 0x0170 */ s16 demoEffectFirstPartTimer; - /* 0x0172 */ u16 unk_172; - /* 0x0174 */ u8 unk_174; - /* 0x0175 */ u8 unk_175; - /* 0x0176 */ u8 unk_176; - /* 0x0177 */ u8 unk_177; - /* 0x0178 */ u8 isVisible; -} ObjTimeblock; // size = 0x017C + /* 0x000 */ DynaPolyActor dyna; + /* 0x164 */ ObjTimeblockActionFunc unk164; + /* 0x168 */ ObjTimeblockUnk168Func unk168; + /* 0x16C */ s16 unk16C; + /* 0x16E */ s16 unk16E; + /* 0x170 */ s16 unk170; + /* 0x172 */ u16 unk172; + /* 0x174 */ u8 unk174; + /* 0x175 */ u8 unk175; + /* 0x176 */ u8 unk176; + /* 0x177 */ u8 unk177; + /* 0x178 */ u8 unk178; + /* 0x179 */ char pad179[3]; /* maybe part of unk178[4]? */ +} ObjTimeblock; // size = 0x017C #endif 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 4719667c406..8e2f18f4dff 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -5,7 +5,6 @@ */ #include "z_obj_tsubo.h" -#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h" #include "libc64/qrand.h" #include "ichain.h" @@ -19,7 +18,6 @@ #include "play_state.h" #include "player.h" -#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_tsubo/object_tsubo.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_THROW_ONLY) @@ -27,22 +25,21 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play); void ObjTsubo_Destroy(Actor* thisx, PlayState* play2); void ObjTsubo_Update(Actor* thisx, PlayState* play); -void ObjTsubo_Draw(Actor* thisx, PlayState* play); - -void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play); -void ObjTsubo_ApplyGravity(ObjTsubo* this); -s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play); -void ObjTsubo_InitCollider(Actor* thisx, PlayState* play); -void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play); -void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play); -void ObjTsubo_SetupWaitForObject(ObjTsubo* this); -void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play); -void ObjTsubo_SetupIdle(ObjTsubo* this); -void ObjTsubo_Idle(ObjTsubo* this, PlayState* play); -void ObjTsubo_SetupLiftedUp(ObjTsubo* this); -void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play); -void ObjTsubo_SetupThrown(ObjTsubo* this); -void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play); + +void func_80BA152C(ObjTsubo* this); +void func_80BA153C(ObjTsubo* this, PlayState* play); +void func_80BA15AC(ObjTsubo* this); +void func_80BA15BC(ObjTsubo* this, PlayState* play); +void func_80BA17C4(ObjTsubo* this); +void func_80BA180C(ObjTsubo* this, PlayState* play); +void func_80BA188C(ObjTsubo* this); +void func_80BA1958(ObjTsubo* this, PlayState* play); +void func_80BA1B0C(Actor* thisx, PlayState* play); + +extern Gfx D_5017870[]; +extern Gfx D_5017A60[]; +extern Gfx D_60017C0[]; +extern Gfx D_6001960[]; static s16 D_80BA1B50 = 0; static s16 D_80BA1B54 = 0; @@ -61,13 +58,11 @@ ActorProfile Obj_Tsubo_Profile = { /**/ NULL, }; -static s16 sObjectIds[] = { OBJECT_GAMEPLAY_DANGEON_KEEP, OBJECT_TSUBO }; - -static Gfx* D_80BA1B84[] = { gPotDL, object_tsubo_DL_0017C0 }; +static s16 D_80BA1B80[2] = { OBJECT_GAMEPLAY_DANGEON_KEEP, OBJECT_TSUBO }; +static Gfx* D_80BA1B84[2] = { D_5017870, object_tsubo_DL_0017C0 }; +static Gfx* D_80BA1B8C[2] = { D_5017A60, object_tsubo_DL_001960 }; -static Gfx* D_80BA1B8C[] = { gPotFragmentDL, object_tsubo_DL_001960 }; - -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit D_80BA1B94 = { { COL_MATERIAL_HARD, AT_ON | AT_TYPE_PLAYER, @@ -87,75 +82,75 @@ static ColliderCylinderInit sCylinderInit = { { 9, 26, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit sColChkInfoInit[] = { 0, 12, 60, MASS_IMMOVABLE }; - -static InitChainEntry sInitChain[] = { +static CollisionCheckInfoInit D_80BA1BC0 = { 0, 0xC, 0x3C, MASS_IMMOVABLE }; +static InitChainEntry D_80BA1BC8[] = { ICHAIN_F32_DIV1000(gravity, -1200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -20000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 150, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 900, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 800, ICHAIN_STOP), }; -void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) { - s16 dropParams = PARAMS_GET_U(this->actor.params, 0, 5); +void func_80BA0D60(ObjTsubo* this, PlayState* play) { + s16 temp_v0; - if ((dropParams >= 0) && (dropParams < ITEM00_MAX)) { - Item_DropCollectible(play, &this->actor.world.pos, dropParams | (PARAMS_GET_U(this->actor.params, 9, 6) << 8)); + temp_v0 = PARAMS_GET_U(this->actor.params, 0, 5); + if ((temp_v0 >= 0) && (temp_v0 < ITEM00_MAX)) { + Item_DropCollectible(play, &this->actor.world.pos, + (s16)(temp_v0 | (PARAMS_GET_U(this->actor.params, 9, 6) << 8))); } } -void ObjTsubo_ApplyGravity(ObjTsubo* this) { +void func_80BA0DC0(ObjTsubo* this) { this->actor.velocity.y += this->actor.gravity; if (this->actor.velocity.y < this->actor.minVelocityY) { this->actor.velocity.y = this->actor.minVelocityY; } } -s32 ObjTsubo_SnapToFloor(ObjTsubo* this, PlayState* play) { - CollisionPoly* groundPoly; - Vec3f pos; - s32 bgId; - f32 groundY; - - pos.x = this->actor.world.pos.x; - pos.y = this->actor.world.pos.y + 20.0f; - pos.z = this->actor.world.pos.z; - groundY = BgCheck_EntityRaycastDown4(&play->colCtx, &groundPoly, &bgId, &this->actor, &pos); - if (groundY > BGCHECK_Y_MIN) { - this->actor.world.pos.y = groundY; +s32 func_80BA0DF4(ObjTsubo* this, PlayState* play) { + CollisionPoly* sp34; + Vec3f sp28; + s32 sp24; + f32 temp_fv0; + + sp28.x = this->actor.world.pos.x; + sp28.y = this->actor.world.pos.y + 20.0f; + sp28.z = this->actor.world.pos.z; + temp_fv0 = BgCheck_EntityRaycastDown4(&play->colCtx, &sp34, &sp24, &this->actor, (Vec3f*)&sp28); + if (temp_fv0 > BGCHECK_Y_MIN) { + this->actor.world.pos.y = temp_fv0; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - return true; + return 1; } else { - PRINTF(T("地面に付着失敗\n", "Failed to attach to ground\n")); - return false; + PRINTF("地面に付着失敗\n"); + return 0; } } -void ObjTsubo_InitCollider(Actor* thisx, PlayState* play) { - ObjTsubo* this = (ObjTsubo*)thisx; +void func_80BA0E98(ObjTsubo* this2, PlayState* play) { + ObjTsubo* this = this2; - Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->collider); + Collider_InitCylinder(play, &this->unk150); + Collider_SetCylinder(play, &this->unk150, &this->actor, &D_80BA1B94); + Collider_UpdateCylinder(&this->actor, &this->unk150); } void ObjTsubo_Init(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; - Actor_ProcessInitChain(&this->actor, sInitChain); - ObjTsubo_InitCollider(&this->actor, play); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, sColChkInfoInit); - if (!ObjTsubo_SnapToFloor(this, play)) { - Actor_Kill(&this->actor); - return; - } - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[PARAMS_GET_U(this->actor.params, 8, 1)]); - if (this->requiredObjectSlot < 0) { - PRINTF(T("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", "Error : Bank danger! (arg_data 0x%04x)(%s %d)\n"), - this->actor.params, "../z_obj_tsubo.c", 410); + Actor_ProcessInitChain(&this->actor, D_80BA1BC8); + func_80BA0E98(this, play); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_80BA1BC0); + if (func_80BA0DF4(this, play) == 0) { Actor_Kill(&this->actor); } else { - ObjTsubo_SetupWaitForObject(this); - PRINTF(T("(dungeon keep 壷)(arg_data 0x%04x)\n", "(dungeon keep pot)(arg_data 0x%04x)\n"), this->actor.params); + this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, D_80BA1B80[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); + } else { + func_80BA152C(this); + PRINTF("(dungeon keep 壷)(arg_data 0x%04x)\n", this->actor.params); + } } } @@ -163,177 +158,182 @@ void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjTsubo* this = (ObjTsubo*)thisx; - Collider_DestroyCylinder(play, &this->collider); + Collider_DestroyCylinder(play, &this->unk150); } -void ObjTsubo_AirBreak(ObjTsubo* this, PlayState* play) { +void func_80BA100C(ObjTsubo* this, PlayState* play) { s32 pad; - f32 rand; - s16 angle; - Vec3f pos; - Vec3f velocity; - f32 sins; - f32 coss; - s32 arg5; - s32 i; - - for (i = 0, angle = 0; i < 15; i++, angle += 0x4E20) { - sins = Math_SinS(angle); - coss = Math_CosS(angle); - pos.x = sins * 8.0f; - pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; - pos.z = coss * 8.0f; - velocity.x = pos.x * 0.23f; - velocity.y = (Rand_ZeroOne() * 5.0f) + 2.0f; - velocity.z = pos.z * 0.23f; - Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); - rand = Rand_ZeroOne(); - if (rand < 0.2f) { - arg5 = 96; - } else if (rand < 0.6f) { - arg5 = 64; + f32 sin; + f32 cos; + Vec3f spC8; + Vec3f spBC; + f32 temp_fv0; + s32 var_s0; + s32 var_s2; + s16 var_s1; + + for (var_s2 = 0, var_s1 = 0; var_s2 < 15; var_s2++, var_s1 += 0x4E20) { + sin = Math_SinS(var_s1); + cos = Math_CosS(var_s1); + spC8.x = sin * 8.0f; + spC8.y = (Rand_ZeroOne() * 5.0f) + 2.0f; + spC8.z = cos * 8.0f; + spBC.x = spC8.x * 0.23f; + spBC.y = (Rand_ZeroOne() * 5.0f) + 2.0f; + spBC.z = spC8.z * 0.23f; + Math_Vec3f_Sum(&spC8, &this->actor.world.pos, &spC8); + temp_fv0 = Rand_ZeroOne(); + if (temp_fv0 < 0.2f) { + var_s0 = 0x60; + } else if (temp_fv0 < 0.6f) { + var_s0 = 0x40; } else { - arg5 = 32; + var_s0 = 0x20; } - 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[PARAMS_GET_U(this->actor.params, 8, 1)], + EffectSsKakera_Spawn(play, &spC8, &spBC, &this->actor.world.pos, -240, var_s0, 0xA, 0xA, 0, + (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 0x20, 60, -1, + D_80BA1B80[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); + func_80033480(play, &this->actor.world.pos, 30.0f, 4, 0x14, 0x32, 1U); } -void ObjTsubo_WaterBreak(ObjTsubo* this, PlayState* play) { +void func_80BA1294(ObjTsubo* this, PlayState* play) { + f32 temp_fs0; + f32 temp_fs1; + s16 var_s1; + Vec3f spC8; + Vec3f spBC; + s32 var_s0; + s32 var_s2; s32 pad[2]; - s16 angle; - Vec3f pos = this->actor.world.pos; - Vec3f velocity; - s32 phi_s0; - s32 i; - - pos.y += this->actor.depthInWater; - EffectSsGSplash_Spawn(play, &pos, NULL, NULL, 0, 400); - for (i = 0, angle = 0; i < 15; i++, angle += 0x4E20) { - f32 sins = Math_SinS(angle); - f32 coss = Math_CosS(angle); - - pos.x = sins * 8.0f; - pos.y = (Rand_ZeroOne() * 5.0f) + 2.0f; - pos.z = coss * 8.0f; - velocity.x = pos.x * 0.2f; - velocity.y = (Rand_ZeroOne() * 4.0f) + 2.0f; - velocity.z = pos.z * 0.2f; - Math_Vec3f_Sum(&pos, &this->actor.world.pos, &pos); - 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[PARAMS_GET_U(this->actor.params, 8, 1)], + + spC8 = this->actor.world.pos; + spC8.y += this->actor.depthInWater; + EffectSsGSplash_Spawn(play, &spC8, NULL, NULL, 0, 0x190); + + for (var_s2 = 0, var_s1 = 0; var_s2 < 15; var_s2++, var_s1 += 0x4E20) { + temp_fs0 = Math_SinS(var_s1); + temp_fs1 = Math_CosS(var_s1); + spC8.x = temp_fs0 * 8.0f; + spC8.y = (Rand_ZeroOne() * 5.0f) + 2.0f; + spC8.z = temp_fs1 * 8.0f; + spBC.x = spC8.x * 0.20f; + spBC.y = (Rand_ZeroOne() * 4.0f) + 2.0f; + spBC.z = spC8.z * 0.20f; + Math_Vec3f_Sum(&spC8, &this->actor.world.pos, &spC8); + if (Rand_ZeroOne() < 0.2f) { + var_s0 = 0x40; + } else { + var_s0 = 0x20; + } + EffectSsKakera_Spawn(play, &spC8, &spBC, &this->actor.world.pos, -180, var_s0, 0x1E, 0x1E, 0, + (Rand_ZeroOne() * 95.0f) + 15.0f, 0, 0x20, 70, -1, + D_80BA1B80[PARAMS_GET_U(this->actor.params, 8, 1)], D_80BA1B8C[PARAMS_GET_U(this->actor.params, 8, 1)]); } } -void ObjTsubo_SetupWaitForObject(ObjTsubo* this) { - this->actionFunc = ObjTsubo_WaitForObject; +void func_80BA152C(ObjTsubo* this) { + this->actionFunc = func_80BA153C; } -void ObjTsubo_WaitForObject(ObjTsubo* this, PlayState* play) { +void func_80BA153C(ObjTsubo* this, PlayState* play) { if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) { - this->actor.draw = ObjTsubo_Draw; + this->actor.draw = func_80BA1B0C; this->actor.objectSlot = this->requiredObjectSlot; - ObjTsubo_SetupIdle(this); + func_80BA15AC(this); this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; } } -void ObjTsubo_SetupIdle(ObjTsubo* this) { - this->actionFunc = ObjTsubo_Idle; +void func_80BA15AC(ObjTsubo* this) { + this->actionFunc = func_80BA15BC; } -void ObjTsubo_Idle(ObjTsubo* this, PlayState* play) { - s32 pad; +void func_80BA15BC(ObjTsubo* this, PlayState* play) { s16 temp_v0; - s32 phi_v1; + s16 var_v1; + s32 pad; if (Actor_HasParent(&this->actor, play)) { - ObjTsubo_SetupLiftedUp(this); + func_80BA17C4(this); } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_WATER) && (this->actor.depthInWater > 15.0f)) { - ObjTsubo_WaterBreak(this, play); + func_80BA1294(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); - ObjTsubo_SpawnCollectible(this, play); + func_80BA0D60(this, play); Actor_Kill(&this->actor); - } else if ((this->collider.base.acFlags & AC_HIT) && - (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & + } else if ((this->unk150.base.acFlags & AC_HIT) && + (this->unk150.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_SWORD | DMG_RANGED | DMG_HAMMER | DMG_BOOMERANG | DMG_EXPLOSIVE))) { - ObjTsubo_AirBreak(this, play); - ObjTsubo_SpawnCollectible(this, play); + func_80BA100C(this, play); + func_80BA0D60(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { if (this->actor.xzDistToPlayer < 600.0f) { - Collider_UpdateCylinder(&this->actor, &this->collider); - this->collider.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk150); + this->unk150.base.acFlags &= ~AC_HIT; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk150.base); if (this->actor.xzDistToPlayer < 150.0f) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); } } if (this->actor.xzDistToPlayer < 100.0f) { temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(play)->actor.world.rot.y; - phi_v1 = ABS(temp_v0); - if (phi_v1 >= 0x5556) { - // GI_NONE in this case allows the player to lift the actor + if (ABS(temp_v0) > 0x5555) { Actor_OfferGetItem(&this->actor, play, GI_NONE, 30.0f, 30.0f); } } } } -void ObjTsubo_SetupLiftedUp(ObjTsubo* this) { - this->actionFunc = ObjTsubo_LiftedUp; +void func_80BA17C4(ObjTsubo* this) { + this->actionFunc = func_80BA180C; this->actor.room = -1; //! @bug: This is an unsafe cast, although the sound effect will still play Player_PlaySfx((Player*)&this->actor, NA_SE_PL_PULL_UP_POT); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; } -void ObjTsubo_LiftedUp(ObjTsubo* this, PlayState* play) { +void func_80BA180C(ObjTsubo* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; - ObjTsubo_SetupThrown(this); - ObjTsubo_ApplyGravity(this); + func_80BA188C(this); + func_80BA0DC0(this); Actor_UpdatePos(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); } } -void ObjTsubo_SetupThrown(ObjTsubo* this) { +void func_80BA188C(ObjTsubo* 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; - this->actor.colChkInfo.mass = 240; + this->actor.colChkInfo.mass = 0xF0; D_80BA1B50 = (Rand_ZeroOne() - 0.7f) * 2800.0f; D_80BA1B58 = (Rand_ZeroOne() - 0.5f) * 2000.0f; D_80BA1B54 = 0; D_80BA1B5C = 0; - this->actionFunc = ObjTsubo_Thrown; + this->actionFunc = func_80BA1958; } -void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play) { +void func_80BA1958(ObjTsubo* this, PlayState* play) { s32 pad[2]; if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || - (this->collider.base.atFlags & AT_HIT)) { - ObjTsubo_AirBreak(this, play); - ObjTsubo_SpawnCollectible(this, play); + (this->unk150.base.atFlags & AT_HIT)) { + func_80BA100C(this, play); + func_80BA0D60(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - ObjTsubo_WaterBreak(this, play); - ObjTsubo_SpawnCollectible(this, play); + func_80BA1294(this, play); + func_80BA0D60(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); Actor_Kill(&this->actor); } else { - ObjTsubo_ApplyGravity(this); + func_80BA0DC0(this); Actor_UpdatePos(&this->actor); Math_StepToS(&D_80BA1B54, D_80BA1B50, 0x64); Math_StepToS(&D_80BA1B5C, D_80BA1B58, 0x64); @@ -341,9 +341,9 @@ void ObjTsubo_Thrown(ObjTsubo* this, PlayState* play) { this->actor.shape.rot.y += D_80BA1B5C; Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); - Collider_UpdateCylinder(&this->actor, &this->collider); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); + Collider_UpdateCylinder(&this->actor, &this->unk150); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk150.base); } } @@ -353,6 +353,6 @@ void ObjTsubo_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } -void ObjTsubo_Draw(Actor* thisx, PlayState* play) { +void func_80BA1B0C(Actor* thisx, PlayState* play) { Gfx_DrawDListOpa(play, D_80BA1B84[PARAMS_GET_U(thisx->params, 8, 1)]); } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h index b42de51f48b..aac8532d76a 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -9,11 +9,11 @@ struct ObjTsubo; typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, struct PlayState*); typedef struct ObjTsubo { - /* 0x0000 */ Actor actor; - /* 0x014C */ ObjTsuboActionFunc actionFunc; - /* 0x0150 */ ColliderCylinder collider; - /* 0x019C */ s8 requiredObjectSlot; -} ObjTsubo; // size = 0x01A0 + /* 0x000 */ Actor actor; + /* 0x14C */ ObjTsuboActionFunc actionFunc; + /* 0x150 */ ColliderCylinder unk150; + /* 0x19C */ s8 requiredObjectSlot; + /* 0x19D */ char pad19D[3]; +} ObjTsubo; // size = 0x1A0 #endif - diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 568f2114739..0befddc064e 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -47,11 +47,11 @@ void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, PlayState* play); void ObjectKankyo_WaitForBeamObject(ObjectKankyo* this, PlayState* play); void ObjectKankyo_Beams(ObjectKankyo* this, PlayState* play); -void ObjectKankyo_DrawFairies(Actor* thisx, PlayState* play2); -void ObjectKankyo_DrawSnow(Actor* thisx, PlayState* play2); -void ObjectKankyo_DrawLightning(Actor* thisx, PlayState* play); -void ObjectKankyo_DrawSunGraveSpark(Actor* thisx, PlayState* play2); -void ObjectKankyo_DrawBeams(Actor* thisx, PlayState* play2); +void ObjectKankyo_DrawFairies(ObjectKankyo* this2, PlayState* play2); +void ObjectKankyo_DrawSnow(ObjectKankyo* this2, PlayState* play2); +void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play); +void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, PlayState* play2); +void ObjectKankyo_DrawBeams(ObjectKankyo* this2, PlayState* play2); static void* sEffLightningTextures[] = { gEffLightning1Tex, gEffLightning2Tex, gEffLightning3Tex, gEffLightning4Tex, @@ -175,9 +175,6 @@ void ObjectKankyo_Init(Actor* thisx, PlayState* play) { this->requiredObjectLoaded = false; ObjectKankyo_SetupAction(this, ObjectKankyo_InitBeams); break; - - default: - break; } } @@ -240,9 +237,6 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { case 771: Sfx_PlaySfxCentered(NA_SE_VO_RT_THROW); break; - - default: - break; } } @@ -374,9 +368,6 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { this->effects[i].dirPhase.y += 0.08f * Rand_ZeroOne(); this->effects[i].dirPhase.z += 0.05f * Rand_ZeroOne(); break; - - default: - break; } } else if (this->effects[i].state == 2) { // scatter when the player moves or after a long enough time @@ -473,9 +464,6 @@ void ObjectKankyo_Fairies(ObjectKankyo* this, PlayState* play) { case 3: // reset, never reached this->effects[i].state = 0; break; - - default: - break; } } } @@ -487,35 +475,34 @@ void ObjectKankyo_Update(Actor* thisx, PlayState* play) { } void ObjectKankyo_Draw(Actor* thisx, PlayState* play) { - switch (thisx->params) { + ObjectKankyo* this = (ObjectKankyo*)thisx; + + switch (this->actor.params) { case 0: - ObjectKankyo_DrawFairies(thisx, play); + ObjectKankyo_DrawFairies(this, play); break; case 2: - ObjectKankyo_DrawLightning(thisx, play); + ObjectKankyo_DrawLightning(this, play); break; case 3: - ObjectKankyo_DrawSnow(thisx, play); + ObjectKankyo_DrawSnow(this, play); break; case 4: - ObjectKankyo_DrawSunGraveSpark(thisx, play); + ObjectKankyo_DrawSunGraveSpark(this, play); break; case 5: - ObjectKankyo_DrawBeams(thisx, play); - break; - - default: + ObjectKankyo_DrawBeams(this, play); break; } } -void ObjectKankyo_DrawFairies(Actor* thisx, PlayState* play2) { +void ObjectKankyo_DrawFairies(ObjectKankyo* this2, PlayState* play2) { + ObjectKankyo* this = this2; PlayState* play = play2; - ObjectKankyo* this = (ObjectKankyo*)thisx; f32 alphaScale; Vec3f vec1 = { 0.0f, 0.0f, 0.0f }; Vec3f vec2 = { 0.0f, 0.0f, 0.0f }; @@ -598,9 +585,9 @@ void ObjectKankyo_DrawFairies(Actor* thisx, PlayState* play2) { } } -void ObjectKankyo_DrawSnow(Actor* thisx, PlayState* play2) { +void ObjectKankyo_DrawSnow(ObjectKankyo* this2, PlayState* play2) { + ObjectKankyo* this = this2; PlayState* play = play2; - ObjectKankyo* this = (ObjectKankyo*)thisx; f32 dist; f32 dx; f32 dy; @@ -707,9 +694,6 @@ void ObjectKankyo_DrawSnow(Actor* thisx, PlayState* play2) { case 2: this->effects[i].state = 0; break; - - default: - break; } if (1) {} @@ -761,16 +745,13 @@ void ObjectKankyo_Lightning(ObjectKankyo* this, PlayState* play) { this->effects[0].state = 0; } break; - - default: - break; } } } -void ObjectKankyo_DrawLightning(Actor* thisx, PlayState* play) { +void ObjectKankyo_DrawLightning(ObjectKankyo* this, PlayState* play) { s32 pad; - ObjectKankyo* this = (ObjectKankyo*)thisx; + s32 pad2; OPEN_DISPS(play->state.gfxCtx, "../z_object_kankyo.c", 1182); @@ -829,9 +810,9 @@ void ObjectKankyo_SunGraveSpark(ObjectKankyo* this, PlayState* play) { } } -void ObjectKankyo_DrawSunGraveSpark(Actor* thisx, PlayState* play2) { +void ObjectKankyo_DrawSunGraveSpark(ObjectKankyo* this2, PlayState* play2) { + ObjectKankyo* this = this2; PlayState* play = play2; - ObjectKankyo* this = (ObjectKankyo*)thisx; Vec3f start; Vec3f end; f32 weight; @@ -927,7 +908,7 @@ void ObjectKankyo_Beams(ObjectKankyo* this, PlayState* play) { } } -void ObjectKankyo_DrawBeams(Actor* thisx, PlayState* play2) { +void ObjectKankyo_DrawBeams(ObjectKankyo* this2, PlayState* play2) { static Color_RGB8 sBeamPrimColors[] = { { 255, 255, 170 }, { 170, 255, 255 }, { 255, 170, 255 }, { 255, 255, 170 }, { 255, 255, 170 }, { 255, 255, 170 }, @@ -935,8 +916,8 @@ void ObjectKankyo_DrawBeams(Actor* thisx, PlayState* play2) { static Color_RGB8 sBeamEnvColors[] = { { 0, 200, 0 }, { 0, 50, 255 }, { 100, 0, 200 }, { 200, 0, 0 }, { 200, 255, 0 }, { 255, 120, 0 }, }; + ObjectKankyo* this = this2; PlayState* play = play2; - ObjectKankyo* this = (ObjectKankyo*)thisx; s16 i; f32 beamX[] = { 430.0f, 860.0f, 430.0f, -426.0f, -862.0f, -440.0f }; f32 beamY[] = { 551.0f, 551.0f, 551.0f, 554.0f, 551.0f, 547.0f }; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 84dd1e6f522..4ea90846f38 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -11,7 +11,6 @@ #include "overlays/actors/ovl_En_Box/z_en_box.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" -#include "overlays/actors/ovl_En_Fish/z_en_fish.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" @@ -74,9 +73,6 @@ typedef struct GetItemEntry { #define CHEST_ANIM_SHORT 0 #define CHEST_ANIM_LONG 1 -#define GET_ITEM_NONE \ - { ITEM_NONE, 0, 0, 0, OBJECT_INVALID } - typedef struct ExplosiveInfo { /* 0x00 */ u8 itemId; /* 0x02 */ s16 actorId; @@ -114,10 +110,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) -#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) +#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; @@ -156,6 +152,14 @@ typedef struct struct_80854B18 { }; } struct_80854B18; // size = 0x08 +typedef struct struct_80858AC8 { + /* 0x00 */ s16 unk_00; + /* 0x02 */ s16 unk_02; + /* 0x04 */ s16 unk_04; + /* 0x06 */ s16 unk_06; + /* 0x08 */ s16 unk_08; +} struct_80858AC8; // size = 0x0A + void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction); void Player_InitDefaultIA(PlayState* play, Player* this); @@ -188,7 +192,7 @@ void func_80839F90(Player* this, PlayState* play); s32 func_8083C61C(PlayState* play, Player* this); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); void func_8084FF7C(Player* this); -void Player_UpdateBunnyEars(Player* this); +void func_8085002C(Player* this); void func_80851008(PlayState* play, Player* this, void* anim); void func_80851030(PlayState* play, Player* this, void* anim); void func_80851050(PlayState* play, Player* this, void* anim); @@ -364,22 +368,22 @@ void Player_Action_CsAction(Player* this, PlayState* play); // .bss part 1 -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" \ - "ique-cn:128 ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64 pal-1.0:64 pal-1.1:64" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" 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:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:128 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:192 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" static s32 sSavedCurrentMask; 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" \ - "ique-cn:192 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ + "ique-cn:160 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" // .data @@ -790,9 +794,9 @@ static GetItemEntry sGetItemTable[] = { // GI_BULLET_BAG_50 GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, GID_BULLET_BAG_50, 0x6C, 0x80, CHEST_ANIM_LONG), // GI_ICE_TRAP - GET_ITEM_NONE, + { ITEM_NONE }, // GI_TEXT_0 - GET_ITEM_NONE, + { ITEM_NONE }, }; #define GET_PLAYER_ANIM(group, type) D_80853914[group * PLAYER_ANIMTYPE_MAX + type] @@ -3700,7 +3704,7 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) { func_80832224(this); this->yaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; - this->hoverBootsTimer = 0; + this->unk_893 = 0; this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_FOCUS_Y | UNK6AE_ROT_UPPER_X; Player_PlayVoiceSfx(this, NA_SE_VO_LI_LASH); return true; @@ -4713,7 +4717,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 hitResponseType, f32 speed } } - this->hoverBootsTimer = 0; + this->unk_893 = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } else { if ((this->speedXZ > 4.0f) && !Player_CheckHostileLockOn(this)) { @@ -4985,7 +4989,7 @@ void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* } this->actor.velocity.y = arg2 * sWaterSpeedFactor; - this->hoverBootsTimer = 0; + this->unk_893 = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; Player_PlayJumpingSfx(this); @@ -5353,7 +5357,7 @@ f32 func_8083973C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3) { * Point B of the line is at player's world position offset by the entire `offset` vector. * Point A and B are always at the same height, meaning this is a horizontal line test. */ -s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId, +s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, u32* bgId, Vec3f* posResult) { Vec3f posA; Vec3f posB; @@ -5746,7 +5750,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { //! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope. if ((this->actor.depthInWater < -80.0f) && (ABS(this->floorPitch) < 0xAAA) && (ABS(this->floorPitchAlt) < 0xAAA)) { CollisionPoly* sp84; - s32 sp80; + u32 sp80; Vec3f sp74; Vec3f sp68; f32 temp1; @@ -5849,7 +5853,7 @@ void func_8083AA10(Player* this, PlayState* play) { return; } - if (this->hoverBootsTimer != 0) { + if (this->unk_893 != 0) { this->actor.velocity.y = 1.0f; sPrevFloorProperty = FLOOR_PROPERTY_9; return; @@ -6318,7 +6322,7 @@ void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzSpeed, f32 yVe this->actor.velocity.y = yVelocity; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; - this->hoverBootsTimer = 0; + this->unk_893 = 0; Player_PlayJumpingSfx(this); Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_L); @@ -7678,7 +7682,7 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { CollisionPoly* wallPoly; - s32 wallBgId; + u32 wallBgId; Vec3f sp6C; Vec3f sp60; Vec3f sp54; @@ -7729,7 +7733,7 @@ s32 func_8083F524(PlayState* play, Player* this) { /** * Two exit walls are placed at each end of the crawlspace, separate to the two entrance walls used to enter the - * crawlspace. These front and back exit walls are further into the crawlspace than the front and + * crawlspace. These front and back exit walls are further into the crawlspace relative to the front and * back entrance walls. When player interacts with either of these two interior exit walls, start the leaving-crawlspace * cutscene and return true. Else, return false */ @@ -8037,7 +8041,7 @@ void func_8084029C(Player* this, f32 arg1) { if (1) {} if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - (this->hoverBootsTimer != 0)) { + (this->unk_893 != 0)) { Actor_PlaySfx_Flagged2(&this->actor, NA_SE_PL_HOBBERBOOTS_LV - SFX_FLAG); } else if (func_8084021C(this->unk_868, arg1, 29.0f, 10.0f) || func_8084021C(this->unk_868, arg1, 29.0f, 24.0f)) { Player_PlaySteppingSfx(this, this->speedXZ); @@ -9062,7 +9066,7 @@ void func_80842D20(PlayState* play, Player* this) { s32 func_80842DF4(PlayState* play, Player* this) { f32 phi_f2; CollisionPoly* groundPoly; - s32 bgId; + u32 bgId; Vec3f sp68; Vec3f sp5C; Vec3f baseToTip; @@ -10762,7 +10766,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { if ((titleFileSize != 0) && gSaveContext.showTitleCard) { if (!IS_CUTSCENE_LAYER && - (gEntranceTable[((void)0, gSaveContext.save.entranceIndex) + ((void)0, gSaveContext.sceneLayer)].field & + (gEntranceTable[(0, gSaveContext.save.entranceIndex) + (0, gSaveContext.sceneLayer)].field & ENTRANCE_INFO_DISPLAY_TITLE_CARD_FLAG) && ((play->sceneId != SCENE_DODONGOS_CAVERN) || GET_EVENTCHKINF(EVENTCHKINF_B0)) && #if OOT_VERSION < PAL_1_0 @@ -10819,7 +10823,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { } if (gSaveContext.entranceSound != 0) { - Actor_PlaySfx(&this->actor, ((void)0, gSaveContext.entranceSound)); + Actor_PlaySfx(&this->actor, (0, gSaveContext.entranceSound)); gSaveContext.entranceSound = 0; } @@ -11029,23 +11033,23 @@ void Player_UpdateInterface(PlayState* play, Player* this) { s32 Player_UpdateHoverBoots(Player* this) { s32 canHoverOnGround; - if ((this->currentBoots == PLAYER_BOOTS_HOVER) && (this->hoverBootsTimer != 0)) { - this->hoverBootsTimer--; + if ((this->currentBoots == PLAYER_BOOTS_HOVER) && (this->unk_893 != 0)) { + this->unk_893--; } else { - this->hoverBootsTimer = 0; + this->unk_893 = 0; } canHoverOnGround = (this->currentBoots == PLAYER_BOOTS_HOVER) && ((this->actor.depthInWater >= 0.0f) || (func_80838144(sFloorType) >= 0) || func_8083816C(sFloorType)); - if (canHoverOnGround && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->hoverBootsTimer != 0)) { + if (canHoverOnGround && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (this->unk_893 != 0)) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (!canHoverOnGround) { - this->hoverBootsTimer = 19; + this->unk_893 = 0x13; } return false; @@ -11186,7 +11190,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { CollisionPoly* wallPoly; - s32 wallBgId; + u32 wallBgId; s16 yawDiff; s32 pad; @@ -11238,7 +11242,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { f32 yDistToLedge; CollisionPoly* ledgeFloorPoly; CollisionPoly* poly; - s32 bgId; + u32 bgId; Vec3f ledgeCheckPos; f32 ledgePosY; f32 ceillingPosY; @@ -11794,7 +11798,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->actor.shape.face = this->faceChange.face + ((play->gameplayFrames & 32) ? 0 : 3); if (this->currentMask == PLAYER_MASK_BUNNY) { - Player_UpdateBunnyEars(this); + func_8085002C(this); } if (func_8002DD6C(this) != 0) { @@ -11960,8 +11964,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_21); } - this->stateFlags1 &= ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | - PLAYER_STATE1_SHIELDING); + this->stateFlags1 &= + ~(PLAYER_STATE1_1 | PLAYER_STATE1_9 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_SHIELDING); this->stateFlags2 &= ~(PLAYER_STATE2_0 | PLAYER_STATE2_2 | PLAYER_STATE2_3 | PLAYER_STATE2_5 | PLAYER_STATE2_6 | PLAYER_STATE2_8 | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_12 | PLAYER_STATE2_14 | PLAYER_STATE2_DO_ACTION_ENTER | PLAYER_STATE2_22 | PLAYER_STATE2_26); @@ -12161,12 +12165,7 @@ skip_update:; } } -typedef struct BunnyEarKinematics { - /* 0x0 */ Vec3s rot; - /* 0x6 */ Vec3s angVel; -} BunnyEarKinematics; // size = 0xC - -static BunnyEarKinematics sBunnyEarKinematics; +static struct_80858AC8 D_80858AC8; static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { gLinkChildKeatonMaskDL, gLinkChildSkullMaskDL, gLinkChildSpookyMaskDL, gLinkChildBunnyHoodDL, @@ -12186,40 +12185,38 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, Player_PostLimbDrawGameplay, this); if ((overrideLimbDraw == Player_OverrideLimbDrawGameplayDefault) && (this->currentMask != PLAYER_MASK_NONE)) { - Mtx* bunnyEarMtx = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Mtx)); + Mtx* sp70 = GRAPH_ALLOC(play->state.gfxCtx, 2 * sizeof(Mtx)); if (this->currentMask == PLAYER_MASK_BUNNY) { - Vec3s earRot; + Vec3s sp68; - gSPSegment(POLY_OPA_DISP++, 0x0B, bunnyEarMtx); + gSPSegment(POLY_OPA_DISP++, 0x0B, sp70); - // Right ear - earRot.x = sBunnyEarKinematics.rot.y + 0x3E2; - earRot.y = sBunnyEarKinematics.rot.z + 0xDBE; - earRot.z = sBunnyEarKinematics.rot.x - 0x348A; - Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &earRot); - MATRIX_TO_MTX(bunnyEarMtx++, "../z_player.c", 19273); + sp68.x = D_80858AC8.unk_02 + 0x3E2; + sp68.y = D_80858AC8.unk_04 + 0xDBE; + sp68.z = D_80858AC8.unk_00 - 0x348A; + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, -240.0f, &sp68); + MATRIX_TO_MTX(sp70++, "../z_player.c", 19273); - // Left ear - earRot.x = sBunnyEarKinematics.rot.y - 0x3E2; - earRot.y = -sBunnyEarKinematics.rot.z - 0xDBE; - earRot.z = sBunnyEarKinematics.rot.x - 0x348A; - Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &earRot); - MATRIX_TO_MTX(bunnyEarMtx, "../z_player.c", 19279); + sp68.x = D_80858AC8.unk_02 - 0x3E2; + sp68.y = -0xDBE - D_80858AC8.unk_04; + sp68.z = D_80858AC8.unk_00 - 0x348A; + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f, 240.0f, &sp68); + MATRIX_TO_MTX(sp70, "../z_player.c", 19279); } gSPDisplayList(POLY_OPA_DISP++, sMaskDlists[this->currentMask - 1]); } if ((this->currentBoots == PLAYER_BOOTS_HOVER) && !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - !(this->stateFlags1 & PLAYER_STATE1_23) && ((u32)this->hoverBootsTimer != 0)) { + !(this->stateFlags1 & PLAYER_STATE1_23) && ((u32)this->unk_893 != 0)) { static s32 D_8085486C = 255; - if (this->hoverBootsTimer < 19) { - if (this->hoverBootsTimer >= 15) { - D_8085486C = (19 - this->hoverBootsTimer) * 51.0f; - } else if (this->hoverBootsTimer < 19) { - s32 sp5C = this->hoverBootsTimer; + if (this->unk_893 < 19) { + if (this->unk_893 >= 15) { + D_8085486C = (19 - this->unk_893) * 51.0f; + } else if (this->unk_893 < 19) { + s32 sp5C = this->unk_893; if (sp5C > 9) { sp5C = 9; @@ -12630,10 +12627,10 @@ void Player_Action_8084B78C(Player* this, PlayState* play) { void func_8084B840(PlayState* play, Player* this, f32 arg2) { if (this->actor.wallBgId != BGCHECK_SCENE) { - DynaPolyActor* dynaPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); + DynaPolyActor* dynaActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); - if (dynaPolyActor != NULL) { - func_8002DFA4(dynaPolyActor, arg2, this->actor.world.rot.y); + if (dynaActor != NULL) { + func_8002DFA4(dynaActor, arg2, this->actor.world.rot.y); } } } @@ -12726,7 +12723,7 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { Vec3f sp5C; f32 temp2; CollisionPoly* sp54; - s32 sp50; + u32 sp50; Vec3f sp44; Vec3f sp38; @@ -13102,7 +13099,7 @@ int func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) { Vec3f sp40; Vec3f sp34; CollisionPoly* sp30; - s32 sp2C; + u32 sp2C; sp50 = rideActor->actor.world.pos.y + 20.0f; sp4C = rideActor->actor.world.pos.y - 20.0f; @@ -14039,7 +14036,7 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { } typedef enum BottleCatchType { - BOTTLE_CATCH_NONE, // This type does not have an associated entry in `sBottleCatchInfo` + BOTTLE_CATCH_NONE, // This type does not have an associated entry in `D_80854A04` BOTTLE_CATCH_FAIRY, BOTTLE_CATCH_FISH, BOTTLE_CATCH_BLUE_FIRE, @@ -14053,11 +14050,11 @@ typedef struct BottleCatchInfo { /* 0x04 */ u8 textId; } BottleCatchInfo; // size = 0x06 -static BottleCatchInfo sBottleCatchInfo[] = { - { ACTOR_EN_ELF, ITEM_BOTTLE_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x46 }, // BOTTLE_CATCH_FAIRY - { ACTOR_EN_FISH, ITEM_BOTTLE_FISH, PLAYER_IA_BOTTLE_FISH, 0x47 }, // BOTTLE_CATCH_FISH - { ACTOR_EN_ICE_HONO, ITEM_BOTTLE_BLUE_FIRE, PLAYER_IA_BOTTLE_FIRE, 0x5D }, // BOTTLE_CATCH_BLUE_FIRE - { ACTOR_EN_INSECT, ITEM_BOTTLE_BUG, PLAYER_IA_BOTTLE_BUG, 0x7A }, // BOTTLE_CATCH_BUGS +static BottleCatchInfo D_80854A04[] = { + { ACTOR_EN_ELF, ITEM_BOTTLE_FAIRY, 0x2A, 0x46 }, // BOTTLE_CATCH_FAIRY + { ACTOR_EN_FISH, ITEM_BOTTLE_FISH, 0x1F, 0x47 }, // BOTTLE_CATCH_FISH + { ACTOR_EN_ICE_HONO, ITEM_BOTTLE_BLUE_FIRE, 0x20, 0x5D }, // BOTTLE_CATCH_BLUE_FIRE + { ACTOR_EN_INSECT, ITEM_BOTTLE_BUG, 0x21, 0x7A }, // BOTTLE_CATCH_BUGS }; void Player_Action_SwingBottle(Player* this, PlayState* play) { @@ -14071,8 +14068,8 @@ void Player_Action_SwingBottle(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av1.bottleCatchType != BOTTLE_CATCH_NONE) { if (!this->av2.startedTextbox) { - // 1 is subtracted because `sBottleCatchInfo` does not have an entry for `BOTTLE_CATCH_NONE` - Message_StartTextbox(play, sBottleCatchInfo[this->av1.bottleCatchType - 1].textId, &this->actor); + // 1 is subtracted because `D_80854A04` does not have an entry for `BOTTLE_CATCH_NONE` + Message_StartTextbox(play, D_80854A04[this->av1.bottleCatchType - 1].textId, &this->actor); Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); this->av2.startedTextbox = true; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { @@ -14093,18 +14090,18 @@ void Player_Action_SwingBottle(Player* this, PlayState* play) { // `interactRangeActor` will be set by the Get Item system. See `Actor_OfferGetItem`. if (this->interactRangeActor != NULL) { - BottleCatchInfo* catchInfo = &sBottleCatchInfo[0]; + BottleCatchInfo* catchInfo = &D_80854A04[0]; s32 i; - // Try to find an `interactRangeActor` with the same ID as an entry in `sBottleCatchInfo` - for (i = 0; i < ARRAY_COUNT(sBottleCatchInfo); i++, catchInfo++) { + // Try to find an `interactRangeActor` with the same ID as an entry in `D_80854A04` + for (i = 0; i < ARRAY_COUNT(D_80854A04); i++, catchInfo++) { if (this->interactRangeActor->id == catchInfo->actorId) { break; } } - if (i < ARRAY_COUNT(sBottleCatchInfo)) { - // 1 is added because `sBottleCatchInfo` does not have an entry for `BOTTLE_CATCH_NONE` + if (i < ARRAY_COUNT(D_80854A04)) { + // 1 is added because `D_80854A04` does not have an entry for `BOTTLE_CATCH_NONE` this->av1.bottleCatchType = i + 1; this->av2.startedTextbox = false; @@ -14119,11 +14116,8 @@ void Player_Action_SwingBottle(Player* this, PlayState* play) { } } - //! @bug If the animation is changed at any point above (such as by func_8083C0E8() or - //! Player_AnimPlayOnceAdjusted()), it will change the curFrame to 0. This causes this flag to be set for one frame, - //! at a time when it does not look like Player is swinging the bottle. if (this->skelAnime.curFrame <= 7.0f) { - this->stateFlags1 |= PLAYER_STATE1_SWINGING_BOTTLE; + this->stateFlags1 |= PLAYER_STATE1_1; } } @@ -14147,7 +14141,7 @@ void Player_Action_8084EED8(Player* this, PlayState* play) { } static BottleDropInfo D_80854A28[] = { - { ACTOR_EN_FISH, FISH_DROPPED }, + { ACTOR_EN_FISH, 0 }, { ACTOR_EN_ICE_HONO, 0 }, { ACTOR_EN_INSECT, INSECT_TYPE_FIRST_DROPPED }, }; @@ -14582,50 +14576,44 @@ void func_8084FF7C(Player* this) { } } -/** - * Updates the Bunny Hood's floppy ears' rotation and velocity. - */ -void Player_UpdateBunnyEars(Player* this) { - Vec3s force; - s16 angle; +void func_8085002C(Player* this) { + s32 pad; + s16 sp2A; + s16 sp28; + s16 sp26; - // Damping: decay by 1/8 the previous value each frame - sBunnyEarKinematics.angVel.x -= sBunnyEarKinematics.angVel.x >> 3; - sBunnyEarKinematics.angVel.y -= sBunnyEarKinematics.angVel.y >> 3; + D_80858AC8.unk_06 -= D_80858AC8.unk_06 >> 3; + D_80858AC8.unk_08 -= D_80858AC8.unk_08 >> 3; + D_80858AC8.unk_06 += -D_80858AC8.unk_00 >> 2; + D_80858AC8.unk_08 += -D_80858AC8.unk_02 >> 2; - // Elastic restorative force - sBunnyEarKinematics.angVel.x += -sBunnyEarKinematics.rot.x >> 2; - sBunnyEarKinematics.angVel.y += -sBunnyEarKinematics.rot.y >> 2; + sp26 = this->actor.world.rot.y - this->actor.shape.rot.y; - // Forcing from motion relative to shape frame - angle = this->actor.world.rot.y - this->actor.shape.rot.y; - force.x = (s32)(this->actor.speed * -200.0f * Math_CosS(angle) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF; - force.y = (s32)(this->actor.speed * 100.0f * Math_SinS(angle) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF; + sp28 = (s32)(this->actor.speed * -200.0f * Math_CosS(sp26) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF; + sp2A = (s32)(this->actor.speed * 100.0f * Math_SinS(sp26) * (Rand_CenteredFloat(2.0f) + 10.0f)) & 0xFFFF; - sBunnyEarKinematics.angVel.x += force.x >> 2; - sBunnyEarKinematics.angVel.y += force.y >> 2; + D_80858AC8.unk_06 += sp28 >> 2; + D_80858AC8.unk_08 += sp2A >> 2; - // Clamp both angular velocities to [-6000, 6000] - if (sBunnyEarKinematics.angVel.x > 6000) { - sBunnyEarKinematics.angVel.x = 6000; - } else if (sBunnyEarKinematics.angVel.x < -6000) { - sBunnyEarKinematics.angVel.x = -6000; + if (D_80858AC8.unk_06 > 6000) { + D_80858AC8.unk_06 = 6000; + } else if (D_80858AC8.unk_06 < -6000) { + D_80858AC8.unk_06 = -6000; } - if (sBunnyEarKinematics.angVel.y > 6000) { - sBunnyEarKinematics.angVel.y = 6000; - } else if (sBunnyEarKinematics.angVel.y < -6000) { - sBunnyEarKinematics.angVel.y = -6000; + + if (D_80858AC8.unk_08 > 6000) { + D_80858AC8.unk_08 = 6000; + } else if (D_80858AC8.unk_08 < -6000) { + D_80858AC8.unk_08 = -6000; } - // Add angular velocity to rotations - sBunnyEarKinematics.rot.x += sBunnyEarKinematics.angVel.x; - sBunnyEarKinematics.rot.y += sBunnyEarKinematics.angVel.y; + D_80858AC8.unk_00 += D_80858AC8.unk_06; + D_80858AC8.unk_02 += D_80858AC8.unk_08; - // swivel ears outwards if bending backwards - if (sBunnyEarKinematics.rot.x < 0) { - sBunnyEarKinematics.rot.z = sBunnyEarKinematics.rot.x >> 1; + if (D_80858AC8.unk_00 < 0) { + D_80858AC8.unk_04 = D_80858AC8.unk_00 >> 1; } else { - sBunnyEarKinematics.rot.z = 0; + D_80858AC8.unk_04 = 0; } } 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 2e6dc9afdef..9448e702e60 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -34,6 +34,8 @@ #include "ss_sram.h" #include "view.h" +#include "functions.h" + #if OOT_PAL_N64 #include "assets/objects/object_mag/object_mag.h" #endif @@ -543,7 +545,7 @@ void FileSelect_UpdateMainMenu(GameState* thisx) { this->newFileNameCharCount = 0; this->nameEntryBoxPosX = 120; this->nameEntryBoxAlpha = 0; - MemCpy(&this->fileNames[this->buttonIndex][0], &emptyName, sizeof(emptyName)); + MemCopy(&this->fileNames[this->buttonIndex][0], &emptyName, 8); } else if (this->n64ddFlags[this->buttonIndex] == this->n64ddFlag) { SFX_PLAY_CENTERED(NA_SE_SY_FSEL_DECIDE_L); this->actionTimer = 8; diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index c8b90787b7f..287373969a4 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -32,15 +32,15 @@ #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" #if DEBUG_FEATURES -void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) { - Gfx* gfx; +void ConsoleLogo_PrintBuildInfo(Gfx** gfxp) { + Gfx* g; GfxPrint* printer; - gfx = *gfxP; - gfx = Gfx_SetupDL_28(gfx); + g = *gfxp; + g = Gfx_SetupDL_28(g); printer = alloca(sizeof(GfxPrint)); GfxPrint_Init(printer); - GfxPrint_Open(printer, gfx); + GfxPrint_Open(printer, g); GfxPrint_SetColor(printer, 255, 155, 255, 255); GfxPrint_SetPos(printer, 9, 21); GfxPrint_Printf(printer, "NOT MARIO CLUB VERSION"); @@ -49,9 +49,9 @@ void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) { GfxPrint_Printf(printer, "[Creator:%s]", gBuildCreator); GfxPrint_SetPos(printer, 7, 24); GfxPrint_Printf(printer, "[Date:%s]", gBuildDate); - gfx = GfxPrint_Close(printer); + g = GfxPrint_Close(printer); GfxPrint_Destroy(printer); - *gfxP = gfx; + *gfxp = g; } #endif diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index 2ba3fd1139f..f5fb19635ee 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -174,12 +174,12 @@ static s16 sSlotItems[] = { ITEM_BOOMERANG, ITEM_LENS_OF_TRUTH, ITEM_MAGIC_BEAN, ITEM_HAMMER, ITEM_ARROW_LIGHT, ITEM_NAYRUS_LOVE, }; -void KaleidoScope_DrawInventoryEditorText(Gfx** gfxP) { +void KaleidoScope_DrawInventoryEditorText(Gfx** gfxp) { GfxPrint printer; s32 pad[2]; GfxPrint_Init(&printer); - GfxPrint_Open(&printer, *gfxP); + GfxPrint_Open(&printer, *gfxp); GfxPrint_SetPos(&printer, 4, 2); GfxPrint_SetColor(&printer, 255, 60, 0, 255); @@ -215,7 +215,7 @@ void KaleidoScope_DrawInventoryEditorText(Gfx** gfxP) { GfxPrint_SetPos(&printer, 28, 24); GfxPrint_Printf(&printer, "%s", "/4"); - *gfxP = GfxPrint_Close(&printer); + *gfxp = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); } diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index ba66f0ca066..197a0f8d737 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -40,8 +40,8 @@ #endif #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1: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 ntsc-1.0:0" \ + "ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #if !PLATFORM_GC #define KALEIDO_PROMPT_CURSOR_R 100 diff --git a/tools/Makefile b/tools/Makefile index 6dd018bd8e1..fbd7f9462d5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -62,7 +62,6 @@ mkspecrules_SOURCES := mkspecrules.c spec.c util.c preprocess_pragmas_SOURCES := preprocess_pragmas.c vtxdis_SOURCES := vtxdis.c - define COMPILE = $(1): $($1_SOURCES) $(CC) $(CFLAGS) $$^ -o $$@ diff --git a/tools/assets/extract/extase_oot64/dlist_resources.py b/tools/assets/extract/extase_oot64/dlist_resources.py index 5bda06879b6..fc3af6f20da 100644 --- a/tools/assets/extract/extase_oot64/dlist_resources.py +++ b/tools/assets/extract/extase_oot64/dlist_resources.py @@ -1459,7 +1459,7 @@ def arg_fn_handle_Dim(arg_num: int): "gHilite2Tex", # used as both rgba16 16x16 and rgba16 32x32 "gUnknownCircle4Tex", # used as both i8 16x16 and rgba16 32x32 "gLinkChildLowerBootTex", # used as both ci8 32x32 and ci8 16x16 - "gDecorativeFlameMaskTex", # used as both i4 32x128 and i4 32x64 + "gEffFire1Tex", # used as both i4 32x128 and i4 32x64 } if ( arg_num == width_arg_i diff --git a/tools/assets/extract/extase_oot64/skelcurve_resources.py b/tools/assets/extract/extase_oot64/skelcurve_resources.py index 1eed98884b3..9f65188b15b 100644 --- a/tools/assets/extract/extase_oot64/skelcurve_resources.py +++ b/tools/assets/extract/extase_oot64/skelcurve_resources.py @@ -83,7 +83,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("curve.h",) + return ("animation.h",) class ConstantDataArrayResource(CDataResource, can_size_be_unknown=True): @@ -254,7 +254,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("curve.h",) + return ("animation.h",) class SkelCurveLimbResource(CDataResource): @@ -283,7 +283,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("curve.h",) + return ("animation.h",) class SkelCurveLimbArrayResource(CDataResource): @@ -328,7 +328,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("curve.h",) + return ("animation.h",) class CurveSkeletonHeaderResource(CDataResource): @@ -375,4 +375,4 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("curve.h",) + return ("animation.h",) diff --git a/tools/assets/extract/write_source.txt b/tools/assets/extract/write_source.txt index 7aece666103..36cafcbe295 100644 --- a/tools/assets/extract/write_source.txt +++ b/tools/assets/extract/write_source.txt @@ -343,7 +343,9 @@ assets/objects/object_tk/object_tk.c assets/objects/object_toki_objects/object_toki_objects.c assets/objects/object_torch2/object_torch2.c assets/objects/object_toryo/object_toryo.c +assets/objects/object_tp/object_tp.c assets/objects/object_trap/object_trap.c +assets/objects/object_triforce_spot/object_triforce_spot.c assets/objects/object_tr/object_tr.c assets/objects/object_ts/object_ts.c assets/objects/object_tsubo/object_tsubo.c @@ -369,6 +371,7 @@ assets/overlays/ovl_Boss_Sst/ovl_Boss_Sst.c assets/overlays/ovl_Demo_Shd/ovl_Demo_Shd.c assets/overlays/ovl_En_Bili/ovl_En_Bili.c assets/overlays/ovl_En_Clear_Tag/ovl_En_Clear_Tag.c +assets/overlays/ovl_En_Ganon_Organ/ovl_En_Ganon_Organ.c assets/overlays/ovl_En_Mag/ovl_En_Mag.c assets/overlays/ovl_En_Sda/ovl_En_Sda.c assets/overlays/ovl_En_Ssh/ovl_En_Ssh.c diff --git a/tools/fix_bss.py b/tools/fix_bss.py index 4c9d22937a5..cfecf8ea416 100755 --- a/tools/fix_bss.py +++ b/tools/fix_bss.py @@ -231,7 +231,6 @@ def resolver(x: Path) -> Path|None: if not ( mapfile_segment.name.startswith("..boot") or mapfile_segment.name.startswith("..code") - or mapfile_segment.name.startswith("..n64dd") or mapfile_segment.name.startswith("..ovl_") ): continue diff --git a/tools/m2ctx.py b/tools/m2ctx.py index 3b2c537a302..bcee5a1e6d8 100755 --- a/tools/m2ctx.py +++ b/tools/m2ctx.py @@ -3,7 +3,6 @@ import os import sys import subprocess -import argparse from pathlib import Path script_dir = os.path.dirname(os.path.realpath(__file__)) @@ -24,10 +23,9 @@ def get_c_file(directory): if file.endswith(".c") and "data" not in file: return file - def import_c_file(in_file, version): in_file = os.path.relpath(in_file, root_dir) - cpp_command = ["gcc", "-nostdinc", "-E", "-P", "-Iinclude", "-Iinclude/libc", "-Isrc", f"-Ibuild/{version}", "-I.", f"-Iextracted/{version}", "-undef", "-DM2CTX", "-D__sgi", "-D_LANGUAGE_C", + cpp_command = ["cpp", "-nostdinc", "-P", "-Iinclude", "-Iinclude/libc", "-Isrc", f"-Ibuild/{version}", "-I.", f"-Iextracted/{version}", "-undef", "-DM2CTX", "-D__sgi", "-D_LANGUAGE_C", "-DNON_MATCHING", "-D_Static_assert(x, y)=", "-D__attribute__(x)=", in_file] try: return subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8") @@ -36,33 +34,28 @@ def import_c_file(in_file, version): "Failed to preprocess input file, when running command:\n" + " ".join(cpp_command), file=sys.stderr, - ) + ) sys.exit(1) - def main(): - parser = argparse.ArgumentParser(usage="./m2ctx.py path/to/file.c or ./m2ctx.py (from an actor or gamestate's asm dir)", - description="Creates a ctx.c file for mips2c. " - "Output will be saved as oot/ctx.c") - parser.add_argument('filepath', help="path of c file to be processed") - parser.add_argument("-v", "--version", dest="oot_version", required=True) - args = parser.parse_args() - - version = args.oot_version - - if args.filepath: - c_file_path = args.filepath - print("Using file: {}".format(c_file_path)) + version = "gc-eu-mq-dbg" + if len(sys.argv) > 1: + arg = sys.argv[1] + if arg == "-h" or arg == "--help": + sys.exit("Usage: ./m2ctx.py path/to/file.c [version]\n" \ + "or ./m2ctx.py (from an actor or gamestate's asm dir)\n" \ + "Output will be saved in oot/ctx.c") + c_file_path = Path.cwd() / sys.argv[1] + if len(sys.argv) > 2: + version = sys.argv[2] else: this_dir = Path.cwd() c_dir_path = get_c_dir(this_dir.name) if c_dir_path is None: - sys.exit( - "Cannot find appropriate c file dir. In argumentless mode, run this script from the c file's corresponding asm dir.") + sys.exit("Cannot find appropriate c file dir. In argumentless mode, run this script from the c file's corresponding asm dir.") c_file = get_c_file(c_dir_path) c_file_path = os.path.join(c_dir_path, c_file) - print("Using file: {}".format(c_file_path)) - + output = import_c_file(c_file_path, version) with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f: diff --git a/tools/mkdmadata.c b/tools/mkdmadata.c index 7e55b71a17c..1001f570433 100644 --- a/tools/mkdmadata.c +++ b/tools/mkdmadata.c @@ -103,7 +103,6 @@ int main(int argc, char **argv) write_compress_ranges(compress_ranges_out); fclose(compress_ranges_out); - free_rom_spec(g_segments, g_segmentsCount); free(spec); return 0; diff --git a/tools/mkldscript.c b/tools/mkldscript.c index 3351298838a..2fb65a07a47 100644 --- a/tools/mkldscript.c +++ b/tools/mkldscript.c @@ -310,7 +310,6 @@ int main(int argc, char **argv) write_ld_script(ldout, entrypoint_addr, argv[3], argv[4]); fclose(ldout); - free_rom_spec(g_segments, g_segmentsCount); free(spec); return EXIT_SUCCESS; } diff --git a/tools/mkspecrules.c b/tools/mkspecrules.c index 16c84111cdb..7452175d373 100644 --- a/tools/mkspecrules.c +++ b/tools/mkspecrules.c @@ -67,7 +67,7 @@ static void write_linker_script(FILE *fout, struct Segment *seg) static void write_overlay_rules(FILE *fout, const char *ovls_dir) { for (int i = 0; i < g_segmentsCount; i++) { - Segment *seg = &g_segments[i]; + struct Segment *seg = &g_segments[i]; /* Write rule for partial linkage of this segment */ fprintf(fout, "%s/%s.plf:", ovls_dir, seg->name); @@ -159,7 +159,7 @@ int main(int argc, char **argv) } for (int i = 0; i < g_segmentsCount; i++) { - Segment *seg = &g_segments[i]; + struct Segment *seg = &g_segments[i]; // Form the full path for this segment's linker script strcpy(ld_outpath + seg_dir_len, seg->name); diff --git a/tools/n64chksum.h b/tools/n64chksum.h index f5b73be49c6..0ca13a819b2 100644 --- a/tools/n64chksum.h +++ b/tools/n64chksum.h @@ -1,7 +1,5 @@ -#ifndef N64CHKSUM_H -#define N64CHKSUM_H - -#include +#ifndef _N64CHKSUM_H_ +#define _N64CHKSUM_H_ bool n64chksum_calculate(const uint8_t *romData, int cicType, uint32_t *chksum); diff --git a/tools/namefixer.py b/tools/namefixer.py index 0877e2893ec..cae85f3b4b5 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -498,7 +498,7 @@ def replace_all(repo): file = subdir + os.sep + filename replace_single(file) -parser = argparse.ArgumentParser(description='Apply function renames to a file') +parser = argparse.ArgumentParser(description='Update to the new animation names') parser.add_argument('file', help="source file to be processed. use . to process the whole repo") if __name__ == "__main__": diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml index 607781e3730..e9d1d979002 100644 --- a/tools/permuter_settings.toml +++ b/tools/permuter_settings.toml @@ -33,6 +33,10 @@ PRINTF = "void" SCHED_DEBUG_PRINTF = "void" ACTOR_DEBUG_PRINTF = "void" +PLAYER_LIMB_BUF_COUNT = "int" +"BGCHECKFLAG_.*" = "int" +GET_PLAYER = "void*" + [decompme.compilers] "tools/ido_recomp/*/7.1/cc" = "ido7.1" "tools/ido_recomp/*/5.3/cc" = "ido5.3" diff --git a/tools/spec.c b/tools/spec.c index 4c079834f3d..bf9f599ad5e 100644 --- a/tools/spec.c +++ b/tools/spec.c @@ -146,102 +146,6 @@ static const char *const stmtNames[] = [STMT_pad_text] = "pad_text", }; -STMTId get_stmt_id_by_stmt_name(const char *stmtName, int lineNum) { - STMTId stmt; - - for (stmt = 0; stmt < ARRAY_COUNT(stmtNames); stmt++) { - if (strcmp(stmtName, stmtNames[stmt]) == 0) - return stmt; - } - util_fatal_error("line %i: unknown statement '%s'", lineNum, stmtName); - return -1; -} - -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_pad_text && - (currSeg->fields & (1 << stmt))) - util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtNames[stmt]); - - currSeg->fields |= 1 << stmt; - - // statements valid within a segment definition - switch (stmt) - { - case STMT_beginseg: - util_fatal_error("line %i: '%s' inside of a segment definition", lineNum, stmtNames[stmt]); - break; - case STMT_endseg: - // verify segment data - if (currSeg->name == NULL) - util_fatal_error("line %i: no name specified for segment", lineNum); - if (currSeg->includesCount == 0) - util_fatal_error("line %i: no includes specified for segment", lineNum); - return true; - break; - case STMT_name: - if (!parse_quoted_string(args, &currSeg->name)) - util_fatal_error("line %i: invalid name", lineNum); - break; - case STMT_after: - if (!parse_quoted_string(args, &currSeg->after)) - util_fatal_error("line %i: invalid name for 'after'", lineNum); - break; - case STMT_address: - if (!parse_number(args, &currSeg->address)) - util_fatal_error("line %i: expected number after 'address'", lineNum); - break; - case STMT_number: - if (!parse_number(args, &currSeg->number)) - util_fatal_error("line %i: expected number after 'number'", lineNum); - break; - case STMT_flags: - if (!parse_flags(args, &currSeg->flags)) - util_fatal_error("line %i: invalid flags", lineNum); - break; - case STMT_align: - if (!parse_number(args, &currSeg->align)) - util_fatal_error("line %i: expected number after 'align'", lineNum); - if (!is_pow_of_2(currSeg->align)) - util_fatal_error("line %i: alignment is not a power of two", lineNum); - break; - case STMT_romalign: - if (!parse_number(args, &currSeg->romalign)) - util_fatal_error("line %i: expected number after 'romalign'", lineNum); - if (!is_pow_of_2(currSeg->romalign)) - util_fatal_error("line %i: alignment is not a power of two", lineNum); - break; - case STMT_include: - currSeg->includesCount++; - currSeg->includes = realloc(currSeg->includes, currSeg->includesCount * sizeof(*currSeg->includes)); - - if (!parse_quoted_string(args, &currSeg->includes[currSeg->includesCount - 1].fpath)) - util_fatal_error("line %i: invalid filename", lineNum); - - currSeg->includes[currSeg->includesCount - 1].linkerPadding = 0; - break; - case STMT_increment: - if (!parse_number(args, &currSeg->increment)) - util_fatal_error("line %i: expected number after 'increment'", lineNum); - break; - case STMT_compress: - currSeg->compress = true; - break; - case STMT_pad_text: - currSeg->includes[currSeg->includesCount - 1].linkerPadding += 0x10; - break; - default: - fprintf(stderr, "warning: '%s' is not implemented\n", stmtNames[stmt]); - break; - } - return false; -} - -/** - * `segments` should be freed with `free_rom_spec` after use. - * Will write to the contents of `spec` to introduce string terminating '\0's. - * `segments` also contains pointers to inside `spec`, so `spec` should not be freed before `segments` - */ void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count) { int lineNum = 1; @@ -263,13 +167,91 @@ void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count) if (line[0] != 0 && stmtName[0] != 0) { char *args = token_split(stmtName); - STMTId stmt = get_stmt_id_by_stmt_name(stmtName, lineNum); + unsigned int stmt; + + for (stmt = 0; stmt < ARRAY_COUNT(stmtNames); stmt++) + if (strcmp(stmtName, stmtNames[stmt]) == 0) + goto got_stmt; + util_fatal_error("line %i: unknown statement '%s'", lineNum, stmtName); + got_stmt: if (currSeg != NULL) { - bool segmentEnded = parse_segment_statement(currSeg, stmt, args, lineNum); - if (segmentEnded) { + // ensure no duplicates (except for 'include' or 'pad_text') + if (stmt != STMT_include && stmt != STMT_pad_text && + (currSeg->fields & (1 << stmt))) + util_fatal_error("line %i: duplicate '%s' statement", lineNum, stmtName); + + currSeg->fields |= 1 << stmt; + + // statements valid within a segment definition + switch (stmt) + { + case STMT_beginseg: + util_fatal_error("line %i: '%s' inside of a segment definition", lineNum, stmtName); + break; + case STMT_endseg: + // verify segment data + if (currSeg->name == NULL) + util_fatal_error("line %i: no name specified for segment", lineNum); + if (currSeg->includesCount == 0) + util_fatal_error("line %i: no includes specified for segment", lineNum); currSeg = NULL; + break; + case STMT_name: + if (!parse_quoted_string(args, &currSeg->name)) + util_fatal_error("line %i: invalid name", lineNum); + break; + case STMT_after: + if (!parse_quoted_string(args, &currSeg->after)) + util_fatal_error("line %i: invalid name for 'after'", lineNum); + break; + case STMT_address: + if (!parse_number(args, &currSeg->address)) + util_fatal_error("line %i: expected number after 'address'", lineNum); + break; + case STMT_number: + if (!parse_number(args, &currSeg->number)) + util_fatal_error("line %i: expected number after 'number'", lineNum); + break; + case STMT_flags: + if (!parse_flags(args, &currSeg->flags)) + util_fatal_error("line %i: invalid flags", lineNum); + break; + case STMT_align: + if (!parse_number(args, &currSeg->align)) + util_fatal_error("line %i: expected number after 'align'", lineNum); + if (!is_pow_of_2(currSeg->align)) + util_fatal_error("line %i: alignment is not a power of two", lineNum); + break; + case STMT_romalign: + if (!parse_number(args, &currSeg->romalign)) + util_fatal_error("line %i: expected number after 'romalign'", lineNum); + if (!is_pow_of_2(currSeg->romalign)) + util_fatal_error("line %i: alignment is not a power of two", lineNum); + break; + case STMT_include: + currSeg->includesCount++; + currSeg->includes = realloc(currSeg->includes, currSeg->includesCount * sizeof(*currSeg->includes)); + + if (!parse_quoted_string(args, &currSeg->includes[currSeg->includesCount - 1].fpath)) + util_fatal_error("line %i: invalid filename", lineNum); + + currSeg->includes[currSeg->includesCount - 1].linkerPadding = 0; + break; + case STMT_increment: + if (!parse_number(args, &currSeg->increment)) + util_fatal_error("line %i: expected number after 'increment'", lineNum); + break; + case STMT_compress: + currSeg->compress = true; + break; + case STMT_pad_text: + currSeg->includes[currSeg->includesCount - 1].linkerPadding += 0x10; + break; + default: + fprintf(stderr, "warning: '%s' is not implemented\n", stmtName); + break; } } else @@ -296,70 +278,6 @@ void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count) } } -/** - * @brief Parses the spec, looking only for the segment with the name `segmentName`. - * Returns true if the segment was found, false otherwise - * - * @param[out] dstSegment The Segment to be filled. Will only contain the data of the searched segment, or garbage if the segment was not found. dstSegment must be previously allocated, a stack variable is recommended - * @param[in,out] spec A null-terminated string containing the whole spec file. This string will be modified by this function - * @param[in] segmentName The name of the segment being searched - */ -bool get_single_segment_by_name(struct Segment* dstSegment, char *spec, const char *segmentName) { - bool insideSegment = false; - int lineNum = 1; - char *line = spec; - - memset(dstSegment, 0, sizeof(struct Segment)); - - // iterate over lines - while (line[0] != '\0') { - char *nextLine = line_split(line); - char* stmtName = skip_whitespace(line); - - if (stmtName[0] != '\0') { - char *args = token_split(stmtName); - STMTId stmt = get_stmt_id_by_stmt_name(stmtName, lineNum); - - if (insideSegment) { - bool segmentEnded = parse_segment_statement(dstSegment, stmt, args, lineNum); - - if (stmt == STMT_name) { - if (strcmp(segmentName, dstSegment->name) != 0) { - // Not the segment we are looking for - insideSegment = false; - } - } else if (segmentEnded) { - return true; - } - } else { - if (stmt == STMT_beginseg) { - insideSegment = true; - if (dstSegment->includes != NULL) { - free(dstSegment->includes); - } - memset(dstSegment, 0, sizeof(struct Segment)); - } - } - } - - line = nextLine; - lineNum++; - } - - return false; -} - -/** - * @brief Frees the elements of the passed Segment. Will not free the pointer itself - * - * @param segment - */ -void free_single_segment_elements(struct Segment *segment) { - if (segment->includes != NULL) { - free(segment->includes); - } -} - void free_rom_spec(struct Segment *segments, int segment_count) { int i; diff --git a/tools/spec.h b/tools/spec.h index 8c48910430a..15cab8ede34 100644 --- a/tools/spec.h +++ b/tools/spec.h @@ -1,10 +1,11 @@ -#ifndef SPEC_H -#define SPEC_H +#ifndef _SPEC_H_ +#define _SPEC_H_ -#include #include +#include -typedef enum { +enum +{ STMT_address, STMT_after, STMT_align, @@ -20,9 +21,10 @@ typedef enum { STMT_stack, STMT_increment, STMT_pad_text, -} STMTId; +}; -enum { +enum +{ FLAG_BOOT = (1 << 0), FLAG_OBJECT = (1 << 1), FLAG_RAW = (1 << 2), @@ -31,15 +33,17 @@ enum { FLAG_OVL = (1 << 5) }; -struct Include { - char* fpath; +struct Include +{ + char *fpath; int linkerPadding; }; -typedef struct Segment { +struct Segment +{ uint32_t fields; - char* name; - char* after; + char *name; + char *after; uint32_t flags; uint32_t address; uint32_t stack; @@ -48,17 +52,13 @@ typedef struct Segment { uint32_t increment; uint32_t entry; uint32_t number; - struct Include* includes; + struct Include *includes; int includesCount; bool compress; -} Segment; - -void parse_rom_spec(char* spec, struct Segment** segments, int* segment_count); - -bool get_single_segment_by_name(struct Segment* dstSegment, char *spec, const char *segmentName); +}; -void free_single_segment_elements(struct Segment *segment); +void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count); -void free_rom_spec(struct Segment* segments, int segment_count); +void free_rom_spec(struct Segment *segments, int segment_count); #endif diff --git a/tools/util.c b/tools/util.c index 824e089e071..421215fceae 100644 --- a/tools/util.c +++ b/tools/util.c @@ -12,18 +12,18 @@ void util_fatal_error(const char *msgfmt, ...) { va_list args; - fputs(ERRMSG_START, stderr); + fputs("error: ", stderr); va_start(args, msgfmt); vfprintf(stderr, msgfmt, args); va_end(args); - fputs(ERRMSG_END "\n", stderr); + fputc('\n', stderr); exit(1); } -// reads a whole file into memory, and returns a malloc'd pointer to the data. +// reads a whole file into memory, and returns a pointer to the data void *util_read_whole_file(const char *filename, size_t *pSize) { FILE *file = fopen(filename, "rb"); diff --git a/tools/util.h b/tools/util.h index ed692bf53d2..e8749d9a4e0 100644 --- a/tools/util.h +++ b/tools/util.h @@ -1,12 +1,8 @@ -#ifndef UTIL_H -#define UTIL_H +#ifndef _UTIL_H_ +#define _UTIL_H_ #include #include -#include - -#define ERRMSG_START "\x1b[91merror\x1b[97m: " -#define ERRMSG_END "\x1b[0m" #ifdef __GNUC__ __attribute__((format(printf, 1, 2), noreturn)) diff --git a/undefined_syms.txt b/undefined_syms.txt index c40597854c0..c1db4b8520e 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1,3 +1,5 @@ +#include "include/versions.h" + // z_kankyo, z_demo_kankyo, z_en_viewer, z_object_kankyo, z_eff_ss_dead_dd D_01000000 = 0x01000000; @@ -9,3 +11,57 @@ D_0F000000 = 0x0F000000; // z_bg_mjin D_06000000 = 0x06000000; + +// z_demo_effect +D_06000050 = 0x06000050; +D_060012E8 = 0x060012E8; + +// z_en_ge3 +D_600A458 = 0x600A458; +D_600B07C = 0x600B07C; + +// z_en_karebaba +D_06002A40 = 0x06002A40; +D_060002B8 = 0x060002B8; +D_06003070 = 0x06003070; +D_060010F0 = 0x060010F0; +D_06001828 = 0x06001828; +D_06001330 = 0x06001330; +D_06001628 = 0x06001628; + +// z_en_test +D_06007C28 = 0x06007C28; +D_0600316C = 0x0600316C; +D_06001978 = 0x06001978; +D_0600B00C = 0x0600B00C; +D_0600B4E4 = 0x0600B4E4; +D_0600BE4C = 0x0600BE4C; +D_0600A324 = 0x0600A324; +D_0600A99C = 0x0600A99C; +D_0600E2B0 = 0x0600E2B0; +D_060081B4 = 0x060081B4; +D_06001C20 = 0x06001C20; +D_060026D4 = 0x060026D4; +D_06000444 = 0x06000444; +D_06001420 = 0x06001420; +D_06008604 = 0x06008604; +D_06009A90 = 0x06009A90; +D_0600C438 = 0x0600C438; + +// z_en_wf +D_6003BC0 = 0x6003BC0; +D_6004638 = 0x6004638; +D_6004AD0 = 0x6004AD0; +D_6004CA4 = 0x6004CA4; +D_6005430 = 0x6005430; +D_60057A0 = 0x60057A0; +D_6009690 = 0x6009690; +D_60098C8 = 0x60098C8; +D_6009B20 = 0x6009B20; +D_600A4AC = 0x600A4AC; + +// z_obj_tsubo +D_5017870 = 0x5017870; +D_5017A60 = 0x5017A60; +D_60017C0 = 0x60017C0; +D_6001960 = 0x6001960; From c3534485d7676c82d1e99e306cadbd1cccd396bf Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 06:41:49 +0200 Subject: [PATCH 002/150] remove reverse-compatibility typedefs for curve skeletons --- include/animation.h | 7 ------- src/boot/z_std_dma.c | 4 ++-- src/code/main.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_kankyo.c | 2 +- .../extase_oot64/skelcurve_resources.py | 20 +++++++++---------- tools/assets/extract/z64_resource_handlers.py | 6 +++--- 7 files changed, 18 insertions(+), 25 deletions(-) diff --git a/include/animation.h b/include/animation.h index cd7b4794ffe..eb68fa7054f 100644 --- a/include/animation.h +++ b/include/animation.h @@ -478,11 +478,4 @@ typedef struct SkelAnimeCurve { typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); -// "reverse" compatibility typedefs -// These map Elliptic's "new" names, as used by ZAPD, -// to "old" names, as kept in this branch after dropping Elliptic's commits. -typedef TransformData CurveInterpKnot; -typedef TransformUpdateIndex CurveAnimationHeader; -typedef SkelCurveLimbList CurveSkeletonHeader; - #endif diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 4f973ae7b24..226465a3f6e 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -45,8 +45,8 @@ #include "dma.h" #include "thread.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:78" \ - "pal-1.0:76 pal-1.1:76" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:82" \ + "pal-1.0:80 pal-1.1:80" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/main.c b/src/code/main.c index e35ec69f731..9ecfdde6bf8 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -44,7 +44,7 @@ extern struct IrqMgr gIrqMgr; #include "thread.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:59 ntsc-1.1:59 ntsc-1.2:59 pal-1.0:57 pal-1.1:57" + "ique-cn:128 ntsc-1.0:62 ntsc-1.1:62 ntsc-1.2:62 pal-1.0:60 pal-1.1:60" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 416a98ef246..34059060f77 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3661,7 +3661,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:101 ntsc-1.1:101 ntsc-1.2:101 pal-1.0:101 pal-1.1:101" + "ique-cn:128 ntsc-1.0:104 ntsc-1.1:104 ntsc-1.2:104 pal-1.0:104 pal-1.1:104" s32 Camera_KeepOn4(Camera* camera) { static Vec3f sAtTarget; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index cbd6289b5bd..8244b9ca213 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:128 ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:128 pal-1.1:128" #include "libc64/qrand.h" #include "libu64/gfxprint.h" diff --git a/tools/assets/extract/extase_oot64/skelcurve_resources.py b/tools/assets/extract/extase_oot64/skelcurve_resources.py index 9f65188b15b..da8d5cde52d 100644 --- a/tools/assets/extract/extase_oot64/skelcurve_resources.py +++ b/tools/assets/extract/extase_oot64/skelcurve_resources.py @@ -50,7 +50,7 @@ def get_h_includes(self): return ("ultra64.h",) -class CurveInterpKnotArrayResource(CDataResource, can_size_be_unknown=True): +class TransformDataArrayResource(CDataResource, can_size_be_unknown=True): elem_cdata_ext = CDataExt_Struct( ( ("flags", CDataExt_Value.u16), @@ -74,7 +74,7 @@ def try_parse_data(self, memory_context: "MemoryContext"): raise ResourceParseWaiting(waiting_for=["self.length"]) def get_c_declaration_base(self): - return f"CurveInterpKnot {self.symbol_name}[]" + return f"TransformData {self.symbol_name}[]" def get_c_reference(self, resource_offset: int): if resource_offset == 0: @@ -114,7 +114,7 @@ def get_h_includes(self): return ("ultra64.h",) -class CurveAnimationHeaderResource(CDataResource): +class TransformUpdateIndexResource(CDataResource): def report_knotCounts(resource, memory_context: "MemoryContext", v): assert isinstance(v, int) address = v @@ -142,8 +142,8 @@ def report_interpolationData(resource, memory_context: "MemoryContext", v): memory_context.report_resource_at_segmented( resource, address, - CurveInterpKnotArrayResource, - lambda file, offset: CurveInterpKnotArrayResource( + TransformDataArrayResource, + lambda file, offset: TransformDataArrayResource( file, offset, f"{resource.name}_{address:08X}_InterpolationData" ), ) @@ -191,7 +191,7 @@ def write_constantData( CDataExt_Value("I") .set_report(report_interpolationData) .set_write(write_interpolationData), - ), # CurveInterpKnot* + ), # TransformData* ( "constantData", CDataExt_Value("I") @@ -213,7 +213,7 @@ def try_parse_data(self, memory_context): ) resource_interpolationData = memory_context.resolve_segmented( interpolationData - ).get_resource(CurveInterpKnotArrayResource) + ).get_resource(TransformDataArrayResource) resource_constantData = memory_context.resolve_segmented( constantData ).get_resource(ConstantDataArrayResource) @@ -248,7 +248,7 @@ def try_parse_data(self, memory_context): raise NotImplementedError def get_c_declaration_base(self): - return f"CurveAnimationHeader {self.symbol_name}" + return f"TransformUpdateIndex {self.symbol_name}" def get_c_reference(self, resource_offset: int): raise ValueError() @@ -331,7 +331,7 @@ def get_h_includes(self): return ("animation.h",) -class CurveSkeletonHeaderResource(CDataResource): +class SkelCurveLimbListResource(CDataResource): def report_limbs(resource, memory_context: "MemoryContext", v): assert isinstance(v, int) address = v @@ -369,7 +369,7 @@ def write_limbs( ) def get_c_declaration_base(self): - return f"CurveSkeletonHeader {self.symbol_name}" + return f"SkelCurveLimbList {self.symbol_name}" def get_c_reference(self, resource_offset: int): raise ValueError() diff --git a/tools/assets/extract/z64_resource_handlers.py b/tools/assets/extract/z64_resource_handlers.py index 0298c901021..ac51493f5ea 100644 --- a/tools/assets/extract/z64_resource_handlers.py +++ b/tools/assets/extract/z64_resource_handlers.py @@ -107,7 +107,7 @@ def skeleton_resource_handler( ) elif resource_desc.limb_type == z64resources.LimbType.CURVE: assert resource_desc.type == z64resources.SkeletonType.CURVE - res = skelcurve_resources.CurveSkeletonHeaderResource( + res = skelcurve_resources.SkelCurveLimbListResource( file, offset, resource_desc.symbol_name ) else: @@ -116,7 +116,7 @@ def skeleton_resource_handler( resource_desc.limb_type, ) # TODO check is this works for SkeletonSkinResource - # TODO implement for CurveSkeletonHeaderResource + # TODO implement for SkelCurveLimbListResource if resource_desc.limb_enum_name is not None: res.set_enum_name(resource_desc.limb_enum_name) if resource_desc.limb_enum_none_member_name is not None: @@ -364,7 +364,7 @@ def CurveAnimation_handler( resource_desc: z64resources.CurveAnimationResourceDesc, ): # TODO use resource_desc.skeleton - return skelcurve_resources.CurveAnimationHeaderResource( + return skelcurve_resources.TransformUpdateIndexResource( file, resource_desc.offset, resource_desc.symbol_name ) From dee72e2c87531908fcfe541e2de53f92c32537fb Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 07:19:32 +0200 Subject: [PATCH 003/150] rm z_viszbuf reference --- undefined_syms.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/undefined_syms.txt b/undefined_syms.txt index c1db4b8520e..c1a2864f3f2 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -3,7 +3,7 @@ // z_kankyo, z_demo_kankyo, z_en_viewer, z_object_kankyo, z_eff_ss_dead_dd D_01000000 = 0x01000000; -// z_viszbuf +// code_800AD920 D_0E000000 = 0x0E000000; // z_vismono From f9832f17bd5749d89c50188bdcc396b51b08fbbe Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 07:21:29 +0200 Subject: [PATCH 004/150] format --- include/ultra64/leo.h | 10 +++++----- include/ultra64/leoappli.h | 6 +++--- .../actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 3 ++- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 14 ++++++++++---- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/include/ultra64/leo.h b/include/ultra64/leo.h index 09055ea84d1..7e28ccf45b6 100644 --- a/include/ultra64/leo.h +++ b/include/ultra64/leo.h @@ -1,7 +1,7 @@ /*---------------------------------------------------------------------* Copyright (C) 1998 Nintendo. - + $RCSfile: leo.h,v $ $Revision: 1.29 $ $Date: 1998/12/21 07:30:15 $ @@ -106,7 +106,7 @@ typedef struct u8 sleep_time; u32 reserve3; } modeselect; - + } data; } LEOCmd; @@ -178,7 +178,7 @@ typedef struct #define LEO_ERROR_NO_SEEK_COMPLETE 21 #define LEO_ERROR_WRITE_FAULT 22 #define LEO_ERROR_UNRECOVERED_READ_ERROR 23 -#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24 +#define LEO_ERROR_NO_REFERENCE_POSITION_FOUND 24 #define LEO_ERROR_TRACK_FOLLOWING_ERROR 25 #define LEO_ERROR_TRACKING_OR_SPDL_SERVO_FAILURE 25 #define LEO_ERROR_INVALID_COMMAND_OPERATION_CODE 31 @@ -244,8 +244,8 @@ extern u32 LeoDriveExist(void); /* Synchronous functions */ extern s32 LeoClearQueue(void); -extern s32 LeoByteToLBA(s32 startLBA, u32 nbytes, s32 *lbas); -extern s32 LeoLBAToByte(s32 startLBA, u32 nLBAs, s32 *bytes); +extern s32 LeoByteToLBA(s32 startlba, u32 nbytes, s32* lba); +extern s32 LeoLBAToByte(s32 startlba, u32 nlbas, s32* bytes); extern s32 LeoReadCapacity(LEOCapacity *cap, s32 dir); extern s32 LeoInquiry(LEOVersion *ver); extern s32 LeoTestUnitReady(LEOStatus *status); diff --git a/include/ultra64/leoappli.h b/include/ultra64/leoappli.h index 619fbc08395..31ae29d58ee 100644 --- a/include/ultra64/leoappli.h +++ b/include/ultra64/leoappli.h @@ -40,8 +40,8 @@ /*-----------------------------------*/ /* LEO FUNCTION DEFINITIONS */ /*-----------------------------------*/ -extern void leoInitialize(OSPri PRI_WRK, OSPri PRI_INT, OSMesg *command_que_buf, u32 cmd_buff_size); -extern void leoCommand(void *CDB); +extern void leoInitialize(OSPri compri, OSPri intpri, OSMesg* command_que_buf, u32 cmd_buff_size); +extern void leoCommand(void* cmd_blk_addr); extern void LeoReset(void); extern s32 LeoResetClear(void); @@ -107,7 +107,7 @@ extern s32 LeoResetClear(void); #define LEO_SENSE_NO_SEEK_COMPLETE 21 #define LEO_SENSE_WRITE_FAULT 22 #define LEO_SENSE_UNRECOVERED_READ_ERROR 23 -#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24 +#define LEO_SENSE_NO_REFERENCE_POSITION_FOUND 24 #define LEO_SENSE_TRACK_FOLLOWING_ERROR 25 #define LEO_SENSE_TRACKING_OR_SPDL_SERVO_FAILURE 25 #define LEO_SENSE_INVALID_COMMAND_OPERATION_CODE 31 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 e666fc9e7ce..20ad98728c1 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,8 @@ void BgJya1flift_InitCollision(Actor* thisx, PlayState* play) { void BgJya1flift_Init(Actor* thisx, PlayState* play) { BgJya1flift* this = (BgJya1flift*)thisx; - PRINTF(T("(1Fリフト)(flag %d)(room %d)\n", "(1F lift)(flag %d)(room %d)\n"), sHasSpawned, play->roomCtx.curRoom.num); + PRINTF(T("(1Fリフト)(flag %d)(room %d)\n", "(1F lift)(flag %d)(room %d)\n"), sHasSpawned, + play->roomCtx.curRoom.num); this->hasInitialized = false; if (sHasSpawned) { Actor_Kill(thisx); 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 3d0803a0a2f..b65a5494d57 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -557,11 +557,17 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxp) { // For iQue, the word "PRESS" is drawn below as a Chinese character instead (gTitlePressCHN) static u8 pressStartFontIndices[] = { #if !PLATFORM_IQUE - FILENAME_UPPERCASE('P'), FILENAME_UPPERCASE('R'), FILENAME_UPPERCASE('E'), - FILENAME_UPPERCASE('S'), FILENAME_UPPERCASE('S'), + FILENAME_UPPERCASE('P'), + FILENAME_UPPERCASE('R'), + FILENAME_UPPERCASE('E'), + FILENAME_UPPERCASE('S'), + FILENAME_UPPERCASE('S'), #endif - FILENAME_UPPERCASE('S'), FILENAME_UPPERCASE('T'), FILENAME_UPPERCASE('A'), - FILENAME_UPPERCASE('R'), FILENAME_UPPERCASE('T'), + FILENAME_UPPERCASE('S'), + FILENAME_UPPERCASE('T'), + FILENAME_UPPERCASE('A'), + FILENAME_UPPERCASE('R'), + FILENAME_UPPERCASE('T'), }; static void* effectMaskTextures[] = { gTitleEffectMask00Tex, gTitleEffectMask01Tex, gTitleEffectMask02Tex, diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 4ea90846f38..9b153cf793a 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -110,10 +110,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) -#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) +#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; From 176c609583ccc0780c29d5dad260692b302850fb Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:19:22 +0200 Subject: [PATCH 005/150] z_demo_effect undef syms cleanup --- assets/xml/objects/object_efc_tw.xml | 7 ++++--- .../actors/ovl_Demo_Effect/z_demo_effect.c | 15 ++++++--------- undefined_syms.txt | 4 ---- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/assets/xml/objects/object_efc_tw.xml b/assets/xml/objects/object_efc_tw.xml index faa39d1299d..f8f0d06d4e8 100644 --- a/assets/xml/objects/object_efc_tw.xml +++ b/assets/xml/objects/object_efc_tw.xml @@ -1,12 +1,13 @@ + - - - + + + 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 ebf4e1d1d7d..23ceb626541 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -87,9 +87,6 @@ void DemoEffect_SetStartPosFromCue(DemoEffect* this, PlayState* play, s32 cueCha void DemoEffect_SetPosRotFromCue(DemoEffect* this, PlayState* play, s32 cueChannel, s32 shouldUpdateFacing); void DemoEffect_MoveTowardCuePos(DemoEffect* this, PlayState* play, s32 cueChannel, f32 speed); -extern TransformUpdateIndex D_06000050; // timewarpTransformUpdateIndex -extern SkelCurveLimbList D_060012E8; // timewarpLimbList - ActorProfile Demo_Effect_Profile = { /**/ ACTOR_DEMO_EFFECT, /**/ ACTORCAT_BG, @@ -691,12 +688,12 @@ void DemoEffect_UpdateGetItem(DemoEffect* this, PlayState* play) { void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { s32 effectType = PARAMS_GET_S(this->actor.params, 0, 8); - if (!SkelCurve_Init(play, &this->skelCurve, &D_060012E8, &D_06000050)) { + if (!SkelCurve_Init(play, &this->skelCurve, &object_efc_tw_0012E8_Skel, &object_efc_tw_000050_Anim)) { ASSERT(0, "0", "../z_demo_effect.c", 1283); } if (effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE || effectType == DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL) { - SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 59.0f, 1.0f, 1.7f); + SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_000050_Anim, 1.0f, 59.0f, 1.0f, 1.7f); SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_InitTimeWarpTimeblock; @@ -707,12 +704,12 @@ void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play) { } } else if (gSaveContext.sceneLayer == 5 || gSaveContext.sceneLayer == 4 || (gSaveContext.save.entranceIndex == ENTR_TEMPLE_OF_TIME_4 && !GET_EVENTCHKINF(EVENTCHKINF_C9))) { - SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 59.0f, 59.0f, 0.0f); + SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_000050_Anim, 1.0f, 59.0f, 59.0f, 0.0f); SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpReturnFromChamberOfSages; PRINTF(VT_FGCOL(CYAN) T(" 縮むバージョン \n", " Shrinking version \n") VT_RST); } else { - SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 59.0f, 1.0f, 1.0f); + SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_000050_Anim, 1.0f, 59.0f, 1.0f, 1.0f); SkelCurve_Update(play, &this->skelCurve); this->updateFunc = DemoEffect_UpdateTimeWarpPullMasterSword; PRINTF(VT_FGCOL(CYAN) T(" 通常 バージョン \n", " Normal version \n") VT_RST); @@ -731,7 +728,7 @@ void DemoEffect_UpdateTimeWarpPullMasterSword(DemoEffect* this, PlayState* play) } if (SkelCurve_Update(play, &this->skelCurve)) { - SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 60.0f, 59.0f, 0.0f); + SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_000050_Anim, 1.0f, 60.0f, 59.0f, 0.0f); } } } @@ -824,7 +821,7 @@ void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play) { Actor_PlaySfx_FlaggedCentered2(&this->actor, NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); if (SkelCurve_Update(play, &this->skelCurve)) { - SkelCurve_SetAnim(&this->skelCurve, &D_06000050, 1.0f, 60.0f, 59.0f, 0.0f); + SkelCurve_SetAnim(&this->skelCurve, &object_efc_tw_000050_Anim, 1.0f, 60.0f, 59.0f, 0.0f); this->updateFunc = DemoEffect_UpdateTimeWarpTimeblock; this->timeWarp.shrinkTimer = 0; } diff --git a/undefined_syms.txt b/undefined_syms.txt index c1a2864f3f2..075f415c04d 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -12,10 +12,6 @@ D_0F000000 = 0x0F000000; // z_bg_mjin D_06000000 = 0x06000000; -// z_demo_effect -D_06000050 = 0x06000050; -D_060012E8 = 0x060012E8; - // z_en_ge3 D_600A458 = 0x600A458; D_600B07C = 0x600B07C; From 314be9c29647486b0f10db1f3a0ab3924fe24289 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:23:55 +0200 Subject: [PATCH 006/150] z_en_ge3 undef syms cleanup --- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 9 +++------ undefined_syms.txt | 4 ---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 22a40dd7ca2..50d590ad802 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -30,9 +30,6 @@ void func_80A34A80(EnGe3* this, PlayState* play); void func_80A34B90(EnGe3* this, PlayState* play); void func_80A34D68(Actor* thisx, PlayState* play); -extern FlexSkeletonHeader D_600A458; -extern AnimationHeader D_600B07C; - ActorProfile En_Ge3_Profile = { /**/ ACTOR_EN_GE3, /**/ ACTORCAT_NPC, @@ -66,7 +63,7 @@ static ColliderCylinderInit D_80A35190 = { }; static void (*D_80A351BC[1])(EnGe3*, PlayState*) = { func_80A34A80 }; -static AnimationHeader* D_80A351C0[1] = { &D_600B07C }; +static AnimationHeader* D_80A351C0[1] = { &gGerudoRedStandAnim }; static u8 D_80A351C4[1] = { ANIMMODE_LOOP }; static Vec3f D_80A351C8 = { 600.0f, 700.0f, 0.0f }; static s32 D_80A351D4[3] = { 0x06005FE8, 0x060065A8, 0x06006D28 }; @@ -83,8 +80,8 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->unk198, &D_600A458, NULL, this->unk1DC, this->unk26C, 24); - Animation_PlayLoop(&this->unk198, &D_600B07C); + SkelAnime_InitFlex(play, &this->unk198, &gGerudoRedSkel, NULL, this->unk1DC, this->unk26C, 24); + Animation_PlayLoop(&this->unk198, &gGerudoRedStandAnim); Collider_InitCylinder(play, &this->unk14C); Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A35190); this->actor.colChkInfo.mass = MASS_IMMOVABLE; diff --git a/undefined_syms.txt b/undefined_syms.txt index 075f415c04d..e9d77971812 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -12,10 +12,6 @@ D_0F000000 = 0x0F000000; // z_bg_mjin D_06000000 = 0x06000000; -// z_en_ge3 -D_600A458 = 0x600A458; -D_600B07C = 0x600B07C; - // z_en_karebaba D_06002A40 = 0x06002A40; D_060002B8 = 0x060002B8; From ed02b2c5bbc5ba0d37351c7d69667ad1099af9fe Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:27:40 +0200 Subject: [PATCH 007/150] z_obj_tsubo undef syms cleanup --- src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 10 +++------- undefined_syms.txt | 6 ------ 2 files changed, 3 insertions(+), 13 deletions(-) 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 8e2f18f4dff..aeeecdf229a 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -18,6 +18,7 @@ #include "play_state.h" #include "player.h" +#include "assets/objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "assets/objects/object_tsubo/object_tsubo.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_THROW_ONLY) @@ -36,11 +37,6 @@ void func_80BA188C(ObjTsubo* this); void func_80BA1958(ObjTsubo* this, PlayState* play); void func_80BA1B0C(Actor* thisx, PlayState* play); -extern Gfx D_5017870[]; -extern Gfx D_5017A60[]; -extern Gfx D_60017C0[]; -extern Gfx D_6001960[]; - static s16 D_80BA1B50 = 0; static s16 D_80BA1B54 = 0; static s16 D_80BA1B58 = 0; @@ -59,8 +55,8 @@ ActorProfile Obj_Tsubo_Profile = { }; static s16 D_80BA1B80[2] = { OBJECT_GAMEPLAY_DANGEON_KEEP, OBJECT_TSUBO }; -static Gfx* D_80BA1B84[2] = { D_5017870, object_tsubo_DL_0017C0 }; -static Gfx* D_80BA1B8C[2] = { D_5017A60, object_tsubo_DL_001960 }; +static Gfx* D_80BA1B84[2] = { gPotDL, object_tsubo_DL_0017C0 }; +static Gfx* D_80BA1B8C[2] = { gPotFragmentDL, object_tsubo_DL_001960 }; static ColliderCylinderInit D_80BA1B94 = { { diff --git a/undefined_syms.txt b/undefined_syms.txt index e9d77971812..cce2ed6856a 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -51,9 +51,3 @@ D_6009690 = 0x6009690; D_60098C8 = 0x60098C8; D_6009B20 = 0x6009B20; D_600A4AC = 0x600A4AC; - -// z_obj_tsubo -D_5017870 = 0x5017870; -D_5017A60 = 0x5017A60; -D_60017C0 = 0x60017C0; -D_6001960 = 0x6001960; From a2464d00d8633f2f2104b0025e467aaf6a338b19 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:34:23 +0200 Subject: [PATCH 008/150] z_en_test undef syms cleanup --- src/overlays/actors/ovl_En_Test/z_en_test.c | 87 +++++++++------------ undefined_syms.txt | 19 ----- 2 files changed, 36 insertions(+), 70 deletions(-) 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 74e711380fc..3b759f6cabc 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -76,24 +76,6 @@ void func_80862FA8(EnTest* this, PlayState* play); s32 EnTest_ReactToProjectile(PlayState* play, EnTest* this); -extern SkeletonHeader D_06007C28; -extern AnimationHeader D_0600316C; // ready stance -extern AnimationHeader D_06001978; // jump back -extern AnimationHeader D_0600B00C; // slash 1 -extern AnimationHeader D_0600B4E4; // slash 1 end -extern AnimationHeader D_0600BE4C; // slash 2 -extern AnimationHeader D_0600A324; // jumpslash start -extern AnimationHeader D_0600A99C; // jumpslash -extern AnimationHeader D_0600E2B0; // sidestep -extern AnimationHeader D_060081B4; // walk forward? -extern AnimationHeader D_06001C20; // block -extern AnimationHeader D_060026D4; //? -extern AnimationHeader D_06000444; -extern AnimationHeader D_06001420; -extern AnimationHeader D_06008604; -extern AnimationHeader D_06009A90; -extern AnimationHeader D_0600C438; - static u8 sUpperBodyLimbCopyMap[] = { false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, @@ -235,9 +217,10 @@ void EnTest_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_Init(play, &this->skelAnime, &D_06007C28, &D_0600316C, this->jointTable, this->morphTable, 61); - SkelAnime_Init(play, &this->upperSkelanime, &D_06007C28, &D_0600316C, this->upperJointTable, this->upperMorphTable, + SkelAnime_Init(play, &this->skelAnime, &gStalfosSkel, &gStalfosFightingWaitAnim, this->jointTable, this->morphTable, 61); + SkelAnime_Init(play, &this->upperSkelanime, &gStalfosSkel, &gStalfosFightingWaitAnim, this->upperJointTable, + this->upperMorphTable, 61); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); @@ -399,7 +382,7 @@ void EnTest_ChooseAction(EnTest* this, PlayState* play) { } void EnTest_SetupWaitGround(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &D_0600316C); + Animation_PlayLoop(&this->skelAnime, &gStalfosFightingWaitAnim); this->unk_7C8 = 0; this->timer = 15; this->actor.scale.y = 0.0f; @@ -430,7 +413,7 @@ void EnTest_WaitGround(EnTest* this, PlayState* play) { } void EnTest_SetupWaitAbove(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &D_0600316C); + Animation_PlayLoop(&this->skelAnime, &gStalfosFightingWaitAnim); this->unk_7C8 = 0; this->actor.world.pos.y = this->actor.home.pos.y + 150.0f; Actor_SetScale(&this->actor, 0.0f); @@ -451,7 +434,7 @@ void EnTest_WaitAbove(EnTest* this, PlayState* play) { } void EnTest_SetupIdle(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &D_0600316C); + Animation_PlayLoop(&this->skelAnime, &gStalfosFightingWaitAnim); this->unk_7C8 = 0xA; this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; @@ -511,7 +494,7 @@ void EnTest_Idle(EnTest* this, PlayState* play) { } void EnTest_Fall(EnTest* this, PlayState* play) { - Animation_PlayOnceSetSpeed(&this->skelAnime, &D_0600C438, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalfosLandingAnim, 0.0f); SkelAnime_Update(&this->skelAnime); if (this->actor.world.pos.y <= this->actor.floorHeight) { @@ -531,8 +514,9 @@ void EnTest_Land(EnTest* this, PlayState* play) { } void EnTest_SetupWalkAndBlock(EnTest* this) { - Animation_Change(&this->upperSkelanime, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2, 2.0f); - Animation_PlayLoop(&this->skelAnime, &D_060081B4); + Animation_Change(&this->upperSkelanime, &gStalfosDefendAnim, 2.0f, 0.0f, + Animation_GetLastFrame(&gStalfosDefendAnim), 2, 2.0f); + Animation_PlayLoop(&this->skelAnime, &gStalfosFightingWalkAnim); this->timer = (s16)(Rand_ZeroOne() * 5.0f); this->unk_7C8 = 0xD; this->actor.world.rot.y = this->actor.shape.rot.y; @@ -576,12 +560,12 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { if (ABS(this->actor.speed) < 3.0f) { s32 pad; - Animation_Change(&this->skelAnime, &D_060081B4, 0.0f, this->skelAnime.curFrame, - Animation_GetLastFrame(&D_060081B4), 0, -6.0f); + Animation_Change(&this->skelAnime, &gStalfosFightingWalkAnim, 0.0f, this->skelAnime.curFrame, + Animation_GetLastFrame(&gStalfosFightingWalkAnim), 0, -6.0f); playSpeed = this->actor.speed * 10.0f; } else { - Animation_Change(&this->skelAnime, &D_060026D4, 0.0f, this->skelAnime.curFrame, - Animation_GetLastFrame(&D_060026D4), 0, -4.0f); + Animation_Change(&this->skelAnime, &gStalfosFightingRunAnim, 0.0f, this->skelAnime.curFrame, + Animation_GetLastFrame(&gStalfosFightingRunAnim), 0, -4.0f); playSpeed = this->actor.speed * 10.0f * 0.02f; } @@ -685,7 +669,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { // a variation of sidestep void func_80860BDC(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &D_0600E2B0); + Animation_PlayLoop(&this->skelAnime, &gStalfosSideWalkAnim); this->unk_7C8 = 0xE; EnTest_SetupAction(this, func_80860C24); } @@ -757,7 +741,7 @@ void func_80860C24(EnTest* this, PlayState* play) { // a variation of sidestep void func_80860EC0(EnTest* this) { - Animation_PlayLoop(&this->skelAnime, &D_0600E2B0); + Animation_PlayLoop(&this->skelAnime, &gStalfosSideWalkAnim); this->unk_7C8 = 0xF; this->actor.speed = (Rand_ZeroOne() > 0.5f) ? -0.5f : 0.5f; this->timer = (s16)((Rand_ZeroOne() * 15.0f) + 25.0f); @@ -873,7 +857,7 @@ void func_80860F84(EnTest* this, PlayState* play) { } void EnTest_SetupSlashDown(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_0600B00C); + Animation_PlayOnce(&this->skelAnime, &gStalfosKiruAnim); Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU); this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->unk_7C8 = 0x10; @@ -913,7 +897,7 @@ void EnTest_SlashDown(EnTest* this, PlayState* play) { } void EnTest_SetupSlashDownEnd(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_0600B4E4); + Animation_PlayOnce(&this->skelAnime, &gStalfosKiruEndAnim); this->unk_7C8 = 0x12; this->actor.speed = 0.0f; EnTest_SetupAction(this, EnTest_SlashDownEnd); @@ -973,7 +957,7 @@ void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { } void EnTest_SetupSlashUp(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_0600BE4C); + Animation_PlayOnce(&this->skelAnime, &gStalfosKiruFinshAnim); this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->unk_7C8 = 0x11; this->swordCollider.elem.atDmgInfo.damage = 16; @@ -1004,7 +988,7 @@ void EnTest_SlashUp(EnTest* this, PlayState* play) { } void EnTest_SetupJumpBack(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_06001978); + Animation_PlayOnce(&this->skelAnime, &gStalfosBackJumpAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); this->unk_7C8 = 0x14; this->timer = 5; @@ -1055,7 +1039,7 @@ void EnTest_JumpBack(EnTest* this, PlayState* play) { } void EnTest_SetupJumpslash(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_0600A324); + Animation_PlayOnce(&this->skelAnime, &gStalfosJumpKiruAnim); Audio_StopSfxByPosAndId(&this->actor.projectedPos, NA_SE_EN_STAL_WARAU); this->timer = 0; this->unk_7C8 = 0x17; @@ -1075,7 +1059,7 @@ void EnTest_SetupJumpslash(EnTest* this) { void EnTest_Jumpslash(EnTest* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->timer == 0) { - Animation_PlayOnce(&this->skelAnime, &D_0600A99C); + Animation_PlayOnce(&this->skelAnime, &gStalfosJumpKiruEndAnim); this->timer = 1; this->swordState = 1; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_SAKEBI); @@ -1102,7 +1086,7 @@ void EnTest_Jumpslash(EnTest* this, PlayState* play) { } void EnTest_SetupJumpUp(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_0600A324); + Animation_PlayOnce(&this->skelAnime, &gStalfosJumpKiruAnim); this->timer = 0; this->unk_7C8 = 4; this->actor.velocity.y = 14.0f; @@ -1130,13 +1114,14 @@ void EnTest_JumpUp(EnTest* this, PlayState* play) { this->actor.speed = 0.0f; this->unk_7C8 = 0xC; this->timer = 4; - Animation_Change(&this->skelAnime, &D_0600C438, 0.0f, 0.0f, 0.0f, 2, 0.0f); + Animation_Change(&this->skelAnime, &gStalfosLandingAnim, 0.0f, 0.0f, 0.0f, 2, 0.0f); EnTest_SetupAction(this, EnTest_Land); } } void EnTest_SetupStopAndBlock(EnTest* this) { - Animation_Change(&this->skelAnime, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2, 2.0f); + Animation_Change(&this->skelAnime, &gStalfosDefendAnim, 2.0f, 0.0f, Animation_GetLastFrame(&gStalfosDefendAnim), 2, + 2.0f); this->unk_7C8 = 0x15; this->actor.speed = 0.0f; this->timer = (Rand_ZeroOne() * 10.0f) + 11.0f; @@ -1163,7 +1148,7 @@ void EnTest_StopAndBlock(EnTest* this, PlayState* play) { } void EnTest_SetupIdleFromBlock(EnTest* this) { - Animation_MorphToLoop(&this->skelAnime, &D_0600316C, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gStalfosFightingWaitAnim, -4.0f); this->unk_7C8 = 0x16; EnTest_SetupAction(this, EnTest_IdleFromBlock); } @@ -1187,7 +1172,7 @@ void EnTest_IdleFromBlock(EnTest* this, PlayState* play) { } void func_80862154(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_06008604); + Animation_PlayOnce(&this->skelAnime, &gStalfosFrontDamageAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DAMAGE); this->unk_7C8 = 8; this->actor.speed = -2.0f; @@ -1231,7 +1216,7 @@ void func_808621D4(EnTest* this, PlayState* play) { } void func_80862398(EnTest* this) { - Animation_PlayOnce(&this->skelAnime, &D_06000444); + Animation_PlayOnce(&this->skelAnime, &gStalfosBackDamageAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DAMAGE); this->unk_7C8 = 9; this->actor.speed = -2.0f; @@ -1285,7 +1270,7 @@ void EnTest_SetupStunned(EnTest* this) { if (this->lastDamageReaction == STALFOS_DMG_REACT_FREEZE) { this->iceTimer = 36; } else { - Animation_PlayOnceSetSpeed(&this->skelAnime, &D_06008604, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalfosFrontDamageAnim, 0.0f); } } @@ -1329,7 +1314,7 @@ void func_808627C4(EnTest* this, PlayState* play) { return; } - Animation_MorphToLoop(&this->skelAnime, &D_0600E2B0, -2.0f); + Animation_MorphToLoop(&this->skelAnime, &gStalfosSideWalkAnim, -2.0f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); this->actor.speed = ((play->gameplayFrames % 2) != 0) ? -4.0f : 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; @@ -1515,7 +1500,7 @@ void func_80862E6C(EnTest* this, PlayState* play) { } void func_80862FA8(EnTest* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &D_06001420); + Animation_PlayOnce(&this->skelAnime, &gStalfosBackDownAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7DE = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; @@ -1544,7 +1529,7 @@ void func_80863044(EnTest* this, PlayState* play) { } void func_808630F0(EnTest* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &D_06009A90); + Animation_PlayOnce(&this->skelAnime, &gStalfosFrontDownAnim); Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_DEAD); this->unk_7C8 = 6; this->actor.colorFilterTimer = 0; @@ -1722,8 +1707,8 @@ void EnTest_Update(Actor* thisx, PlayState* play) { break; case 1: - Animation_Change(&this->upperSkelanime, &D_06001C20, 2.0f, 0.0f, Animation_GetLastFrame(&D_06001C20), 2, - 2.0f); + Animation_Change(&this->upperSkelanime, &gStalfosDefendAnim, 2.0f, 0.0f, + Animation_GetLastFrame(&gStalfosDefendAnim), 2, 2.0f); AnimTaskQueue_AddCopyUsingMap(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->upperSkelanime.jointTable, sUpperBodyLimbCopyMap); this->unk_7DE++; @@ -1957,7 +1942,7 @@ void EnTest_Draw(Actor* thisx, PlayState* play) { // a variation of sidestep void func_80864158(EnTest* this, f32 xzSpeed) { - Animation_MorphToLoop(&this->skelAnime, &D_0600E2B0, -2.0f); + Animation_MorphToLoop(&this->skelAnime, &gStalfosSideWalkAnim, -2.0f); this->actor.speed = xzSpeed; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; this->timer = (Rand_ZeroOne() * 20.0f) + 15.0f; diff --git a/undefined_syms.txt b/undefined_syms.txt index cce2ed6856a..28a86a1f021 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -21,25 +21,6 @@ D_06001828 = 0x06001828; D_06001330 = 0x06001330; D_06001628 = 0x06001628; -// z_en_test -D_06007C28 = 0x06007C28; -D_0600316C = 0x0600316C; -D_06001978 = 0x06001978; -D_0600B00C = 0x0600B00C; -D_0600B4E4 = 0x0600B4E4; -D_0600BE4C = 0x0600BE4C; -D_0600A324 = 0x0600A324; -D_0600A99C = 0x0600A99C; -D_0600E2B0 = 0x0600E2B0; -D_060081B4 = 0x060081B4; -D_06001C20 = 0x06001C20; -D_060026D4 = 0x060026D4; -D_06000444 = 0x06000444; -D_06001420 = 0x06001420; -D_06008604 = 0x06008604; -D_06009A90 = 0x06009A90; -D_0600C438 = 0x0600C438; - // z_en_wf D_6003BC0 = 0x6003BC0; D_6004638 = 0x6004638; From e6dbfff6ecb26cd37e8d8e9dc6d53160844a4985 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:39:15 +0200 Subject: [PATCH 009/150] z_en_karebaba undef syms cleanup --- assets/xml/objects/object_dekubaba.xml | 10 +++---- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 30 ++++++++----------- undefined_syms.txt | 9 ------ 3 files changed, 17 insertions(+), 32 deletions(-) diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml index f1e914a526d..4f93fb60ba2 100644 --- a/assets/xml/objects/object_dekubaba.xml +++ b/assets/xml/objects/object_dekubaba.xml @@ -13,19 +13,19 @@ - + - + - + - + @@ -42,7 +42,7 @@ - + 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 8450b141d54..bb8b5be2ae7 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -19,6 +19,7 @@ #include "save.h" #include "assets/objects/gameplay_keep/shadow_circle.h" +#include "assets/objects/object_dekubaba/object_dekubaba.h" #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE) @@ -100,20 +101,13 @@ static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_WITHERED_DEKU_BABA, ICHAIN_STOP), }; -extern SkeletonHeader D_06002A40; -extern AnimationHeader D_060002B8; -extern Gfx D_06003070[]; // deku stick drop -extern Gfx D_060010F0[]; // leaf base -extern Gfx D_06001828[]; // upper third of stem -extern Gfx D_06001330[]; // mid third of stem -extern Gfx D_06001628[]; // lower third of stem - void EnKarebaba_Init(Actor* thisx, PlayState* play) { EnKarebaba* this = (EnKarebaba*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &D_06002A40, &D_060002B8, this->jointTable, this->morphTable, 8); + SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, + this->morphTable, 8); Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); Collider_UpdateCylinder(&this->actor, &this->bodyCollider); @@ -162,8 +156,8 @@ void EnKarebaba_SetupIdle(EnKarebaba* this) { } void EnKarebaba_SetupAwaken(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &D_060002B8, 4.0f, 0.0f, Animation_GetLastFrame(&D_060002B8), ANIMMODE_LOOP, - -3.0f); + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_DUMMY482); this->actionFunc = EnKarebaba_Awaken; } @@ -214,14 +208,14 @@ void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, PlayState* play) { } void EnKarebaba_SetupRetract(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &D_060002B8, -3.0f, Animation_GetLastFrame(&D_060002B8), 0.0f, ANIMMODE_ONCE, - -3.0f); + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -3.0f, + Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); EnKarebaba_ResetCollider(this); this->actionFunc = EnKarebaba_Retract; } void EnKarebaba_SetupDead(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &D_060002B8, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); EnKarebaba_ResetCollider(this); this->actor.shape.rot.x = -0x4000; this->actor.params = 200; @@ -476,7 +470,7 @@ void EnKarebaba_DrawCenterShadow(EnKarebaba* this, PlayState* play) { void EnKarebaba_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 black = { 0, 0, 0, 0 }; - static Gfx* dLists[] = { D_06001330, D_06001628, D_06001828 }; + static Gfx* dLists[] = { object_dekubaba_DL_001330, object_dekubaba_DL_001628, object_dekubaba_DL_001828 }; static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnKarebaba* this = (EnKarebaba*)thisx; s32 i; @@ -491,7 +485,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { if (this->actor.params > 40 || PARAMS_GET_U(this->actor.params, 0, 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1066); - gSPDisplayList(POLY_OPA_DISP++, D_06003070); + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_003070); } } else if (this->actionFunc != EnKarebaba_Dead) { func_80026230(play, &black, 1, 2); @@ -536,12 +530,12 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->actor.home.rot.y), MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1144); - gSPDisplayList(POLY_OPA_DISP++, D_060010F0); + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_0010F0); if (this->actionFunc == EnKarebaba_Dying) { Matrix_RotateZYX(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1155); - gSPDisplayList(POLY_OPA_DISP++, D_06001828); + gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); } func_80026608(play); diff --git a/undefined_syms.txt b/undefined_syms.txt index 28a86a1f021..b8b9002508e 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -12,15 +12,6 @@ D_0F000000 = 0x0F000000; // z_bg_mjin D_06000000 = 0x06000000; -// z_en_karebaba -D_06002A40 = 0x06002A40; -D_060002B8 = 0x060002B8; -D_06003070 = 0x06003070; -D_060010F0 = 0x060010F0; -D_06001828 = 0x06001828; -D_06001330 = 0x06001330; -D_06001628 = 0x06001628; - // z_en_wf D_6003BC0 = 0x6003BC0; D_6004638 = 0x6004638; From b3f8adafe6cbe05770704c113b93319675ebfb95 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:42:47 +0200 Subject: [PATCH 010/150] z_en_wf undef syms cleanup --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 58 +++++++++++-------------- undefined_syms.txt | 12 ----- 2 files changed, 26 insertions(+), 44 deletions(-) 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 35f99b7b877..46208345ca2 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -24,6 +24,8 @@ #include "play_state.h" #include "player.h" +#include "assets/objects/object_wf/object_wf.h" + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED) void EnWf_Init(Actor* thisx, PlayState* play); @@ -58,17 +60,6 @@ void func_80B36C8C(EnWf* this); void func_80B36D3C(EnWf* this, PlayState* play); s32 func_80B37830(PlayState* play, EnWf* this); -extern FlexSkeletonHeader D_6003BC0; -extern AnimationHeader D_6004638; -extern AnimationHeader D_6004AD0; -extern AnimationHeader D_6004CA4; -extern AnimationHeader D_6005430; -extern AnimationHeader D_60057A0; -extern FlexSkeletonHeader D_6009690; -extern AnimationHeader D_60098C8; -extern AnimationHeader D_6009B20; -extern AnimationHeader D_600A4AC; - static ColliderJntSphElementInit D_80B37990[4] = { { { @@ -225,11 +216,13 @@ void EnWf_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->unk470); Collider_SetCylinder(play, &this->unk470, &this->actor, &D_80B37A5C); if (this->actor.params == 0) { - SkelAnime_InitFlex(play, &this->unk188, &D_6009690, &D_600A4AC, this->unk1CC, this->unk250, 22); + SkelAnime_InitFlex(play, &this->unk188, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->unk1CC, + this->unk250, 22); Actor_SetScale(&this->actor, 0.0075f); this->actor.naviEnemyId = NAVI_ENEMY_WOLFOS; } else { - SkelAnime_InitFlex(play, &this->unk188, &D_6003BC0, &D_600A4AC, this->unk1CC, this->unk250, 22); + SkelAnime_InitFlex(play, &this->unk188, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->unk1CC, + this->unk250, 22); Actor_SetScale(&this->actor, 0.01f); this->unk304.elements[0].base.atDmgInfo.damage = this->unk304.elements[1].base.atDmgInfo.damage = 8; this->actor.naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; @@ -364,7 +357,7 @@ s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { } void func_80B34380(EnWf* this) { - Animation_Change(&this->unk188, &D_6005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); + Animation_Change(&this->unk188, &object_wf_Anim_005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; this->unk2E8 = 0x14; this->unk300 = 0; @@ -402,7 +395,7 @@ void func_80B34428(EnWf* this, PlayState* play) { } void func_80B3455C(EnWf* this) { - Animation_MorphToLoop(&this->unk188, &D_600A4AC, -4.0f); + Animation_MorphToLoop(&this->unk188, &object_wf_Anim_00A4AC, -4.0f); this->unk2D4 = 6; this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 2.0f; this->actor.speed = 0.0f; @@ -468,8 +461,8 @@ void func_80B345E4(EnWf* this, PlayState* play) { } void func_80B347FC(EnWf* this, PlayState* play) { - Animation_Change(&this->unk188, &D_60057A0, 1.0f, 0.0f, Animation_GetLastFrame(&D_60057A0), ANIMMODE_LOOP_INTERP, - -4.0f); + Animation_Change(&this->unk188, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), + ANIMMODE_LOOP_INTERP, -4.0f); this->unk2D4 = 9; func_80B33CB0(this, func_80B3487C); } @@ -553,7 +546,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { } void func_80B34CFC(EnWf* this) { - Animation_MorphToLoop(&this->unk188, &D_60098C8, -4.0f); + Animation_MorphToLoop(&this->unk188, &object_wf_Anim_0098C8, -4.0f); this->unk2D4 = 0xA; func_80B33CB0(this, func_80B34D48); } @@ -599,8 +592,8 @@ void func_80B34D48(EnWf* this, PlayState* play) { } void func_80B34F28(EnWf* this) { - Animation_Change(&this->unk188, &D_60057A0, 1.0f, 0.0f, Animation_GetLastFrame(&D_60057A0), ANIMMODE_LOOP_INTERP, - -4.0f); + Animation_Change(&this->unk188, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), + ANIMMODE_LOOP_INTERP, -4.0f); if (Rand_ZeroOne() > 0.5f) { this->unk2FE = 0x3E80; } else { @@ -691,7 +684,7 @@ void func_80B35024(EnWf* this, PlayState* play) { } void func_80B35540(EnWf* this) { - Animation_PlayOnce(&this->unk188, &D_6004638); + Animation_PlayOnce(&this->unk188, &object_wf_Anim_004638); this->unk304.base.atFlags &= ~4; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->unk2D4 = 8; @@ -767,8 +760,8 @@ void func_80B3590C(EnWf* this) { if ((s32)this->unk188.curFrame >= 16) { var_fv0 = 15.0f; } - Animation_Change(&this->unk188, &D_6004638, -0.5f, this->unk188.curFrame - 1.0f, var_fv0, ANIMMODE_ONCE_INTERP, - 0.0f); + Animation_Change(&this->unk188, &object_wf_Anim_004638, -0.5f, this->unk188.curFrame - 1.0f, var_fv0, + ANIMMODE_ONCE_INTERP, 0.0f); this->unk2D4 = 0xC; this->unk2F8 = 0; func_80B33CB0(this, func_80B359A8); @@ -816,7 +809,7 @@ void func_80B359A8(EnWf* this, PlayState* play) { } void func_80B35B94(EnWf* this) { - Animation_MorphToPlayOnce(&this->unk188, &D_6004AD0, -3.0f); + Animation_MorphToPlayOnce(&this->unk188, &object_wf_Anim_004AD0, -3.0f); this->unk2E8 = 0; this->unk300 = 1; this->unk2D4 = 5; @@ -847,7 +840,7 @@ void func_80B35D18(EnWf* this) { this->actor.speed = 0.0f; } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - Animation_PlayOnceSetSpeed(&this->unk188, &D_6009B20, 0.0f); + Animation_PlayOnceSetSpeed(&this->unk188, &object_wf_Anim_009B20, 0.0f); this->unk2D4 = 0xF; func_80B33CB0(this, func_80B35D90); } @@ -872,7 +865,7 @@ void func_80B35D90(EnWf* this, PlayState* play) { } void func_80B35E4C(EnWf* this) { - Animation_MorphToPlayOnce(&this->unk188, &D_6009B20, -4.0f); + Animation_MorphToPlayOnce(&this->unk188, &object_wf_Anim_009B20, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk300 = 0; this->actor.speed = -4.0f; @@ -924,7 +917,8 @@ void func_80B35EE4(EnWf* this, PlayState* play) { } void func_80B360E8(EnWf* this) { - Animation_Change(&this->unk188, &D_6004AD0, -1.0f, Animation_GetLastFrame(&D_6004AD0), 0.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->unk188, &object_wf_Anim_004AD0, -1.0f, Animation_GetLastFrame(&object_wf_Anim_004AD0), 0.0f, + ANIMMODE_ONCE, -3.0f); this->unk2E8 = 0; this->unk300 = 0; this->unk2D4 = 4; @@ -959,14 +953,14 @@ void func_80B361A0(EnWf* this, PlayState* play) { void func_80B36288(EnWf* this) { f32 temp_fv1; - temp_fv1 = (f32)Animation_GetLastFrame(&D_6004CA4); + temp_fv1 = (f32)Animation_GetLastFrame(&object_wf_Anim_004CA4); if (this->unk2F8 != 0) { this->unk2F8 = -1; } this->actor.speed = 0.0f; this->unk2D4 = 7; this->unk2E8 = 0xA; - Animation_Change(&this->unk188, &D_6004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); + Animation_Change(&this->unk188, &object_wf_Anim_004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); func_80B33CB0(this, func_80B36328); } @@ -1023,8 +1017,8 @@ void func_80B365A8(EnWf* this, PlayState* play) { s16 temp_v1_sp36; Player* player; - Animation_Change(&this->unk188, &D_60057A0, 1.0f, 0.0f, Animation_GetLastFrame(&D_60057A0), ANIMMODE_LOOP_INTERP, - -4.0f); + Animation_Change(&this->unk188, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), + ANIMMODE_LOOP_INTERP, -4.0f); player = GET_PLAYER(play); temp_v1_sp36 = player->actor.shape.rot.y + this->unk2FE; if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) > 0.0f) { @@ -1130,7 +1124,7 @@ void func_80B36740(EnWf* this, PlayState* play) { } void func_80B36C8C(EnWf* this) { - Animation_MorphToPlayOnce(&this->unk188, &D_6005430, -4.0f); + Animation_MorphToPlayOnce(&this->unk188, &object_wf_Anim_005430, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk300 = 0; diff --git a/undefined_syms.txt b/undefined_syms.txt index b8b9002508e..20fd25cdf06 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -11,15 +11,3 @@ D_0F000000 = 0x0F000000; // z_bg_mjin D_06000000 = 0x06000000; - -// z_en_wf -D_6003BC0 = 0x6003BC0; -D_6004638 = 0x6004638; -D_6004AD0 = 0x6004AD0; -D_6004CA4 = 0x6004CA4; -D_6005430 = 0x6005430; -D_60057A0 = 0x60057A0; -D_6009690 = 0x6009690; -D_60098C8 = 0x60098C8; -D_6009B20 = 0x6009B20; -D_600A4AC = 0x600A4AC; From a28f02599a3e8f9cea39cce9ca223fdf944e3c02 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 09:53:15 +0200 Subject: [PATCH 011/150] soften trivial diffs --- .gitignore | 1 + Makefile | 96 +++++++++++++++++++++++----------------------- undefined_syms.txt | 2 - 3 files changed, 49 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index 65afa6ef884..4ccab810466 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # Cache files __pycache__/ .pyc +.DS_Store # IDE files .vscode/ diff --git a/Makefile b/Makefile index 04f4afdc102..be53ed4d801 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ COMPILER ?= ido # gc-jp-ce GameCube Japan (Collector's Edition disc) # ique-cn iQue Player (Simplified Chinese) VERSION ?= gc-eu-mq-dbg -# Number of threads to compress with. +# Number of threads to extract assets and compress with. N_THREADS ?= $(shell nproc) # If DEBUG_OBJECTS is 1, produce additional debugging files such as objdump output or raw binaries for assets DEBUG_OBJECTS ?= 0 @@ -843,6 +843,49 @@ ifneq ($(COMPARE),0) endif endif +clean: + $(RM) -r $(BUILD_DIR) + +assetclean: + $(RM) -r $(EXTRACTED_DIR) + +distclean: + $(RM) -r extracted/ + $(RM) -r build/ + $(MAKE) -C tools distclean + +venv: +# Create the virtual environment if it doesn't exist. +# Delete the virtual environment directory if creation fails. + test -d $(VENV) || python3 -m venv $(VENV) || { rm -rf $(VENV); false; } + $(PYTHON) -m pip install -U pip + $(PYTHON) -m pip install -U -r requirements.txt + +setup: venv + $(MAKE) -C tools -j + $(PYTHON) tools/decompress_baserom.py $(VERSION) + $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION) + $(PYTHON) -m tools.assets.extract $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR) -v $(VERSION) -j$(N_THREADS) + $(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION) + $(PYTHON) tools/extract_text.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/text -v $(VERSION) + $(PYTHON) tools/extract_audio.py -b $(EXTRACTED_DIR)/baserom -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml + +disasm: + $(RM) -r $(EXPECTED_DIR) + VERSION=$(VERSION) DISASM_BASEROM=$(BASEROM_DIR)/baserom-decompressed.z64 DISASM_DIR=$(EXPECTED_DIR) PYTHON=$(PYTHON) AS_CMD='$(AS) $(ASFLAGS)' LD=$(LD) ./tools/disasm/do_disasm.sh + +resources: $(ASSET_FILES_OUT) +run: $(ROM) +ifeq ($(N64_EMULATOR),) + $(error Emulator path not set. Set N64_EMULATOR in the Makefile or define it as an environment variable) +endif + $(N64_EMULATOR) $< + +.PHONY: all rom compress clean assetclean distclean venv setup disasm run +.DEFAULT_GOAL := rom + +#### Various Recipes #### + ifeq ($(PLATFORM),IQUE) COMPRESS_ARGS := --format gzip --pad-to 0x4000 CIC = 6102 @@ -871,6 +914,10 @@ $(ELF): $(TEXTURE_FILES_OUT) $(ASSET_FILES_OUT) $(SEGMENT_FILES) $(RELOC_O_FILES $(BUILD_DIR)/linker_scripts/makerom.ld: linker_scripts/makerom.ld $(CPP) -I include $(CPPFLAGS) $< > $@ +o_files: $(O_FILES) +$(RELOC_O_FILES): | o_files +.PHONY: o_files + $(BUILD_DIR)/spec: $(SPEC) $(SPEC_INCLUDES) $(CPP) $(CPPFLAGS) -MD -MP -MF $@.d -MT $@ -I. $< | $(BUILD_DIR_REPLACE) > $@ @@ -893,49 +940,6 @@ $(SEGMENTS_DIR)/%.reloc.o: $(SEGMENTS_DIR)/%.plf $(BUILD_DIR)/undefined_syms.txt: undefined_syms.txt $(CPP) $(CPPFLAGS) $< > $(BUILD_DIR)/undefined_syms.txt -clean: - $(RM) -r $(BUILD_DIR) - -assetclean: - $(RM) -r $(EXTRACTED_DIR) - -distclean: - $(RM) -r extracted/ - $(RM) -r build/ - $(MAKE) -C tools distclean - -venv: -# Create the virtual environment if it doesn't exist. -# Delete the virtual environment directory if creation fails. - test -d $(VENV) || python3 -m venv $(VENV) || { rm -rf $(VENV); false; } - $(PYTHON) -m pip install -U pip - $(PYTHON) -m pip install -U -r requirements.txt - -setup: venv - $(MAKE) -C tools -j - $(PYTHON) tools/decompress_baserom.py $(VERSION) - $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION) - $(PYTHON) -m tools.assets.extract $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR) -v $(VERSION) -j$(N_THREADS) - $(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/incbin -v $(VERSION) - $(PYTHON) tools/extract_text.py $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR)/text -v $(VERSION) - $(PYTHON) tools/extract_audio.py -b $(EXTRACTED_DIR)/baserom -o $(EXTRACTED_DIR) -v $(VERSION) --read-xml - -disasm: - $(RM) -r $(EXPECTED_DIR) - VERSION=$(VERSION) DISASM_BASEROM=$(BASEROM_DIR)/baserom-decompressed.z64 DISASM_DIR=$(EXPECTED_DIR) PYTHON=$(PYTHON) AS_CMD='$(AS) $(ASFLAGS)' LD=$(LD) ./tools/disasm/do_disasm.sh - -resources: $(ASSET_FILES_OUT) -run: $(ROM) -ifeq ($(N64_EMULATOR),) - $(error Emulator path not set. Set N64_EMULATOR in the Makefile or define it as an environment variable) -endif - $(N64_EMULATOR) $< - -.PHONY: all rom compress clean assetclean distclean venv setup disasm run -.DEFAULT_GOAL := rom - -#### Various Recipes #### - $(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/% $(OBJCOPY) -I binary -O $(LD_OFORMAT) $< $@ @@ -1025,10 +1029,6 @@ $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/compress_ranges.txt: $(BUILD_DIR) $(BUILD_DIR)/src/boot/z_std_dma.o: $(BUILD_DIR)/dmadata_table_spec.h $(BUILD_DIR)/src/dmadata/dmadata.o: $(BUILD_DIR)/dmadata_table_spec.h -o_files: $(O_FILES) -$(RELOC_O_FILES): | o_files -.PHONY: o_files - $(BUILD_DIR)/src/%.o: src/%.c $(CC_CHECK) $< -o $@ $(PREPROCESS) $(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $< diff --git a/undefined_syms.txt b/undefined_syms.txt index 20fd25cdf06..deba8affd06 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1,5 +1,3 @@ -#include "include/versions.h" - // z_kankyo, z_demo_kankyo, z_en_viewer, z_object_kankyo, z_eff_ss_dead_dd D_01000000 = 0x01000000; From f2cbc7458b79e5aadd344db0dcefd0e81497a1d3 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 10:44:37 +0200 Subject: [PATCH 012/150] make animation_curve.h --- include/animation.h | 48 ------------- include/animation_curve.h | 69 +++++++++++++++++++ include/functions.h | 13 ---- src/boot/z_std_dma.c | 4 +- src/code/code_8006C510.c | 2 +- src/code/main.c | 2 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 4 +- src/code/z_fcurve_data_skelanime.c | 4 +- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_kankyo.c | 8 +-- src/code/z_message.c | 2 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 2 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 2 +- .../actors/ovl_Demo_Effect/z_demo_effect.c | 3 +- .../actors/ovl_Demo_Effect/z_demo_effect.h | 1 + .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.c | 3 +- .../actors/ovl_Demo_Tre_Lgt/z_demo_tre_lgt.h | 1 + .../actors/ovl_Door_Warp1/z_door_warp1.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 4 +- .../actors/ovl_Magic_Wind/z_magic_wind.c | 3 +- .../actors/ovl_Magic_Wind/z_magic_wind.h | 1 + .../actors/ovl_player_actor/z_player.c | 6 +- .../extase_oot64/skelcurve_resources.py | 10 +-- 25 files changed, 105 insertions(+), 97 deletions(-) create mode 100644 include/animation_curve.h diff --git a/include/animation.h b/include/animation.h index eb68fa7054f..fdf14843b94 100644 --- a/include/animation.h +++ b/include/animation.h @@ -430,52 +430,4 @@ void LinkAnimation_BlendToMorph(struct PlayState* play, SkelAnime* skelAnime, Li s32 LinkAnimation_OnFrame(SkelAnime* skelAnime, f32 frame); -// fcurve_skelanime structs -typedef struct TransformData { - /* 0x0000 */ u16 unk_00; // appears to be flags - /* 0x0002 */ s16 unk_02; - /* 0x0004 */ s16 unk_04; - /* 0x0006 */ s16 unk_06; - /* 0x0008 */ f32 unk_08; -} TransformData; // size = 0xC - -typedef struct TransformUpdateIndex { - /* 0x0000 */ u8* refIndex; - /* 0x0004 */ TransformData* transformData; - /* 0x0008 */ s16* copyValues; - /* 0x000C */ s16 unk_0C; - /* 0x000E */ s16 unk_0E; -} TransformUpdateIndex; // size = 0x10 - -typedef struct SkelCurveLimb { - /* 0x0000 */ u8 firstChildIdx; - /* 0x0001 */ u8 nextLimbIdx; - /* 0x0004 */ Gfx* dList[2]; -} SkelCurveLimb; // size = 0xC - -typedef struct SkelCurveLimbList { - /* 0x0000 */ SkelCurveLimb** limbs; - /* 0x0004 */ u8 limbCount; -} SkelCurveLimbList; // size = 0x8 - -typedef struct LimbTransform { - /* 0x0000 */ Vec3s scale; - /* 0x0006 */ Vec3s rot; - /* 0x000C */ Vec3s pos; -} LimbTransform; // size = 0x12 - -typedef struct SkelAnimeCurve { - /* 0x0000 */ u8 limbCount; - /* 0x0004 */ SkelCurveLimb** limbList; - /* 0x0008 */ TransformUpdateIndex* transUpdIdx; - /* 0x000C */ f32 unk_0C; // seems to be unused - /* 0x0010 */ f32 animFinalFrame; - /* 0x0014 */ f32 animSpeed; - /* 0x0018 */ f32 animCurFrame; - /* 0x001C */ LimbTransform* transforms; -} SkelAnimeCurve; // size = 0x20 - -typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); -typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); - #endif diff --git a/include/animation_curve.h b/include/animation_curve.h new file mode 100644 index 00000000000..1c2217899c5 --- /dev/null +++ b/include/animation_curve.h @@ -0,0 +1,69 @@ +#ifndef ANIMATION_CURVE_H +#define ANIMATION_CURVE_H + +#include "ultra64.h" +#include "z_math.h" + +struct Actor; +struct PlayState; + +// fcurve_skelanime structs +typedef struct TransformData { + /* 0x0000 */ u16 unk_00; // appears to be flags + /* 0x0002 */ s16 unk_02; + /* 0x0004 */ s16 unk_04; + /* 0x0006 */ s16 unk_06; + /* 0x0008 */ f32 unk_08; +} TransformData; // size = 0xC + +typedef struct TransformUpdateIndex { + /* 0x0000 */ u8* refIndex; + /* 0x0004 */ TransformData* transformData; + /* 0x0008 */ s16* copyValues; + /* 0x000C */ s16 unk_0C; + /* 0x000E */ s16 unk_0E; +} TransformUpdateIndex; // size = 0x10 + +typedef struct SkelCurveLimb { + /* 0x0000 */ u8 firstChildIdx; + /* 0x0001 */ u8 nextLimbIdx; + /* 0x0004 */ Gfx* dList[2]; +} SkelCurveLimb; // size = 0xC + +typedef struct SkelCurveLimbList { + /* 0x0000 */ SkelCurveLimb** limbs; + /* 0x0004 */ u8 limbCount; +} SkelCurveLimbList; // size = 0x8 + +typedef struct LimbTransform { + /* 0x0000 */ Vec3s scale; + /* 0x0006 */ Vec3s rot; + /* 0x000C */ Vec3s pos; +} LimbTransform; // size = 0x12 + +typedef struct SkelAnimeCurve { + /* 0x0000 */ u8 limbCount; + /* 0x0004 */ SkelCurveLimb** limbList; + /* 0x0008 */ TransformUpdateIndex* transUpdIdx; + /* 0x000C */ f32 unk_0C; // seems to be unused + /* 0x0010 */ f32 animFinalFrame; + /* 0x0014 */ f32 animSpeed; + /* 0x0018 */ f32 animCurFrame; + /* 0x001C */ LimbTransform* transforms; +} SkelAnimeCurve; // size = 0x20 + +typedef s32 (*OverrideCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); +typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCurve, s32 limbIndex, void*); + +f32 func_8006C5A8(f32 target, TransformData* transData, s32 refIdx); +void SkelCurve_Clear(SkelAnimeCurve* skelCurve); +s32 SkelCurve_Init(struct PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, + TransformUpdateIndex* transUpdIdx); +void SkelCurve_Destroy(struct PlayState* play, SkelAnimeCurve* skelCurve); +void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame, + f32 animCurFrame, f32 animSpeed); +s32 SkelCurve_Update(struct PlayState* play, SkelAnimeCurve* skelCurve); +void SkelCurve_Draw(struct Actor* actor, struct PlayState* play, SkelAnimeCurve* skelCurve, + OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data); + +#endif diff --git a/include/functions.h b/include/functions.h index 8d64dbb4004..9ad76444092 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2,22 +2,9 @@ #define FUNCTIONS_H #include "z64.h" -#include "animation.h" -#include "play_state.h" void* MemCopy(void* dest, void* src, s32 size); -f32 func_8006C5A8(f32 target, TransformData* transData, s32 refIdx); -void SkelCurve_Clear(SkelAnimeCurve* skelCurve); -s32 SkelCurve_Init(PlayState* play, SkelAnimeCurve* skelCurve, SkelCurveLimbList* limbListSeg, - TransformUpdateIndex* transUpdIdx); -void SkelCurve_Destroy(PlayState* play, SkelAnimeCurve* skelCurve); -void SkelCurve_SetAnim(SkelAnimeCurve* skelCurve, TransformUpdateIndex* transUpdIdx, f32 arg2, f32 animFinalFrame, - f32 animCurFrame, f32 animSpeed); -s32 SkelCurve_Update(PlayState* play, SkelAnimeCurve* skelCurve); -void SkelCurve_Draw(Actor* actor, PlayState* play, SkelAnimeCurve* skelCurve, - OverrideCurveLimbDraw overrideLimbDraw, PostCurveLimbDraw postLimbDraw, s32 lod, void* data); - void func_800ACE70(struct_801664F0* this); void func_800ACE90(struct_801664F0* this); void func_800ACE98(struct_801664F0* this, Gfx** gfxp); diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 226465a3f6e..a2a3d810d98 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -45,8 +45,8 @@ #include "dma.h" #include "thread.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:82" \ - "pal-1.0:80 pal-1.1:80" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:102" \ + "pal-1.0:100 pal-1.1:100" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/code_8006C510.c b/src/code/code_8006C510.c index feed11512aa..e4680f7f5ef 100644 --- a/src/code/code_8006C510.c +++ b/src/code/code_8006C510.c @@ -1,5 +1,5 @@ #include "ultra64.h" -#include "animation.h" +#include "animation_curve.h" #include "math.h" f32 func_8006C510(f32 arg0, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5) { diff --git a/src/code/main.c b/src/code/main.c index 9ecfdde6bf8..832b169f708 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -44,7 +44,7 @@ extern struct IrqMgr gIrqMgr; #include "thread.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:62 ntsc-1.1:62 ntsc-1.2:62 pal-1.0:60 pal-1.1:60" + "ique-cn:128 ntsc-1.0:82 ntsc-1.1:82 ntsc-1.2:82 pal-1.0:80 pal-1.1:80" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index ac15f6ebd04..fc2a2f33269 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -15,7 +15,7 @@ #include "skin_matrix.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:40 ntsc-1.1:40 ntsc-1.2:40" + "ique-cn:128 ntsc-1.0:64 ntsc-1.1:64 ntsc-1.2:64" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 34059060f77..6e13d4327c7 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3661,7 +3661,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:104 ntsc-1.1:104 ntsc-1.2:104 pal-1.0:104 pal-1.1:104" + "ique-cn:128 ntsc-1.0:124 ntsc-1.1:124 ntsc-1.2:124 pal-1.0:124 pal-1.1:124" s32 Camera_KeepOn4(Camera* camera) { static Vec3f sAtTarget; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index d5a0f4ee64f..da53c266f9f 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -16,8 +16,8 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" #include "z_lib.h" -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ique-cn:64" \ - "ntsc-1.0:56 ntsc-1.1:56 ntsc-1.2:56 pal-1.0:56 pal-1.1:56" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:64 ntsc-1.0:80 ntsc-1.1:80 ntsc-1.2:80 pal-1.0:80 pal-1.1:80" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_fcurve_data_skelanime.c b/src/code/z_fcurve_data_skelanime.c index 3b6729fb0d7..4a65471a9ad 100644 --- a/src/code/z_fcurve_data_skelanime.c +++ b/src/code/z_fcurve_data_skelanime.c @@ -1,3 +1,5 @@ +#include "animation.h" +#include "animation_curve.h" #include "gfx.h" #include "printf.h" #include "regs.h" @@ -8,8 +10,6 @@ #include "actor.h" #include "play_state.h" -#include "functions.h" - void SkelCurve_Clear(SkelAnimeCurve* skelCurve) { skelCurve->limbCount = 0; skelCurve->limbList = NULL; diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 7c7fb49842e..f61b56fef0a 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:240 ntsc-1.1:240 ntsc-1.2:240 pal-1.0:240 pal-1.1:240" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:240" \ + "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" #include "libu64/debug.h" #include "kaleido_manager.h" diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 8244b9ca213..3458198e543 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:128 pal-1.1:128" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ + "ique-cn:160 ntsc-1.0:160 ntsc-1.1:160 ntsc-1.2:160 pal-1.0:160 pal-1.1:160" #include "libc64/qrand.h" #include "libu64/gfxprint.h" @@ -243,8 +243,8 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:192 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "gc-eu:208 gc-eu-mq:208 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ique-cn:208 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; diff --git a/src/code/z_message.c b/src/code/z_message.c index 27730cdb10b..15a7aab5608 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -29,7 +29,7 @@ #include "assets/textures/parameter_static/parameter_static.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + "ntsc-1.0:32 ntsc-1.1:32 ntsc-1.2:32 pal-1.0:0 pal-1.1:0" #if !PLATFORM_IQUE #define MSG_BUF_DECODED (msgCtx->msgBufDecoded) 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 c46fc51e422..31fef26cb05 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -27,7 +27,7 @@ #include "assets/objects/object_tw/object_tw.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" \ - "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:0 pal-1.1:0" + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 494b183409b..34351df6840 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -29,7 +29,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep_0x55DB0.h" #include "assets/objects/object_bv/object_bv.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:128" \ "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS \ 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 23ceb626541..9d20ae3984b 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -2,6 +2,7 @@ #include "libc64/math64.h" #include "libc64/qrand.h" +#include "animation_curve.h" #include "attributes.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -23,8 +24,6 @@ #include "play_state.h" #include "save.h" -#include "functions.h" - #include "assets/objects/gameplay_keep/eff_flash.h" #include "assets/objects/object_efc_crystal_light/object_efc_crystal_light.h" #include "assets/objects/object_efc_fire_ball/object_efc_fire_ball.h" 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 1ad121c81ba..b66e9953a12 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.h @@ -3,6 +3,7 @@ #include "ultra64.h" #include "actor.h" +#include "animation_curve.h" struct DemoEffect; 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 0c0795a9fe4..0cbd696d6f6 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 @@ -1,6 +1,7 @@ #include "z_demo_tre_lgt.h" #include "overlays/actors/ovl_En_Box/z_en_box.h" +#include "animation_curve.h" #include "gfx.h" #include "gfx_setupdl.h" #include "printf.h" @@ -9,8 +10,6 @@ #include "play_state.h" #include "save.h" -#include "functions.h" - #include "assets/objects/object_box/object_box.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED 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 8f61a1e2866..55ff2359c7b 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 @@ -3,6 +3,7 @@ #include "ultra64.h" #include "actor.h" +#include "animation_curve.h" struct DemoTreLgt; 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 407730e989c..f7c9e270c6c 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -19,7 +19,7 @@ #include "assets/objects/object_warp1/object_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" \ - "ique-cn:0 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS 0 diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 5eb99d4ef7d..8458e9db24b 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -38,8 +38,8 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ + "ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index c6e3ee9f6b5..de4c918e72f 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -6,6 +6,7 @@ #include "z_magic_wind.h" +#include "animation_curve.h" #include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" @@ -15,8 +16,6 @@ #include "play_state.h" #include "player.h" -#include "functions.h" - #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicWind_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h index 1839c8d4845..53731dd3972 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.h @@ -3,6 +3,7 @@ #include "ultra64.h" #include "actor.h" +#include "animation_curve.h" struct MagicWind; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 9b153cf793a..2043669cb09 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -376,14 +376,14 @@ 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:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ique-cn:192 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" + "ique-cn:192 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; static Input* sControlInput; -#pragma increment_block_number "gc-eu:160 gc-eu-mq:160 gc-jp:160 gc-jp-ce:160 gc-jp-mq:160 gc-us:160 gc-us-mq:160" \ - "ique-cn:160 ntsc-1.0:192 ntsc-1.1:192 ntsc-1.2:192 pal-1.0:192 pal-1.1:192" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ + "ique-cn:160 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // .data diff --git a/tools/assets/extract/extase_oot64/skelcurve_resources.py b/tools/assets/extract/extase_oot64/skelcurve_resources.py index da8d5cde52d..501a51d8232 100644 --- a/tools/assets/extract/extase_oot64/skelcurve_resources.py +++ b/tools/assets/extract/extase_oot64/skelcurve_resources.py @@ -83,7 +83,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("animation.h",) + return ("animation_curve.h",) class ConstantDataArrayResource(CDataResource, can_size_be_unknown=True): @@ -254,7 +254,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("animation.h",) + return ("animation_curve.h",) class SkelCurveLimbResource(CDataResource): @@ -283,7 +283,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("animation.h",) + return ("animation_curve.h",) class SkelCurveLimbArrayResource(CDataResource): @@ -328,7 +328,7 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("animation.h",) + return ("animation_curve.h",) class SkelCurveLimbListResource(CDataResource): @@ -375,4 +375,4 @@ def get_c_reference(self, resource_offset: int): raise ValueError() def get_h_includes(self): - return ("animation.h",) + return ("animation_curve.h",) From 24c8d2803c864b1aa5c339a1552418a1f38d5f45 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 11:11:26 +0200 Subject: [PATCH 013/150] extract n64dd data --- assets/xml/misc/n64dd.xml | 8 + baseroms/ntsc-1.0/config.yml | 4 + baseroms/ntsc-1.1/config.yml | 4 + baseroms/ntsc-1.2/config.yml | 4 + baseroms/pal-1.0/config.yml | 4 + baseroms/pal-1.1/config.yml | 4 + src/n64dd/n64dd_6.c | 1478 +--------------------------------- 7 files changed, 34 insertions(+), 1472 deletions(-) create mode 100644 assets/xml/misc/n64dd.xml diff --git a/assets/xml/misc/n64dd.xml b/assets/xml/misc/n64dd.xml new file mode 100644 index 00000000000..838b346b146 --- /dev/null +++ b/assets/xml/misc/n64dd.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/baseroms/ntsc-1.0/config.yml b/baseroms/ntsc-1.0/config.yml index 919307cf222..1056ad38a2e 100644 --- a/baseroms/ntsc-1.0/config.yml +++ b/baseroms/ntsc-1.0/config.yml @@ -67,6 +67,10 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB600 end_offset: 0xEC088 +- name: misc/n64dd + xml_path: assets/xml/misc/n64dd.xml + start_offset: 0xC160 + end_offset: 0x11D60 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/ntsc-1.1/config.yml b/baseroms/ntsc-1.1/config.yml index 1ed8fc185b1..41d8ff909e1 100644 --- a/baseroms/ntsc-1.1/config.yml +++ b/baseroms/ntsc-1.1/config.yml @@ -67,6 +67,10 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB7C0 end_offset: 0xEC248 +- name: misc/n64dd + xml_path: assets/xml/misc/n64dd.xml + start_offset: 0xC140 + end_offset: 0x11D40 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/ntsc-1.2/config.yml b/baseroms/ntsc-1.2/config.yml index a7ba264e295..e54d92cfaec 100644 --- a/baseroms/ntsc-1.2/config.yml +++ b/baseroms/ntsc-1.2/config.yml @@ -67,6 +67,10 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB610 end_offset: 0xEC098 +- name: misc/n64dd + xml_path: assets/xml/misc/n64dd.xml + start_offset: 0xC120 + end_offset: 0x11D20 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/pal-1.0/config.yml b/baseroms/pal-1.0/config.yml index 60fdb421698..6f222188038 100644 --- a/baseroms/pal-1.0/config.yml +++ b/baseroms/pal-1.0/config.yml @@ -73,6 +73,10 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F20 end_offset: 0xE99A8 +- name: misc/n64dd + xml_path: assets/xml/misc/n64dd.xml + start_offset: 0xC0E0 + end_offset: 0x11CE0 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/baseroms/pal-1.1/config.yml b/baseroms/pal-1.1/config.yml index a62af8e9937..d432dc8bd55 100644 --- a/baseroms/pal-1.1/config.yml +++ b/baseroms/pal-1.1/config.yml @@ -73,6 +73,10 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F60 end_offset: 0xE99E8 +- name: misc/n64dd + xml_path: assets/xml/misc/n64dd.xml + start_offset: 0xC0E0 + end_offset: 0x11CE0 - name: misc/link_animetion xml_path: assets/xml/misc/link_animetion.xml - name: misc/z_select_static diff --git a/src/n64dd/n64dd_6.c b/src/n64dd/n64dd_6.c index 864e8407a68..81bfe190b11 100644 --- a/src/n64dd/n64dd_6.c +++ b/src/n64dd/n64dd_6.c @@ -109,1485 +109,19 @@ const char* D_801D3760[2][8][4] = { }; UNK_TYPE1 D_801D3860[2][0x600] = { { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x44, 0x58, 0x88, 0x9B, 0xBF, 0x70, 0, - 0, 0x3B, 0xBB, 0xBB, 0xBB, 0xBB, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, -1, -1, -1, -8, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xAB, -0x25, -0x31, 0x88, 0x98, 0x20, 0, - 0, 0x4F, 0x98, 0x88, 0x88, 0xBF, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x68, 0, 0, 0, 0, 0, 0, 0x4B, 0x30, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0xBF, -1, -1, -1, -1, 0x80, 0, 0, 2, 0x44, 0x44, 0x44, 0x42, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, -0x2F, 0x4F, 0, -0x27, 0, 0, - 0, 0x4F, 0x40, 0, 0, 0x8F, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3, -0x15, 0, 0, 0, 0, 0, 0x3D, -1, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x68, 0x88, 0xBF, 0x88, 0x88, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 8, 0x88, -6, 0x9F, 0x89, -8, 0x88, 0, - 0, 0x4F, -0x35, 0xBB, 0xBB, -0x21, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x1C, -5, 0, 0, 0, 0, 0, 0x26, 0x5F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0xBB, 0xBB, 0xBB, 0xBB, 0xBB, 0x80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0xBB, 0xBE, -1, -2, 0xBB, 0xBB, 0, - 0, 0x28, 0x88, 0x88, 0x88, 0x88, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x9B, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0x88, 0x88, 0x88, 0x88, 0x8E, -0xF, 0, - 2, 0x44, 0x44, 0x44, 0x44, 0x44, 0x42, 0, 0, 0, 0x7F, 0x9F, 0x6F, 0x70, 0, 0, - 0x28, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 6, -0x1E, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3F, 0x90, 0, - 8, -1, -1, -1, -1, -1, -8, 0, 0, 0x2A, -0x1A, 0x4F, 6, -5, 0x40, 0, - 0x3B, 0xBD, -5, 0xBB, 0xBB, 0xBB, 0xBB, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x3E, 0x50, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xBE, 0x20, 0, - 4, 0x88, 0x88, 0x88, 0x88, 0x88, 0x84, 0, 0x19, -1, 0xA8, 0x88, 0x88, 0xAF, -5, 0x40, - 0, 0xB, 0xC0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, -0x37, 0, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 8, -9, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 9, 0x6B, 0xB8, 0x9F, 0x88, 0x8F, 0x8B, 0x10, - 0, 0xF, -1, -1, -1, -1, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, -8, 0x88, -0x23, 0x82, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0x8F, 0x90, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0x94, 0x7F, 0x44, 0x4F, 0x40, 0, - 0, 0x5F, 0x74, 0x44, 0x44, 0x7F, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 0xBB, 0xBB, -0x12, 0xB3, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xF, -1, -1, -1, -1, -1, -5, 0, 0, 0, 0, 0x4B, -7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, -0x25, -0x31, 0xBB, 0xBF, 0x40, 0, - 0, 0x27, 0, 0, 0, 0x6F, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 0x88, 0x88, 0x88, 0x88, 0x88, 0x86, 0, 0, 4, 0x8D, -3, 0x50, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0x94, 0x7F, 0x44, 0x4F, 0x40, 0, - 0, 0, 0, 0, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0xBB, 0, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, -5, 0x60, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, -0x25, 0xBB, 0xBB, 0xBF, 0x40, 0, - 0, 0, 0, 0, 0x5B, -0x16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x20, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0x40, 0, 0, 8, 0x20, 0, - 0, 0, 0, 0, 0x28, 0x61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#include "assets/misc/n64dd/D_801D3860_0.bin.inc.c" }, { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0xBB, 0xBB, 0xBB, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB, 0x90, 0, 0, 0x86, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0x80, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0x64, 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -8, 0x88, 0x88, 0x86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xF, -0xA, 0, 0, 0xB8, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0xB0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, - -8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0x10, 0, 0, 0, 0, 0, 0, 0x41, 0, 0, 0, 0x41, 0, 0, 0, - 0x44, 0, 0, 0, 0, 0x41, 0, 0, 0, 0, 0xF, 0xAE, 0x10, 0, 0xB8, 0, - 0, 0, 0, 0, 0, 0, 1, 0x41, 0, 0x43, 0, 0, 8, 0xB0, 0x34, 0, - 0, 0, 0, 0x44, 0, 0, 0, 0, 0x41, 0, 0, 0, 0, 0, 0, 0x2E, - -8, 0, 2, 0x8D, -8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0x10, 0, 0, 0, 0, 8, 0xBB, -0xC, 0, 8, 0xBB, -0xC, 0, 0, 0x6E, - -1, -0x2D, 0, 8, 0xBB, -0xC, 0, 0, 0, 0, 0xF, 0x4B, 0xA0, 0, 0xB8, 0, - 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x7E, -2, 0x6C, -1, 0x90, 0, 8, -0x35, -1, -0x1B, - 0, 0, 0x5E, -1, -0x2D, 0, 8, 0xBB, -0xC, 0, 0, 0, 0, 0, 0, -0x36, - 0xB8, 0, 2, 0x88, -0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0xC, 0x44, 0x44, 0x41, 0, 8, -8, 0, 0, 8, -8, 0, 0, 2, -9, - 1, 0x9E, 0x10, 8, -8, 0, 0, 0, 0, 0, 0xF, 0x42, -0xC, 0, 0xB8, 0, - 0xB, 0x80, 0, 0x8B, 0, 0xF, -0x2E, 0x1B, -9, 5, -0xE, 0, 8, -7, 0x11, 0x9E, - 0x10, 2, -0x19, 1, 0x9E, 0x10, 8, -8, 0, 0, 0, 0, 0, 0, 8, -0x2F, - 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -1, -1, -1, -0xC, 0, 8, -0x30, 0, 0, 8, -0x30, 0, 0, 8, 0xC0, - 0, 0xE, 0x60, 8, -0x30, 0, 0, 0, 0, 0, 0xF, 0x40, 0x8D, 0x10, 0xB8, 0, - 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x60, 8, 0xC0, 0, -0xC, 0, 8, -0x20, 0, 0x1E, - 0x60, 8, 0x90, 0, 0xD, 0x60, 8, -0x30, 0, 0, 0, 0, 0, 0, 0x5F, 0x30, - 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0x10, 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 0xB, 0x80, - 0, 0xB, 0x80, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0xC, 0x80, 0xB8, 0, - 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, 0xB0, 0, 0xB, - 0x80, 0xB, -0x25, 0xBB, 0xBE, 0x80, 8, 0xB0, 0, 0, 0, 0, 0, 2, -0x19, 0, - 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0x10, 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 0xB, 0x80, - 0, 0xB, 0x80, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 4, -0xD, 0xB8, 0, - 0xB, 0x80, 0, 0x8B, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, 0xB0, 0, 0xB, - 0x80, 0xB, 0xB8, 0x88, 0x88, 0x40, 8, 0xB0, 0, 0, 0, 0, 0, 8, -5, 0xBB, - -0x13, 0xB0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0x10, 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 9, 0xB0, - 0, 0x1F, 0x50, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x8C, 0xB8, 0, - 0xB, 0x80, 0, 0xAB, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, -0x1F, 0, 0x1F, - 0x50, 8, 0xA0, 0, 7, 0x40, 8, 0xB0, 0, 0, 0, 0, 0, 4, 0x88, 0x88, - -0x25, 0x80, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -0xC, 0x44, 0x44, 0x43, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 4, -9, - 1, 0x9D, 0, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x1E, -8, 0, - 9, -0x2E, 7, -5, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, -7, 0x11, 0x9D, - 0, 3, -9, 1, 0x9F, 0x20, 8, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -1, -1, -1, -5, 0, 8, 0xB0, 0, 0, 8, 0xB0, 0, 0, 0, 0x6F, - -1, -0x2D, 0, 8, 0xB0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 5, -8, 0, - 3, -0x11, -4, 0x8B, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 8, 0xBB, -1, -0x2D, - 0, 0, 0x6E, -1, -0x1A, 0, 8, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xB8, 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x34, 0, - 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#include "assets/misc/n64dd/D_801D3860_1.bin.inc.c" }, }; s8 D_801D4460[2][0x2800] = { { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x24, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x30, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0x88, 0x86, 8, 0xB0, 0xC, 0x80, 0, 0, 2, 0x41, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0x30, 0, 0, 0, 0x10, 0, 0, 4, 0x81, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0x28, 0x88, 0x88, 0x88, 0, 0, 0, 0, - 0, 0x4F, 6, 0xBB, 0xBB, 0xBB, 0x20, 0, 4, 0x88, 0x86, 7, 0x70, 8, 0x90, 0, - 0, 0, 0, 0, 0x88, 0x88, 0x84, 0, 0, 0x14, 0x44, 0x9F, 0x44, 0x44, 0x10, 0, - 0, 0, 0, 0x4A, 0x30, 0, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, 0, - 4, 0x88, 0x84, 0, 0xB, 0x80, 0, 0, 0, 0, 0, 0x46, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0x30, 0, 0, 0, 0, 8, 0x50, 0, 0, -0x37, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 0xBB, 0xB8, 2, -0xD, 0x4F, 0x40, 0, 0, 8, -0xE, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x5E, -0x2F, 0, 0, 0, 0xAC, 0, 0, 5, -0x10, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0x3B, -4, 0xBD, -0x15, 0, 0, 0, 0, - 0, 0x4F, 4, 0x8D, 0xB8, 0xBF, 0, 0, 6, 0xBB, 0xB8, 8, -0x1F, 0xD, 0x90, 0, - 8, -1, -1, 0x40, -4, 0xBB, -8, 0, 0, 0x3B, 0xBB, -0x21, 0xBB, 0xBF, 0x40, 0, - 0, 0, 0, 0xBD, 0x10, 0x30, 0, 0, 0, 0, 0x4F, 0x40, 0, 0, 0, 0, - 6, 0xBB, 0xB6, 0x8B, 0xBE, -0x25, 0xBB, 0, 0, 0x3B, -1, -1, 0x90, 0, 0, 0, - 0, 0, 0, 0, 0x5E, -0x2F, 0, 0, 0, 0, 0x1F, 0x80, 0, 0x4C, 0x48, 0x10, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0x3B, 0xBB, 0xBB, 0x8B, -0x25, -0x22, 0xBB, 0, 0, 8, -0x10, 0, 0, 0, 0, 0, - 0, 0, 0, 8, -4, 0x20, 0, 0, 0, -0x26, 0, 0, 4, -0x10, 0x11, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -0xC, 8, 0xB6, 0xBB, 0xBB, 0xB3, 0, - 0, 0x4F, 0, 0xB, 0x80, 0x8E, 0, 0, 0x3B, 0xBB, 0xBB, 0x61, -0x3E, 0x2F, 0x40, 0, - 8, -0x3C, 0x7F, 0x40, -0xC, 0, -8, 0, 0x3B, 0xBB, 0xBB, -0x21, 0xBB, 0xBF, -0x35, 0x30, - 0, 0x6B, 0xBB, -3, -0x31, -0x10, 0, 0, 0, 0, 0x4F, 0x46, 0x51, -0x17, 0x20, 0, - 0x3B, 0xBB, 0xBB, 0x68, 0x8D, 0xB8, 0x88, 0, 0, 0x28, 0x74, 0x5F, 0x40, 0, 0, 0, - 0, 0, 0, 8, -4, 0x20, 0, 0, 0, 0, 0x5F, 0x66, 0x93, 9, 0x80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0x28, 0x88, 0x88, 0x68, 0x8D, -0x28, 0x88, 0, 0, 8, -0x10, 0, 0, 0, 0, 0, - 0, 0, 3, -0x31, 0x80, 0, 0, 0, 0, -9, 6, 0x88, 0x89, -4, -8, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0x8B, 0xB4, 0xBD, 0x88, -9, 0, - 0x4F, -1, -8, 0xB, 0x80, 0xAB, 0, 0, 0x28, 0x88, 0x88, 0x4B, 0xBB, -0x31, 0xB6, 0, - 8, 0xB0, 0x4F, 0x40, -9, 0x44, -8, 0, 0, 0x14, 0x44, 0x9F, 0x44, 0x4F, 0x40, 0, - 0, 0x48, 0x8F, -0x38, 0x64, 0x20, 0, 0, 0, -1, -1, -2, 0x60, 0x5D, -0xA, 0, - 0x28, 0x88, 0x88, 4, 0x4C, 0x94, 0x40, 0, 0, 0, 0, 0x9D, 0, 0, 0, 0, - 0, 0, 3, -0x31, 0x80, 0, 0, 0, 4, -1, -1, -1, 0xB2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 0xBB, 0xB8, 0, 0xB, 0xB0, 0, 0, 0, 8, 0xB0, 0, 0, 0, 0, 0, - 0, 1, 0x8F, 0xB3, 0, 0, 0, 0, 4, -0xC, 6, 0xBB, 0xBC, -8, 0x62, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0xBD, 0xB0, 0x8B, 3, -0xD, 0, - 0x14, 0x7F, 0x42, 0xB, 0x80, 0xBD, 0x85, 0, 6, 0xBB, 0xB8, 0xF, 0x98, 0x88, -0x28, 0, - 8, -0x28, 0x9F, 0x42, -1, -1, -8, 0, 0, 0x3B, 0xBB, -0x21, 0xBB, 0xBB, 0x30, 0, - 0, 0, 0x8F, 0x64, 0, 0, 0, 0, 0, 0x44, 0x9F, 0x20, 0, 0, 0x86, 0, - 6, 0xBB, 0xB6, 0xF, -1, -1, -0x10, 0, 0, 0, 1, -0x19, 0, 0x8F, 0x30, 0, - 0, 1, 0x8F, 0xB3, 0, 0, 0, 0, 2, 0x54, -0x17, 0x13, 0x58, 0x88, 0x80, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0x88, 0x86, 8, 0x8D, -0x28, 0x82, 0, 0, 8, 0xB0, 0, 0, 0, 0, 0, - 0, 0x3E, -0x2A, 0, 0, 0, 0, 0, 4, -0xF, 0, 0, 4, -0x10, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -0xC, 8, 0xB0, 0x6C, 6, -0x20, 0, - 0, 0x4F, 2, 0xB, 0xA0, -0x13, -0x21, 0, 4, 0x88, 0x86, 0xF, 0x40, 0, 0xB8, 0, - 8, -0x15, -0x31, 0x44, -0x10, 0, -8, 0, 0, 0xBB, 0xBB, -0x21, 0xBB, 0xBB, 0xB0, 0, - 0, 6, -2, 0xBF, 0x80, 0x28, -0x2E, 0, 0, 0, 0x8F, 0, 2, 0x20, 0, 0, - 4, 0x88, 0x85, 0x44, 0x44, 0x44, 0x44, 0, 0, 0, 6, -0xF, 0, 0x8F, 0, 0, - 0, 0x3E, -0x2A, 0, 0, 0, 0, 0, 0, 3, -0xE, 0xE, -4, 0xBB, 0xC0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 0xBB, 0xB8, 0xB, 0xBE, -0x15, 0xB3, 0, 0, 8, 0xB0, 0, 0, 0, 0, 0, - 0, 0x7F, 0x60, 0, 0, 0, 0, 0, 6, -0x10, 0, 0, 4, -0x10, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, 0xBD, 0xB0, 0x3F, 0x1A, 0xA0, 0, - 0, 0x6F, -0x18, 0xE, -0x1F, 0, 0xAA, 0, 6, 0xBB, 0xB8, 0xF, 0x98, 0x88, -0x28, 0, - 8, 0xB0, 0x4F, 0x45, -0x10, 0, -8, 0, 0, 0x44, 0x44, 0x9F, 0x44, 0x44, 0x40, 0, - 0, 0x3F, 0x91, 8, -0x24, -3, 0x93, 0, 0, 0, 0x8F, 0x7B, -1, -3, 0x50, 0, - 6, 0xBB, 0xB9, -5, 0xBB, 0xBB, -0x31, 0, 0, 0x5C, -1, -5, 0x96, 0xAE, 0, 0, - 0, 0x7F, 0x60, 0, 0, 0, 0, 0, 0, 8, 0xC0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, 0x88, 0x86, 0, 0xB, 0xB0, 0, 0, 0, 0xB, 0xB0, 0, 0, 1, 0xA3, 0, - 0, 7, -0x16, 0x10, 0, 0, 0, 0, 8, -0x10, 0, 0, 4, -0xC, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -7, 0x8B, 0xB0, 0xE, 0x7F, 0x60, 0, - 0x5D, -1, 0x50, 0x2F, -0x18, 2, -0xA, 0, 4, 0x88, 0x86, 0xB, -4, -0x13, 0xB6, 0, - 8, 0xB0, 0x4F, 0x48, -0x28, 0x88, -8, 0, 0x4F, -1, -1, -1, -1, -1, -1, 0x40, - 3, -0x17, 2, 0x9F, -0x19, 0x20, 0, 0, 0, 4, -0x31, 0xB6, 0x30, 0x29, -0xE, 0, - 4, 0x88, 0x88, -0x10, 0x82, 0x46, 0x4F, 0, 8, -0x18, 0x8F, 0x57, 0xAE, -3, 0x60, 0, - 0, 7, -0x16, 0x10, 0, 0, 0, 0, 0, 0xE, 0x60, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 8, 0xBB, 0xBB, 0x34, 0x4C, -0x3C, 0x44, 0x10, 0, 0xB, 0xB0, 0, 0, 8, -0xD, 0, - 0, 0, 0x3D, -0x1C, 0, 0, 0, 0, 8, -0x10, 0, 0x25, 0x77, -0xC, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -0xC, 8, 0xB0, 9, -3, 0, 0, - 0x39, 0x6F, 0, 0x7D, 0x6F, 0x39, -0x30, 0, 8, 0xBB, 0xBB, 2, -0xC, 0xB8, 0, 0, - 8, -0x15, -0x31, 0x4C, -0x25, 0xBB, -8, 0, 0, 0x14, 0x44, 0x44, 0x44, 0x44, 0x10, 0, - 3, 0xB0, 0x6F, 0x8C, 0xB0, 0, 0, 0, 0, 0x8F, 0xBF, 0, 0, 0, -0x28, 0, - 8, 0xBB, 0xB7, 0x40, -0xC, 0x8B, 0x14, 0, 0x2F, 0x60, -0x37, 0, 3, -2, -3, 0x10, - 0, 0, 0x3D, -0x1C, 0, 0, 0, 0, 0, 0x6E, 0x10, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xB, -0x28, 0xBF, 0xBF, -1, -1, -1, 0x40, 0, 9, 0xB0, 0, 0, 0x4F, 0x80, 0, - 0, 0, 1, -0x31, 0x60, 0, 0, 0, 7, -0x10, 3, -0x15, 0xBE, -6, 0x30, 0, - 2, 0x30, 0, 0, 0, 0, 0, 0, 2, -7, 0xAD, 0xB0, 5, -8, 0, 0, - 0, 0x4F, 0, -0x28, 0xD, -0x21, 0x40, 0, 0xB, -0x28, 0xBF, 5, -0xE, 0xB8, 0, 0, - 8, -0x28, 0x88, 0x6F, 0x30, 0, -8, 0, 0, 0x4F, 0x98, 0x88, 0x88, 0x9F, 0x40, 0, - 0, 2, -0xC, 0xB, 0xB0, 0, 0, 0, 6, -0x1C, 0x4F, 0, 0, 0, 0xBA, 0, - 0xB, 0xB8, -0x28, 2, -0xC, 0x8B, 0, 0, 0x4F, 0x19, -0x1F, 0, 0xA, -0x1F, 0x68, 0, - 0, 0, 1, -0x31, 0x60, 0, 0, 0, 0, 0xB9, 4, -0xF, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xB, 0xB0, 0x8F, 0, 0xB, 0xB0, 0, 0, 0, 7, -0xF, 0, 7, -7, 0, 0, - 0, 0, 0, 0x1C, -0xA, 0, 0, 0, 4, -0xF, 8, 0x80, 4, -2, -8, 0, - 0xB, -0x1D, 0, 0, 0, 0, 0, 0, 0x4F, -5, 0x8B, 0xB0, 0x3E, -0x31, 0x70, 0, - 0, 0x4F, 7, -0xE, 8, -2, 0x10, 0, 0xB, 0xB0, 0x8F, 9, -0x20, 0xB8, 4, 0, - 6, 0x80, 0, -0x35, 0, 0, -8, 0, 0, 0x4F, -0x35, 0xBB, 0xBB, -0x31, 0x40, 0, - 0, 7, -0xF, 0, 0, 0, 0, 0, 7, -0x2F, 0x4F, 6, 0x80, 3, -9, 0, - 0xB, 0x80, 0xB8, 7, -0x20, 0x8B, 1, 0, 0xE, -3, 0x30, 0, 0x9F, 0x50, 0, 0, - 0, 0, 0, 0x1C, -0xA, 0, 0, 0, 4, -0xD, 0, -9, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xB, -0x15, -0x21, 0, 0xB, 0xB0, 0, 0, 0, 1, -0x12, 0xBB, -0x12, 0x80, 0, 0, - 0, 0, 0, 1, -0x31, 0x60, 0, 0, 4, -0xC, 4, -0x18, 0x8C, -0x20, 0x89, 0, - 1, -0x24, 0x10, 0, 0, 0, 0, 0, 3, 0, 8, 0xB5, -0x14, 0x18, -6, 0x20, - 0, 0x4F, 0x3E, 0x82, 0x9F, 0xBF, -0x1C, 0, 0xB, -0x28, 0xBF, 0x3F, 0x80, 0xB8, 0x1F, 0x70, - 0, 0, 9, -0x1E, 0, 0x24, -8, 0, 0, 0x4F, 0x74, 0x44, 0x44, 0x7F, 0x40, 0, - 0, 2, -0x13, 0x88, 0x88, 0x8A, 0x30, 0, 1, -0x33, 0x9F, 6, -4, 0xBE, -0x3F, 0, - 0xB, -0x25, -0x18, 0x4E, 0x80, 0x8C, 0x1F, 0x50, 2, 0x41, 0, 0x6D, -0xA, 0, 0, 0, - 0, 0, 0, 1, -0x31, 0x60, 0, 0, 9, 0xB0, 0, 0x8F, -0x25, 0xBB, 0xBA, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0xB, -0x28, 0xBF, 0, 0xB, 0xB0, 0, 0, 0, 0, 0x17, 0x98, 0x61, 0, 0, 0, - 0, 0, 0, 0, 0x1C, 0xB0, 0, 0, 1, -0x3B, 0, 0x49, 0xBA, 0x30, 0, 0, - 0, 0x4D, 0x20, 0, 0, 0, 0, 0, 0, 0, 8, -0x35, 0x80, 0, 0x6C, 0x10, - 8, -0x23, 0x8C, 0x6F, -0x1B, 4, -0x12, 0x20, 0xB, -0x15, -0x21, -0x24, 0x10, 0x9F, -1, 0x20, - 0, 0, 0x5F, 0x50, 0, 0x2F, -0xB, 0, 0, 0x4F, -1, -1, -1, -1, 0x40, 0, - 0, 0, 0x28, 0xBB, -0x25, 0xBB, 0x30, 0, 0, 8, 0xBA, 0, 0x48, 0xA7, 0x10, 0, - 0xB, 0xB8, -0x28, -0x17, 0, 0x6F, -2, 0x10, 0, 0, 0, -0x23, 0x40, 0, 0, 0, - 0, 0, 0, 0, 0x1C, 0xB0, 0, 0, 9, 0x50, 0, 3, 0x88, 0xBB, 0x86, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0x30, 0, 0, 3, 0x30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0x30, 0, 0, 0, 0, - 4, 0x61, 3, 7, 0x10, 0, 0x25, 0, 3, 0x30, 0, 0x41, 0, 4, 0x42, 0, - 0, 0, 2, 0, 0, 6, 0x20, 0, 0, 0x3B, 0x30, 0, 0, 0x28, 0x20, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0x20, 0, 0x20, 0, 3, 0x41, 0, 0, 0, 0, 0x20, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x9D, 0, 2, 0x10, 0, 0, 0x68, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x4F, 0x77, 0xAF, 0x50, 0, 0, 0xBC, 0, 0, 4, -0x1D, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x9B, 0xBB, -0x31, -3, 0x96, 0x10, 0, 0, -0x38, 0, 0, 0, -0x25, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x68, 0x88, 0x56, -0xC, 0, 0, 0, 0, -8, 0, 0, 0, 0x6F, 0x40, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x8D, 0x10, 0, 0, 0, -0xB, 0, 0, 0, 0xE, 0xA0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x34, 0x1C, 0xB0, 0, 0, 0, -0xC, 0, 0, 0, 9, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 0xAF, -1, -1, -7, 0, 0, 0, -9, 0, 0, 0, 5, -0xB, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x3F, 0xA3, 0, 3, 0x87, 0, 0, 0, -0x38, 6, 0x10, 0, 1, -8, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x8D, 0, 0, 0, 0, 0, 0, 0, 0x9C, 0x1E, 0x60, 0, 0, -0x18, 0, - 1, 0x87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x7E, 0x30, 0, 0, 0, 0, 0, 0, 0x5F, -0x22, 0, 0, 0, 0, 0, - 0xC, 0x68, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x1B, -5, 0x88, 0x88, 0x96, 0, 0, 0, 0xC, -0xB, 0, 0, 0, 0, 0, - 0xC, 1, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0x58, 0xBB, 0xBB, 0xB5, 0, 0, 0, 1, 0x30, 0, 0, 0, 0, 0, - 9, 0x9B, 0x60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +#include "assets/misc/n64dd/D_801D3860_2.bin.inc.c" + }, + { +#include "assets/misc/n64dd/D_801D3860_3.bin.inc.c" }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 0xBB, 0xBB, 0xB8, 0x10, 0, 3, 0xB0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x3B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0x3B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0x3B, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0xB8, 0x88, 0x8E, 0xB0, 0, 4, -0x10, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 8, 0xB0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 0, 0x28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 3, -0xD, 0, 4, -0x10, 0, 0, 0x44, 0, 0, 0, - 2, 0x42, 0, 0, 0, 3, 0x41, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0x41, 0, 0, 0, 0x44, 0, 0, 0, 2, 0x42, - 0, 0, 0, 2, 0x41, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 8, 0xB0, 0x34, 0x10, 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0x24, 0x10, 0, 0, 3, 0x41, 0, 0, 0, 0xB8, 0, 0, - 0, 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0x34, 0, 0, 0, 0xB8, 0, - 0, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, 0x24, 0x10, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 0, -0xC, 0, 4, -0x10, 0, 0x5E, -1, -0x2D, 0, 1, - 0xBF, -1, 0xB1, 0, 1, -0x31, -1, 0x60, 0, 0, 0x5E, -1, -0x2D, 0, 0, 0, - 0, 0, 0, 0, 8, 0xBB, -0xC, 0, 0, 0x5E, -1, -0x2D, 0, 1, 0xBF, -1, - 0xB1, 0, 0, 0x9F, -2, 0x9F, 0, 0, 0, 0, 0, 0, 0, 0xB, -1, -0x10, - 8, 0xB9, -1, -0x1B, 0, 0, 0x5E, -1, -0x2D, 0, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, 0xB9, -1, -0xA, 0, 1, -0x31, -1, 0x60, 0, 0xB, -1, -0x10, 8, - 0xBB, -0xC, 0, 0xB, 0x80, 0, 0x8B, 0, 0, 0x3D, -1, -0x1A, 0, 0xB, -1, -0x10, - 0, 0x4F, 0, 0, 0x6E, -1, -0x2D, 0, 8, 0xB9, -1, -0xA, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 7, -0xF, 0, 4, -0x10, 2, -0x19, 1, 0x9E, 0x10, 6, - -0x1D, 2, -0x29, 0, 9, 0xA1, 7, -0xE, 0, 2, -0x19, 1, 0x9E, 0x10, 0, 0, - 0, 0, 0, 0, 8, -8, 0, 0, 2, -0x19, 1, 0x9E, 0x10, 6, -0x1D, 2, - -0x29, 0, 6, -0x1C, 4, -0x11, 0, 0, 0, 0, 0, 0, 0, 3, -0x37, 0x40, - 8, -7, 0x11, 0xAD, 0, 2, -0x19, 1, 0x9E, 0x10, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, -7, 0x11, 0xAD, 0, 9, 0xA1, 7, -0xE, 0, 3, -0x37, 0x40, 8, - -8, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 0, -0x27, 0x11, 0x9E, 0, 3, -0x37, 0x40, - 0, 0x4F, 0, 2, -9, 1, 0x9E, 0x10, 8, -7, 0x11, 0xAD, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, -0x25, 0xBB, -0x31, 0x80, 0, 4, -0x10, 8, 0x90, 0, 0xD, 0x60, 2, - 0x30, 0, -0x38, 0, 0xB, 0xA1, 0, 0x41, 0, 8, 0x90, 0, 0xD, 0x60, 0, 0, - 0, 0, 0, 0, 8, -0x30, 0, 0, 8, 0x90, 0, 0xD, 0x60, 2, 0x30, 0, - -0x38, 0, 0xC, 0x80, 0, 0x7F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 8, -0x30, 0, 0x4F, 0, 8, 0x90, 0, 0xD, 0x60, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, -0x30, 0, 0x4F, 0, 0xB, 0xA1, 0, 0x41, 0, 0, 0xB8, 0, 8, - -0x30, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 5, -0xF, 0, 0x1B, 0x30, 0, 0xB8, 0, - 0, 0x4F, 0, 8, 0xC0, 0, 0xE, 0x60, 8, -0x30, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0xB8, 0x88, 0x85, 0, 0, 4, -0x10, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, - 0x7B, -0x21, -0x18, 0, 3, -0x11, 0xB7, 0x20, 0, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, 0, - 0, 0, 0, 0, 8, 0xB0, 0, 0, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, 0x7B, -0x21, - -0x18, 0, 0xF, 0x40, 0, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 8, 0xB0, 0, 0x4F, 0, 0xB, -0x25, 0xBB, 0xBE, 0x80, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 3, -0x11, 0xB7, 0x20, 0, 0, 0xB8, 0, 8, - 0xB0, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 8, 0xB0, 0, 0, 0, 0, 0xB8, 0, - 0, 0x4F, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 0xB, 0xB8, 0x88, 0x88, 0x40, 9, - -0x18, 0x52, 0xB8, 0, 0, 0x15, 0x8D, -0xC, 0, 0xB, 0xB8, 0x88, 0x88, 0x40, 0, 0, - 0, 0, 0, 0, 8, 0xB0, 0, 0, 0xB, 0xB8, 0x88, 0x88, 0x40, 9, -0x18, 0x52, - 0xB8, 0, 0xF, 0x40, 0, 0x4F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 8, 0xB0, 0, 0x4F, 0, 0xB, 0xB8, 0x88, 0x88, 0x40, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 0, 0x15, 0x8D, -0xC, 0, 0, 0xB8, 0, 8, - 0xB0, 0, 0, 0xB, 0x80, 0, 0x8B, 0, 8, 0xB0, 0, 0, 0, 0, 0xB8, 0, - 0, 0x4F, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 8, 0xA0, 0, 7, 0x40, 0xF, - 0x50, 0, -0x28, 0, 8, 0x20, 0, -0x38, 0, 8, 0xA0, 0, 7, 0x40, 0, 0, - 0, 0, 0, 0, 8, 0xB0, 0, 0, 8, 0xA0, 0, 7, 0x40, 0xF, 0x50, 0, - -0x28, 0, 0xC, 0x80, 0, 0x8F, 0, 0, 0, 0, 0, 0, 0, 0, 0xB8, 0, - 8, 0xB0, 0, 0x4F, 0, 8, 0xA0, 0, 7, 0x40, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 8, 0x20, 0, -0x38, 0, 0, 0xB8, 0, 8, - 0xB0, 0, 0, 0xB, 0x80, 0, 0xAB, 0, 6, -0x20, 0, 0x1B, 0x30, 0, 0xB8, 0, - 0, 0x4F, 0, 9, 0xB0, 0, 0x1F, 0x50, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 3, -9, 1, 0x9F, 0x20, 0xD, - 0x90, 0x29, -8, 0, 0xB, 0xA1, 4, -0x1A, 0, 3, -9, 1, 0x9F, 0x20, 0, 0, - 0, 0, 0, 0, 8, 0xB0, 0, 0, 3, -9, 1, 0x9F, 0x20, 0xD, 0x90, 0x29, - -8, 0, 8, -0x1C, 4, -0x11, 0, 0, 0, 0, 0, 0, 0, 0, 0xBA, 0x40, - 8, 0xB0, 0, 0x4F, 0, 3, -9, 1, 0x9F, 0x20, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 0xB, 0xA1, 4, -0x1A, 0, 0, 0xBA, 0x40, 8, - 0xB0, 0, 0, 9, -0x2E, 7, -5, 0, 1, -0x17, 0x11, 0x9D, 0, 0, 0xBA, 0x40, - 0, 0x4F, 0, 4, -9, 1, 0x9D, 0, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xB, 0x80, 0, 0, 0, 0, 4, -0x10, 0, 0x6E, -1, -0x1A, 0, 6, - -1, -8, 0x8F, 0x40, 3, -0x11, -1, 0x90, 0, 0, 0x6E, -1, -0x1A, 0, 0, 0, - 0, 0, 0, 0, 8, 0xB0, 0, 0, 0, 0x6E, -1, -0x1A, 0, 6, -1, -8, - 0x8F, 0x40, 0, 0x9F, -2, 0x7F, 0, 0, 0, 0, 0, 0, 0, 0, 0x8F, -0x10, - 8, 0xB0, 0, 0x4F, 0, 0, 0x6E, -1, -0x1A, 0, 0, 0, 0, 0, 0, 0, - 0x4F, 0, 8, 0xB0, 0, 0x4F, 0, 3, -0x11, -1, 0x90, 0, 0, 0x8F, -0x10, 8, - 0xB0, 0, 0, 3, -0x11, -4, 0x8B, 0, 0, 0x3E, -1, -0x2D, 0, 0, 0x8F, -0x10, - 0, 0x4F, 0, 0, 0x6F, -1, -0x2D, 0, 8, 0xB0, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x44, 0, 0, 0, - 0x14, 0x20, 4, 0x10, 0, 4, 0x42, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x44, 0, 0, 0, 0x14, 0x20, - 4, 0x10, 0, 2, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0x30, - 0, 0, 0, 0, 0, 0, 0, 0x44, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 4, 0x42, 0, 0, 0, 4, 0x30, 0, - 0, 0, 0, 0, 4, 0x30, 0, 0, 0, 0, 0x44, 0, 0, 0, 4, 0x30, - 0, 0, 0, 0, 1, 0x43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0xB0, 0, - 0, 0, 0, 0, 0, 0, 5, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3B, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3B, 0, 3, 0xB0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xE, 0xA6, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x4F, 0, 0, 0, 0, - 0, 0, 0, 0xB8, 0, 0, 0, 0, 0, 0, 0, 0x28, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0x41, 0, 0x43, 0, 0, 0, 2, 0x42, 0, 0, 0, 0, - 0x24, 0x10, 0, 0, 0, 0, 0, 0, 0, 2, 0x42, 0, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0, 0, 0x44, 0, 0, 0, 0, - 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0x41, 0x4F, 0, 0, 0, 0x44, - 0, 0, 0, 0xB8, 0, 0, 2, 0x42, 0, 0, 0, 0, 0, 4, -0x10, 0, - 3, 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x7E, -2, 0x6C, -1, 0x90, 0, 1, 0xBF, -1, 0xB1, 0, 8, 0xB9, - -1, -0xA, 0, 0xB, 0x80, 0, 0x8B, 0, 1, 0xBF, -1, 0xB1, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, -1, -5, 0, 0, 0x6E, -1, -0x2D, 0, 8, 0xBB, - -0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0x9F, -2, 0x9F, 0, 0, 0x5E, -1, - -0x2D, 0, 0xB, -1, -0x10, 1, 0xBF, -1, 0xB1, 0, 0, 0x4F, 0, 4, -0x10, 1, - -0x31, -1, 0x60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, -0x2E, 0x1B, -9, 5, -0xE, 0, 6, -0x1D, 2, -0x29, 0, 8, -7, - 0x11, 0xAD, 0, 0xB, 0x80, 0, 0x8B, 0, 6, -0x1D, 2, -0x29, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0x4F, 0x73, 0, 2, -9, 1, 0x9E, 0x10, 8, -8, - 0, 0, 0, 0, 0, 0, 0, 0, 6, -0x1C, 4, -0x11, 0, 2, -0x19, 1, - 0x9E, 0x10, 3, -0x37, 0x40, 6, -0x1D, 2, -0x29, 0, 0, 0x4F, 0, 4, -0x10, 9, - 0xA1, 7, -0xE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x60, 8, 0xC0, 0, -0xC, 0, 2, 0x30, 0, -0x38, 0, 8, -0x30, - 0, 0x4F, 0, 0xB, 0x80, 0, 0x8B, 0, 2, 0x30, 0, -0x38, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 8, 0xC0, 0, 0xE, 0x60, 8, -0x30, - 0, 0, 0, 0, 0, 0, 0, 0, 0xC, 0x80, 0, 0x7F, 0, 8, 0x90, 0, - 0xD, 0x60, 0, 0xB8, 0, 2, 0x30, 0, -0x38, 0, 0, 0x4F, 0, 4, -0x10, 0xB, - 0xA1, 0, 0x41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 0, 0x7B, -0x21, -0x18, 0, 8, 0xB0, - 0, 0x4F, 0, 0xB, 0x80, 0, 0x8B, 0, 0, 0x7B, -0x21, -0x18, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, - 0, 0, 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x4F, 0, 0xB, -0x25, 0xBB, - 0xBE, 0x80, 0, 0xB8, 0, 0, 0x7B, -0x21, -0x18, 0, 0, 0x4F, 0, 4, -0x10, 3, - -0x11, 0xB7, 0x20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 9, -0x18, 0x52, 0xB8, 0, 8, 0xB0, - 0, 0x4F, 0, 0xB, 0x80, 0, 0x8B, 0, 9, -0x18, 0x52, 0xB8, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0xB, 0x80, 0, 0xB, 0x80, 8, 0xB0, - 0, 0, 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0x4F, 0, 0xB, 0xB8, 0x88, - 0x88, 0x40, 0, 0xB8, 0, 9, -0x18, 0x52, 0xB8, 0, 0, 0x4F, 0, 4, -0x10, 0, - 0x15, 0x8D, -0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 0xF, 0x50, 0, -0x28, 0, 8, 0xB0, - 0, 0x4F, 0, 0xB, 0x80, 0, 0xAB, 0, 0xF, 0x50, 0, -0x28, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 9, 0xB0, 0, 0x1F, 0x50, 8, 0xB0, - 0, 0, 0, 0, 0, 0, 0, 0, 0xC, 0x80, 0, 0x8F, 0, 8, 0xA0, 0, - 7, 0x40, 0, 0xB8, 0, 0xF, 0x50, 0, -0x28, 0, 0, 0x4F, 0, 4, -0x10, 8, - 0x20, 0, -0x38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 0xD, 0x90, 0x29, -8, 0, 8, 0xB0, - 0, 0x4F, 0, 9, -0x2E, 7, -5, 0, 0xD, 0x90, 0x29, -8, 0, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 4, -9, 1, 0x9D, 0, 8, 0xB0, - 0, 0, 0, 0, 0, 0, 0, 0, 8, -0x1C, 4, -0x11, 0, 3, -9, 1, - 0x9F, 0x20, 0, 0xBA, 0x40, 0xD, 0x90, 0x29, -8, 0, 0, 0x4F, 0, 4, -0x10, 0xB, - 0xA1, 4, -0x1A, 0, 4, 0x10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0xF, 0x40, 8, 0xB0, 0, -0xC, 0, 6, -1, -8, 0x8F, 0x40, 8, 0xB0, - 0, 0x4F, 0, 3, -0x11, -4, 0x8B, 0, 6, -1, -8, 0x8F, 0x40, 4, -0x10, 0, - 0, 0, 0, 0, 0, 0, 0xF, 0x40, 0, 0, 0x6F, -1, -0x2D, 0, 8, 0xB0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x9F, -2, 0x7F, 0, 0, 0x6E, -1, - -0x1A, 0, 0, 0x8F, -0x10, 6, -1, -8, 0x8F, 0x40, 0, 0x4F, 0, 4, -0x10, 3, - -0x11, -1, 0x90, 0, 0xF, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x14, 0x20, 4, 0x10, 0, 0, - 0, 0, 0, 0, 4, 0x30, 0, 0, 0, 0x14, 0x20, 4, 0x10, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x43, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0x40, 0, 0, 0, 0, 0x44, - 0, 0, 0, 4, 0x30, 0, 0x14, 0x20, 4, 0x10, 0, 0, 0, 0, 0, 0, - 4, 0x42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }; u8 D_801E1800[0x600]; From 7f9097188f1b20624958e2b4ec4e2d9632d0ae49 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 11:13:02 +0200 Subject: [PATCH 014/150] rm n64dd.bss.s --- data/n64dd.bss.s | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 data/n64dd.bss.s diff --git a/data/n64dd.bss.s b/data/n64dd.bss.s deleted file mode 100644 index 9fe5cdf89a1..00000000000 --- a/data/n64dd.bss.s +++ /dev/null @@ -1,2 +0,0 @@ -.bss -.space 0xDC80 From d02904d26983b522eff92b40dc20b70db594b49d Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 11:21:42 +0200 Subject: [PATCH 015/150] memory_utils.h --- include/functions.h | 2 -- include/memory_utils.h | 4 ++-- src/code/z_demo.c | 2 -- src/code/z_message.c | 2 -- src/code/z_sram.c | 2 -- src/overlays/gamestates/ovl_file_choose/z_file_choose.c | 2 -- 6 files changed, 2 insertions(+), 12 deletions(-) diff --git a/include/functions.h b/include/functions.h index 9ad76444092..3206c7859e1 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3,8 +3,6 @@ #include "z64.h" -void* MemCopy(void* dest, void* src, s32 size); - void func_800ACE70(struct_801664F0* this); void func_800ACE90(struct_801664F0* this); void func_800ACE98(struct_801664F0* this, Gfx** gfxp); diff --git a/include/memory_utils.h b/include/memory_utils.h index 7a8d9aca91b..f214818c131 100644 --- a/include/memory_utils.h +++ b/include/memory_utils.h @@ -3,7 +3,7 @@ #include "ultra64.h" -void* MemCpy(void* dest, const void* src, s32 len); -void* MemSet(void* dest, s32 val, s32 len); +void* MemCopy(void* dest, void* src, s32 size); +void* MemSet(void* dest, s32 val, s32 size); #endif diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 4e4295a34be..16233d69605 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -30,8 +30,6 @@ #include "player.h" #include "save.h" -#include "functions.h" - #include "assets/scenes/indoors/tokinoma/tokinoma_scene.h" #include "assets/scenes/overworld/ganon_tou/ganon_tou_scene.h" diff --git a/src/code/z_message.c b/src/code/z_message.c index 15a7aab5608..cd8e36e26ff 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -24,8 +24,6 @@ #include "player.h" #include "save.h" -#include "functions.h" - #include "assets/textures/parameter_static/parameter_static.h" #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ diff --git a/src/code/z_sram.c b/src/code/z_sram.c index 9095b3817e5..84662ccc6b6 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -17,8 +17,6 @@ #include "scene.h" #include "ss_sram.h" -#include "functions.h" - #define SLOT_SIZE (sizeof(SaveContext) + 0x28) #define CHECKSUM_SIZE (sizeof(Save) / 2) 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 9448e702e60..618d48c3ab5 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -34,8 +34,6 @@ #include "ss_sram.h" #include "view.h" -#include "functions.h" - #if OOT_PAL_N64 #include "assets/objects/object_mag/object_mag.h" #endif From 8020cb7f77e9f010e203daca8195f1afb89b1846 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 11:31:46 +0200 Subject: [PATCH 016/150] make vis.h --- include/functions.h | 16 ---------------- include/{z64.h => vis.h} | 14 ++++++++++++-- src/code/code_800ACE70.c | 4 +--- src/code/code_800AD920.c | 4 +--- src/code/game.c | 4 +--- src/code/z_play.c | 8 +++----- src/code/z_vismono.c | 4 +--- 7 files changed, 19 insertions(+), 35 deletions(-) delete mode 100644 include/functions.h rename include/{z64.h => vis.h} (62%) diff --git a/include/functions.h b/include/functions.h deleted file mode 100644 index 3206c7859e1..00000000000 --- a/include/functions.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef FUNCTIONS_H -#define FUNCTIONS_H - -#include "z64.h" - -void func_800ACE70(struct_801664F0* this); -void func_800ACE90(struct_801664F0* this); -void func_800ACE98(struct_801664F0* this, Gfx** gfxp); -void VisMono_Init(VisMono* this); -void VisMono_Destroy(VisMono* this); -void VisMono_Draw(VisMono* this, Gfx** gfxp); -void func_800AD920(struct_80166500* this); -void func_800AD950(struct_80166500* this); -void func_800AD958(struct_80166500* this, Gfx** gfxp); - -#endif diff --git a/include/z64.h b/include/vis.h similarity index 62% rename from include/z64.h rename to include/vis.h index 5b8e3af0bff..561dfe95ce6 100644 --- a/include/z64.h +++ b/include/vis.h @@ -1,5 +1,5 @@ -#ifndef Z64_H -#define Z64_H +#ifndef VIS_H +#define VIS_H #include "ultra64.h" #include "color.h" @@ -29,4 +29,14 @@ typedef struct struct_80166500 { /* 0x08 */ Color_RGBA8_u32 envColor; } struct_80166500; // size = 0x10 +void func_800ACE70(struct_801664F0* this); +void func_800ACE90(struct_801664F0* this); +void func_800ACE98(struct_801664F0* this, Gfx** gfxp); +void VisMono_Init(VisMono* this); +void VisMono_Destroy(VisMono* this); +void VisMono_Draw(VisMono* this, Gfx** gfxp); +void func_800AD920(struct_80166500* this); +void func_800AD950(struct_80166500* this); +void func_800AD958(struct_80166500* this, Gfx** gfxp); + #endif diff --git a/src/code/code_800ACE70.c b/src/code/code_800ACE70.c index 27878d5807c..aa53aeb36fc 100644 --- a/src/code/code_800ACE70.c +++ b/src/code/code_800ACE70.c @@ -1,8 +1,6 @@ #include "ultra64.h" #include "gfx.h" - -#include "functions.h" -#include "z64.h" +#include "vis.h" // Note : This file is related to z_vismono, the original name was probably z_vis diff --git a/src/code/code_800AD920.c b/src/code/code_800AD920.c index 62b9b54c5bc..e8ab7d04773 100644 --- a/src/code/code_800AD920.c +++ b/src/code/code_800AD920.c @@ -1,8 +1,6 @@ #include "ultra64.h" #include "gfx.h" - -#include "functions.h" -#include "z64.h" +#include "vis.h" // Note : This file is related to z_vismono, the original name was probably z_vis diff --git a/src/code/game.c b/src/code/game.c index 3ddf9c8c436..4dafafc5657 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -30,9 +30,7 @@ #include "dma.h" #include "game.h" #include "play_state.h" - -#include "functions.h" -#include "z64.h" +#include "vis.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" diff --git a/src/code/z_play.c b/src/code/z_play.c index c306143b8bc..894d9a520e4 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -45,12 +45,10 @@ #include "play_state.h" #include "player.h" #include "save.h" +#include "vis.h" -#include "functions.h" -#include "z64.h" - -#pragma increment_block_number "gc-eu:226 gc-eu-mq:226 gc-jp:226 gc-jp-ce:226 gc-jp-mq:226 gc-us:226 gc-us-mq:226" \ - "ique-cn:226 ntsc-1.0:226 ntsc-1.1:226 ntsc-1.2:226 pal-1.0:226 pal-1.1:226" +#pragma increment_block_number "gc-eu:227 gc-eu-mq:227 gc-jp:227 gc-jp-ce:227 gc-jp-mq:227 gc-us:227 gc-us-mq:227" \ + "ique-cn:227 ntsc-1.0:227 ntsc-1.1:227 ntsc-1.2:227 pal-1.0:227 pal-1.1:227" TransitionTile gTransitionTile; s32 gTransitionTileState; diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index 90446d59be1..c21c2889471 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -7,9 +7,7 @@ #include "attributes.h" #include "gfx.h" #include "gfxalloc.h" - -#include "functions.h" -#include "z64.h" +#include "vis.h" // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into From 5f08f822848d9bfe6825e520d75f153513b3360e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 11:32:34 +0200 Subject: [PATCH 017/150] remove -j from make -C tools --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index be53ed4d801..b3c0ab1e95c 100644 --- a/Makefile +++ b/Makefile @@ -862,7 +862,7 @@ venv: $(PYTHON) -m pip install -U -r requirements.txt setup: venv - $(MAKE) -C tools -j + $(MAKE) -C tools $(PYTHON) tools/decompress_baserom.py $(VERSION) $(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 $(EXTRACTED_DIR)/baserom -v $(VERSION) $(PYTHON) -m tools.assets.extract $(EXTRACTED_DIR)/baserom $(EXTRACTED_DIR) -v $(VERSION) -j$(N_THREADS) From 20b37b7bf07ff2f2180526830d48ed73ad0e6068 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 12:38:00 +0200 Subject: [PATCH 018/150] fix warnings --- include/ultra64/gu.h | 4 ++- src/n64dd/libleo/leocmdex.c | 2 +- src/n64dd/libleo/leomseq_tbl.c | 2 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 2 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 2 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h | 2 +- .../ovl_Bg_Jya_Bigmirror/z_bg_jya_bigmirror.c | 1 - .../z_bg_mori_rakkatenjo.c | 1 + .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.h | 2 +- src/overlays/actors/ovl_En_Boom/z_en_boom.h | 2 +- .../ovl_En_Diving_Game/z_en_diving_game.h | 2 +- src/overlays/actors/ovl_En_Dog/z_en_dog.c | 2 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 4 +-- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 2 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 6 ++--- src/overlays/actors/ovl_En_Ru1/z_en_ru1.h | 1 + src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 2 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- .../actors/ovl_player_actor/z_player.c | 26 +++++++++---------- 21 files changed, 37 insertions(+), 34 deletions(-) diff --git a/include/ultra64/gu.h b/include/ultra64/gu.h index d0548b3a8d4..7b640bf3670 100644 --- a/include/ultra64/gu.h +++ b/include/ultra64/gu.h @@ -5,7 +5,9 @@ #define GU_PI 3.1415926 -#define FTOFIX32(x) (s32)((x) * (f32)0x00010000) +#ifndef FTOFIX32 +# define FTOFIX32(x) (s32)((x) * (f32)0x00010000) +#endif #define FIX32TOF(x) ((f32)(x) * (1.0f / (f32)0x00010000)) #define ROUND(x) (s32)(((x) >= 0.0) ? ((x) + 0.5) : ((x) - 0.5)) diff --git a/src/n64dd/libleo/leocmdex.c b/src/n64dd/libleo/leocmdex.c index 17b8b130071..c02699a0f38 100644 --- a/src/n64dd/libleo/leocmdex.c +++ b/src/n64dd/libleo/leocmdex.c @@ -4,7 +4,7 @@ extern u16 LEOrw_flags; -void (*cmd_tbl[])() = { +void (*cmd_tbl[])(void) = { NULL, leoClr_queue, leoInquiry, leoTest_unit_rdy, leoRezero, leoRead, leoWrite, leoSeek, leoStart_stop, leoRd_capacity, leoTranslate, leoMode_sel, leoReadDiskId, leoReadTimer, leoSetTimer, leoClr_reset, diff --git a/src/n64dd/libleo/leomseq_tbl.c b/src/n64dd/libleo/leomseq_tbl.c index ce71288fadf..6be4e7560ba 100644 --- a/src/n64dd/libleo/leomseq_tbl.c +++ b/src/n64dd/libleo/leomseq_tbl.c @@ -15,7 +15,7 @@ STATIC const u32 wt_mseq_code[0x10] = { }; void leoSet_mseq(u16 rwmode) { - u32* tbl; + const u32* tbl; u32 sct_byte_x; u32 sct_byte_u; u8 i; diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 1338740ad35..cc7eeac1a50 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -52,7 +52,7 @@ static ColliderQuadInit sQuadInit = { ACELEM_NONE, OCELEM_NONE, }, - { 0 }, + { 0.0f, 0.0f, 0.0f }, }; static Vec3f sUnusedVec1 = { 0.0f, 0.5f, 0.0f }; 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 262c7f101b6..da1bb832d2d 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 @@ -45,7 +45,7 @@ typedef enum BgDdanJdState { STATE_GO_BOTTOM, STATE_GO_MIDDLE_FROM_BOTTOM, STATE_GO_MIDDLE_FROM_TOP, - STATE_GO_TOP, + STATE_GO_TOP } BgDdanJdState; #define MOVE_HEIGHT_MIDDLE 140.0f diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h index 19411b379ee..41efb902a93 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.h @@ -15,4 +15,4 @@ typedef struct BgHidanSyoku { /* 0x016A */ s16 unk_16A; } BgHidanSyoku; // size = 0x016C -#endif; +#endif 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 1740a3bad9d..1d4ebe7077b 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 @@ -42,7 +42,6 @@ typedef struct struct_80893EF4 { /* 0x0C */ s16 unkC; /* 0x0E */ s16 unkE; /* 0x10 */ s16 unk10; - /* 0x12 */ char pad12[2]; } struct_80893EF4; static struct_80893EF4 D_80893EF4[2] = { { { -560.0f, 1743.0f, -310.0f }, -0xFF, 0x4000, 0x8000 }, diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 3d68864291b..a5ed33f3f8d 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -76,6 +76,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) { PRINTF(T("Warning : セット位置が変更されています。プログラムを修正しましょう。\n", "Warning : The set position has been changed. Let's fix the program.\n")); } + //! @bug rot.y is a s16, it will never equal 0x8000 if (this->dyna.actor.home.rot.y != 0x8000) { PRINTF(T("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n", "Warning : The set Angle has changed. Let's fix the program.\n")); 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 4dfbb4efbfe..3fd0960883c 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 @@ -9,7 +9,7 @@ typedef enum BgSpot03TakiState { WATERFALL_OPENING_IDLE, WATERFALL_OPENING_ANIMATED, WATERFALL_OPENED, - WATERFALL_CLOSING, + WATERFALL_CLOSING } BgSpot03TakiState; struct BgSpot03Taki; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.h b/src/overlays/actors/ovl_En_Boom/z_en_boom.h index 3a3506b8e2d..49f38619a5b 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -16,7 +16,7 @@ typedef struct EnBoom { /* 0x01D0 */ Actor* grabbed; // actor grabbed by the boomerang /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 /* 0x01D5 */ u8 activeTimer; // increments once every update - /* 0x01D8 */ u32 effectIndex; // set by Effect_Add + /* 0x01D8 */ s32 effectIndex; // set by Effect_Add /* 0x01DC */ WeaponInfo weaponInfo; /* 0x01F8 */ EnBoomActionFunc actionFunc; } EnBoom; // size = 0x01FC 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 70261f97580..b655626f018 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 @@ -64,7 +64,7 @@ typedef enum EnDivingGameState { typedef enum EnDivingGameRupeePhase { /* 0 */ ENDIVINGGAME_RUPEE_PHASE_NONE, // No rupees underwater yet, but they might be thrown. /* 1 */ ENDIVINGGAME_RUPEE_PHASE_SWITCHING_CAM, // Switching to underwater view. - /* 2 */ ENDIVINGGAME_RUPEE_PHASE_SINKING, // Rupees are spawned and sinking, player can grab them. + /* 2 */ ENDIVINGGAME_RUPEE_PHASE_SINKING // Rupees are spawned and sinking, player can grab them. } EnDivingGameRupeePhase; #endif 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 e1516cd1bfd..96ff5b3ff9a 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -92,7 +92,7 @@ typedef enum DogBehavior { /* 0x03 */ DOG_SIT, /* 0x04 */ DOG_SIT_2, /* 0x05 */ DOG_BOW, - /* 0x06 */ DOG_BOW_2, + /* 0x06 */ DOG_BOW_2 } DogBehavior; void EnDog_PlayWalkSFX(EnDog* this) { diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h index 99a41900547..c8a375d2b3c 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.h @@ -26,7 +26,7 @@ typedef enum EnExRuppyType { /* 1 */ ENEXRUPPY_TYPE_BOMB_LARGE, // Giant pink Rupee that explodes when you touch it /* 2 */ ENEXRUPPY_TYPE_BOMB_SMALL, // Smaller version of the same /* 3 */ ENEXRUPPY_TYPE_HYRULE_COURTYARD, // Spawned by the guard in Hyrule courtyard - /* 4 */ ENEXRUPPY_TYPE_SHOOTING_GALLERY_PROGRESS, // Progress markers in the shooting gallery + /* 4 */ ENEXRUPPY_TYPE_SHOOTING_GALLERY_PROGRESS // Progress markers in the shooting gallery } EnExRuppyType; #endif 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 6d5749a424a..c96f5cc1ed3 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -334,7 +334,7 @@ s32 EnFd_ColliderCheck(EnFd* this, PlayState* play) { */ s32 EnFd_CanSeeActor(EnFd* this, Actor* actor, PlayState* play) { CollisionPoly* colPoly; - u32 bgId; + s32 bgId; Vec3f colPoint; s16 angle; s32 pad; @@ -422,7 +422,7 @@ Vec3f* EnFd_GetPosAdjAroundCircle(Vec3f* dst, EnFd* this, f32 radius, s16 dir) { s32 EnFd_ShouldStopRunning(EnFd* this, PlayState* play, f32 radius, s16* runDir) { CollisionPoly* poly; - u32 bgId; + s32 bgId; Vec3f colPoint; Vec3f pos; 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 12951a209e5..d1efbfcf616 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -83,7 +83,7 @@ static Vec3f sMtxSrc = { typedef enum EnFuFace { /* 0x00 */ FU_FACE_CALM, - /* 0x01 */ FU_FACE_MAD, + /* 0x01 */ FU_FACE_MAD } EnFuFace; void EnFu_Init(Actor* thisx, PlayState* play) { 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 8e1e22ce68e..afa6ee7fa34 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -111,7 +111,7 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) { s32 EnFw_PlayerInRange(EnFw* this, PlayState* play) { Player* player = GET_PLAYER(play); CollisionPoly* poly; - u32 bgId; + s32 bgId; Vec3f collisionPos; if (this->actor.xzDistToPlayer > 300.0f) { 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 f2be2bc220f..7ccc126c287 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -1229,7 +1229,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { f32 playSpeedABS; if (Math_Vec3f_DistXZ(&this->waypointPos, &this->actor.world.pos) <= 8.0f || - Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f) { + (Rand_ZeroOne() < 0.1f && Math_Vec3f_DistXZ(&this->actor.home.pos, &this->actor.world.pos) <= 4.0f)) { EnMb_SetupSpearPatrolTurnTowardsWaypoint(this, play); } else { Math_SmoothStepToF(&this->actor.speed, 0.59999996f, 0.1f, 1.0f, 0.0f); @@ -1242,7 +1242,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { yDistToPlayerAbs = (this->actor.yDistToPlayer >= 0.0f) ? this->actor.yDistToPlayer : -this->actor.yDistToPlayer; if (yDistToPlayerAbs <= 20.0f && EnMb_IsPlayerInCorridor(this, play)) { relYawTowardsPlayer = (this->actor.shape.rot.y - this->actor.yawTowardsPlayer); - if (ABS(relYawTowardsPlayer) <= 0x4000 || func_8002DDE4(play) != 0 && this->actor.xzDistToPlayer < 160.0f) { + if (ABS(relYawTowardsPlayer) <= 0x4000 || (func_8002DDE4(play) != 0 && this->actor.xzDistToPlayer < 160.0f)) { EnMb_FindWaypointTowardsPlayer(this, play); Actor_PlaySfx(&this->actor, NA_SE_EN_MORIBLIN_VOICE); EnMb_SetupSpearPrepareAndCharge(this); @@ -1268,7 +1268,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, PlayState* play) { playSpeedABS = (this->skelAnime.playSpeed >= 0.0f) ? this->skelAnime.playSpeed : -this->skelAnime.playSpeed; if (prevFrame != (s32)this->skelAnime.curFrame) { if ((beforeCurFrame <= 1 && (s32)playSpeedABS + prevFrame >= 1) || - beforeCurFrame <= 20 && (s32)playSpeedABS + prevFrame >= 20) { + (beforeCurFrame <= 20 && (s32)playSpeedABS + prevFrame >= 20)) { Actor_PlaySfx(&this->actor, NA_SE_EN_MORIBLIN_WALK); } } 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 d3040686ae2..6e16bf247a5 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h @@ -126,6 +126,7 @@ typedef enum EnRu1Type { #if DEBUG_FEATURES /* 10 */ ENRU1_TYPE_DEBUG = 10, #endif + ENRU1_TYPE_MAX } EnRu1Type; typedef enum EnRu1Eyes { 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 2c502abecf9..e1231a920c2 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -868,7 +868,7 @@ void EnRu2_StartSwimmingUp(EnRu2* this, PlayState* play) { } void EnRu2_EndSwimmingUp(EnRu2* this, PlayState* play) { - if (this->swimmingUpFrame > (((u16)(kREG(3) + 0x28)) + ((u16)(kREG(2) + 0x96)) & 0xFFFF)) { + if (this->swimmingUpFrame > (((u16)(kREG(3) + 0x28) + (u16)(kREG(2) + 0x96)) & 0xFFFF)) { Actor_Kill(&this->actor); } } 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 e9a3f83be56..3f3b14237bc 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -121,7 +121,7 @@ typedef enum ShellbladeBehavior { /* 0x01 */ SHELLBLADE_WAIT_CLOSED, /* 0x02 */ SHELLBLADE_WAIT_OPEN, /* 0x03 */ SHELLBLADE_LUNGE, - /* 0x04 */ SHELLBLADE_BOUNCE, + /* 0x04 */ SHELLBLADE_BOUNCE } ShellbladeBehavior; void EnSb_Init(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 2043669cb09..99398512842 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -110,10 +110,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) -#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) +#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; @@ -794,9 +794,9 @@ static GetItemEntry sGetItemTable[] = { // GI_BULLET_BAG_50 GET_ITEM(ITEM_BULLET_BAG_50, OBJECT_GI_DEKUPOUCH, GID_BULLET_BAG_50, 0x6C, 0x80, CHEST_ANIM_LONG), // GI_ICE_TRAP - { ITEM_NONE }, + { ITEM_NONE, 0, 0, 0, 0 }, // GI_TEXT_0 - { ITEM_NONE }, + { ITEM_NONE, 0, 0, 0, 0 }, }; #define GET_PLAYER_ANIM(group, type) D_80853914[group * PLAYER_ANIMTYPE_MAX + type] @@ -5357,7 +5357,7 @@ f32 func_8083973C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3) { * Point B of the line is at player's world position offset by the entire `offset` vector. * Point A and B are always at the same height, meaning this is a horizontal line test. */ -s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, u32* bgId, +s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId, Vec3f* posResult) { Vec3f posA; Vec3f posB; @@ -5750,7 +5750,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { //! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope. if ((this->actor.depthInWater < -80.0f) && (ABS(this->floorPitch) < 0xAAA) && (ABS(this->floorPitchAlt) < 0xAAA)) { CollisionPoly* sp84; - u32 sp80; + s32 sp80; Vec3f sp74; Vec3f sp68; f32 temp1; @@ -7682,7 +7682,7 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { CollisionPoly* wallPoly; - u32 wallBgId; + s32 wallBgId; Vec3f sp6C; Vec3f sp60; Vec3f sp54; @@ -9066,7 +9066,7 @@ void func_80842D20(PlayState* play, Player* this) { s32 func_80842DF4(PlayState* play, Player* this) { f32 phi_f2; CollisionPoly* groundPoly; - u32 bgId; + s32 bgId; Vec3f sp68; Vec3f sp5C; Vec3f baseToTip; @@ -11190,7 +11190,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { CollisionPoly* wallPoly; - u32 wallBgId; + s32 wallBgId; s16 yawDiff; s32 pad; @@ -11242,7 +11242,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { f32 yDistToLedge; CollisionPoly* ledgeFloorPoly; CollisionPoly* poly; - u32 bgId; + s32 bgId; Vec3f ledgeCheckPos; f32 ledgePosY; f32 ceillingPosY; @@ -12723,7 +12723,7 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { Vec3f sp5C; f32 temp2; CollisionPoly* sp54; - u32 sp50; + s32 sp50; Vec3f sp44; Vec3f sp38; @@ -13099,7 +13099,7 @@ int func_8084C89C(PlayState* play, Player* this, s32 arg2, f32* arg3) { Vec3f sp40; Vec3f sp34; CollisionPoly* sp30; - u32 sp2C; + s32 sp2C; sp50 = rideActor->actor.world.pos.y + 20.0f; sp4C = rideActor->actor.world.pos.y - 20.0f; From 9655cda17935a04698927170d309ae09001ed54b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 13:24:29 +0200 Subject: [PATCH 019/150] format --- src/overlays/actors/ovl_player_actor/z_player.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 99398512842..18ff635a2d8 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -110,10 +110,10 @@ typedef enum AnimSfxType { #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) -#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame) & 0x7FF))) +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) -#define ANIMSFX_GET_TYPE(data) ((data) & 0x7800) -#define ANIMSFX_GET_FRAME(data) ((data) & 0x7FF) +#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) +#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; From 9da31cbd1b960f4691dce5907c4f1dc97341f10c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 13:33:25 +0200 Subject: [PATCH 020/150] colliders cleanup: sJntSphInit, sJntSphElementsInit --- .../ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c | 6 +++--- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 6 +++--- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 15 ++++++++------- src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 14 ++++++++------ src/overlays/actors/ovl_En_Fish/z_en_fish.c | 8 ++++---- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 8 ++++---- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 8 ++++---- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 8 ++++---- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 6 +++--- 9 files changed, 41 insertions(+), 38 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 62553babe41..1fef30e28f2 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -37,7 +37,7 @@ ActorProfile Bg_Hidan_Rsekizou_Profile = { /**/ BgHidanRsekizou_Draw, }; -static ColliderJntSphElementInit D_8088CC80[6] = { +static ColliderJntSphElementInit sJntSphElementsInit[6] = { { { 0, { 0x20000000, 1, 4 }, { 0, 0, 0 }, 0x19, 0, 0 }, { 1, { { 0, 0x1E, 0x28 }, 0x19 }, 0x64 }, @@ -63,7 +63,7 @@ static ColliderJntSphElementInit D_8088CC80[6] = { { 1, { { 0x50, 0x23, -0x82 }, 0x2A }, 0x64 }, }, }; -ColliderJntSphInit D_8088CD58 = { { 0xA, 0x11, 0, 0, 0x20, 0 }, 6, D_8088CC80 }; +static ColliderJntSphInit sJntSphInit = { { 0xA, 0x11, 0, 0, 0x20, 0 }, 6, sJntSphElementsInit }; InitChainEntry D_8088CD68[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 400, ICHAIN_CONTINUE), @@ -87,7 +87,7 @@ void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &sp30); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); Collider_InitJntSph(play, &this->unk168); - Collider_SetJntSph(play, &this->unk168, &this->dyna.actor, &D_8088CD58, this->unk188); + Collider_SetJntSph(play, &this->unk168, &this->dyna.actor, &sJntSphInit, this->unk188); for (i = 0; i < 6; i++) { this->unk168.elements[i].dim.worldSphere.radius = this->unk168.elements[i].dim.modelSphere.radius; } diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index 9b33e10d702..44e12fe09c1 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -43,13 +43,13 @@ ActorProfile Bg_Jya_Haheniron_Profile = { /**/ BgJyaHaheniron_Update, /**/ BgJyaHaheniron_Draw, }; -static ColliderJntSphElementInit D_80898740[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { 0, { 0xFFCFFFFF, 0, 4 }, { 0, 0, 0 }, 1, 0, 0 }, { 0, { { 0, 0, 0 }, 0xA }, 0x64 }, }, }; -static ColliderJntSphInit D_80898764 = { { 0xA, 0x11, 1, 0, 0, 0 }, 1, D_80898740 }; +static ColliderJntSphInit sJntSphInit = { { 0xA, 0x11, 1, 0, 0, 0 }, 1, sJntSphElementsInit }; static s16 D_80898774[5] = { 5, 8, 0xB, 0xE, 0x11 }; static InitChainEntry D_80898780[5] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -15000, ICHAIN_CONTINUE), @@ -69,7 +69,7 @@ void func_808980C0(BgJyaHaheniron* this, PlayState* play) { s32 pad; Collider_InitJntSph(play, &this->unk150); - Collider_SetJntSph(play, &this->unk150, &this->actor, &D_80898764, this->unk170); + Collider_SetJntSph(play, &this->unk150, &this->actor, &sJntSphInit, this->unk170); } void func_80898114(PlayState* play, Vec3f* arg1, Vec3f* arg2) { 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 19e9ac39c15..906128d5952 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -53,7 +53,7 @@ ActorProfile En_Dekubaba_Profile = { /**/ EnDekubaba_Draw, }; -static ColliderJntSphElementInit D_809E8ECC[7] = { +static ColliderJntSphElementInit sJntSphElementsInit[7] = { { { ELEM_MATERIAL_UNK0, @@ -133,7 +133,7 @@ static ColliderJntSphElementInit D_809E8ECC[7] = { }, }; -static ColliderJntSphInit D_809E8FC8 = { +static ColliderJntSphInit sJntSphInit = { { COL_MATERIAL_HIT6, AT_ON | AT_TYPE_ENEMY, @@ -143,7 +143,7 @@ static ColliderJntSphInit D_809E8FC8 = { COLSHAPE_JNTSPH, }, 7, - D_809E8ECC, + sJntSphElementsInit, }; static CollisionCheckInfoInit D_809E8FD8 = { 2, 0x19, 0x19, 0xFF }; @@ -179,12 +179,13 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->unk17C, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->unk1D0, this->unk200, 8); Collider_InitJntSph(play, &this->unk238); - Collider_SetJntSph(play, &this->unk238, &this->actor, &D_809E8FC8, this->unk258); + Collider_SetJntSph(play, &this->unk238, &this->actor, &sJntSphInit, this->unk258); if (this->actor.params == 1) { this->unk230 = 2.50f; - for (var_a0 = 0; var_a0 < D_809E8FC8.count; var_a0++) { + for (var_a0 = 0; var_a0 < sJntSphInit.count; var_a0++) { this->unk238.elements[var_a0].dim.worldSphere.radius = - this->unk238.elements[var_a0].dim.modelSphere.radius = D_809E8ECC[var_a0].dim.modelSphere.radius * 2.5f; + this->unk238.elements[var_a0].dim.modelSphere.radius = + sJntSphElementsInit[var_a0].dim.modelSphere.radius * 2.5f; } if (!LINK_IS_ADULT) { D_809E9000.table[0x1B] = 4; @@ -195,7 +196,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { this->actor.attentionRangeType = ATTENTION_RANGE_2; } else { this->unk230 = 1.0f; - for (var_a0 = 0; var_a0 < D_809E8FC8.count; var_a0++) { + for (var_a0 = 0; var_a0 < sJntSphInit.count; var_a0++) { this->unk238.elements[var_a0].dim.worldSphere.radius = this->unk238.elements[var_a0].dim.modelSphere.radius; } if (!LINK_IS_ADULT) { 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 45a644b73d9..3f0394fa969 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -49,11 +49,13 @@ ActorProfile En_Firefly_Profile = { /**/ EnFirefly_Update, /**/ EnFirefly_DrawOpa, }; -static ColliderJntSphElementInit D_80A14F30 = { - { 0, { 0xFFCFFFFF, 1, 8 }, { 0xFFCFFFFF, 0, 0 }, 9, 1, 1 }, - { 1, { { 0, 0x3E8, 0 }, 0xF }, 0x64 }, +static ColliderJntSphElementInit sJntSphElementsInit[1] = { + { + { 0, { 0xFFCFFFFF, 1, 8 }, { 0xFFCFFFFF, 0, 0 }, 9, 1, 1 }, + { 1, { { 0, 0x3E8, 0 }, 0xF }, 0x64 }, + }, }; -static ColliderJntSphInit D_80A14F54 = { { 3, 0x11, 9, 0x39, 0x10, 0 }, 1, &D_80A14F30 }; +static ColliderJntSphInit sJntSphInit = { { 3, 0x11, 9, 0x39, 0x10, 0 }, 1, sJntSphElementsInit }; static CollisionCheckInfoInit D_80A14F64 = { 1, 0xA, 0xA, 0x1E }; static DamageTable D_80A14F6C = { { @@ -100,7 +102,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->unk1BE, this->unk266, 0x1C); Collider_InitJntSph(play, &this->collider); - Collider_SetJntSph(play, &this->collider, &this->actor, &D_80A14F54, this->colliderElements); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80A14F6C, &D_80A14F64); if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; @@ -139,7 +141,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { this->unk1B8 = 0; } } - this->collider.elements->dim.worldSphere.radius = D_80A14F54.elements->dim.modelSphere.radius; + this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius; } void EnFirefly_Destroy(Actor* thisx, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index b720e9ee553..39db38f1e51 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -56,7 +56,7 @@ static EnFish* D_80A17010 = NULL; static f32 D_80A17014 = 0.0f; static f32 D_80A17018 = 0.0f; -static ColliderJntSphElementInit D_80A1701C[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -70,7 +70,7 @@ static ColliderJntSphElementInit D_80A1701C[1] = { }, }; -static ColliderJntSphInit D_80A17040 = { +static ColliderJntSphInit sJntSphInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -80,7 +80,7 @@ static ColliderJntSphInit D_80A17040 = { COLSHAPE_JNTSPH, }, 1, - D_80A1701C, + sJntSphElementsInit, }; ActorProfile En_Fish_Profile = { @@ -167,7 +167,7 @@ void EnFish_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_80A17070); SkelAnime_InitFlex(play, &this->unk1AC, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); Collider_InitJntSph(play, &this->unk14C); - Collider_SetJntSph(play, &this->unk14C, &this->actor, &D_80A17040, &this->unk16C); + Collider_SetJntSph(play, &this->unk14C, &this->actor, &sJntSphInit, &this->unk16C); this->actor.colChkInfo.mass = 0x32; this->unk24C = (s16)(s32)(Rand_ZeroOne() * 65535.5f); this->unk24E = (s16)(s32)(Rand_ZeroOne() * 65535.5f); 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 879e34666be..2f4dc974b08 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -56,7 +56,7 @@ void EnSkb_TakeDamage(EnSkb* this, PlayState* play); void EnSkb_SetupDeath(EnSkb* this, PlayState* play); void EnSkb_Death(EnSkb* this, PlayState* play); -static ColliderJntSphElementInit D_80AFE020[2] = { +static ColliderJntSphElementInit sJntSphElementsInit[2] = { { { ELEM_MATERIAL_UNK0, @@ -81,7 +81,7 @@ static ColliderJntSphElementInit D_80AFE020[2] = { }, }; -static ColliderJntSphInit D_80AFE068 = { +static ColliderJntSphInit sJntSphInit = { { COL_MATERIAL_HIT6, AT_ON | AT_TYPE_ENEMY, @@ -91,7 +91,7 @@ static ColliderJntSphInit D_80AFE068 = { COLSHAPE_JNTSPH, }, 2, - D_80AFE020, + sJntSphElementsInit, }; static DamageTable D_80AFE078 = { @@ -158,7 +158,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->unk2A4); - Collider_SetJntSph(play, &this->unk2A4, &this->actor, &D_80AFE068, this->unk2C4); + Collider_SetJntSph(play, &this->unk2A4, &this->actor, &sJntSphInit, this->unk2C4); Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f); this->unk2A4.elements[0].dim.modelSphere.radius = this->unk2A4.elements[0].dim.worldSphere.radius = this->actor.params + 10; 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 1338fb88fc5..f7208b82112 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -61,7 +61,7 @@ ActorProfile En_Tp_Profile = { /**/ EnTp_Draw, }; -static ColliderJntSphElementInit D_80B22A90[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { ELEM_MATERIAL_UNK0, @@ -75,7 +75,7 @@ static ColliderJntSphElementInit D_80B22A90[1] = { }, }; -static ColliderJntSphInit D_80B22AB4 = { +static ColliderJntSphInit sJntSphInit = { { COL_MATERIAL_HIT1, AT_ON | AT_TYPE_ENEMY, @@ -85,7 +85,7 @@ static ColliderJntSphInit D_80B22AB4 = { COLSHAPE_JNTSPH, }, 1, - D_80B22A90, + sJntSphElementsInit, }; static DamageTable D_80B22AC4 = { @@ -119,7 +119,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { var_s5 = this; this->unk15E = 0xFF; Collider_InitJntSph(play, &this->unk174); - Collider_SetJntSph(play, &this->unk174, &this->actor, &D_80B22AB4, &this->unk194); + Collider_SetJntSph(play, &this->unk174, &this->actor, &sJntSphInit, &this->unk194); if (this->actor.params < 0) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; this->unk15A = 0; 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 46208345ca2..5132329b9e3 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -60,7 +60,7 @@ void func_80B36C8C(EnWf* this); void func_80B36D3C(EnWf* this, PlayState* play); s32 func_80B37830(PlayState* play, EnWf* this); -static ColliderJntSphElementInit D_80B37990[4] = { +static ColliderJntSphElementInit sJntSphElementsInit[4] = { { { ELEM_MATERIAL_UNK0, @@ -107,7 +107,7 @@ static ColliderJntSphElementInit D_80B37990[4] = { }, }; -static ColliderJntSphInit D_80B37A20 = { +static ColliderJntSphInit sJntSphInit = { { COL_MATERIAL_METAL, AT_ON | AT_TYPE_ENEMY, @@ -117,7 +117,7 @@ static ColliderJntSphInit D_80B37A20 = { COLSHAPE_JNTSPH, }, 4, - D_80B37990, + sJntSphElementsInit, }; static ColliderCylinderInit D_80B37A30 = { @@ -210,7 +210,7 @@ void EnWf_Init(Actor* thisx, PlayState* play) { this->unk302 = 0; this->unk2F4 = 10.0f; Collider_InitJntSph(play, &this->unk304); - Collider_SetJntSph(play, &this->unk304, &this->actor, &D_80B37A20, this->unk324); + Collider_SetJntSph(play, &this->unk304, &this->actor, &sJntSphInit, this->unk324); Collider_InitCylinder(play, &this->unk424); Collider_SetCylinder(play, &this->unk424, &this->actor, &D_80B37A30); Collider_InitCylinder(play, &this->unk470); 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 80c0f5ffecf..0c9452f3a6c 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -62,13 +62,13 @@ static ColliderQuadInit D_80B8E674 = { { 0.0f, 0.0f, 0.0f }, } }, }; -static ColliderJntSphElementInit D_80B8E6C4[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[1] = { { { 0, { 0x200000, 0, 0 }, { 0, 0, 0 }, 1, 0, 0 }, { 0, { { 0, 0, 0 }, 0x32 }, 0x64 }, }, }; -static ColliderJntSphInit D_80B8E6E8 = { { 0xA, 9, 0, 0, 0, 0 }, 1, D_80B8E6C4 }; +static ColliderJntSphInit sJntSphInit = { { 0xA, 9, 0, 0, 0, 0 }, 1, sJntSphElementsInit }; typedef struct struct_80B8E6F8 { /* 0x00 */ Vec3s coneFrustumCenterTop; /* 0x06 */ Vec3s coneFrustumCenterBase; @@ -305,7 +305,7 @@ void MirRay_Init(Actor* thisx, PlayState* play) { this->reflectionOriginModelPositions[5].y = -800.0f; if (temp_s1->unk1F & UNK1F_1) { Collider_InitJntSph(play, &this->unk14C); - Collider_SetJntSph(play, &this->unk14C, &this->actor, &D_80B8E6E8, &this->unk16C); + Collider_SetJntSph(play, &this->unk14C, &this->actor, &sJntSphInit, &this->unk16C); if (!(temp_s1->unk1F & UNK1F_2)) { MirRay_UpdateColliderSphereShape(this); } From 4aa19f9bf4aca872923c60a7debb7f5e1975e20d Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 13:52:36 +0200 Subject: [PATCH 021/150] reextract colliders --- .../actors/ovl_Arms_Hook/z_arms_hook.c | 2 +- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 20 +++++++++-- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 20 +++++++++-- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 20 +++++++++-- .../actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c | 36 ++++++++++--------- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 4 +-- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 19 ++++++++-- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 5 +-- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 20 +++++++++-- src/overlays/actors/ovl_En_Md/z_en_md.c | 20 +++++++++-- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 4 +-- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 4 +-- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 4 +-- .../actors/ovl_En_Wood02/z_en_wood02.c | 20 +++++++++-- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 25 ++++++++----- 15 files changed, 166 insertions(+), 57 deletions(-) diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index cc7eeac1a50..1b193f8ca25 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -52,7 +52,7 @@ static ColliderQuadInit sQuadInit = { ACELEM_NONE, OCELEM_NONE, }, - { 0.0f, 0.0f, 0.0f }, + { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; static Vec3f sUnusedVec1 = { 0.0f, 0.5f, 0.0f }; diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index d653d810a06..2087130b47d 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -72,9 +72,23 @@ ActorProfile Bg_Haka_Trap_Profile = { }; ColliderCylinderInit D_80880F54 = { - { 9, 0x11, 0xD, 9, 0x20, 1 }, - { 0, { 0xFFCFFFFF, 0, 4 }, { 0xFFCFFFFF, 0, 0 }, 1, 1, 1 }, - { 0x1E, 0x5A, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_METAL, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_PLAYER, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x04 }, + { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, + OCELEM_ON, + }, + { 30, 90, 0, { 0, 0, 0 } }, }; static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index b9d15620588..3af12badebb 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -30,9 +30,23 @@ void func_80892424(BgIceTurara*, PlayState*); void func_80892574(BgIceTurara*, PlayState*); static ColliderCylinderInit D_80892620 = { - { 0xA, 0x11, 9, 0, 0x20, 1 }, - { 0, { 0xFFCFFFFF, 0, 4 }, { 0x4FC007CA, 0, 0 }, 1, 1, 0 }, - { 0xD, 0x78, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_NONE, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x04 }, + { 0x4FC007CA, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_ON, + OCELEM_NONE, + }, + { 13, 120, 0, { 0, 0, 0 } }, }; ActorProfile Bg_Ice_Turara_Profile = { /**/ ACTOR_BG_ICE_TURARA, 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 df39cc4d60f..98ee351c66e 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 @@ -20,9 +20,23 @@ void BgPoSyokudai_Update(Actor* thisx, PlayState* play); void BgPoSyokudai_Draw(Actor* thisx, PlayState* play); static ColliderCylinderInit D_808A8960 = { - { 9, 0, 0xD, 0x39, 0x20, 1 }, - { 0, { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0 }, 0, 1, 1 }, - { 0xC, 0x3C, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_METAL, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_ON, + OCELEM_ON, + }, + { 12, 60, 0, { 0, 0, 0 } }, }; static Color_RGBA8 D_808A898C[4] = { { 0xFF, 0xAA, 0xFF, 0xFF }, diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 9527be9cc26..b2f1c6e760c 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -47,23 +47,25 @@ ActorProfile Bg_Toki_Swd_Profile = { /**/ BgTokiSwd_Draw, }; -static ColliderCylinderInit sCylinderInit = { { - COL_MATERIAL_NONE, - AT_NONE, - AC_NONE, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1 | OC2_UNK1, - COLSHAPE_CYLINDER, - }, - { - ELEM_MATERIAL_UNK0, - { 0xFFCFFFFF, 0x00, 0x00 }, - { 0xFFCFFFFF, 0x00, 0x00 }, - ATELEM_NONE, - ACELEM_NONE, - OCELEM_ON, - }, - { 10, 70, 0, { 0 } } }; +static ColliderCylinderInit sCylinderInit = { + { + COL_MATERIAL_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1 | OC2_UNK1, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_NONE, + OCELEM_ON, + }, + { 10, 70, 0, { 0, 0, 0 } }, +}; static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_IMMOVABLE }; 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 906128d5952..27f776027f2 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -53,7 +53,7 @@ ActorProfile En_Dekubaba_Profile = { /**/ EnDekubaba_Draw, }; -static ColliderJntSphElementInit sJntSphElementsInit[7] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -142,7 +142,7 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 7, + ARRAY_COUNT(sJntSphElementsInit), sJntSphElementsInit, }; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index b4231552c2a..334c180b031 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -63,9 +63,22 @@ ActorProfile En_Dns_Profile = { /**/ EnDns_Draw, }; static ColliderCylinderInitType1 D_809F03E0 = { - { 0xA, 0, 9, 0x39, 1 }, - { 0, { 0, 0, 0 }, { 0xFFCFFFFF, 0, 0 }, 0, 1, 1 }, - { 0x12, 0x20, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_ON, + OCELEM_ON, + }, + { 18, 32, 0, { 0, 0, 0 } }, }; static u16 sStartingTextIds[] = { 0x10A0, // DNS_TYPE_DEKU_NUTS_5 diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 39db38f1e51..a4317e72dce 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -1,6 +1,7 @@ #include "z_en_fish.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx_setupdl.h" #include "ichain.h" #include "printf.h" @@ -56,7 +57,7 @@ static EnFish* D_80A17010 = NULL; static f32 D_80A17014 = 0.0f; static f32 D_80A17018 = 0.0f; -static ColliderJntSphElementInit sJntSphElementsInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -79,7 +80,7 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 1, + ARRAY_COUNT(sJntSphElementsInit), sJntSphElementsInit, }; 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 add77d18f14..073791344ea 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -61,9 +61,23 @@ static s16 D_80A9C200[4] = { OBJECT_KUSA, }; static ColliderCylinderInit D_80A9C208 = { - { 0xA, 0, 9, 0x29, 0x20, 1 }, - { 0, { 0, 0, 0 }, { 0x4FC00758, 0, 0 }, 0, 1, 1 }, - { 0xC, 0x2C, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_PLAYER | OC1_TYPE_2, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0x4FC00758, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_ON, + OCELEM_ON, + }, + { 12, 44, 0, { 0, 0, 0 } }, }; static CollisionCheckInfoInit D_80A9C234 = { 0, 0xC, 0x1E, 0xFF }; static Vec3f sUnitDirections[4] = { 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 44af2268dd2..5bbced81e09 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -47,9 +47,23 @@ ActorProfile En_Md_Profile = { }; ColliderCylinderInit D_80AAC310 = { - { 0xA, 0, 0, 0x39, 0x20, 1 }, - { 0, { 0, 0, 0 }, { 0, 0, 0 }, 0, 0, 1 }, - { 0x24, 0x2E, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_NONE, + AT_NONE, + AC_NONE, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_2, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK0, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0x00000000, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_NONE, + OCELEM_ON, + }, + { 36, 46, 0, { 0, 0, 0 } }, }; CollisionCheckInfoInit2 D_80AAC33C = { 0, 0, 0, 0, 0xFF }; 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 2f4dc974b08..f71036c2fe8 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -56,7 +56,7 @@ void EnSkb_TakeDamage(EnSkb* this, PlayState* play); void EnSkb_SetupDeath(EnSkb* this, PlayState* play); void EnSkb_Death(EnSkb* this, PlayState* play); -static ColliderJntSphElementInit sJntSphElementsInit[2] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -90,7 +90,7 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 2, + ARRAY_COUNT(sJntSphElementsInit), sJntSphElementsInit, }; 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 f7208b82112..60ed42fa847 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -61,7 +61,7 @@ ActorProfile En_Tp_Profile = { /**/ EnTp_Draw, }; -static ColliderJntSphElementInit sJntSphElementsInit[1] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -84,7 +84,7 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 1, + ARRAY_COUNT(sJntSphElementsInit), sJntSphElementsInit, }; 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 5132329b9e3..eadb17c9add 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -60,7 +60,7 @@ void func_80B36C8C(EnWf* this); void func_80B36D3C(EnWf* this, PlayState* play); s32 func_80B37830(PlayState* play, EnWf* this); -static ColliderJntSphElementInit sJntSphElementsInit[4] = { +static ColliderJntSphElementInit sJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -116,7 +116,7 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - 4, + ARRAY_COUNT(sJntSphElementsInit), sJntSphElementsInit, }; 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 61d3c457809..b1409b83994 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -50,9 +50,23 @@ ActorProfile En_Wood02_Profile = { /**/ EnWood02_Draw, }; static ColliderCylinderInit D_80B3BF00 = { - { 0xD, 0, 0xD, 0x39, 0x10, 1 }, - { 5, { 0, 0, 0 }, { 0x0FC0074A, 0, 0 }, 0, 1, 1 }, - { 0x12, 0x3C, 0, { 0, 0, 0 } }, + { + COL_MATERIAL_TREE, + AT_NONE, + AC_ON | AC_HARD | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEM_MATERIAL_UNK5, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0x0FC0074A, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_ON, + OCELEM_ON, + }, + { 18, 60, 0, { 0, 0, 0 } }, }; static f32 sSpawnDistances[] = { 707.0f, 525.0f, 510.0f, 500.0f, 566.0f, 141.0f }; static s16 sSpawnAngles[] = { 0x1FFF, 0x4C9E, 0x77F5, 0xA5C9, -0x293D, 0xA000 }; 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 0c9452f3a6c..049701a13b1 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -53,14 +53,23 @@ ActorProfile Mir_Ray_Profile = { static u8 D_80B8E670 = false; static ColliderQuadInit D_80B8E674 = { - { 0xA, 9, 0, 0, 0, 3 }, - { 0, { 0x200000, 0, 0 }, { 0xFFCFFFFF, 0, 0 }, 1, 0, 0 }, - { { - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 0.0f }, - } }, + { + COL_MATERIAL_NONE, + AT_ON | AT_TYPE_PLAYER, + AC_NONE, + OC1_NONE, + OC2_NONE, + COLSHAPE_QUAD, + }, + { + ELEM_MATERIAL_UNK0, + { 0x00200000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_ON | ATELEM_SFX_NORMAL, + ACELEM_NONE, + OCELEM_NONE, + }, + { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; static ColliderJntSphElementInit sJntSphElementsInit[1] = { { From 94793bbf5404499c56b23473bd1e2bd7fd9d8d72 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 13:57:09 +0200 Subject: [PATCH 022/150] colliders cleanup: sCylinderInit --- src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 4 ++-- src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 4 ++-- src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 4 ++-- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 4 ++-- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 ++-- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 4 ++-- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 4 ++-- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 4 ++-- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 4 ++-- src/overlays/actors/ovl_En_Md/z_en_md.c | 4 ++-- src/overlays/actors/ovl_En_Mu/z_en_mu.c | 4 ++-- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 4 ++-- src/overlays/actors/ovl_En_Wood02/z_en_wood02.c | 4 ++-- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 ++-- src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 4 ++-- 15 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 2087130b47d..86c38871097 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -71,7 +71,7 @@ ActorProfile Bg_Haka_Trap_Profile = { /**/ BgHakaTrap_Draw, }; -ColliderCylinderInit D_80880F54 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_METAL, AT_ON | AT_TYPE_ENEMY, @@ -132,7 +132,7 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { spikedCrusherFlipPtr = &sSpikedCrusherFlip; if (this->dyna.actor.params != BG_HAKA_TRAP_FAN_BLADE) { Collider_InitCylinder(play, &this->unk178); - Collider_SetCylinder(play, &this->unk178, &this->dyna.actor, &D_80880F54); + Collider_SetCylinder(play, &this->unk178, &this->dyna.actor, &sCylinderInit); if ((this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE) || (this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE_FAST)) { this->unk168 = 0x14; diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index 3af12badebb..a15d09310a9 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -29,7 +29,7 @@ void func_808922B8(BgIceTurara*, PlayState*); void func_80892424(BgIceTurara*, PlayState*); void func_80892574(BgIceTurara*, PlayState*); -static ColliderCylinderInit D_80892620 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_ENEMY, @@ -79,7 +79,7 @@ void BgIceTurara_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &sp24); Collider_InitCylinder(play, &this->unk16C); - Collider_SetCylinder(play, &this->unk16C, &this->dyna.actor, &D_80892620); + Collider_SetCylinder(play, &this->unk16C, &this->dyna.actor, &sCylinderInit); Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp24); if (this->dyna.actor.params == 0) { 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 98ee351c66e..41e88b2de6f 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 @@ -19,7 +19,7 @@ void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play); void BgPoSyokudai_Update(Actor* thisx, PlayState* play); void BgPoSyokudai_Draw(Actor* thisx, PlayState* play); -static ColliderCylinderInit D_808A8960 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_METAL, AT_NONE, @@ -79,7 +79,7 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { Lights_PointGlowSetInfo(&this->unk154, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 65, this->actor.world.pos.z, 0, 0, 0, 0); Collider_InitCylinder(play, &this->unk164); - Collider_SetCylinder(play, &this->unk164, &this->actor, &D_808A8960); + Collider_SetCylinder(play, &this->unk164, &this->actor, &sCylinderInit); this->unk164.dim.pos.x = this->actor.world.pos.x; this->unk164.dim.pos.y = this->actor.world.pos.y; this->unk164.dim.pos.z = this->actor.world.pos.z; 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 579cd34f130..50a834eb011 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -66,7 +66,7 @@ ActorProfile En_Bili_Profile = { /**/ EnBili_Draw, }; -static ColliderCylinderInit D_809C1640 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_HIT8, AT_ON | AT_TYPE_ENEMY, @@ -108,7 +108,7 @@ void EnBili_Init(Actor* thisx, PlayState* play) { this->actor.shape.shadowAlpha = 155; SkelAnime_Init(play, &this->unk14C, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->unk198, this->unk1B6, 5); Collider_InitCylinder(play, &this->unk1D4); - Collider_SetCylinder(play, &this->unk1D4, &this->actor, &D_809C1640); + Collider_SetCylinder(play, &this->unk1D4, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_809C1678, &D_809C166C); this->unk195 = 0; if (this->actor.params == -1) { 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 8c7d47c4e3c..a47612caf00 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -48,7 +48,7 @@ ActorProfile En_Ge1_Profile = { /**/ EnGe1_Draw, }; -static ColliderCylinderInit D_80A32770 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -81,7 +81,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { this->unk23C, 16); Animation_PlayOnce(&this->unk198, &object_ge1_000228_Anim); Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A32770); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk2B0 = &object_ge1_000228_Anim; this->unk2B8 = func_80A323B0; 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 b3c8aeefbd5..2ad61539689 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -49,7 +49,7 @@ ActorProfile En_Ge2_Profile = { /**/ EnGe2_Draw, }; -static ColliderCylinderInit D_80A34310 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -108,7 +108,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->unk198, &object_gla_008968_Skel, NULL, this->unk1DC, this->unk260, 22); Animation_PlayLoop(&this->unk198, &object_gla_009ED4_Anim); Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A34310); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); if (play->sceneId == SCENE_GERUDO_VALLEY) { diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 50d590ad802..a8dc0dad6cf 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -42,7 +42,7 @@ ActorProfile En_Ge3_Profile = { /**/ EnGe3_Draw, }; -static ColliderCylinderInit D_80A35190 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -83,7 +83,7 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->unk198, &gGerudoRedSkel, NULL, this->unk1DC, this->unk26C, 24); Animation_PlayLoop(&this->unk198, &gGerudoRedStandAnim); Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &D_80A35190); + Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.world.rot.z = 0; 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 143db84b373..978a7843e0a 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -170,7 +170,7 @@ static CutsceneData gJabuInhalingCs[0x2D4] = { { -1 }, { 0 }, { 0 }, { 0 }, }; -static ColliderCylinderInit D_80A88CB4 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -233,7 +233,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { CollisionHeader_GetVirtual(&object_jj_000A1C_Col, &sp4C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); Collider_InitCylinder(play, &this->unk2B0); - Collider_SetCylinder(play, &this->unk2B0, &this->dyna.actor, &D_80A88CB4); + Collider_SetCylinder(play, &this->unk2B0, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; return; 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 073791344ea..fed83afe3d6 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -60,7 +60,7 @@ static s16 D_80A9C200[4] = { OBJECT_KUSA, OBJECT_KUSA, }; -static ColliderCylinderInit D_80A9C208 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -220,7 +220,7 @@ void func_80A9B630(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; Collider_InitCylinder(play, &this->unk150); - Collider_SetCylinder(play, &this->unk150, &this->actor, &D_80A9C208); + Collider_SetCylinder(play, &this->unk150, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->unk150); } 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 5bbced81e09..646435d050d 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -46,7 +46,7 @@ ActorProfile En_Md_Profile = { /**/ EnMd_Draw, }; -ColliderCylinderInit D_80AAC310 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -679,7 +679,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->unk14C, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); Collider_InitCylinder(play, &this->unk194); - Collider_SetCylinder(play, &this->unk194, &this->actor, &D_80AAC310); + Collider_SetCylinder(play, &this->unk194, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AAC33C); if (func_80AAB03C(this, play) == 0) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 3fd3ba25a66..92ee117161a 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -26,7 +26,7 @@ void EnMu_Draw(Actor* thisx, PlayState* play); void EnMu_Pose(EnMu* this, PlayState* play); s16 EnMu_UpdateTalkState(PlayState* play, Actor* thisx); -static ColliderCylinderInit D_80AB0BD0 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -146,7 +146,7 @@ void EnMu_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 160.0f); SkelAnime_InitFlex(play, &this->skelAnime, &object_mu_Skel_004F70, &object_mu_Anim_0003F4, NULL, NULL, 0); Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AB0BD0); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AB0BFC); this->actor.attentionRangeType = ATTENTION_RANGE_6; Actor_SetScale(&this->actor, 0.01f); 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 9f4bee28456..4173df70696 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -73,7 +73,7 @@ static ColliderQuadInit D_80B288A0 = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -static ColliderCylinderInit D_80B288F0 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_HIT8, AT_ON | AT_TYPE_ENEMY, @@ -123,7 +123,7 @@ void EnVali_Init(Actor* thisx, PlayState* play) { Collider_InitQuad(play, &this->unk37C); Collider_SetQuad(play, &this->unk37C, &this->actor, &D_80B288A0); Collider_InitCylinder(play, &this->unk3FC); - Collider_SetCylinder(play, &this->unk3FC, &this->actor, &D_80B288F0); + Collider_SetCylinder(play, &this->unk3FC, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B28924, &D_80B2891C); func_80B26878(this); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; 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 b1409b83994..13fe774558b 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -49,7 +49,7 @@ ActorProfile En_Wood02_Profile = { /**/ EnWood02_Update, /**/ EnWood02_Draw, }; -static ColliderCylinderInit D_80B3BF00 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_TREE, AT_NONE, @@ -179,7 +179,7 @@ void EnWood02_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); if (this->actor.params < EN_WOOD_02_TYPE_11) { Collider_InitCylinder(play, &this->unk158); - Collider_SetCylinder(play, &this->unk158, &this->actor, &D_80B3BF00); + Collider_SetCylinder(play, &this->unk158, &this->actor, &sCylinderInit); var_t0_sp4E = 0; } switch (this->actor.params) { 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 21c8bc81bf9..5f7551635ec 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -93,7 +93,7 @@ ActorProfile En_Zf_Profile = { /**/ EnZf_Draw, }; -static ColliderCylinderInit D_80B4A1D8 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_HIT0, AT_NONE, @@ -261,7 +261,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.cylRadius = 40; this->actor.colChkInfo.cylHeight = 100; Collider_InitCylinder(play, &this->unk418); - Collider_SetCylinder(play, &this->unk418, &this->actor, &D_80B4A1D8); + Collider_SetCylinder(play, &this->unk418, &this->actor, &sCylinderInit); Collider_InitQuad(play, &this->unk464); Collider_SetQuad(play, &this->unk464, &this->actor, &D_80B4A204); if (this->actor.params == -2) { 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 aeeecdf229a..d5389d6aa1d 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -58,7 +58,7 @@ static s16 D_80BA1B80[2] = { OBJECT_GAMEPLAY_DANGEON_KEEP, OBJECT_TSUBO }; static Gfx* D_80BA1B84[2] = { gPotDL, object_tsubo_DL_0017C0 }; static Gfx* D_80BA1B8C[2] = { gPotFragmentDL, object_tsubo_DL_001960 }; -static ColliderCylinderInit D_80BA1B94 = { +static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_HARD, AT_ON | AT_TYPE_PLAYER, @@ -126,7 +126,7 @@ void func_80BA0E98(ObjTsubo* this2, PlayState* play) { ObjTsubo* this = this2; Collider_InitCylinder(play, &this->unk150); - Collider_SetCylinder(play, &this->unk150, &this->actor, &D_80BA1B94); + Collider_SetCylinder(play, &this->unk150, &this->actor, &sCylinderInit); Collider_UpdateCylinder(&this->actor, &this->unk150); } From cbd4530cee0d4cc1cf99f0d8f97dcb2eca3e4771 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 13:58:22 +0200 Subject: [PATCH 023/150] colliders cleanup: sColliderQuadInit --- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 6 +++--- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 ++-- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) 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 4173df70696..f00126f3d31 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -53,7 +53,7 @@ ActorProfile En_Vali_Profile = { /**/ EnVali_Draw, }; -static ColliderQuadInit D_80B288A0 = { +static ColliderQuadInit sColliderQuadInit = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_ENEMY, @@ -119,9 +119,9 @@ void EnVali_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->unk14C, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->unk198, this->unk246, 29); Collider_InitQuad(play, &this->unk2FC); - Collider_SetQuad(play, &this->unk2FC, &this->actor, &D_80B288A0); + Collider_SetQuad(play, &this->unk2FC, &this->actor, &sColliderQuadInit); Collider_InitQuad(play, &this->unk37C); - Collider_SetQuad(play, &this->unk37C, &this->actor, &D_80B288A0); + Collider_SetQuad(play, &this->unk37C, &this->actor, &sColliderQuadInit); Collider_InitCylinder(play, &this->unk3FC); Collider_SetCylinder(play, &this->unk3FC, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B28924, &D_80B2891C); 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 5f7551635ec..694507ada39 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -113,7 +113,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 70, 0, { 0, 0, 0 } }, }; -static ColliderQuadInit D_80B4A204 = { +static ColliderQuadInit sColliderQuadInit = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_ENEMY, @@ -263,7 +263,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->unk418); Collider_SetCylinder(play, &this->unk418, &this->actor, &sCylinderInit); Collider_InitQuad(play, &this->unk464); - Collider_SetQuad(play, &this->unk464, &this->actor, &D_80B4A204); + Collider_SetQuad(play, &this->unk464, &this->actor, &sColliderQuadInit); if (this->actor.params == -2) { this->actor.colChkInfo.health = 12; this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; 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 049701a13b1..9e72d83b1d1 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -52,7 +52,7 @@ ActorProfile Mir_Ray_Profile = { }; static u8 D_80B8E670 = false; -static ColliderQuadInit D_80B8E674 = { +static ColliderQuadInit sColliderQuadInit = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_PLAYER, @@ -320,7 +320,7 @@ void MirRay_Init(Actor* thisx, PlayState* play) { } } Collider_InitQuad(play, &this->unk1AC); - Collider_SetQuad(play, &this->unk1AC, &this->actor, &D_80B8E674); + Collider_SetQuad(play, &this->unk1AC, &this->actor, &sColliderQuadInit); if ((this->actor.params == 5) || (this->actor.params == 7) || (this->actor.params == 8)) { this->actor.room = -1; } From bf4f7fd83fe60613327134e5788923c5f711f72c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:05:09 +0200 Subject: [PATCH 024/150] colliders cleanup: ColliderJntSph collider; ColliderJntSphElement colliderElements[N]; --- .../z_bg_hidan_rsekizou.c | 12 +-- .../z_bg_hidan_rsekizou.h | 4 +- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 14 ++-- .../ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h | 4 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 79 ++++++++++--------- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 4 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 10 +-- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 4 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 32 ++++---- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 4 +- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 48 +++++------ src/overlays/actors/ovl_En_Tp/z_en_tp.h | 4 +- 12 files changed, 110 insertions(+), 109 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 1fef30e28f2..2ccc88c8aef 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -86,10 +86,10 @@ void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &sp30); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); - Collider_InitJntSph(play, &this->unk168); - Collider_SetJntSph(play, &this->unk168, &this->dyna.actor, &sJntSphInit, this->unk188); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->dyna.actor, &sJntSphInit, this->colliderElements); for (i = 0; i < 6; i++) { - this->unk168.elements[i].dim.worldSphere.radius = this->unk168.elements[i].dim.modelSphere.radius; + this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } this->unk166 = 0; this->unk164 = 0; @@ -99,7 +99,7 @@ void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play) { BgHidanRsekizou* this = (BgHidanRsekizou*)thisx; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyJntSph(play, &this->unk168); + Collider_DestroyJntSph(play, &this->collider); } void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { @@ -121,7 +121,7 @@ void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { sp24 = Math_SinS(this->dyna.actor.shape.rot.y); temp_fv0 = Math_CosS(this->dyna.actor.shape.rot.y); for (i = 0; i < 6; i++) { - temp_v0_2 = &this->unk168.elements[i]; + temp_v0_2 = &this->collider.elements[i]; temp_v0_2->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + (temp_fv0 * temp_v0_2->dim.modelSphere.center.x) + (sp24 * temp_v0_2->dim.modelSphere.center.z); @@ -130,7 +130,7 @@ void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) { (sp24 * temp_v0_2->dim.modelSphere.center.x) + (temp_fv0 * temp_v0_2->dim.modelSphere.center.z); } - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk168.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); Actor_PlaySfx_Flagged(&this->dyna.actor, 0x2033U); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h index a4cf85b08b3..a4d7df1a162 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.h @@ -10,8 +10,8 @@ typedef struct BgHidanRsekizou { /* 0x000 */ DynaPolyActor dyna; /* 0x164 */ s16 unk164; /* 0x166 */ s16 unk166; - /* 0x168 */ ColliderJntSph unk168; - /* 0x188 */ ColliderJntSphElement unk188[6]; + /* 0x168 */ ColliderJntSph collider; + /* 0x188 */ ColliderJntSphElement colliderElements[6]; } BgHidanRsekizou; // size = 0x0308 #endif diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index 44e12fe09c1..5f1206d5b5c 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -68,8 +68,8 @@ static Gfx* D_808987B8[] = { void func_808980C0(BgJyaHaheniron* this, PlayState* play) { s32 pad; - Collider_InitJntSph(play, &this->unk150); - Collider_SetJntSph(play, &this->unk150, &this->actor, &sJntSphInit, this->unk170); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); } void func_80898114(PlayState* play, Vec3f* arg1, Vec3f* arg2) { @@ -121,7 +121,7 @@ void BgJyaHaheniron_Destroy(Actor* thisx, PlayState* play) { BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; if (this->actor.params == 0) { - Collider_DestroyJntSph(play, &this->unk150); + Collider_DestroyJntSph(play, &this->collider); } } @@ -136,8 +136,8 @@ void func_8089844C(BgJyaHaheniron* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 8.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) || - ((this->unk150.base.atFlags & AT_HIT) && (this->unk150.base.at != NULL) && - (this->unk150.base.at->category == 2))) { + ((this->collider.base.atFlags & AT_HIT) && (this->collider.base.at != NULL) && + (this->collider.base.at->category == 2))) { sp2C.x = -Rand_ZeroOne() * this->actor.velocity.x; sp2C.y = -Rand_ZeroOne() * this->actor.velocity.y; sp2C.z = -Rand_ZeroOne() * this->actor.velocity.z; @@ -146,7 +146,7 @@ void func_8089844C(BgJyaHaheniron* this, PlayState* play) { } else if (this->unk1B0 >= 0x3D) { Actor_Kill(&this->actor); } else { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk150.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } this->actor.shape.rot.y += 0x4B0; this->actor.shape.rot.x += 0xFA0; @@ -190,7 +190,7 @@ void BgJyaHaheniron_Draw(Actor* thisx, PlayState* play) { BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; if (this->actor.params == 0) { - Collider_UpdateSpheres(0, &this->unk150); + Collider_UpdateSpheres(0, &this->collider); } Gfx_DrawDListOpa(play, D_808987B8[this->actor.params]); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h index 1046d76ef78..58dda603e13 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.h @@ -11,8 +11,8 @@ typedef void (*BgJyaHahenironActionFunc)(struct BgJyaHaheniron*, struct PlayStat typedef struct BgJyaHaheniron { /* 0x000 */ Actor actor; /* 0x14C */ BgJyaHahenironActionFunc unk14C; - /* 0x150 */ ColliderJntSph unk150; - /* 0x170 */ ColliderJntSphElement unk170[1]; + /* 0x150 */ ColliderJntSph collider; + /* 0x170 */ ColliderJntSphElement colliderElements[1]; /* 0x1B0 */ s16 unk1B0; /* 0x1B2 */ char pad1B2[2]; } BgJyaHaheniron; // size = 0x01B4 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 27f776027f2..56db9c08d2b 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -178,13 +178,13 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); SkelAnime_Init(play, &this->unk17C, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->unk1D0, this->unk200, 8); - Collider_InitJntSph(play, &this->unk238); - Collider_SetJntSph(play, &this->unk238, &this->actor, &sJntSphInit, this->unk258); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params == 1) { this->unk230 = 2.50f; for (var_a0 = 0; var_a0 < sJntSphInit.count; var_a0++) { - this->unk238.elements[var_a0].dim.worldSphere.radius = - this->unk238.elements[var_a0].dim.modelSphere.radius = + this->collider.elements[var_a0].dim.worldSphere.radius = + this->collider.elements[var_a0].dim.modelSphere.radius = sJntSphElementsInit[var_a0].dim.modelSphere.radius * 2.5f; } if (!LINK_IS_ADULT) { @@ -197,7 +197,8 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { } else { this->unk230 = 1.0f; for (var_a0 = 0; var_a0 < sJntSphInit.count; var_a0++) { - this->unk238.elements[var_a0].dim.worldSphere.radius = this->unk238.elements[var_a0].dim.modelSphere.radius; + this->collider.elements[var_a0].dim.worldSphere.radius = + this->collider.elements[var_a0].dim.modelSphere.radius; } if (!LINK_IS_ADULT) { D_809E8FE0.table[0x1B] = 4; @@ -215,14 +216,14 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; - Collider_DestroyJntSph(play, &this->unk238); + Collider_DestroyJntSph(play, &this->collider); } void func_809E5A38(EnDekubaba* this) { s32 i; for (i = 1; i < 7; i++) { - this->unk238.elements[i].base.acElemFlags &= ~ACELEM_ON; + this->collider.elements[i].base.acElemFlags &= ~ACELEM_ON; } } @@ -236,11 +237,11 @@ void func_809E5ABC(EnDekubaba* this) { this->actor.world.pos.z = this->actor.home.pos.z; this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->unk230); Actor_SetScale(&this->actor, this->unk230 * 0.01f * 0.5f); - this->unk238.base.colMaterial = COL_MATERIAL_HARD; - this->unk238.base.acFlags |= AC_HARD; + this->collider.base.colMaterial = COL_MATERIAL_HARD; + this->collider.base.acFlags |= AC_HARD; this->unk1C6 = 0x2D; for (i = 1; i < 7; i++) { - temp_v0_2 = &this->unk238.elements[i]; + temp_v0_2 = &this->collider.elements[i]; temp_v0_2->dim.worldSphere.center.x = this->actor.world.pos.x; temp_v0_2->dim.worldSphere.center.y = (s16)this->actor.world.pos.y - 7; temp_v0_2->dim.worldSphere.center.z = this->actor.world.pos.z; @@ -256,10 +257,10 @@ void func_809E5D28(EnDekubaba* this) { Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_ONCE, 0.0f); this->unk1C6 = 0xF; for (i = 2; i < 7; i++) { - this->unk238.elements[i].base.ocElemFlags |= 1; + this->collider.elements[i].base.ocElemFlags |= 1; } - this->unk238.base.colMaterial = COL_MATERIAL_HIT6; - this->unk238.base.acFlags &= ~AC_HARD; + this->collider.base.colMaterial = COL_MATERIAL_HIT6; + this->collider.base.acFlags &= ~AC_HARD; Actor_PlaySfx(&this->actor, NA_SE_EN_DUMMY482); this->unk1C0 = func_809E65A0; } @@ -271,7 +272,7 @@ void func_809E5E58(EnDekubaba* this) { Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); this->unk1C6 = 0xF; for (i = 2; i < 7; i++) { - this->unk238.elements[i].base.ocElemFlags &= ~1; + this->collider.elements[i].base.ocElemFlags &= ~1; } this->unk1C0 = func_809E6A04; } @@ -303,7 +304,7 @@ void func_809E6000(EnDekubaba* this) { void func_809E6078(EnDekubaba* this) { this->unk1C6 = 9; - this->unk238.base.acFlags |= AC_ON; + this->collider.base.acFlags |= AC_ON; this->unk1C0 = func_809E77E4; this->unk17C.playSpeed = -1.0f; } @@ -311,7 +312,7 @@ void func_809E6078(EnDekubaba* this) { void func_809E60A8(EnDekubaba* this, s32 arg1) { Animation_MorphToPlayOnce(&this->unk17C, &object_dekubaba_Anim_000208, -5.0f); this->unk1C6 = arg1; - this->unk238.base.acFlags &= ~AC_ON; + this->collider.base.acFlags &= ~AC_ON; Actor_SetScale(&this->actor, this->unk230 * 0.01f); if (arg1 == 2) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 155, COLORFILTER_BUFFLAG_OPA, 62); @@ -328,7 +329,7 @@ void func_809E6170(EnDekubaba* this) { this->actor.velocity.y = 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; this->actor.speed = this->unk230 * 3.0f; - this->unk238.base.acFlags &= ~AC_ON; + this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED; this->unk1C0 = func_809E7BB0; } @@ -336,7 +337,7 @@ void func_809E6170(EnDekubaba* this) { void func_809E61E0(EnDekubaba* this) { Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, -1.5f, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); - this->unk238.base.acFlags &= ~AC_ON; + this->collider.base.acFlags &= ~AC_ON; this->unk1C0 = func_809E7F14; } @@ -344,7 +345,7 @@ void func_809E6264(EnDekubaba* this) { s32 i; for (i = 1; i < 7; i++) { - this->unk238.elements[i].base.acElemFlags |= ACELEM_ON; + this->collider.elements[i].base.acElemFlags |= ACELEM_ON; } if (this->unk1C6 == 1) { Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, @@ -367,7 +368,7 @@ void func_809E63EC(EnDekubaba* this) { this->unk1CA_arr[1] = -0x4800; func_809E5A38(this); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 35); - this->unk238.base.acFlags &= ~AC_ON; + this->collider.base.acFlags &= ~AC_ON; this->unk1C0 = func_809E7A88; } @@ -597,7 +598,7 @@ void func_809E7104(EnDekubaba* this, PlayState* play) { func_8002829C(play, &this->actor.world.pos, &sp3C, &D_809E8EA0, &D_809E9024, &D_809E9028, 1, this->unk230 * 100.0f); this->unk1C6 = 1; - this->unk238.base.acFlags |= AC_ON; + this->collider.base.acFlags |= AC_ON; } } else if (this->unk1C6 >= 0xB) { func_809E6000(this); @@ -743,7 +744,7 @@ void func_809E78DC(EnDekubaba* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { func_809E61E0(this); } else { - this->unk238.base.acFlags |= AC_ON; + this->collider.base.acFlags |= AC_ON; if (this->unk1C6 == 0) { if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { func_809E5F9C(this); @@ -785,7 +786,7 @@ void func_809E7A88(EnDekubaba* this, PlayState* play) { } temp_v0 = this->unk1C8 + 0x4000; if (ABS(temp_v0) < 0x100) { - this->unk238.base.acFlags |= AC_ON; + this->collider.base.acFlags |= AC_ON; if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { func_809E5F9C(this); } else { @@ -877,10 +878,10 @@ void func_809E8140(EnDekubaba* this, PlayState* play) { s32 var_s0; s32 i; - if (this->unk238.base.acFlags & AC_HIT) { - this->unk238.base.acFlags &= ~AC_HIT; - Actor_SetDropFlagJntSph(&this->actor, &this->unk238, true); - if ((this->unk238.base.colMaterial != COL_MATERIAL_HARD) && + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); + if ((this->collider.base.colMaterial != COL_MATERIAL_HARD) && (((this->actor.colChkInfo.damageReaction != 0)) || (this->actor.colChkInfo.damage != 0))) { var_s0 = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; if (this->unk1C0 != func_809E79EC) { @@ -923,7 +924,7 @@ void func_809E8140(EnDekubaba* this, PlayState* play) { } else { return; } - } else if ((play->actorCtx.unk_02 != 0) && (this->unk238.base.colMaterial != COL_MATERIAL_HARD) && + } else if ((play->actorCtx.unk_02 != 0) && (this->collider.base.colMaterial != COL_MATERIAL_HARD) && (this->unk1C0 != func_809E79EC) && (this->unk1C0 != func_809E78DC) && (this->actor.colChkInfo.health != 0)) { this->actor.colChkInfo.health--; @@ -952,8 +953,8 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; s32 pad; - if (this->unk238.base.atFlags & AT_HIT) { - this->unk238.base.atFlags &= ~AT_HIT; + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; func_809E6078(this); } func_809E8140(this, play); @@ -971,14 +972,14 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { } } if (this->unk1C0 == func_809E7104) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk238.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } - if (this->unk238.base.acFlags & 1) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk238.base); + if (this->collider.base.acFlags & 1) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->unk1C0 != func_809E80D8) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk238.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -1030,8 +1031,8 @@ void func_809E86B8(EnDekubaba* this, PlayState* play) { Matrix_RotateZYX(this->unk1CA_arr[i__var_s2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2533); gSPDisplayList(POLY_OPA_DISP++, D_809E902C[i__var_s2]); - Collider_UpdateSpheres(0x33 + (i__var_s2 * 2), &this->unk238); - Collider_UpdateSpheres(0x34 + (i__var_s2 * 2), &this->unk238); + Collider_UpdateSpheres(0x33 + (i__var_s2 * 2), &this->collider); + Collider_UpdateSpheres(0x34 + (i__var_s2 * 2), &this->collider); if (i__var_s2 == 0) { if (this->unk1C0 != func_809E7A88) { this->actor.focus.pos.x = spB0.mf[3][0]; @@ -1057,8 +1058,8 @@ void func_809E89E4(EnDekubaba* this, PlayState* play) { Matrix_RotateZYX(this->unk1CA_arr[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2586); gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); - Collider_UpdateSpheres(0x37, &this->unk238); - Collider_UpdateSpheres(0x38, &this->unk238); + Collider_UpdateSpheres(0x37, &this->collider); + Collider_UpdateSpheres(0x38, &this->collider); CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2596); } @@ -1082,7 +1083,7 @@ void func_809E8C0C(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thi EnDekubaba* this = thisx; if (arg1 == 1) { - Collider_UpdateSpheres(arg1, &this->unk238); + Collider_UpdateSpheres(arg1, &this->collider); } } 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 668ffc81a59..2c4f75e6951 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -21,8 +21,8 @@ typedef struct EnDekubaba { /* 0x200 */ Vec3s unk200[8]; /* 0x230 */ f32 unk230; /* 0x234 */ struct CollisionPoly* unk234; - /* 0x238 */ ColliderJntSph unk238; - /* 0x258 */ ColliderJntSphElement unk258[7]; + /* 0x238 */ ColliderJntSph collider; + /* 0x258 */ ColliderJntSphElement colliderElements[7]; } EnDekubaba; // size = 0x418 #endif diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index a4317e72dce..90555315077 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -167,8 +167,8 @@ void EnFish_Init(Actor* thisx, PlayState* play) { sp3A = this->actor.params; Actor_ProcessInitChain(&this->actor, D_80A17070); SkelAnime_InitFlex(play, &this->unk1AC, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); - Collider_InitJntSph(play, &this->unk14C); - Collider_SetJntSph(play, &this->unk14C, &this->actor, &sJntSphInit, &this->unk16C); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.colChkInfo.mass = 0x32; this->unk24C = (s16)(s32)(Rand_ZeroOne() * 65535.5f); this->unk24E = (s16)(s32)(Rand_ZeroOne() * 65535.5f); @@ -187,7 +187,7 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnFish* this = (EnFish*)thisx; - Collider_DestroyJntSph(play, &this->unk14C); + Collider_DestroyJntSph(play, &this->collider); } void func_80A155D0(EnFish* this) { @@ -664,7 +664,7 @@ void func_80A16C68(EnFish* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->unk250); } if (this->actor.xzDistToPlayer < 70.0f) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.01f); if (Actor_HasParent(&this->actor, play)) { @@ -726,5 +726,5 @@ void EnFish_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); SkelAnime_DrawFlexOpa(play, this->unk1AC.skeleton, this->unk1AC.jointTable, this->unk1AC.dListCount, NULL, NULL, NULL); - Collider_UpdateSpheres(0, &this->unk14C); + Collider_UpdateSpheres(0, &this->collider); } 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 e3a23434581..392fa609987 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -8,8 +8,8 @@ struct EnFish; typedef struct EnFish { /* 0x000 */ Actor actor; - /* 0x14C */ ColliderJntSph unk14C; - /* 0x16C */ ColliderJntSphElement unk16C; + /* 0x14C */ ColliderJntSph collider; + /* 0x16C */ ColliderJntSphElement colliderElements[1]; /* 0x1AC */ SkelAnime unk1AC; /* 0x1F0 */ Vec3s unk1F0[7]; /* 0x21A */ Vec3s unk21A[7]; 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 f71036c2fe8..0bd7d8404e2 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -157,12 +157,12 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->unk14C, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->unk190, this->unk208, 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; - Collider_InitJntSph(play, &this->unk2A4); - Collider_SetJntSph(play, &this->unk2A4, &this->actor, &sJntSphInit, this->unk2C4); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); Actor_SetScale(&this->actor, ((this->actor.params * 0.1f) + 1.0f) * 0.01f); - this->unk2A4.elements[0].dim.modelSphere.radius = this->unk2A4.elements[0].dim.worldSphere.radius = + this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius = this->actor.params + 10; - this->unk2A4.elements[1].dim.modelSphere.radius = this->unk2A4.elements[1].dim.worldSphere.radius = + this->collider.elements[1].dim.modelSphere.radius = this->collider.elements[1].dim.worldSphere.radius = (this->actor.params + 10) * 2; this->actor.home.pos = this->actor.world.pos; this->actor.floorHeight = this->actor.world.pos.y; @@ -187,7 +187,7 @@ void EnSkb_Destroy(Actor* thisx, PlayState* play) { } } } - Collider_DestroyJntSph(play, &this->unk2A4); + Collider_DestroyJntSph(play, &this->collider); } void EnSkb_DecideNextAction(EnSkb* this) { @@ -289,7 +289,7 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { void EnSkb_SetupAttack(EnSkb* this) { Animation_Change(&this->unk14C, &object_skb_000460_Anim, 0.6f, 0.0f, Animation_GetLastFrame(&object_skb_000460_Anim), ANIMMODE_ONCE_INTERP, 4.0f); - this->unk2A4.base.atFlags &= ~AT_BOUNCED; + this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_ATTACKING; this->actor.speed = 0.0f; func_80AFC9A0(this, EnSkb_Attack); @@ -306,8 +306,8 @@ void EnSkb_Attack(EnSkb* this, PlayState* play) { } else if (temp_ft1 == 6) { this->setColliderAT = false; } - if (this->unk2A4.base.atFlags & AT_BOUNCED) { - this->unk2A4.base.atFlags &= ~(AT_HIT | AT_BOUNCED); + if (this->collider.base.atFlags & AT_BOUNCED) { + this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); EnSkb_SetupRecoil(this); } else if (SkelAnime_Update(&this->unk14C)) { EnSkb_DecideNextAction(this); @@ -317,7 +317,7 @@ void EnSkb_Attack(EnSkb* this, PlayState* play) { void EnSkb_SetupRecoil(EnSkb* this) { Animation_Change(&this->unk14C, &object_skb_000460_Anim, -0.4f, this->unk14C.curFrame - 1.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f); - this->unk2A4.base.atFlags &= ~AT_BOUNCED; + this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_RECOILING; this->setColliderAT = false; func_80AFC9A0(this, EnSkb_Recoil); @@ -438,11 +438,11 @@ void EnSkb_CheckDamage(EnSkb* this, PlayState* play) { this->actor.colChkInfo.health = 0; this->setColliderAT = false; EnSkb_SetupDeath(this, play); - } else if ((this->actionState >= SKB_BEHAVIOR_ATTACKING) && (this->unk2A4.base.acFlags & AC_HIT)) { - this->unk2A4.base.acFlags &= ~AC_HIT; + } else if ((this->actionState >= SKB_BEHAVIOR_ATTACKING) && (this->collider.base.acFlags & AC_HIT)) { + this->collider.base.acFlags &= ~AC_HIT; if (((this->actor.colChkInfo.damageReaction != 6))) { this->lastDamageReaction = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->unk2A4.elements[1].base, true); + Actor_SetDropFlag(&this->actor, &this->collider.elements[1].base, true); this->setColliderAT = false; if (this->actor.colChkInfo.damageReaction == 1) { if (this->actionState != SKB_BEHAVIOR_STUNNED) { @@ -499,13 +499,13 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 3000.0f * this->actor.scale.y; if (this->setColliderAT) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk2A4.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->actionState >= SKB_BEHAVIOR_ATTACKING) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk2A4.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk2A4.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } s32 func_80AFDD30(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg5, void* thisx) { @@ -532,7 +532,7 @@ s32 func_80AFDD30(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg void func_80AFDF24(PlayState* arg0, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { EnSkb* this = thisx; - Collider_UpdateSpheres(arg1, &this->unk2A4); + Collider_UpdateSpheres(arg1, &this->collider); if ((this->breakFlags ^ 1) == 0) { BodyBreak_SetInfo(&this->bodyBreak, arg1, 11, 12, 18, arg2, BODYBREAK_OBJECT_SLOT_DEFAULT); } else if ((this->breakFlags ^ (this->breakFlags | 4)) == 0) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index f434fdedd58..6b9682dd7aa 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -19,8 +19,8 @@ typedef struct EnSkb { /* 0x288 */ s16 headlessYawOffset; /* 0x28A */ char pad28A[2]; /* 0x28C */ BodyBreak bodyBreak; - /* 0x2A4 */ ColliderJntSph unk2A4; - /* 0x2C4 */ ColliderJntSphElement unk2C4[2]; + /* 0x2A4 */ ColliderJntSph collider; + /* 0x2C4 */ ColliderJntSphElement colliderElements[2]; } EnSkb; // size = 0x344 #endif 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 60ed42fa847..7010d27373b 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -118,14 +118,14 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { this->actor.colChkInfo.health = 1; var_s5 = this; this->unk15E = 0xFF; - Collider_InitJntSph(play, &this->unk174); - Collider_SetJntSph(play, &this->unk174, &this->actor, &sJntSphInit, &this->unk194); + Collider_InitJntSph(play, &this->collider); + Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params < 0) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; this->unk15A = 0; - this->unk174.base.acFlags |= 4; - this->unk174.elements[0].dim.worldSphere.radius = 8; - this->unk174.elements[0].dim.modelSphere.radius = this->unk174.elements[0].dim.worldSphere.radius; + this->collider.base.acFlags |= 4; + this->collider.elements[0].dim.worldSphere.radius = 8; + this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius; func_80B21B90(this); this->actor.focus.pos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED; @@ -161,7 +161,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { void EnTp_Destroy(Actor* thisx, PlayState* play) { EnTp* this = (EnTp*)thisx; - Collider_DestroyJntSph(play, &this->unk174); + Collider_DestroyJntSph(play, &this->collider); } void func_80B21084(EnTp* this) { @@ -212,9 +212,9 @@ void func_80B212C0(EnTp* this, PlayState* play) { player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 30.0f, 1.0f, 0.5f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); - if (this->unk174.base.atFlags & AT_HIT) { - this->unk174.base.atFlags &= ~AT_HIT; - if (&player->actor == this->unk174.base.at) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + if (&player->actor == this->collider.base.at) { this->unk15A = 1; } } @@ -335,9 +335,9 @@ void func_80B219A8(EnTp* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->unk16C, 1.0f, this->actor.speed * 0.25f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); - if (this->unk174.base.atFlags & AT_HIT) { - this->unk174.base.atFlags &= ~AT_HIT; - if (&player->actor == this->unk174.base.at) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + if (&player->actor == this->collider.base.at) { this->unk15C = 1; } } @@ -378,9 +378,9 @@ void func_80B21BDC(EnTp* this, PlayState* play) { player = GET_PLAYER(play); this->unk15C -= 1; if (this->actor.xzDistToPlayer < 200.0f) { - if (this->unk174.base.atFlags & AT_HIT) { - this->unk174.base.atFlags &= ~AT_HIT; - if (&player->actor == this->unk174.base.at) { + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; + if (&player->actor == this->collider.base.at) { this->unk15A = 0; } } @@ -498,14 +498,14 @@ void func_80B221E8(EnTp* this, PlayState* play) { s32 var_s4; EnTp* new_var; - if ((this->unk174.base.acFlags & AC_HIT) && (this->unk14C >= 2)) { + if ((this->collider.base.acFlags & AC_HIT) && (this->unk14C >= 2)) { var_s2 = 0; var_s4 = 0; if (this->actor.params < 0) { var_s2 = 1; } - this->unk174.base.acFlags &= ~2; - Actor_SetDropFlagJntSph(&this->actor, &this->unk174, true); + this->collider.base.acFlags &= ~2; + Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); this->unk158 = this->actor.colChkInfo.damageReaction; if (this->actor.colChkInfo.damageReaction != 0) { if (this->actor.colChkInfo.damageReaction == 1) { @@ -536,7 +536,7 @@ void func_80B221E8(EnTp* this, PlayState* play) { } var_s0 = (EnTp*)this->actor.parent; while (var_s0 != NULL) { - var_s0->unk174.base.acFlags &= ~AC_HIT; + var_s0->collider.base.acFlags &= ~AC_HIT; if (var_s4 != 0) { var_s0->actor.freezeTimer = 80; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); @@ -552,7 +552,7 @@ void func_80B221E8(EnTp* this, PlayState* play) { } var_s0_2 = (EnTp*)this->actor.child; while (var_s0_2 != NULL) { - var_s0_2->unk174.base.acFlags &= ~AC_HIT; + var_s0_2->collider.base.acFlags &= ~AC_HIT; if (var_s4 != 0) { var_s0_2->actor.freezeTimer = 80; if (var_s2 != 0) { @@ -612,7 +612,7 @@ void EnTp_Update(Actor* thisx, PlayState* play) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_CRY); } if (this->unk14C >= 2) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk174.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.params != 0xB) { @@ -621,7 +621,7 @@ void EnTp_Update(Actor* thisx, PlayState* play) { } this->actor.focus.pos = this->actor.world.pos; if (this->unk158 == 0xE) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk174.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if ((this->unk162 & 7) == 0) { sp40.r = this->unk160; @@ -634,7 +634,7 @@ void EnTp_Update(Actor* thisx, PlayState* play) { EffectSsKiraKira_SpawnSmall(play, &sp44, &sp5C, &sp50, &sp40, &sp3C); } if ((this->unk14C >= 2) && (this->actor.colChkInfo.health != 0)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk174.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -667,6 +667,6 @@ void EnTp_Draw(Actor* thisx, PlayState* play) { } CLOSE_DISPS(play->state.gfxCtx, "../z_en_tp.c", 0x5D7); if ((this->actor.params <= 0) || (this->actor.params == 0xB)) { - Collider_UpdateSpheres(0, &this->unk174); + Collider_UpdateSpheres(0, &this->collider); } } 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 f272a43976a..fdbe9d16695 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -23,8 +23,8 @@ typedef struct EnTp { /* 0x168 */ f32 unk168; /* 0x16C */ f32 unk16C; /* 0x170 */ f32 unk170; - /* 0x174 */ ColliderJntSph unk174; - /* 0x194 */ ColliderJntSphElement unk194; + /* 0x174 */ ColliderJntSph collider; + /* 0x194 */ ColliderJntSphElement colliderElements[1]; /* 0x1D4 */ struct EnTp* unk1D4; } EnTp; // size = 0x1D8 From 112bf1f077cace3674bf6c99d28d5c5f5755bd2d Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:10:14 +0200 Subject: [PATCH 025/150] colliders cleanup: ColliderCylinder collider; --- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 24 ++++---- .../ovl_Bg_Ice_Turara/z_bg_ice_turara.h | 2 +- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 16 ++--- .../ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h | 2 +- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 60 +++++++++---------- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 14 ++--- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 18 +++--- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 2 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 29 ++++----- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 2 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 10 ++-- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 2 +- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 14 ++--- src/overlays/actors/ovl_En_Jj/z_en_jj.h | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 28 ++++----- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 2 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 24 ++++---- .../actors/ovl_En_M_Thunder/z_en_m_thunder.h | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 16 ++--- src/overlays/actors/ovl_En_Md/z_en_md.h | 2 +- .../actors/ovl_En_Wood02/z_en_wood02.c | 16 ++--- .../actors/ovl_En_Wood02/z_en_wood02.h | 2 +- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 28 ++++----- .../actors/ovl_Obj_Tsubo/z_obj_tsubo.h | 2 +- 26 files changed, 162 insertions(+), 161 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index a15d09310a9..93f54574382 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -78,9 +78,9 @@ void BgIceTurara_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->dyna.actor, D_8089266C); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &sp24); - Collider_InitCylinder(play, &this->unk16C); - Collider_SetCylinder(play, &this->unk16C, &this->dyna.actor, &sCylinderInit); - Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp24); if (this->dyna.actor.params == 0) { this->unk164 = func_80892220; @@ -95,7 +95,7 @@ void BgIceTurara_Destroy(Actor* thisx, PlayState* play) { BgIceTurara* this = (BgIceTurara*)thisx; DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(play, &this->unk16C); + Collider_DestroyCylinder(play, &this->collider); } void func_80892040(BgIceTurara* this, PlayState* play, f32 arg2) { @@ -122,11 +122,11 @@ void func_80892040(BgIceTurara* this, PlayState* play, f32 arg2) { } void func_80892220(BgIceTurara* this, PlayState* play) { - if (this->unk16C.base.acFlags & AC_HIT) { + if (this->collider.base.acFlags & AC_HIT) { func_80892040(this, play, 50.0f); Actor_Kill(&this->dyna.actor); } else { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk16C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -150,8 +150,8 @@ void func_808922B8(BgIceTurara* this, PlayState* play) { if (this->unk168 == 0) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z; - Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk16C.base); + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->unk164 = func_80892424; } else { @@ -173,8 +173,8 @@ void func_808922B8(BgIceTurara* this, PlayState* play) { } void func_80892424(BgIceTurara* this, PlayState* play) { - if ((this->unk16C.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->unk16C.base.atFlags &= ~AT_HIT; + if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + this->collider.base.atFlags &= ~AT_HIT; this->dyna.actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; if (this->dyna.actor.world.pos.y < this->dyna.actor.floorHeight) { this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; @@ -192,8 +192,8 @@ void func_80892424(BgIceTurara* this, PlayState* play) { this->dyna.actor.world.pos.y += 40.0f; Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); this->dyna.actor.world.pos.y -= 40.0f; - Collider_UpdateCylinder(&this->dyna.actor, &this->unk16C); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk16C.base); + Collider_UpdateCylinder(&this->dyna.actor, &this->collider); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } 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 218d4a8ed1e..5d025bcfa4a 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 @@ -13,7 +13,7 @@ typedef struct BgIceTurara { /* 0x164 */ BgIceTuraraActionFunc unk164; /* 0x168 */ s16 unk168; /* 0x16A */ char pad16A[2]; - /* 0x16C */ ColliderCylinder unk16C; + /* 0x16C */ ColliderCylinder collider; } BgIceTurara; // size = 0x01B8 #endif 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 41e88b2de6f..10572b11f64 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 @@ -78,11 +78,11 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { this->unk150 = LightContext_InsertLight(play, &play->lightCtx, &this->unk154); Lights_PointGlowSetInfo(&this->unk154, this->actor.world.pos.x, (s16)this->actor.world.pos.y + 65, this->actor.world.pos.z, 0, 0, 0, 0); - Collider_InitCylinder(play, &this->unk164); - Collider_SetCylinder(play, &this->unk164, &this->actor, &sCylinderInit); - this->unk164.dim.pos.x = this->actor.world.pos.x; - this->unk164.dim.pos.y = this->actor.world.pos.y; - this->unk164.dim.pos.z = this->actor.world.pos.z; + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; if ((this->unk14C == 0) && Flags_GetSwitch(play, 0x1F) && Flags_GetSwitch(play, 0x1E) && Flags_GetSwitch(play, 0x1D) && !Flags_GetSwitch(play, this->actor.params)) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_PO_SISTERS, 119.0f, 225.0f, -1566.0f, 0, 0, 0, this->actor.params); @@ -102,7 +102,7 @@ void BgPoSyokudai_Destroy(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; LightContext_RemoveLight(play, &play->lightCtx, this->unk150); - Collider_DestroyCylinder(play, &this->unk164); + Collider_DestroyCylinder(play, &this->collider); if (play->envCtx.lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) { play->envCtx.lightSettingOverride = LIGHT_SETTING_OVERRIDE_NONE; } @@ -112,8 +112,8 @@ void BgPoSyokudai_Update(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk164.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk164.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (Flags_GetSwitch(play, this->actor.params)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h index b9aa8bacfc8..5f4e64a0fb1 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.h @@ -13,7 +13,7 @@ typedef struct BgPoSyokudai { /* 0x14E */ s16 unk14E; /* 0x150 */ LightNode* unk150; /* 0x154 */ LightInfo unk154; - /* 0x164 */ ColliderCylinder unk164; + /* 0x164 */ ColliderCylinder collider; } BgPoSyokudai; // size = 0x01B0 #endif 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 50a834eb011..8bd420186dc 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -107,8 +107,8 @@ void EnBili_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; SkelAnime_Init(play, &this->unk14C, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->unk198, this->unk1B6, 5); - Collider_InitCylinder(play, &this->unk1D4); - Collider_SetCylinder(play, &this->unk1D4, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_809C1678, &D_809C166C); this->unk195 = 0; if (this->actor.params == -1) { @@ -121,18 +121,18 @@ void EnBili_Init(Actor* thisx, PlayState* play) { void EnBili_Destroy(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - Collider_DestroyCylinder(play, &this->unk1D4); + Collider_DestroyCylinder(play, &this->collider); } void func_809BF9BC(EnBili* this) { this->actor.speed = 0.7f; - this->unk1D4.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; + this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; this->unk196 = 0x20; this->actor.home.pos.y = this->actor.world.pos.y; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; - this->unk1D4.base.atFlags |= AT_ON; - this->unk1D4.base.acFlags |= AC_ON; + this->collider.base.atFlags |= AT_ON; + this->collider.base.acFlags |= AC_ON; this->unk190 = func_809C0174; } @@ -142,7 +142,7 @@ void func_809BFA14(EnBili* this) { this->actor.velocity.y = 6.0f; this->actor.gravity = -0.3f; this->actor.speed = 3.0f; - this->unk1D4.base.atFlags &= ~AT_ON; + this->collider.base.atFlags &= ~AT_ON; this->unk190 = func_809C0260; } @@ -156,7 +156,7 @@ void func_809BFA8C(EnBili* this) { void func_809BFAE8(EnBili* this) { Animation_PlayOnce(&this->unk14C, &object_bl_Anim_000064); - this->unk1D4.base.atFlags &= ~AT_ON; + this->collider.base.atFlags &= ~AT_ON; this->unk190 = func_809C04B4; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; @@ -172,7 +172,7 @@ void func_809BFB5C(EnBili* this) { this->unk196 = 0x60; this->actor.speed = 0.9f; this->actor.home.pos.y = this->actor.world.pos.y; - this->unk1D4.base.atFlags |= 1; + this->collider.base.atFlags |= 1; this->unk190 = func_809C0600; } @@ -180,8 +180,8 @@ void func_809BFBC4(EnBili* this) { if (this->unk14C.animation != &object_bl_Anim_0000A4) { Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); } - this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->unk1D4.base.ac->prevPos) + 0x8000; - this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->unk1D4.base.ac->prevPos); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->collider.base.ac->prevPos) + 0x8000; + this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->collider.base.ac->prevPos); this->unk190 = func_809C067C; this->actor.speed = 5.0f; } @@ -191,8 +191,8 @@ void func_809BFC48(EnBili* this) { Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); } this->unk196 = 0x14; - this->unk1D4.base.atFlags &= ~AT_ON; - this->unk1D4.base.acFlags &= ~AC_ON; + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_XLU, 20); @@ -208,12 +208,12 @@ void func_809BFCE8(EnBili* this) { void func_809BFD18(EnBili* this) { this->unk196 = 0x50; - this->unk1D4.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; + this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; this->actor.gravity = -1.0f; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 80); Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->unk1D4.base.atFlags &= ~AT_ON; + this->collider.base.atFlags &= ~AT_ON; this->unk190 = func_809C0980; } @@ -235,8 +235,8 @@ void func_809BFD94(EnBili* this, PlayState* play) { } this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 10); - this->unk1D4.base.atFlags &= ~AT_ON; - this->unk1D4.base.acFlags &= ~AC_ON; + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; this->unk196 = 0x12C; this->unk190 = func_809C09E0; } @@ -498,9 +498,9 @@ void func_809C09E0(EnBili* this, PlayState* play) { } void func_809C0A70(EnBili* this, PlayState* play) { - if ((this->actor.colChkInfo.health != 0) && (this->unk1D4.base.acFlags & AC_HIT)) { - this->unk1D4.base.acFlags &= ~AC_HIT; - Actor_SetDropFlag(&this->actor, &this->unk1D4.elem, true); + if ((this->actor.colChkInfo.health != 0) && (this->collider.base.acFlags & AC_HIT)) { + this->collider.base.acFlags &= ~AC_HIT; + Actor_SetDropFlag(&this->actor, &this->collider.elem, true); if ((((this->actor.colChkInfo.damageReaction != 0)) || (this->actor.colChkInfo.damage != 0))) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_DEAD); @@ -531,7 +531,7 @@ void func_809C0A70(EnBili* this, PlayState* play) { } else { func_809BFC48(this); } - if (this->unk1D4.elem.acHitElem->atDmgInfo.dmgFlags & DMG_ARROW) { + if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_ARROW) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; } } @@ -542,8 +542,8 @@ void EnBili_Update(Actor* thisx, PlayState* play2) { EnBili* this = (EnBili*)thisx; PlayState* play = play2; - if (this->unk1D4.base.atFlags & AT_HIT) { - this->unk1D4.base.atFlags &= ~AT_HIT; + if (this->collider.base.atFlags & AT_HIT) { + this->collider.base.atFlags &= ~AT_HIT; func_809BFA8C(this); } func_809C0A70(this, play); @@ -565,16 +565,16 @@ void EnBili_Update(Actor* thisx, PlayState* play2) { } else { Actor_MoveXZGravity(&this->actor); } - Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, this->unk1D4.dim.radius, this->unk1D4.dim.height, + Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, this->collider.dim.radius, this->collider.dim.height, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); - Collider_UpdateCylinder(&this->actor, &this->unk1D4); - if (this->unk1D4.base.atFlags & 1) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk1D4.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + if (this->collider.base.atFlags & 1) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->unk1D4.base.acFlags & 1) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1D4.base); + if (this->collider.base.acFlags & 1) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk1D4.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_SetFocus(&this->actor, 0.0f); } } 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 31dc7e2fbca..3e1e209fbb4 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -15,7 +15,7 @@ typedef struct EnBili { /* 0x196 */ s16 unk196; /* 0x198 */ Vec3s unk198[5]; /* 0x1B6 */ Vec3s unk1B6[5]; - /* 0x1D4 */ ColliderCylinder unk1D4; + /* 0x1D4 */ ColliderCylinder collider; } EnBili; // size = 0x220 #endif diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 334c180b031..1eed2f6c350 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -62,7 +62,7 @@ ActorProfile En_Dns_Profile = { /**/ EnDns_Update, /**/ EnDns_Draw, }; -static ColliderCylinderInitType1 D_809F03E0 = { +static ColliderCylinderInitType1 sCylinderInit = { { COL_MATERIAL_NONE, AT_NONE, @@ -181,8 +181,8 @@ void EnDns_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_809F052C); SkelAnime_InitFlex(play, &this->unk14C, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, this->unk1FC, 0x12); - Collider_InitCylinder(play, &this->unk26C); - Collider_SetCylinderType1(play, &this->unk26C, &this->actor, &D_809F03E0); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; Actor_SetScale(&this->actor, 0.01f); @@ -200,7 +200,7 @@ void EnDns_Init(Actor* thisx, PlayState* play) { void EnDns_Destroy(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; - Collider_DestroyCylinder(play, &this->unk26C); + Collider_DestroyCylinder(play, &this->collider); } void EnDns_ChangeAnim(EnDns* this, u8 arg1) { @@ -358,7 +358,7 @@ void EnDns_Idle(EnDns* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { this->unk268 = func_809EFC9C; } else { - if ((this->unk26C.base.ocFlags1 & OC1_HIT) || (this->actor.isLockedOn != 0)) { + if ((this->collider.base.ocFlags1 & OC1_HIT) || (this->actor.isLockedOn != 0)) { this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } else { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; @@ -520,8 +520,8 @@ void EnDns_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } if (this->isColliderEnabled != 0) { - Collider_UpdateCylinder(&this->actor, &this->unk26C); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk26C.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } 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 6cc9729f813..529186f0e03 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -51,7 +51,7 @@ typedef struct EnDns { /* 0x190 */ Vec3s unk190[BUSINESS_SCRUB_LIMB_MAX]; /* 0x1FC */ Vec3s unk1FC[BUSINESS_SCRUB_LIMB_MAX]; /* 0x268 */ void (*unk268)(struct EnDns*, struct PlayState*); - /* 0x26C */ ColliderCylinder unk26C; + /* 0x26C */ ColliderCylinder collider; /* 0x2B8 */ s16 unk2B8; /* 0x2BA */ u8 animIndex; /* 0x2BB */ u8 isColliderEnabled; 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 a47612caf00..12c76c36b11 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -80,8 +80,8 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->unk198, &object_ge1_000330_Skel, &object_ge1_000228_Anim, this->unk1DC, this->unk23C, 16); Animation_PlayOnce(&this->unk198, &object_ge1_000228_Anim); - Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->unk2B0 = &object_ge1_000228_Anim; this->unk2B8 = func_80A323B0; @@ -158,7 +158,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { void EnGe1_Destroy(Actor* thisx, PlayState* play) { EnGe1* this = (EnGe1*)thisx; - Collider_DestroyCylinder(play, &this->unk14C); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionFunc arg4) { @@ -228,10 +228,10 @@ void func_80A30F48(EnGe1* this, PlayState* play) { if ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 100.0f)) { func_80A30EE8(this, play); } - if (this->unk14C.base.acFlags & 2) { + if (this->collider.base.acFlags & 2) { func_80A30EE8(this, play); } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } void func_80A31000(EnGe1* this, PlayState* play) { @@ -269,10 +269,10 @@ void func_80A310C4(EnGe1* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 400.0f))) { func_80A30EE8(this, play); } - if (this->unk14C.base.acFlags & 2) { + if (this->collider.base.acFlags & 2) { func_80A30EE8(this, play); } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } void func_80A3118C(EnGe1* this, PlayState* play) { @@ -672,8 +672,8 @@ void EnGe1_Update(Actor* thisx, PlayState* play) { s32 pad; EnGe1* this = (EnGe1*)thisx; - Collider_UpdateCylinder(&this->actor, &this->unk14C); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->unk2B8(this); 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 752765e6683..cb6619c7bc6 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -10,7 +10,7 @@ typedef void (*EnGe1ActionFunc)(struct EnGe1*, struct PlayState*); typedef struct EnGe1 { /* 0x000 */ Actor actor; - /* 0x14C */ ColliderCylinder unk14C; + /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime unk198; /* 0x1DC */ Vec3s unk1DC[16]; /* 0x23C */ Vec3s unk23C[16]; 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 2ad61539689..dfea1e9606c 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -107,8 +107,8 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->unk198, &object_gla_008968_Skel, NULL, this->unk1DC, this->unk260, 22); Animation_PlayLoop(&this->unk198, &object_gla_009ED4_Anim); - Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); if (play->sceneId == SCENE_GERUDO_VALLEY) { @@ -160,7 +160,7 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { void EnGe2_Destroy(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - Collider_DestroyCylinder(play, &this->unk14C); + Collider_DestroyCylinder(play, &this->collider); } s32 func_80A32ECC(PlayState* play, EnGe2* this) { @@ -459,8 +459,8 @@ void func_80A33B7C(EnGe2* this, PlayState* play) { void func_80A33BE8(EnGe2* this, PlayState* play) { s32 pad[2]; - Collider_UpdateCylinder(&this->actor, &this->unk14C); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (!(this->unk2F4 & 2) && SkelAnime_Update(&this->unk198)) { this->unk2F4 |= 2; @@ -515,9 +515,9 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { if ((this->unk2F4 & 4) || (this->unk2F4 & 8)) { this->unk308(this, play); } else { - if (this->unk14C.base.acFlags & AC_HIT) { - if ((this->unk14C.elem.acHitElem != NULL) && - (this->unk14C.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { + if (this->collider.base.acFlags & AC_HIT) { + if ((this->collider.elem.acHitElem != NULL) && + (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the //! colorfilter. //! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144 @@ -544,7 +544,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) { } if (!(this->unk2F4 & 4) && ((PARAMS_GET_S(this->actor.params, 0, 8) == 0) || (PARAMS_GET_S(this->actor.params, 0, 8) == 1))) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } func_80A33C8C(this, play); if ((func_80A330A0() != 0) && !(this->unk2F4 & 4)) { @@ -557,11 +557,12 @@ void func_80A3402C(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnGe2* this = (EnGe2*)thisx; - Collider_UpdateCylinder(&this->actor, &this->unk14C); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if ((this->unk14C.base.acFlags & AC_HIT) && (((this->unk14C.elem.acHitElem == NULL)) || - !(this->unk14C.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) { + if ((this->collider.base.acFlags & AC_HIT) && + (((this->collider.elem.acHitElem == NULL)) || + !(this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) { this->actor.colorFilterTimer = 0; func_80A32BD0(this, 3); this->unk305 = 0x64; @@ -569,7 +570,7 @@ void func_80A3402C(Actor* thisx, PlayState* play2) { this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); } - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk14C.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (func_80A330A0() != 0) { this->actor.update = func_80A33D10; this->actor.attentionRangeType = ATTENTION_RANGE_6; diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index ad9f3b1b05c..7b868e0449b 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -8,7 +8,7 @@ struct EnGe2; typedef struct EnGe2 { /* 0x000 */ Actor actor; - /* 0x14C */ ColliderCylinder unk14C; + /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime unk198; /* 0x1DC */ Vec3s unk1DC[22]; /* 0x260 */ Vec3s unk260[22]; diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index a8dc0dad6cf..4f9d199cce7 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -82,8 +82,8 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); SkelAnime_InitFlex(play, &this->unk198, &gGerudoRedSkel, NULL, this->unk1DC, this->unk26C, 24); Animation_PlayLoop(&this->unk198, &gGerudoRedStandAnim); - Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; Actor_SetScale(&this->actor, 0.01f); this->actor.world.rot.z = 0; @@ -99,7 +99,7 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { void EnGe3_Destroy(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - Collider_DestroyCylinder(play, &this->unk14C); + Collider_DestroyCylinder(play, &this->collider); } void func_80A347F4(EnGe3* this, PlayState* play) { @@ -185,8 +185,8 @@ void func_80A34B90(EnGe3* this, PlayState* play) { void func_80A34C40(EnGe3* this, PlayState* play) { s32 pad[2]; - Collider_UpdateCylinder(&this->actor, &this->unk14C); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk14C.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if (!(this->unk30C & 2) && SkelAnime_Update(&this->unk198)) { this->unk30C |= 2; diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index ecdebd30bbb..cc0bdef81ba 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -8,7 +8,7 @@ struct EnGe3; typedef struct EnGe3 { /* 0x000 */ Actor actor; - /* 0x14C */ ColliderCylinder unk14C; + /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime unk198; /* 0x1DC */ Vec3s unk1DC[24]; /* 0x26C */ Vec3s unk26C[24]; 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 978a7843e0a..10ae4194d3f 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -232,8 +232,8 @@ void EnJj_Init(Actor* thisx, PlayState* play) { DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_jj_000A1C_Col, &sp4C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); - Collider_InitCylinder(play, &this->unk2B0); - Collider_SetCylinder(play, &this->unk2B0, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; return; @@ -264,7 +264,7 @@ void EnJj_Destroy(Actor* thisx, PlayState* play) { switch (this->dyna.actor.params) { case -1: DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - Collider_DestroyCylinder(play, &this->unk2B0); + Collider_DestroyCylinder(play, &this->collider); return; case 0: @@ -316,10 +316,10 @@ void func_80A87C30(EnJj* this, PlayState* play) { this->unk30C = 0x64; func_80A87800(this, func_80A87CEC); } - this->unk2B0.dim.pos.x = -0x4DD; - this->unk2B0.dim.pos.y = 0x14; - this->unk2B0.dim.pos.z = -0x30; - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk2B0.base); + this->collider.dim.pos.x = -0x4DD; + this->collider.dim.pos.y = 0x14; + this->collider.dim.pos.z = -0x30; + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void func_80A87CEC(EnJj* this, PlayState* play) { 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 86c614369ca..4edaacb499c 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -11,7 +11,7 @@ typedef struct EnJj { /* 0x164 */ SkelAnime unk164; /* 0x1A8 */ Vec3s unk1A8[22]; /* 0x22C */ Vec3s unk22C[22]; - /* 0x2B0 */ ColliderCylinder unk2B0; + /* 0x2B0 */ ColliderCylinder collider; /* 0x2FC */ void (*unk2FC)(struct EnJj*, struct PlayState*); /* 0x300 */ struct EnJj* unk300; /* 0x304 */ Actor* unk304; 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 fed83afe3d6..f736be5eb94 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -219,9 +219,9 @@ void func_80A9B574(EnKusa* this, PlayState* play) { void func_80A9B630(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - Collider_InitCylinder(play, &this->unk150); - Collider_SetCylinder(play, &this->unk150, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->unk150); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->collider); } void EnKusa_Init(Actor* thisx, PlayState* play) { @@ -253,7 +253,7 @@ void EnKusa_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnKusa* this = (EnKusa*)thisx; - Collider_DestroyCylinder(play, &this->unk150); + Collider_DestroyCylinder(play, &this->collider); } void EnKusa_SetupWaitForObject(EnKusa* this) { @@ -284,8 +284,8 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { func_80A9BA98(this); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); - } else if (this->unk150.base.acFlags & AC_HIT) { - this->unk150.base.acFlags &= ~AC_HIT; + } else if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; func_80A9B21C(this, play); func_80A9B07C(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); @@ -299,14 +299,14 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { EnKusa_SetupCut(this); this->actor.flags |= ACTOR_FLAG_GRASS_DESTROYED; } else { - if (!(this->unk150.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) { - this->unk150.base.ocFlags1 |= OC1_TYPE_PLAYER; + if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 12.0f)) { + this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; } if (this->actor.xzDistToPlayer < 600.0f) { - Collider_UpdateCylinder(&this->actor, &this->unk150); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk150.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 400.0f) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 100.0f) { Actor_OfferCarry(&this->actor, play); } @@ -394,8 +394,8 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 7.5f, 35.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_6 | UPDBGCHECKINFO_FLAG_7); - Collider_UpdateCylinder(&this->actor, &this->unk150); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } void EnKusa_SetupCut(EnKusa* this) { @@ -450,7 +450,7 @@ void EnKusa_Regrow(EnKusa* this, PlayState* play) { if (isFullyGrown) { Actor_SetScale(&this->actor, 0.4f); EnKusa_SetupMain(this); - this->unk150.base.ocFlags1 &= ~OC1_TYPE_PLAYER; + this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; } } 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 d28547700b6..a65e1257158 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -17,7 +17,7 @@ typedef enum EnKusaType { typedef struct EnKusa { /* 0x000 */ Actor actor; /* 0x14C */ EnKusaActionFunc actionFunc; - /* 0x150 */ ColliderCylinder unk150; + /* 0x150 */ ColliderCylinder collider; /* 0x19C */ s16 unk19C; /* 0x19E */ s8 requiredObjectSlot; /* 0x19F */ char pad19F[1]; 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 81bf24d6636..79e785b91b8 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 @@ -81,15 +81,15 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { Player* player; player = GET_PLAYER(play); - Collider_InitCylinder(play, &this->unk14C); - Collider_SetCylinder(play, &this->unk14C, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->swordType = PARAMS_GET_U(this->actor.params, 0, 8) - 1; Lights_PointNoGlowSetInfo(&this->unk19C, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 255, 255, 255, 0); this->unk198 = LightContext_InsertLight(play, &play->lightCtx, &this->unk19C); - this->unk14C.dim.radius = 0; - this->unk14C.dim.height = 40; - this->unk14C.dim.yShift = -20; + this->collider.dim.radius = 0; + this->collider.dim.height = 40; + this->collider.dim.yShift = -20; this->followPlayerTimer = 8; this->spinTrailTexScroll = 0.0f; this->actor.world.pos = player->bodyPartsPos[PLAYER_BODYPART_WAIST]; @@ -111,7 +111,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { } player->stateFlags2 &= ~PLAYER_STATE2_17; this->isUsingMagic = true; - this->unk14C.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; + this->collider.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; this->attackStrength = M_THUNDER_ATTACK_WEAK; if (this->swordType == M_THUNDER_SWORD_KOKIRI) { this->targetScale = 2; @@ -134,7 +134,7 @@ void EnMThunder_Destroy(Actor* thisx, PlayState* play) { if (this->isUsingMagic) { Magic_Reset(play); } - Collider_DestroyCylinder(play, &this->unk14C); + Collider_DestroyCylinder(play, &this->collider); EnMThunder_AdjustEnvLights(play, 0.0f); LightContext_RemoveLight(play, &play->lightCtx, this->unk198); } @@ -202,7 +202,7 @@ void EnMThunder_ChargingSpinAttack(EnMThunder* this, PlayState* play) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; } if (player->unk_858 < 0.85f) { - this->unk14C.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; + this->collider.elem.atDmgInfo.dmgFlags = sSpinAttackDmgFlags[this->swordType]; this->attackStrength = M_THUNDER_ATTACK_WEAK; if (this->swordType == M_THUNDER_SWORD_KOKIRI) { this->targetScale = 2; @@ -210,7 +210,7 @@ void EnMThunder_ChargingSpinAttack(EnMThunder* this, PlayState* play) { this->targetScale = 4; } } else { - this->unk14C.elem.atDmgInfo.dmgFlags = sJumpAttackDmgFlags[this->swordType]; + this->collider.elem.atDmgInfo.dmgFlags = sJumpAttackDmgFlags[this->swordType]; this->attackStrength = M_THUNDER_ATTACK_STRONG; if (this->swordType == M_THUNDER_SWORD_KOKIRI) { this->targetScale = 4; @@ -294,9 +294,9 @@ void EnMThunder_SpinAttacking(EnMThunder* this, PlayState* play) { } else { Math_SmoothStepToF(&this->actor.scale.x, (s32)this->targetScale, 0.6f, 0.8f, 0.0f); Actor_SetScale(&this->actor, this->actor.scale.x); - this->unk14C.dim.radius = this->actor.scale.x * 25.0f; - Collider_UpdateCylinder(&this->actor, &this->unk14C); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk14C.base); + this->collider.dim.radius = this->actor.scale.x * 25.0f; + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->followPlayerTimer > 0) { this->actor.world.pos.x = player->bodyPartsPos[PLAYER_BODYPART_WAIST].x; diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h index 1eec81ac71b..da6fe149ac0 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.h @@ -11,7 +11,7 @@ typedef void (*EnMThunderActionFunc)(struct EnMThunder*, struct PlayState*); typedef struct EnMThunder { /* 0x000 */ Actor actor; - /* 0x14C */ ColliderCylinder unk14C; + /* 0x14C */ ColliderCylinder collider; /* 0x198 */ LightNode* unk198; /* 0x19C */ LightInfo unk19C; /* 0x1AA */ char pad1AA[2]; 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 646435d050d..c6a05244367 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -603,7 +603,7 @@ void EnMd_UpdateTalking(EnMd* this, PlayState* play) { } Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode); if ((this->unk190 != EnMd_ListenToOcarina) && canUpdateTalking) { - Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->unk194.dim.radius + 30.0f, + Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, func_80AAAE94, EnMd_UpdateTalkState); } } @@ -678,8 +678,8 @@ void EnMd_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); SkelAnime_InitFlex(play, &this->unk14C, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); - Collider_InitCylinder(play, &this->unk194); - Collider_SetCylinder(play, &this->unk194, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AAC33C); if (func_80AAB03C(this, play) == 0) { Actor_Kill(&this->actor); @@ -708,7 +708,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { void EnMd_Destroy(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; - Collider_DestroyCylinder(play, &this->unk194); + Collider_DestroyCylinder(play, &this->collider); } void EnMd_Idle(EnMd* this, PlayState* play) { @@ -775,7 +775,7 @@ void EnMd_BlockPath(EnMd* this, PlayState* play) { sp2C->unk_6A8 = &this->actor; Message_StartOcarina(play, OCARINA_ACTION_CHECK_SARIA); this->unk190 = EnMd_ListenToOcarina; - } else if (this->actor.xzDistToPlayer < (30.0f + (f32)this->unk194.dim.radius)) { + } else if (this->actor.xzDistToPlayer < (30.0f + (f32)this->collider.dim.radius)) { sp2C->stateFlags2 |= PLAYER_STATE2_23; } } @@ -792,7 +792,7 @@ void EnMd_ListenToOcarina(EnMd* this, PlayState* play) { } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { SFX_PLAY_CENTERED(NA_SE_SY_CORRECT_CHIME); this->actor.textId = 0x1067; - Actor_OfferTalk(&this->actor, play, (f32)this->unk194.dim.radius + 30.0f); + Actor_OfferTalk(&this->actor, play, (f32)this->collider.dim.radius + 30.0f); this->unk190 = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { @@ -823,8 +823,8 @@ void EnMd_Update(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; s32 pad; - Collider_UpdateCylinder(&this->actor, &this->unk194); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk194.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->unk14C); func_80AAB0E0(this); EnMd_UpdateAlphaByDistance(this, play); 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 a6f95356d8a..c0a9b023609 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -18,7 +18,7 @@ typedef struct EnMd { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime unk14C; /* 0x190 */ EnMdActionFunc unk190; - /* 0x194 */ ColliderCylinder unk194; + /* 0x194 */ ColliderCylinder collider; /* 0x1E0 */ NpcInteractInfo interactInfo; /* 0x208 */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` /* 0x209 */ u8 messageState; // last known result of `Message_GetState` 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 13fe774558b..10331825edc 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -178,8 +178,8 @@ void EnWood02_Init(Actor* thisx, PlayState* play) { this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8); Actor_ProcessInitChain(&this->actor, sInitChain); if (this->actor.params < EN_WOOD_02_TYPE_11) { - Collider_InitCylinder(play, &this->unk158); - Collider_SetCylinder(play, &this->unk158, &this->actor, &sCylinderInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); var_t0_sp4E = 0; } switch (this->actor.params) { @@ -290,7 +290,7 @@ void EnWood02_Destroy(Actor* thisx, PlayState* play) { EnWood02* this = (EnWood02*)thisx; if (this->actor.params < EN_WOOD_02_TYPE_11) { - Collider_DestroyCylinder(play, &this->unk158); + Collider_DestroyCylinder(play, &this->collider); } } @@ -317,8 +317,8 @@ void EnWood02_Update(Actor* thisx, PlayState* play) { EnWood02_SpawnUnculledChildren(this, play); } if (thisx->params < EN_WOOD_02_TYPE_11) { - if (this->unk158.base.acFlags & AC_HIT) { - this->unk158.base.acFlags &= ~AC_HIT; + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; Actor_PlaySfx(&this->actor, NA_SE_IT_REFLECTION_WOOD); } if (this->actor.home.rot.y != 0) { @@ -353,9 +353,9 @@ void EnWood02_Update(Actor* thisx, PlayState* play) { this->actor.home.rot.y = 0; } if (this->actor.xzDistToPlayer < 600.0f) { - Collider_UpdateCylinder(&this->actor, &this->unk158); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk158.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk158.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } else if (this->actor.params < EN_WOOD_02_TYPE_23) { Player* player; 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 61466f818a3..e3ca27e3be3 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.h @@ -42,7 +42,7 @@ typedef struct EnWood02 { /* 0x153 */ u8 unk153; /* 0x154 */ u8 unk154; /* 0x155 */ char pad155[3]; - /* 0x158 */ ColliderCylinder unk158; + /* 0x158 */ ColliderCylinder collider; } EnWood02; // size = 0x1A4 #endif 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 d5389d6aa1d..4235f14ada6 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -125,9 +125,9 @@ s32 func_80BA0DF4(ObjTsubo* this, PlayState* play) { void func_80BA0E98(ObjTsubo* this2, PlayState* play) { ObjTsubo* this = this2; - Collider_InitCylinder(play, &this->unk150); - Collider_SetCylinder(play, &this->unk150, &this->actor, &sCylinderInit); - Collider_UpdateCylinder(&this->actor, &this->unk150); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->collider); } void ObjTsubo_Init(Actor* thisx, PlayState* play) { @@ -154,7 +154,7 @@ void ObjTsubo_Destroy(Actor* thisx, PlayState* play2) { PlayState* play = play2; ObjTsubo* this = (ObjTsubo*)thisx; - Collider_DestroyCylinder(play, &this->unk150); + Collider_DestroyCylinder(play, &this->collider); } void func_80BA100C(ObjTsubo* this, PlayState* play) { @@ -259,8 +259,8 @@ void func_80BA15BC(ObjTsubo* this, PlayState* play) { SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); func_80BA0D60(this, play); Actor_Kill(&this->actor); - } else if ((this->unk150.base.acFlags & AC_HIT) && - (this->unk150.elem.acHitElem->atDmgInfo.dmgFlags & + } else if ((this->collider.base.acFlags & AC_HIT) && + (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & (DMG_SWORD | DMG_RANGED | DMG_HAMMER | DMG_BOOMERANG | DMG_EXPLOSIVE))) { func_80BA100C(this, play); func_80BA0D60(this, play); @@ -268,11 +268,11 @@ void func_80BA15BC(ObjTsubo* this, PlayState* play) { Actor_Kill(&this->actor); } else { if (this->actor.xzDistToPlayer < 600.0f) { - Collider_UpdateCylinder(&this->actor, &this->unk150); - this->unk150.base.acFlags &= ~AC_HIT; - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk150.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + this->collider.base.acFlags &= ~AC_HIT; + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); if (this->actor.xzDistToPlayer < 150.0f) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.xzDistToPlayer < 100.0f) { @@ -318,7 +318,7 @@ void func_80BA1958(ObjTsubo* this, PlayState* play) { s32 pad[2]; if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) || - (this->unk150.base.atFlags & AT_HIT)) { + (this->collider.base.atFlags & AT_HIT)) { func_80BA100C(this, play); func_80BA0D60(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_POT_BROKEN); @@ -337,9 +337,9 @@ void func_80BA1958(ObjTsubo* this, PlayState* play) { this->actor.shape.rot.y += D_80BA1B5C; Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, 15.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_7); - Collider_UpdateCylinder(&this->actor, &this->unk150); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk150.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk150.base); + Collider_UpdateCylinder(&this->actor, &this->collider); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h index aac8532d76a..e8bc99bd25e 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.h @@ -11,7 +11,7 @@ typedef void (*ObjTsuboActionFunc)(struct ObjTsubo*, struct PlayState*); typedef struct ObjTsubo { /* 0x000 */ Actor actor; /* 0x14C */ ObjTsuboActionFunc actionFunc; - /* 0x150 */ ColliderCylinder unk150; + /* 0x150 */ ColliderCylinder collider; /* 0x19C */ s8 requiredObjectSlot; /* 0x19D */ char pad19D[3]; } ObjTsubo; // size = 0x1A0 From 7f613832b7d2463d6d7b7ed9e61e32a8e99b8572 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:15:00 +0200 Subject: [PATCH 026/150] SkelAnime skelAnime; --- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 49 ++--- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 42 ++--- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 2 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 56 +++--- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 2 +- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 14 +- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 2 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 50 ++--- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 26 +-- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 2 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 12 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 2 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 12 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 2 +- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 16 +- src/overlays/actors/ovl_En_Jj/z_en_jj.h | 2 +- src/overlays/actors/ovl_En_Md/z_en_md.c | 106 +++++------ src/overlays/actors/ovl_En_Md/z_en_md.h | 2 +- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 44 ++--- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 2 +- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 32 ++-- src/overlays/actors/ovl_En_Tr/z_en_tr.h | 2 +- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 38 ++-- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 126 ++++++------- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 2 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 174 +++++++++--------- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 2 +- 30 files changed, 414 insertions(+), 413 deletions(-) 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 8bd420186dc..92c805b571e 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -106,7 +106,8 @@ void EnBili_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_809C1698); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->unk14C, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->unk198, this->unk1B6, 5); + SkelAnime_Init(play, &this->skelAnime, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->unk198, this->unk1B6, + 5); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_809C1678, &D_809C166C); @@ -137,7 +138,7 @@ void func_809BF9BC(EnBili* this) { } void func_809BFA14(EnBili* this) { - Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); + Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); this->unk196 = 0x19; this->actor.velocity.y = 6.0f; this->actor.gravity = -0.3f; @@ -147,7 +148,7 @@ void func_809BFA14(EnBili* this) { } void func_809BFA8C(EnBili* this) { - Animation_PlayLoop(&this->unk14C, &object_bl_Anim_000024); + Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_000024); this->unk196 = 0xA; this->unk190 = func_809C02B8; this->actor.speed = 0.0f; @@ -155,7 +156,7 @@ void func_809BFA8C(EnBili* this) { } void func_809BFAE8(EnBili* this) { - Animation_PlayOnce(&this->unk14C, &object_bl_Anim_000064); + Animation_PlayOnce(&this->skelAnime, &object_bl_Anim_000064); this->collider.base.atFlags &= ~AT_ON; this->unk190 = func_809C04B4; this->actor.speed = 0.0f; @@ -168,7 +169,7 @@ void func_809BFB40(EnBili* this) { } void func_809BFB5C(EnBili* this) { - Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); + Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); this->unk196 = 0x60; this->actor.speed = 0.9f; this->actor.home.pos.y = this->actor.world.pos.y; @@ -177,8 +178,8 @@ void func_809BFB5C(EnBili* this) { } void func_809BFBC4(EnBili* this) { - if (this->unk14C.animation != &object_bl_Anim_0000A4) { - Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); + if (this->skelAnime.animation != &object_bl_Anim_0000A4) { + Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); } this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->collider.base.ac->prevPos) + 0x8000; this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->collider.base.ac->prevPos); @@ -188,7 +189,7 @@ void func_809BFBC4(EnBili* this) { void func_809BFC48(EnBili* this) { if (this->unk190 == func_809C04B4) { - Animation_PlayLoop(&this->unk14C, &object_bl_Anim_0000A4); + Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); } this->unk196 = 0x14; this->collider.base.atFlags &= ~AT_ON; @@ -247,7 +248,7 @@ void func_809BFF6C(EnBili* this) { s16 temp_ft1; s16 temp_v1_3; - temp_ft1 = this->unk14C.curFrame; + temp_ft1 = this->skelAnime.curFrame; if (this->unk190 == func_809C02B8) { temp_v1_2 = 3 - temp_ft1; this->unk194 = (ABS(temp_v1_2) + 5) % 8; @@ -298,7 +299,7 @@ void func_809C008C(EnBili* this) { } void func_809C0174(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk196 != 0) { this->unk196--; } @@ -315,7 +316,7 @@ void func_809C0174(EnBili* this, PlayState* play) { } void func_809C0260(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk196 != 0) { this->unk196--; } @@ -338,13 +339,13 @@ void func_809C02B8(EnBili* this, PlayState* play) { EffectSsLightning_Spawn(play, (Vec3f*)&sp78, &D_809C16A0, &D_809C16A4, 0xF, (s16)(s32)temp_s1, 6, 2); } } - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); if (this->unk196 != 0) { this->unk196--; } this->actor.velocity.y *= -1.0f; - if ((this->unk196 == 0) && Animation_OnFrame(&this->unk14C, 0.0f)) { + if ((this->unk196 == 0) && Animation_OnFrame(&this->skelAnime, 0.0f)) { if (this->actor.params == 1) { func_809BFCE8(this); } else { @@ -357,9 +358,9 @@ void func_809C04B4(EnBili* this, PlayState* play) { s32 animFinished; f32 sp28; - animFinished = SkelAnime_Update(&this->unk14C); - sp28 = this->unk14C.curFrame; - if (Animation_OnFrame(&this->unk14C, 9.0f)) { + animFinished = SkelAnime_Update(&this->skelAnime); + sp28 = this->skelAnime.curFrame; + if (Animation_OnFrame(&this->skelAnime, 9.0f)) { Actor_PlaySfx(&this->actor, 0x3899U); } if (sp28 > 9.0f) { @@ -372,7 +373,7 @@ void func_809C04B4(EnBili* this, PlayState* play) { } void func_809C0570(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x71C); if (this->unk196 != 0) { this->unk196--; @@ -387,7 +388,7 @@ void func_809C0570(EnBili* this, PlayState* play) { } void func_809C0600(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk196 != 0) { this->unk196--; } @@ -399,7 +400,7 @@ void func_809C0600(EnBili* this, PlayState* play) { } void func_809C067C(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (Math_StepToF(&this->actor.speed, 0.0f, 0.3f) != 0) { this->actor.world.rot.y += 0x8000; func_809BF9BC(this); @@ -407,7 +408,7 @@ void func_809C067C(EnBili* this, PlayState* play) { } void func_809C06E0(EnBili* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.colorFilterTimer = 0x14; } else { @@ -550,7 +551,7 @@ void EnBili_Update(Actor* thisx, PlayState* play2) { this->unk190(this, play); if (this->unk190 != func_809C0754) { func_809BFF6C(this); - if (Animation_OnFrame(&this->unk14C, 9.0f) && + if (Animation_OnFrame(&this->skelAnime, 9.0f) && (((this->unk190 == func_809C0174)) || (this->unk190 == func_809C0600) || (this->unk190 == func_809C0570) || (this->unk190 == func_809C067C))) { if (this->unk195 != 0) { @@ -666,7 +667,7 @@ s32 EnBili_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, f32 temp_fv0; sp20 = D_809C16C0; - temp_fv0 = this->unk14C.curFrame; + temp_fv0 = this->skelAnime.curFrame; if (arg1 == 3) { func_809C0E08(this, temp_fv0, &sp20); } else if (arg1 == 2) { @@ -691,7 +692,7 @@ void EnBili_Draw(Actor* thisx, PlayState* play) { } else { gSPSegment(POLY_XLU_DISP++, 9, D_809C1700); } - POLY_XLU_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, EnBili_OverrideLimbDraw, NULL, - this, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBili_OverrideLimbDraw, + NULL, this, POLY_XLU_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_bili.c", 1552); } 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 3e1e209fbb4..40df10b2ef7 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 struct EnBili { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ void (*unk190)(struct EnBili*, struct PlayState*); /* 0x194 */ u8 unk194; /* 0x195 */ u8 unk195; 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 c3e501bd412..565d6f21568 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 @@ -77,7 +77,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { EnSyatekiNiw* temp_v0; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->unk14C, &object_bg_006EB0_Skel, &object_bg_000710_Anim, &this->unk190, + SkelAnime_InitFlex(play, &this->skelAnime, &object_bg_006EB0_Skel, &object_bg_000710_Anim, &this->unk190, &this->unk1D2, 0xB); PRINTF("\x1b[32m☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n\x1b[m"); PRINTF("\x1b[32m☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n\x1b[m", play->bombchuBowlingStatus); @@ -103,8 +103,8 @@ void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { void func_809C3820(EnBomBowlMan* this, PlayState* play) { this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_000710_Anim); - Animation_Change(&this->unk14C, &object_bg_000710_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, ANIMMODE_LOOP, - -10.0f); + Animation_Change(&this->skelAnime, &object_bg_000710_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, + ANIMMODE_LOOP, -10.0f); this->actor.textId = 0xC0; this->unk22E = TEXT_STATE_EVENT; this->actionFunc = func_809C38A8_WaitTalk; @@ -114,7 +114,7 @@ void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayer; s16 relYawTowardsPlayerAbs; - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (Actor_TalkOfferAccepted(&this->actor, play)) { this->actionFunc = func_809C395C; } else { @@ -127,7 +127,7 @@ void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play) { } void func_809C395C(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_809C39D0; @@ -136,8 +136,8 @@ void func_809C395C(EnBomBowlMan* this, PlayState* play) { void func_809C39D0(EnBomBowlMan* this, PlayState* play) { this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_000080_Anim); - Animation_Change(&this->unk14C, &object_bg_000080_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, ANIMMODE_ONCE, - -10.0f); + Animation_Change(&this->skelAnime, &object_bg_000080_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, + ANIMMODE_ONCE, -10.0f); this->unk238 = 1; this->actionFunc = func_809C3A54; } @@ -145,8 +145,8 @@ void func_809C39D0(EnBomBowlMan* this, PlayState* play) { void func_809C3A54(EnBomBowlMan* this, PlayState* play) { f32 sp1C; - sp1C = this->unk14C.curFrame; - SkelAnime_Update(&this->unk14C); + sp1C = this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); if (sp1C == 30.0f) { this->unk22E = TEXT_STATE_EVENT; if (GET_EVENTCHKINF(EVENTCHKINF_25) || (gRegEditor->data[0x962] != 0)) { @@ -166,11 +166,11 @@ void func_809C3A54(EnBomBowlMan* this, PlayState* play) { } void func_809C3B50(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_0072AC_Anim); - Animation_Change(&this->unk14C, &object_bg_0072AC_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, + Animation_Change(&this->skelAnime, &object_bg_0072AC_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, ANIMMODE_LOOP, -10.0f); this->unk238 = 3; this->unk236 = (s16)Rand_ZeroFloat(60.0f) + 0x14; @@ -186,7 +186,7 @@ void func_809C3B50(EnBomBowlMan* this, PlayState* play) { } void func_809C3C7C(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (Actor_TalkOfferAccepted(&this->actor, play)) { this->actionFunc = func_809C3CD4; } else { @@ -195,7 +195,7 @@ void func_809C3C7C(EnBomBowlMan* this, PlayState* play) { } void func_809C3CD4(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actionFunc = func_809C3C7C; @@ -203,7 +203,7 @@ void func_809C3CD4(EnBomBowlMan* this, PlayState* play) { } void func_809C3D40(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk_258 == 0) { if (this->unk232 == 0) { this->actor.textId = 0x18; @@ -222,7 +222,7 @@ void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayer; s16 relYawTowardsPlayerAbs; - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (gRegEditor->data[0x963] != 0) { PRINTF("\x1b[31m☆ game_play->bomchu_game_flag ☆ %d\n\x1b[m", play->bombchuBowlingStatus); PRINTF("\x1b[31m☆ 壁1の状態どう? ☆ %d\n\x1b[m", this->unk23E_arr[0]); @@ -274,7 +274,7 @@ void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { } void func_809C4040(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { @@ -319,7 +319,7 @@ void func_809C4040(EnBomBowlMan* this, PlayState* play) { } void func_809C41FC(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(play, 0x38)) { @@ -346,7 +346,7 @@ void func_809C4318(EnBomBowlMan* this, PlayState* play) { Vec3f sp38 = D_809C4A54; Vec3f sp2C; - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { sp2C.x = 148.0f; sp2C.y = 40.0f; @@ -362,7 +362,7 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { s16 var_v1; s32 pad; - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk22A == 0) { switch (this->unk242) { case 0: @@ -418,7 +418,7 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { } void func_809C4664(EnBomBowlMan* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); @@ -495,7 +495,7 @@ void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809C4AA8[this->unk234])); - SkelAnime_DrawFlexOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, this->unk14C.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomBowlMan_OverrideLimbDraw, NULL, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 923); } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index 50b3e508e15..c9f83de3d0e 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -10,7 +10,7 @@ typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, struct PlayState*); typedef struct EnBomBowlMan { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ Vec3s unk190; /* 0x196 */ char pad196[0x3C]; /* maybe part of unk190[0xB]? */ /* 0x1D2 */ Vec3s unk1D2; 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 56db9c08d2b..0db6c3e1a85 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -176,7 +176,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_809E9020); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->unk17C, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->unk1D0, + SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->unk1D0, this->unk200, 8); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); @@ -252,7 +252,7 @@ void func_809E5ABC(EnDekubaba* this) { void func_809E5D28(EnDekubaba* this) { s32 i; - Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8) * 0.06666667f, 0.0f, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_ONCE, 0.0f); this->unk1C6 = 0xF; @@ -268,7 +268,7 @@ void func_809E5D28(EnDekubaba* this) { void func_809E5E58(EnDekubaba* this) { s32 i; - Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, -1.5f, + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -1.5f, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); this->unk1C6 = 0xF; for (i = 2; i < 7; i++) { @@ -279,24 +279,24 @@ void func_809E5E58(EnDekubaba* this) { void func_809E5F44(EnDekubaba* this) { this->unk1C6 = Animation_GetLastFrame(&object_dekubaba_Anim_0002B8) * 2; - Animation_MorphToLoop(&this->unk17C, &object_dekubaba_Anim_0002B8, -3.0f); + Animation_MorphToLoop(&this->skelAnime, &object_dekubaba_Anim_0002B8, -3.0f); this->unk1C0 = func_809E6ED4; } void func_809E5F9C(EnDekubaba* this) { this->unk1C6 = 8; this->unk1C0 = func_809E738C; - this->unk17C.playSpeed = 0.0f; + this->skelAnime.playSpeed = 0.0f; } void func_809E5FBC(EnDekubaba* this) { - Animation_PlayOnce(&this->unk17C, &object_dekubaba_Anim_000208); + Animation_PlayOnce(&this->skelAnime, &object_dekubaba_Anim_000208); this->unk1C6 = 0; this->unk1C0 = func_809E7104; } void func_809E6000(EnDekubaba* this) { - Animation_Change(&this->unk17C, &object_dekubaba_Anim_000208, 1.0f, 15.0f, + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_000208, 1.0f, 15.0f, Animation_GetLastFrame(&object_dekubaba_Anim_000208), ANIMMODE_ONCE, -3.0f); this->unk1C6 = 0; this->unk1C0 = func_809E7458; @@ -306,11 +306,11 @@ void func_809E6078(EnDekubaba* this) { this->unk1C6 = 9; this->collider.base.acFlags |= AC_ON; this->unk1C0 = func_809E77E4; - this->unk17C.playSpeed = -1.0f; + this->skelAnime.playSpeed = -1.0f; } void func_809E60A8(EnDekubaba* this, s32 arg1) { - Animation_MorphToPlayOnce(&this->unk17C, &object_dekubaba_Anim_000208, -5.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_dekubaba_Anim_000208, -5.0f); this->unk1C6 = arg1; this->collider.base.acFlags &= ~AC_ON; Actor_SetScale(&this->actor, this->unk230 * 0.01f); @@ -324,7 +324,7 @@ void func_809E60A8(EnDekubaba* this, s32 arg1) { void func_809E6170(EnDekubaba* this) { this->unk1C6 = 0; - this->unk17C.playSpeed = 0.0f; + this->skelAnime.playSpeed = 0.0f; this->actor.gravity = -0.8f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; @@ -335,7 +335,7 @@ void func_809E6170(EnDekubaba* this) { } void func_809E61E0(EnDekubaba* this) { - Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, -1.5f, + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -1.5f, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); this->collider.base.acFlags &= ~AC_ON; this->unk1C0 = func_809E7F14; @@ -348,11 +348,11 @@ void func_809E6264(EnDekubaba* this) { this->collider.elements[i].base.acElemFlags |= ACELEM_ON; } if (this->unk1C6 == 1) { - Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); this->unk1C6 = 0x28; } else { - Animation_Change(&this->unk17C, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); this->unk1C6 = 0x3C; } @@ -410,7 +410,7 @@ void func_809E65A0(EnDekubaba* this, PlayState* play) { if (this->unk1C6 != 0) { this->unk1C6--; } - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = this->unk230 * 0.01f * (0.5f + (((0xF - this->unk1C6) * 0.5f) / 15.0f)); @@ -471,7 +471,7 @@ void func_809E6A04(EnDekubaba* this, PlayState* play) { if (this->unk1C6 != 0) { this->unk1C6 -= 1; } - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = this->unk230 * 0.01f * (0.5f + (this->unk1C6 * 0.033333335f)); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); @@ -530,8 +530,8 @@ void func_809E6ED4(EnDekubaba* this, PlayState* play) { Actor* sp34; sp34 = play->actorCtx.actorLists[2].head; - SkelAnime_Update(&this->unk17C); - if (Animation_OnFrame(&this->unk17C, 0.0f) || Animation_OnFrame(&this->unk17C, 12.0f)) { + SkelAnime_Update(&this->skelAnime); + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { @@ -575,9 +575,9 @@ void func_809E7104(EnDekubaba* this, PlayState* play) { s16 sp4A; Vec3f sp3C; - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); if (this->unk1C6 == 0) { - if (Animation_OnFrame(&this->unk17C, 1.0f)) { + if (Animation_OnFrame(&this->skelAnime, 1.0f)) { if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_ATTACK); } else { @@ -585,13 +585,13 @@ void func_809E7104(EnDekubaba* this, PlayState* play) { } } Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x222); - sp4A = this->unk17C.curFrame * 10.0f; + sp4A = this->skelAnime.curFrame * 10.0f; sp4C = true; sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[0], -0xE38, sp4A + 0x38E); sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[1], -0xE38, sp4A + 0x71C); sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[2], -0xE38, sp4A + 0xE38); if (sp4C) { - Animation_PlayLoopSetSpeed(&this->unk17C, &object_dekubaba_Anim_0002B8, 4.0f); + Animation_PlayLoopSetSpeed(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f); sp3C.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; sp3C.y = 0.0f; sp3C.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; @@ -607,7 +607,7 @@ void func_809E7104(EnDekubaba* this, PlayState* play) { if ((this->unk1C6 >= 4) && !Actor_IsFacingPlayer(&this->actor, 0x16C)) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 15, 0x71C); } - if (Animation_OnFrame(&this->unk17C, 0.0f) || Animation_OnFrame(&this->unk17C, 12.0f)) { + if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { if (this->actor.params == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { @@ -642,7 +642,7 @@ void func_809E7458(EnDekubaba* this, PlayState* play) { f32 var_fv1; s32 var_v0; - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); if (this->unk1C6 == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x38E); Math_ScaledStepToS(&this->unk1CA_arr[0], -0x888, 0x16C); @@ -710,7 +710,7 @@ void func_809E7458(EnDekubaba* this, PlayState* play) { void func_809E77E4(EnDekubaba* this, PlayState* play) { s32 temp_s0; - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); if (this->unk1C6 >= 9) { temp_s0 = 0; temp_s0 |= Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 1, 0x11C6, 0x71C); @@ -734,7 +734,7 @@ void func_809E77E4(EnDekubaba* this, PlayState* play) { void func_809E78DC(EnDekubaba* this, PlayState* play) { s32 temp_s0; - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); temp_s0 = true; temp_s0 &= Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0xE38); temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[0], -0x4000, 0xE38); @@ -760,7 +760,7 @@ void func_809E78DC(EnDekubaba* this, PlayState* play) { } void func_809E79EC(EnDekubaba* this, PlayState* play) { - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); if (this->unk1C6 != 0) { this->unk1C6 -= 1; } @@ -777,7 +777,7 @@ void func_809E79EC(EnDekubaba* this, PlayState* play) { void func_809E7A88(EnDekubaba* this, PlayState* play) { s16 temp_v0; - SkelAnime_Update(&this->unk17C); + SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1CA_arr[0], 0x71C); Math_ScaledStepToS(&this->unk1CA_arr[0], this->unk1CA_arr[1], 0x71C); Math_ScaledStepToS(&this->unk1CA_arr[1], this->unk1CA_arr[2], 0x71C); @@ -1094,7 +1094,7 @@ void EnDekubaba_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2752); Gfx_SetupDL_25Opa(play->state.gfxCtx); if (this->unk1C0 != func_809E80D8) { - SkelAnime_DrawOpa(play, this->unk17C.skeleton, this->unk17C.jointTable, NULL, func_809E8C0C, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, func_809E8C0C, this); if (this->unk1C0 == func_809E64F4) { func_809E858C(this, play); } else { 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 2c4f75e6951..6ee7a3827ca 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -11,7 +11,7 @@ typedef struct EnDekubaba { /* 0x14C */ Vec3f unk14C[2]; /* 0x164 */ Vec3f unk164; /* 0x170 */ Vec3f unk170; - /* 0x17C */ SkelAnime unk17C; + /* 0x17C */ SkelAnime skelAnime; /* 0x1C0 */ void (*unk1C0)(struct EnDekubaba*, struct PlayState*); /* 0x1C4 */ char pad1C4[2]; /* 0x1C6 */ s16 unk1C6; diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 1eed2f6c350..db2bb8f54f2 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -179,7 +179,7 @@ void EnDns_Init(Actor* thisx, PlayState* play) { } PRINTF("\x1b[32m◆◆◆ 売りナッツ『%s』 ◆◆◆\x1b[m\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); Actor_ProcessInitChain(&this->actor, D_809F052C); - SkelAnime_InitFlex(play, &this->unk14C, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, this->unk1FC, 0x12); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); @@ -208,7 +208,7 @@ void EnDns_ChangeAnim(EnDns* this, u8 arg1) { temp_ft0 = Animation_GetLastFrame(sAnimationInfo[arg1].animation); this->animIndex = arg1; - Animation_Change(&this->unk14C, sAnimationInfo[arg1].animation, 1.0f, 0.0f, temp_ft0, sAnimationInfo[arg1].mode, + Animation_Change(&this->skelAnime, sAnimationInfo[arg1].animation, 1.0f, 0.0f, temp_ft0, sAnimationInfo[arg1].mode, sAnimationInfo[arg1].morphFrames); } @@ -345,7 +345,7 @@ void EnDns_PayForDekuNutUpgrade(EnDns* this) { } void EnDns_SetupIdle(EnDns* this, PlayState* play) { - if (this->unk14C.curFrame == this->unk14C.endFrame) { + if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->unk268 = EnDns_Idle; EnDns_ChangeAnim(this, DNS_ANIM_IDLE); } @@ -470,7 +470,7 @@ void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play) { void EnDns_Burrow(EnDns* this, PlayState* play) { f32 f = Animation_GetLastFrame(&gBusinessScrubLeaveBurrowAnim); - if (this->unk14C.curFrame == f) { + if (this->skelAnime.curFrame == f) { Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); this->unk268 = EnDns_PostBurrow; this->unk2BC = 0; @@ -513,7 +513,7 @@ void EnDns_Update(Actor* thisx, PlayState* play) { this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; Actor_SetFocus(&this->actor, 60.0f); Actor_SetScale(&this->actor, 0.01f); - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); Actor_MoveXZGravity(&this->actor); this->unk268(this, play); if (this->unk2BC != 0) { @@ -529,6 +529,6 @@ void EnDns_Draw(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, this->unk14C.dListCount, NULL, NULL, - &this->actor); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, &this->actor); } 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 529186f0e03..091037ab625 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -47,7 +47,7 @@ typedef struct EnDnsPurchaseInfo { typedef struct EnDns { /* 0x0000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ Vec3s unk190[BUSINESS_SCRUB_LIMB_MAX]; /* 0x1FC */ Vec3s unk1FC[BUSINESS_SCRUB_LIMB_MAX]; /* 0x268 */ void (*unk268)(struct EnDns*, struct PlayState*); diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 90555315077..afd7b71a4f2 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -121,13 +121,13 @@ f32 func_80A15280(Vec3f* arg0, Vec3f* arg1) { } void func_80A152AC(EnFish* this) { - Animation_Change(&this->unk1AC, &gFish2Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish2Anim), ANIMMODE_LOOP_INTERP, - 2.0f); + Animation_Change(&this->skelAnime, &gFish2Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish2Anim), + ANIMMODE_LOOP_INTERP, 2.0f); } void func_80A15310(EnFish* this) { - Animation_Change(&this->unk1AC, &gFish1Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish1Anim), ANIMMODE_LOOP_INTERP, - 2.0f); + Animation_Change(&this->skelAnime, &gFish1Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish1Anim), + ANIMMODE_LOOP_INTERP, 2.0f); } void func_80A15374(EnFish* this) { @@ -166,7 +166,7 @@ void EnFish_Init(Actor* thisx, PlayState* play) { sp3A = this->actor.params; Actor_ProcessInitChain(&this->actor, D_80A17070); - SkelAnime_InitFlex(play, &this->unk1AC, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); this->actor.colChkInfo.mass = 0x32; @@ -228,8 +228,8 @@ void func_80A157A4(EnFish* this) { void func_80A157FC(EnFish* this, PlayState* play) { func_80A155D0(this); Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.05f, 0.3f, 0.0f); - this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.4f) + 0.8f, 2.0f); - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.4f) + 0.8f, 2.0f); + SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->unk248 <= 0) { func_80A158EC(this); @@ -264,8 +264,8 @@ void func_80A15944(EnFish* this, PlayState* play) { } } this->actor.shape.rot.y = this->actor.world.rot.y; - this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); + SkelAnime_Update(&this->skelAnime); if (this->unk248 <= 0) { func_80A157A4(this); } else if (this->actor.child == &this->actor) { @@ -318,8 +318,8 @@ void func_80A15B2C(EnFish* this, PlayState* play) { } } this->actor.shape.rot.y = this->actor.world.rot.y; - this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); + SkelAnime_Update(&this->skelAnime); if ((this->unk248 <= 0) || !sp34) { func_80A157A4(this); } else if (this->actor.child == &this->actor) { @@ -363,8 +363,8 @@ void func_80A15D68(EnFish* this, PlayState* play) { Math_StepToAngleS(&this->actor.world.rot.y, v, 0xBB8); } this->actor.shape.rot.y = this->actor.world.rot.y; - this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); + SkelAnime_Update(&this->skelAnime); if (this->unk248 <= 0) { func_80A157A4(this); } @@ -387,7 +387,7 @@ void func_80A15F84(EnFish* this, PlayState* play) { this->actor.shape.rot.x = this->actor.world.rot.x; this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.shape.rot.z = this->actor.world.rot.z; - SkelAnime_Update(&this->unk1AC); + SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk248 = 0x190; func_80A160BC(this); @@ -449,7 +449,7 @@ void func_80A16200(EnFish* this, PlayState* play) { this->actor.world.rot.y += (s16)(s32)(((Math_SinS(this->unk24C) * 2000.0f) + (Math_SinS(this->unk24E) * 1000.0f)) * Rand_ZeroOne()); this->actor.shape.rot = this->actor.world.rot; - SkelAnime_Update(&this->unk1AC); + SkelAnime_Update(&this->skelAnime); if (this->unk248 <= 0) { Actor_Kill(&this->actor); return; @@ -499,8 +499,8 @@ void func_80A16450(EnFish* this, PlayState* play) { if (this->unk248 < 0x64) { Actor_SetScale(&this->actor, this->actor.scale.x * 0.982f); } - this->unk1AC.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 1.0f, 4.0f); - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 1.0f, 4.0f); + SkelAnime_Update(&this->skelAnime); if (this->unk248 <= 0) { Actor_Kill(&this->actor); } @@ -550,8 +550,8 @@ void func_80A16670(EnFish* this, PlayState* play) { } this->actor.shape.rot.y = this->actor.world.rot.y; //! @bug swapped min and max clamp bounds - this->unk1AC.playSpeed = CLAMP((this->actor.speed * 1.2f) + 0.2f + sp44, 1.5f, 0.5); - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = CLAMP((this->actor.speed * 1.2f) + 0.2f + sp44, 1.5f, 0.5); + SkelAnime_Update(&this->skelAnime); if (this->unk248 <= 0) { this->unk248 = Rand_S16Offset(5, 0x50); } @@ -575,8 +575,8 @@ void func_80A16898(EnFish* this, PlayState* play) { } else { D_80A17018 -= 0.4f; } - this->unk1AC.playSpeed = ((sp24 + sp20) * 0.5f) + 2.0f; - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = ((sp24 + sp20) * 0.5f) + 2.0f; + SkelAnime_Update(&this->skelAnime); } void func_80A169C8(EnFish* this, PlayState* play) { @@ -589,8 +589,8 @@ void func_80A169C8(EnFish* this, PlayState* play) { this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.z += 0x64; Math_StepToF(&D_80A17014, 0.0f, 1.0f); - this->unk1AC.playSpeed = ((sp28 + sp24) * 0.5f) + 2.0f; - SkelAnime_Update(&this->unk1AC); + this->skelAnime.playSpeed = ((sp28 + sp24) * 0.5f) + 2.0f; + SkelAnime_Update(&this->skelAnime); } void func_80A16A64(EnFish* this, PlayState* play) { @@ -724,7 +724,7 @@ void EnFish_Draw(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawFlexOpa(play, this->unk1AC.skeleton, this->unk1AC.jointTable, this->unk1AC.dListCount, NULL, NULL, - NULL); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, NULL); Collider_UpdateSpheres(0, &this->collider); } 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 392fa609987..64eb3e68616 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -10,7 +10,7 @@ typedef struct EnFish { /* 0x000 */ Actor actor; /* 0x14C */ ColliderJntSph collider; /* 0x16C */ ColliderJntSphElement colliderElements[1]; - /* 0x1AC */ SkelAnime unk1AC; + /* 0x1AC */ SkelAnime skelAnime; /* 0x1F0 */ Vec3s unk1F0[7]; /* 0x21A */ Vec3s unk21A[7]; /* 0x244 */ void (*unk244)(struct EnFish*, struct PlayState*); 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 12c76c36b11..86742a2d9dc 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -77,9 +77,9 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->unk198, &object_ge1_000330_Skel, &object_ge1_000228_Anim, this->unk1DC, + SkelAnime_InitFlex(play, &this->skelAnime, &object_ge1_000330_Skel, &object_ge1_000228_Anim, this->unk1DC, this->unk23C, 16); - Animation_PlayOnce(&this->unk198, &object_ge1_000228_Anim); + Animation_PlayOnce(&this->skelAnime, &object_ge1_000228_Anim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -167,7 +167,7 @@ s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionF this->unk2B8 = func_80A323EC; this->unk2AC &= ~4; this->unk2B0 = &object_ge1_000228_Anim; - Animation_Change(&this->unk198, &object_ge1_000228_Anim, 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_ge1_000228_Anim, 1.0f, 0.0f, Animation_GetLastFrame(&object_ge1_000228_Anim), ANIMMODE_ONCE, -8.0f); return 1; } else { @@ -180,7 +180,7 @@ s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionF } void func_80A30D48(EnGe1* this) { - Animation_Change(&this->unk198, &object_ge1_000228_Anim, -1.0f, Animation_GetLastFrame(&object_ge1_000228_Anim), + Animation_Change(&this->skelAnime, &object_ge1_000228_Anim, -1.0f, Animation_GetLastFrame(&object_ge1_000228_Anim), 0.0f, ANIMMODE_ONCE, 8.0f); this->unk2B0 = &object_ge1_000228_Anim; this->unk2B8 = func_80A323B0; @@ -301,7 +301,7 @@ void func_80A31234(EnGe1* this, PlayState* play) { Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); this->unk2AF = 0x32; Message_CloseTextbox(play); - } else if ((this->unk198.curFrame == 15.0f) || (this->unk198.curFrame == 19.0f)) { + } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Actor_PlaySfx(&this->actor, 0x184DU); } } @@ -309,7 +309,7 @@ void func_80A31234(EnGe1* this, PlayState* play) { void func_80A312E4(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk2B4 = func_80A31234; - Animation_Change(&this->unk198, &object_ge1_00A048_Anim, 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_ge1_00A048_Anim, 1.0f, 0.0f, Animation_GetLastFrame(&object_ge1_00A048_Anim), ANIMMODE_ONCE, -3.0f); this->unk2B0 = &object_ge1_00A048_Anim; this->unk2B8 = func_80A323EC; @@ -389,7 +389,7 @@ void func_80A31644(EnGe1* this, PlayState* play) { Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); this->unk2AF = 0x32; Message_CloseTextbox(play); - } else if ((this->unk198.curFrame == 15.0f) || (this->unk198.curFrame == 19.0f)) { + } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Actor_PlaySfx(&this->actor, NA_SE_IT_HAND_CLAP); } } @@ -398,7 +398,7 @@ void func_80A316F4(EnGe1* this, PlayState* play) { this->unk2AC |= 1; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk2B4 = func_80A31644; - Animation_Change(&this->unk198, &object_ge1_00A048_Anim, 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_ge1_00A048_Anim, 1.0f, 0.0f, Animation_GetLastFrame(&object_ge1_00A048_Anim), ANIMMODE_ONCE, -3.0f); this->unk2B0 = &object_ge1_00A048_Anim; this->unk2B8 = func_80A323EC; @@ -431,7 +431,7 @@ void func_80A31880(EnGe1* this, PlayState* play) { if (func_80A30C70(this, play, textId, 100.0f, func_80A3183C) != 0) { this->unk2B8 = func_80A323B0; this->unk2B0 = &object_ge1_00A498_Anim; - Animation_Change(&this->unk198, &object_ge1_00A498_Anim, 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_ge1_00A498_Anim, 1.0f, 0.0f, Animation_GetLastFrame(&object_ge1_00A498_Anim), ANIMMODE_ONCE, -8.0f); } } @@ -695,14 +695,14 @@ void EnGe1_Update(Actor* thisx, PlayState* play) { } void func_80A323B0(EnGe1* this) { - if (SkelAnime_Update(&this->unk198) != 0) { - Animation_PlayOnce(&this->unk198, this->unk2B0); + if (SkelAnime_Update(&this->skelAnime) != 0) { + Animation_PlayOnce(&this->skelAnime, this->unk2B0); } } void func_80A323EC(EnGe1* this) { if (!(this->unk2AC & 4)) { - if (SkelAnime_Update(&this->unk198) != 0) { + if (SkelAnime_Update(&this->skelAnime) != 0) { this->unk2AC |= 4; } this->unk2AC |= 8; @@ -748,7 +748,7 @@ void EnGe1_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1442); Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A327B4[this->unk2A8])); - SkelAnime_DrawFlexOpa(play, this->unk198.skeleton, this->unk198.jointTable, this->unk198.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1459); } 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 cb6619c7bc6..5a813d84c4d 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -11,7 +11,7 @@ typedef void (*EnGe1ActionFunc)(struct EnGe1*, struct PlayState*); typedef struct EnGe1 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; - /* 0x198 */ SkelAnime unk198; + /* 0x198 */ SkelAnime skelAnime; /* 0x1DC */ Vec3s unk1DC[16]; /* 0x23C */ Vec3s unk23C[16]; /* 0x29C */ Vec3s unk29C; 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 dfea1e9606c..8ca65cfcf10 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -95,7 +95,7 @@ static s32 D_80A343BC[3] = { void func_80A32BD0(EnGe2* this, s32 arg1) { this->unk308 = D_80A3433C[arg1]; - Animation_Change(&this->unk198, D_80A34360[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A34360[arg1]), + Animation_Change(&this->skelAnime, D_80A34360[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A34360[arg1]), D_80A34384[arg1], -8.0f); this->unk2F4 &= ~2; } @@ -105,8 +105,8 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->unk198, &object_gla_008968_Skel, NULL, this->unk1DC, this->unk260, 22); - Animation_PlayLoop(&this->unk198, &object_gla_009ED4_Anim); + SkelAnime_InitFlex(play, &this->skelAnime, &object_gla_008968_Skel, NULL, this->unk1DC, this->unk260, 22); + Animation_PlayLoop(&this->skelAnime, &object_gla_009ED4_Anim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -462,7 +462,7 @@ void func_80A33BE8(EnGe2* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if (!(this->unk2F4 & 2) && SkelAnime_Update(&this->unk198)) { + if (!(this->unk2F4 & 2) && SkelAnime_Update(&this->skelAnime)) { this->unk2F4 |= 2; } } @@ -606,7 +606,7 @@ void EnGe2_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A343BC[this->unk2E4])); func_8002EBCC(&this->actor, play, 0); - SkelAnime_DrawFlexOpa(play, this->unk198.skeleton, this->unk198.jointTable, this->unk198.dListCount, func_80A3415C, - func_80A341A0, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80A3415C, func_80A341A0, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1291); } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 7b868e0449b..2e2395874a0 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -9,7 +9,7 @@ struct EnGe2; typedef struct EnGe2 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; - /* 0x198 */ SkelAnime unk198; + /* 0x198 */ SkelAnime skelAnime; /* 0x1DC */ Vec3s unk1DC[22]; /* 0x260 */ Vec3s unk260[22]; /* 0x2E4 */ s16 unk2E4; diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 4f9d199cce7..a99c03d4783 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -70,7 +70,7 @@ static s32 D_80A351D4[3] = { 0x06005FE8, 0x060065A8, 0x06006D28 }; void func_80A34620(EnGe3* this, s32 arg1) { this->unk310 = D_80A351BC[arg1]; - Animation_Change(&this->unk198, D_80A351C0[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A351C0[arg1]), + Animation_Change(&this->skelAnime, D_80A351C0[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A351C0[arg1]), D_80A351C4[arg1], -8.0f); this->unk30C &= ~2; } @@ -80,8 +80,8 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->unk198, &gGerudoRedSkel, NULL, this->unk1DC, this->unk26C, 24); - Animation_PlayLoop(&this->unk198, &gGerudoRedStandAnim); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->unk1DC, this->unk26C, 24); + Animation_PlayLoop(&this->skelAnime, &gGerudoRedStandAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; @@ -188,7 +188,7 @@ void func_80A34C40(EnGe3* this, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if (!(this->unk30C & 2) && SkelAnime_Update(&this->unk198)) { + if (!(this->unk30C & 2) && SkelAnime_Update(&this->skelAnime)) { this->unk30C |= 2; } } @@ -292,7 +292,7 @@ void EnGe3_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A351D4[this->unk2FC])); func_8002EBCC(&this->actor, play, 0); - SkelAnime_DrawFlexOpa(play, this->unk198.skeleton, this->unk198.jointTable, this->unk198.dListCount, func_80A34E58, - func_80A35004, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + func_80A34E58, func_80A35004, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 631); } diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index cc0bdef81ba..8e141be4d06 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -9,7 +9,7 @@ struct EnGe3; typedef struct EnGe3 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; - /* 0x198 */ SkelAnime unk198; + /* 0x198 */ SkelAnime skelAnime; /* 0x1DC */ Vec3s unk1DC[24]; /* 0x26C */ Vec3s unk26C[24]; /* 0x2FC */ s16 unk2FC; 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 10ae4194d3f..eb4d1d99477 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -213,9 +213,9 @@ void EnJj_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); switch (this->dyna.actor.params) { case -1: - SkelAnime_InitFlex(play, &this->unk164, &object_jj_00B9A8_Skel, &object_jj_001F4C_Anim, this->unk1A8, + SkelAnime_InitFlex(play, &this->skelAnime, &object_jj_00B9A8_Skel, &object_jj_001F4C_Anim, this->unk1A8, this->unk22C, 22); - Animation_PlayLoop(&this->unk164, &object_jj_001F4C_Anim); + Animation_PlayLoop(&this->skelAnime, &object_jj_001F4C_Anim); this->unk30A = 0; this->unk30E = 0; this->unk30F = 0; @@ -399,14 +399,14 @@ void EnJj_Update(Actor* thisx, PlayState* play) { func_80A87D94(this, play); } else { this->unk2FC(this, play); - if (this->unk164.curFrame == 41.0f) { + if (this->skelAnime.curFrame == 41.0f) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN); } } func_80A87B1C(this); - SkelAnime_Update(&this->unk164); + SkelAnime_Update(&this->skelAnime); Actor_SetScale(&this->dyna.actor, 0.087f); - this->unk164.jointTable[10].z = (s16)this->unk308; + this->skelAnime.jointTable[10].z = (s16)this->unk308; } void EnJj_Draw(Actor* thisx, PlayState* play) { @@ -415,10 +415,10 @@ void EnJj_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_jj.c", 879); Gfx_SetupDL_37Opa(play->state.gfxCtx); - Matrix_Translate(0.0f, (cosf(this->unk164.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A88CFC[this->unk30E])); - SkelAnime_DrawFlexOpa(play, this->unk164.skeleton, this->unk164.jointTable, (s32)this->unk164.dListCount, NULL, - NULL, this); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32)this->skelAnime.dListCount, + NULL, NULL, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_jj.c", 898); } 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 4edaacb499c..78d02cf69bd 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -8,7 +8,7 @@ struct EnJj; typedef struct EnJj { /* 0x000 */ DynaPolyActor dyna; - /* 0x164 */ SkelAnime unk164; + /* 0x164 */ SkelAnime skelAnime; /* 0x1A8 */ Vec3s unk1A8[22]; /* 0x22C */ Vec3s unk22C[22]; /* 0x2B0 */ ColliderCylinder collider; 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 c6a05244367..17320deeb9a 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -126,23 +126,23 @@ void EnMd_ReverseAnimation(EnMd* this) { f32 temp_fv0; f32 temp_fv1; - temp_fv0 = this->unk14C.startFrame; - temp_fv1 = this->unk14C.endFrame; - this->unk14C.startFrame = temp_fv1; - this->unk14C.curFrame = temp_fv1; - this->unk14C.endFrame = temp_fv0; - this->unk14C.playSpeed = -1.0f; + temp_fv0 = this->skelAnime.startFrame; + temp_fv1 = this->skelAnime.endFrame; + this->skelAnime.startFrame = temp_fv1; + this->skelAnime.curFrame = temp_fv1; + this->skelAnime.endFrame = temp_fv0; + this->skelAnime.playSpeed = -1.0f; } void EnMd_UpdateAnimSequence_IdleToHalt(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_HALT); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); this->animSequenceEntry++; } break; @@ -152,12 +152,12 @@ void EnMd_UpdateAnimSequence_IdleToHalt(EnMd* this) { void EnMd_UpdateAnimSequence_HaltToCurious(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_HALT_TO_CURIOUS); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT_TO_CURIOUS); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS); this->animSequenceEntry++; } break; @@ -167,21 +167,21 @@ void EnMd_UpdateAnimSequence_HaltToCurious(EnMd* this) { void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); this->animSequenceEntry++; } else { break; } FALLTHROUGH; case 2: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_WALK); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_WALK); this->animSequenceEntry++; } break; @@ -191,12 +191,12 @@ void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { void EnMd_UpdateAnimSequence_TwitchIdle_Unused(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -206,13 +206,13 @@ void EnMd_UpdateAnimSequence_TwitchIdle_Unused(EnMd* this) { void EnMd_UpdateAnimSequence_HaltToIdle(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_HALT); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -222,12 +222,12 @@ void EnMd_UpdateAnimSequence_HaltToIdle(EnMd* this) { void EnMd_UpdateAnimSequence_SurpriseToAnnoyed(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } break; @@ -237,13 +237,13 @@ void EnMd_UpdateAnimSequence_SurpriseToAnnoyed(EnMd* this) { void EnMd_UpdateAnimSequence_SurpriseToIdle(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_SURPISE); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -253,12 +253,12 @@ void EnMd_UpdateAnimSequence_SurpriseToIdle(EnMd* this) { void EnMd_UpdateAnimSequence_CuriousToAnnoyed(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS_TO_ANNOYED); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS_TO_ANNOYED); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } break; @@ -268,12 +268,12 @@ void EnMd_UpdateAnimSequence_CuriousToAnnoyed(EnMd* this) { void EnMd_UpdateAnimSequence_AnnoyedToHalt(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED_TO_HALT); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED_TO_HALT); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_HALT); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); this->animSequenceEntry++; } break; @@ -283,12 +283,12 @@ void EnMd_UpdateAnimSequence_AnnoyedToHalt(EnMd* this) { void EnMd_UpdateAnimSequence_IdleToAnnoyed(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_ANNOYED); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_ANNOYED); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } break; @@ -298,13 +298,13 @@ void EnMd_UpdateAnimSequence_IdleToAnnoyed(EnMd* this) { void EnMd_UpdateAnimSequence_StopWalking(EnMd* this) { switch (this->animSequenceEntry) { case 0: - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); EnMd_ReverseAnimation(this); this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->unk14C, this->unk14C.endFrame) != 0) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } break; @@ -401,8 +401,8 @@ void EnMd_UpdateAnimSequence_WithTalking(EnMd* this) { } break; } - } else if (this->unk14C.animation != &gMidoIdleAnim) { - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); + } else if (this->skelAnime.animation != &gMidoIdleAnim) { + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_NONE); } EnMd_UpdateAnimSequence(this); @@ -677,7 +677,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(play, &this->unk14C, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AAC33C); @@ -685,7 +685,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->actor); return; } - Animation_ChangeByInfo(&this->unk14C, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_DEFAULT); + Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_DEFAULT); Actor_SetScale(&this->actor, 0.01f); this->actor.attentionRangeType = ATTENTION_RANGE_6; this->unk210 = 255; @@ -712,7 +712,7 @@ void EnMd_Destroy(Actor* thisx, PlayState* play) { } void EnMd_Idle(EnMd* this, PlayState* play) { - if (this->unk14C.animation == &gMidoIdleAnim) { + if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } else if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (this->animSequence != ENMD_ANIM_SEQ_SURPRISE_TO_IDLE)) { @@ -722,7 +722,7 @@ void EnMd_Idle(EnMd* this, PlayState* play) { } void EnMd_Watch(EnMd* this, PlayState* play) { - if (this->unk14C.animation == &gMidoIdleAnim) { + if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } EnMd_UpdateAnimSequence(this); @@ -746,7 +746,7 @@ void EnMd_BlockPath(EnMd* this, PlayState* play) { this->actor.world.pos.z = this->actor.home.pos.z; this->actor.world.pos.z += 60.0f * Math_CosS(temp_v0_3); temp_fv1 = fabsf((f32)this->actor.yawTowardsPlayer - (f32)temp_v0_3) * 0.001f * 3.0f; - this->unk14C.playSpeed = CLAMP(temp_fv1, 1.0f, 3.0f); + this->skelAnime.playSpeed = CLAMP(temp_fv1, 1.0f, 3.0f); } if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && @@ -766,7 +766,7 @@ void EnMd_BlockPath(EnMd* this, PlayState* play) { this->unk190 = EnMd_Walk; this->actor.speed = 1.5f; } else { - if (this->unk14C.animation == &gMidoIdleAnim) { + if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_LOST_WOODS)) { @@ -812,7 +812,7 @@ void EnMd_Walk(EnMd* this, PlayState* play) { Actor_Kill(&this->actor); } else { EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_STOP_WALKING); - this->unk14C.playSpeed = 0.0f; + this->skelAnime.playSpeed = 0.0f; this->actor.speed = 0.0f; this->actor.home.pos = this->actor.world.pos; this->unk190 = EnMd_Watch; @@ -825,7 +825,7 @@ void EnMd_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); func_80AAB0E0(this); EnMd_UpdateAlphaByDistance(this, play); Actor_MoveXZGravity(&this->actor); @@ -874,10 +874,10 @@ void EnMd_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_md.c", 1280); if (this->unk210 == 255) { gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80AAC4A4[this->unk20E])); - func_80034BA0(play, &this->unk14C, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); + func_80034BA0(play, &this->skelAnime, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); } else if (this->unk210 != 0) { gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80AAC4A4[this->unk20E])); - func_80034CC4(play, &this->unk14C, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); + func_80034CC4(play, &this->skelAnime, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_md.c", 1317); } 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 c0a9b023609..b90217a469f 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -16,7 +16,7 @@ typedef void (*EnMdActionFunc)(struct EnMd*, struct PlayState*); typedef struct EnMd { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ EnMdActionFunc unk190; /* 0x194 */ ColliderCylinder collider; /* 0x1E0 */ NpcInteractInfo interactInfo; 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 0bd7d8404e2..11e9169d063 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -154,7 +154,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(play, &this->unk14C, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->unk190, this->unk208, + SkelAnime_Init(play, &this->skelAnime, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->unk190, this->unk208, 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->collider); @@ -202,7 +202,7 @@ void EnSkb_DecideNextAction(EnSkb* this) { } void EnSkb_SetupRiseFromGround(EnSkb* this) { - Animation_PlayOnceSetSpeed(&this->unk14C, &object_skb_001854_Anim, 1.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &object_skb_001854_Anim, 1.0f); this->actionState = SKB_BEHAVIOR_BURIED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_APPEAR); @@ -210,7 +210,7 @@ void EnSkb_SetupRiseFromGround(EnSkb* this) { } void EnSkb_RiseFromGround(EnSkb* this, PlayState* play) { - if (this->unk14C.curFrame < 4.0f) { + if (this->skelAnime.curFrame < 4.0f) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; @@ -220,13 +220,13 @@ void EnSkb_RiseFromGround(EnSkb* this, PlayState* play) { if (play->gameplayFrames & 1) { func_80AFC9A8(play, this, &this->actor.world.pos); } - if (SkelAnime_Update(&this->unk14C) && (this->actor.shape.yOffset == 0.0f)) { + if (SkelAnime_Update(&this->skelAnime) && (this->actor.shape.yOffset == 0.0f)) { EnSkb_DecideNextAction(this); } } void EnSkb_SetupDespawn(EnSkb* this) { - Animation_Change(&this->unk14C, &object_skb_001854_Anim, -1.0f, Animation_GetLastFrame(&object_skb_001854_Anim), + Animation_Change(&this->skelAnime, &object_skb_001854_Anim, -1.0f, Animation_GetLastFrame(&object_skb_001854_Anim), 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState = SKB_BEHAVIOR_BURIED; this->setColliderAT = false; @@ -242,13 +242,13 @@ void EnSkb_Despawn(EnSkb* this, PlayState* play) { func_80AFC9A8(play, this, &this->actor.world.pos); } Math_SmoothStepToF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f, 0.0f); - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { Actor_Kill(&this->actor); } } void EnSkb_SetupWalkForward(EnSkb* this) { - Animation_Change(&this->unk14C, &object_skb_0047E0_Anim, 0.96000004f, 0.0f, + Animation_Change(&this->skelAnime, &object_skb_0047E0_Anim, 0.96000004f, 0.0f, Animation_GetLastFrame(&object_skb_0047E0_Anim), ANIMMODE_LOOP, -4.0f); this->actionState = SKB_BEHAVIOR_WALKING; this->headlessYawOffset = 0; @@ -268,12 +268,12 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->headlessYawOffset, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; - temp_ft2_sp34 = (s32)this->unk14C.curFrame; - SkelAnime_Update(&this->unk14C); - var_fv1_2 = ABS(this->unk14C.playSpeed); - temp_ft4 = (s32)(this->unk14C.curFrame - var_fv1_2); - var_fv1_2 = ABS(this->unk14C.playSpeed); - if ((temp_ft2_sp34 != (s32)this->unk14C.curFrame) && + temp_ft2_sp34 = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + var_fv1_2 = ABS(this->skelAnime.playSpeed); + temp_ft4 = (s32)(this->skelAnime.curFrame - var_fv1_2); + var_fv1_2 = ABS(this->skelAnime.playSpeed); + if ((temp_ft2_sp34 != (s32)this->skelAnime.curFrame) && (((temp_ft4 < 9) && (((s32)var_fv1_2 + temp_ft2_sp34) >= 8)) || ((temp_ft4 < 0x10) && (((s32)var_fv1_2 + temp_ft2_sp34) >= 0xF)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); @@ -287,7 +287,7 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { } void EnSkb_SetupAttack(EnSkb* this) { - Animation_Change(&this->unk14C, &object_skb_000460_Anim, 0.6f, 0.0f, + Animation_Change(&this->skelAnime, &object_skb_000460_Anim, 0.6f, 0.0f, Animation_GetLastFrame(&object_skb_000460_Anim), ANIMMODE_ONCE_INTERP, 4.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_ATTACKING; @@ -299,7 +299,7 @@ void EnSkb_Attack(EnSkb* this, PlayState* play) { s32 temp_ft1; u8 temp_v0; - temp_ft1 = (s32)this->unk14C.curFrame; + temp_ft1 = (s32)this->skelAnime.curFrame; if (temp_ft1 == 3) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->setColliderAT = true; @@ -309,13 +309,13 @@ void EnSkb_Attack(EnSkb* this, PlayState* play) { if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED); EnSkb_SetupRecoil(this); - } else if (SkelAnime_Update(&this->unk14C)) { + } else if (SkelAnime_Update(&this->skelAnime)) { EnSkb_DecideNextAction(this); } } void EnSkb_SetupRecoil(EnSkb* this) { - Animation_Change(&this->unk14C, &object_skb_000460_Anim, -0.4f, this->unk14C.curFrame - 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &object_skb_000460_Anim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_RECOILING; @@ -324,7 +324,7 @@ void EnSkb_SetupRecoil(EnSkb* this) { } void EnSkb_Recoil(EnSkb* this, PlayState* play) { - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { EnSkb_DecideNextAction(this); } } @@ -360,7 +360,7 @@ void EnSkb_Stunned(EnSkb* this, PlayState* play) { } void EnSkb_SetupTakeDamage(EnSkb* this) { - Animation_MorphToPlayOnce(&this->unk14C, &object_skb_000D98_Anim, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_skb_000D98_Anim, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -4.0f; } @@ -387,14 +387,14 @@ void EnSkb_TakeDamage(EnSkb* this, PlayState* play) { } } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (SkelAnime_Update(&this->unk14C) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { EnSkb_DecideNextAction(this); } } } void EnSkb_SetupDeath(EnSkb* this, PlayState* play) { - Animation_MorphToPlayOnce(&this->unk14C, &object_skb_0009DC_Anim, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_skb_0009DC_Anim, -4.0f); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -6.0f; @@ -544,5 +544,5 @@ void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80AFDD30, func_80AFDF24, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80AFDD30, func_80AFDF24, this); } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 6b9682dd7aa..7afa04728de 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -8,7 +8,7 @@ struct EnSkb; typedef struct EnSkb { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ Vec3s unk190[20]; /* 0x208 */ Vec3s unk208[20]; /* 0x280 */ u8 actionState; diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index 9bed9fce9ba..83ec7ce83a7 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -95,18 +95,18 @@ void EnTr_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); switch (this->actor.params) { case 0: - SkelAnime_InitFlex(play, &this->unk14C, &gKoumeSkel, &gKotakeKoumeStandingBroomOverRightShoulderAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gKoumeSkel, &gKotakeKoumeStandingBroomOverRightShoulderAnim, this->unk190, this->unk232, KOTAKE_KOUME_LIMB_MAX); - Animation_PlayOnce(&this->unk14C, &gKotakeKoumeStandingBroomOverRightShoulderAnim); + Animation_PlayOnce(&this->skelAnime, &gKotakeKoumeStandingBroomOverRightShoulderAnim); this->unk2E4 = NULL; EnTr_SetupAction(this, func_80B23A88); this->cueChannel = 3; break; case 1: - SkelAnime_InitFlex(play, &this->unk14C, &gKotakeSkel, &gKotakeKoumeStandingBroomOverLeftShoulderAnim, + SkelAnime_InitFlex(play, &this->skelAnime, &gKotakeSkel, &gKotakeKoumeStandingBroomOverLeftShoulderAnim, this->unk190, this->unk232, KOTAKE_KOUME_LIMB_MAX); - Animation_PlayOnce(&this->unk14C, &gKotakeKoumeStandingBroomOverLeftShoulderAnim); + Animation_PlayOnce(&this->skelAnime, &gKotakeKoumeStandingBroomOverLeftShoulderAnim); this->unk2E4 = NULL; EnTr_SetupAction(this, func_80B23A88); this->cueChannel = 2; @@ -153,7 +153,7 @@ void func_80B22F28(EnTr* this, PlayState* play) { break; case 6: - Animation_Change(&this->unk14C, D_80B24380[this->actor.params], 1.0f, 0.0f, + Animation_Change(&this->skelAnime, D_80B24380[this->actor.params], 1.0f, 0.0f, Animation_GetLastFrame(D_80B24380[this->actor.params]), ANIMMODE_ONCE, -5.0f); EnTr_SetupAction(this, func_80B22E6C); this->unk2E4 = D_80B24378[this->actor.params]; @@ -296,7 +296,7 @@ void func_80B23820(EnTr* this, PlayState* play) { this->unk2D6 = 0x22; EnTr_SetStartPosRotFromCue(this, play, this->cueChannel); EnTr_SetupAction(this, func_80B23690); - Animation_PlayLoop(&this->unk14C, &gKotakeKoumeFlyAnim); + Animation_PlayLoop(&this->skelAnime, &gKotakeKoumeFlyAnim); this->unk2E4 = NULL; Actor_SetScale(&this->actor, 0.003f); } @@ -311,7 +311,7 @@ void func_80B238E0(EnTr* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { temp_v0 = play->csCtx.actorCues[this->cueChannel]; if ((temp_v0 != NULL) && (temp_v0->id == 3)) { - Animation_Change(&this->unk14C, D_80B24378[this->actor.params], 1.0f, 0.0f, temp_fv0, 0U, -10.0f); + Animation_Change(&this->skelAnime, D_80B24378[this->actor.params], 1.0f, 0.0f, temp_fv0, 0U, -10.0f); this->unk2E4 = NULL; EnTr_SetupAction(this, func_80B22F28); } @@ -326,7 +326,7 @@ void func_80B239A8(EnTr* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { temp_v0 = play->csCtx.actorCues[this->cueChannel]; if ((temp_v0 != NULL) && (temp_v0->id == 2)) { - Animation_Change(&this->unk14C, D_80B24368[this->actor.params], 1.0f, 0.0f, temp_fv0, 2U, -4.0f); + Animation_Change(&this->skelAnime, D_80B24368[this->actor.params], 1.0f, 0.0f, temp_fv0, 2U, -4.0f); this->unk2E4 = D_80B24370[this->actor.params]; EnTr_SetupAction(this, func_80B238E0); } @@ -350,7 +350,7 @@ void func_80B23A88(EnTr* this, PlayState* play) { case 3: EnTr_SetStartPosRotFromCue(this, play, this->cueChannel); EnTr_SetupAction(this, func_80B22F28); - Animation_PlayLoop(&this->unk14C, &gKotakeKoumeFlyAnim); + Animation_PlayLoop(&this->skelAnime, &gKotakeKoumeFlyAnim); this->unk2E4 = NULL; break; @@ -361,7 +361,7 @@ void func_80B23A88(EnTr* this, PlayState* play) { case 7: EnTr_SetupAction(this, func_80B230D8); - Animation_PlayLoop(&this->unk14C, &gKotakeKoumeFlyAnim); + Animation_PlayLoop(&this->skelAnime, &gKotakeKoumeFlyAnim); this->unk2E4 = NULL; if (this->actor.params != 0) { this->unk2D6 = ((u8)temp_a3 * 0x400) + 0x8000; @@ -380,7 +380,7 @@ void EnTr_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); this->actionFunc(this, play); - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (this->unk2E4 != NULL) { if ((this->unk2E4 == &gKotakeKoumeLookingOverLeftShoulderAnim) || (this->unk2E4 == &gKotakeKoumeLookingOverRightShoulderAnim)) { @@ -389,17 +389,17 @@ void EnTr_Update(Actor* thisx, PlayState* play) { } else { Actor_PlaySfx(&this->actor, NA_SE_EN_TWINROBA_LAUGH); } - Animation_PlayLoop(&this->unk14C, this->unk2E4); + Animation_PlayLoop(&this->skelAnime, this->unk2E4); } else if (this->unk2E4 == &gKotakeKoumeFlyAnim) { EnTr_SetupAction(this, func_80B22F28); - Animation_Change(&this->unk14C, &gKotakeKoumeFlyAnim, 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &gKotakeKoumeFlyAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gKotakeKoumeFlyAnim), ANIMMODE_LOOP, -5.0f); } else { - Animation_PlayLoop(&this->unk14C, this->unk2E4); + Animation_PlayLoop(&this->skelAnime, this->unk2E4); } this->unk2E4 = NULL; } else { - this->unk14C.curFrame = 0.0f; + this->skelAnime.curFrame = 0.0f; } } Actor_SetFocus(&this->actor, 0.0f); @@ -443,7 +443,7 @@ void EnTr_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_37Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B243D0[this->unk2E0])); func_8002EBCC(&this->actor, play, 0); - SkelAnime_DrawFlexOpa(play, this->unk14C.skeleton, this->unk14C.jointTable, this->unk14C.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnTr_OverrideLimbDraw, NULL, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_tr.c", 854); } 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 020ab15a901..069915ae7df 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.h +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.h @@ -41,7 +41,7 @@ typedef enum KotakeKoumeLimb { typedef struct EnTr { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ Vec3s unk190[KOTAKE_KOUME_LIMB_MAX]; /* 0x232 */ Vec3s unk232[KOTAKE_KOUME_LIMB_MAX]; /* 0x2D4 */ s16 unk2D4; 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 f00126f3d31..11bbaefe343 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -116,8 +116,8 @@ void EnVali_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_80B28944); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->unk14C, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->unk198, this->unk246, - 29); + SkelAnime_Init(play, &this->skelAnime, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->unk198, + this->unk246, 29); Collider_InitQuad(play, &this->unk2FC); Collider_SetQuad(play, &this->unk2FC, &this->actor, &sColliderQuadInit); Collider_InitQuad(play, &this->unk37C); @@ -143,7 +143,7 @@ void EnVali_Destroy(Actor* thisx, PlayState* play) { } void func_80B26878(EnVali* this) { - Animation_PlayLoop(&this->unk14C, &object_vali_Anim_0014AC); + Animation_PlayLoop(&this->skelAnime, &object_vali_Anim_0014AC); this->actor.draw = NULL; this->unk3FC.base.acFlags &= ~AC_ON; this->unk190 = func_80B27098; @@ -168,7 +168,7 @@ void func_80B268FC(EnVali* this) { f32 temp_fv1; s32 pad[6]; - Animation_MorphToLoop(&this->unk14C, &object_vali_Anim_000710, -3.0f); + Animation_MorphToLoop(&this->skelAnime, &object_vali_Anim_000710, -3.0f); sp3C = this->actor.world.pos; this->unk37C.dim.quad[1] = sp3C; sp48 = sp3C; @@ -209,7 +209,7 @@ void func_80B26B18(EnVali* this) { } void func_80B26B4C(EnVali* this) { - Animation_MorphToPlayOnce(&this->unk14C, &object_vali_Anim_000854, -5.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_vali_Anim_000854, -5.0f); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); this->actor.params = 0; this->unk3FC.base.acFlags &= ~AC_ON; @@ -217,7 +217,7 @@ void func_80B26B4C(EnVali* this) { } void func_80B26BBC(EnVali* this) { - Animation_PlayOnce(&this->unk14C, &object_vali_Anim_000B34); + Animation_PlayOnce(&this->skelAnime, &object_vali_Anim_000B34); this->unk190 = func_80B2742C; } @@ -249,7 +249,7 @@ void func_80B26C50(EnVali* this, PlayState* play) { } void func_80B26D54(EnVali* this) { - Animation_MorphToPlayOnce(&this->unk14C, &object_vali_Anim_000710, 10.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_vali_Anim_000710, 10.0f); this->unk196 = 0x50; this->actor.velocity.y = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 80); @@ -268,7 +268,7 @@ void func_80B26DE0(EnVali* this) { } void func_80B26E40(EnVali* this) { - Animation_MorphToPlayOnce(&this->unk14C, &object_vali_Anim_0014AC, 10.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_vali_Anim_0014AC, 10.0f); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->unk190 = func_80B278A0; @@ -302,7 +302,7 @@ void func_80B27098(EnVali* this, PlayState* play) { } void func_80B270D8(EnVali* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); this->actor.velocity.y *= 1.5f; this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 40.0f); if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { @@ -314,11 +314,11 @@ void func_80B270D8(EnVali* this, PlayState* play) { void func_80B2716C(EnVali* this, PlayState* play) { s32 var_v1; - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk195 != 0) { this->unk195 -= 1; } - var_v1 = (s32)this->unk14C.curFrame; + var_v1 = (s32)this->skelAnime.curFrame; Math_StepToF(&this->unk2F8, this->actor.floorHeight + 40.0f, 1.2f); this->actor.world.pos.y = this->unk2F8 - (sinf(var_v1 * 3.1415927f * 0.0125f) * 8.0f); if (this->unk195 != 0) { @@ -361,7 +361,7 @@ void func_80B27318(EnVali* this, PlayState* play) { } void func_80B273D0(EnVali* this, PlayState* play) { - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { func_80B26BBC(this); } else { @@ -371,7 +371,7 @@ void func_80B273D0(EnVali* this, PlayState* play) { } void func_80B2742C(EnVali* this, PlayState* play) { - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { func_80B268FC(this); } } @@ -427,7 +427,7 @@ static Gfx D_80B289A8[] = { }; void func_80B27654(EnVali* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (this->unk196 != 0) { this->unk196 -= 1; } @@ -474,7 +474,7 @@ void func_80B27710(EnVali* this, PlayState* play) { } void func_80B278A0(EnVali* this, PlayState* play) { - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 15.0f, 0.1f) < 0.01f) { func_80B26878(this); } @@ -658,7 +658,7 @@ s32 func_80B281F0(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg *arg2 = NULL; return 0; } else { - new_var = this->unk14C.curFrame; + new_var = this->skelAnime.curFrame; if (((arg1 == 9) || (arg1 == 0x12)) && (func_80B28054(this, new_var) != 0)) { Matrix_Scale(this->unk2F4, 1.0f, 1.0f, MTXMODE_APPLY); } @@ -699,7 +699,7 @@ void func_80B28344(EnVali* this, PlayState* play) { sp68 = D_80B28988; OPEN_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1428); Matrix_Get(&sp80); - sp74 = this->unk14C.curFrame; + sp74 = this->skelAnime.curFrame; func_80B27E38(this, sp74, &sp68); Matrix_Scale(sp68.x, sp68.y, sp68.z, 1U); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1436); @@ -742,7 +742,7 @@ void EnVali_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_XLU_DISP++, 9, D_80B289A8); } func_80B28344(this, play); - POLY_XLU_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80B281F0, func_80B28280, - this, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80B281F0, + func_80B28280, this, POLY_XLU_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1538); } 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 b53ecdecaf8..6e41e572dba 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 struct EnVali { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ void (*unk190)(struct EnVali*, struct PlayState*); /* 0x194 */ u8 unk194; /* 0x195 */ u8 unk195; 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 eadb17c9add..0b3c7f671ae 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -216,12 +216,12 @@ void EnWf_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->unk470); Collider_SetCylinder(play, &this->unk470, &this->actor, &D_80B37A5C); if (this->actor.params == 0) { - SkelAnime_InitFlex(play, &this->unk188, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->unk1CC, + SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->unk1CC, this->unk250, 22); Actor_SetScale(&this->actor, 0.0075f); this->actor.naviEnemyId = NAVI_ENEMY_WOLFOS; } else { - SkelAnime_InitFlex(play, &this->unk188, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->unk1CC, + SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->unk1CC, this->unk250, 22); Actor_SetScale(&this->actor, 0.01f); this->unk304.elements[0].base.atDmgInfo.damage = this->unk304.elements[1].base.atDmgInfo.damage = 8; @@ -357,7 +357,7 @@ s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { } void func_80B34380(EnWf* this) { - Animation_Change(&this->unk188, &object_wf_Anim_005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); + Animation_Change(&this->skelAnime, &object_wf_Anim_005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; this->unk2E8 = 0x14; this->unk300 = 0; @@ -387,7 +387,7 @@ void func_80B34428(EnWf* this, PlayState* play) { if (this->unk2E8 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); } - } else if (SkelAnime_Update(&this->unk188)) { + } else if (SkelAnime_Update(&this->skelAnime)) { this->actor.scale.y = this->actor.scale.x; this->actor.gravity = -2.0f; func_80B3455C(this); @@ -395,7 +395,7 @@ void func_80B34428(EnWf* this, PlayState* play) { } void func_80B3455C(EnWf* this) { - Animation_MorphToLoop(&this->unk188, &object_wf_Anim_00A4AC, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &object_wf_Anim_00A4AC, -4.0f); this->unk2D4 = 6; this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 2.0f; this->actor.speed = 0.0f; @@ -409,7 +409,7 @@ void func_80B345E4(EnWf* this, PlayState* play) { s16 var_v1_sp26; player = GET_PLAYER(play); - SkelAnime_Update(&this->unk188); + SkelAnime_Update(&this->skelAnime); if (this->unk2E2 != 0) { var_v1_sp26 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk4D6; if (ABS(var_v1_sp26) >= 0x2001) { @@ -461,8 +461,8 @@ void func_80B345E4(EnWf* this, PlayState* play) { } void func_80B347FC(EnWf* this, PlayState* play) { - Animation_Change(&this->unk188, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), - ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, + Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); this->unk2D4 = 9; func_80B33CB0(this, func_80B3487C); } @@ -495,7 +495,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { } else { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 6.65f, 0.0f); } - this->unk188.playSpeed = this->actor.speed * 0.175f; + this->skelAnime.playSpeed = this->actor.speed * 0.175f; var_v0_real = sp48_real->actor.shape.rot.y - this->actor.shape.rot.y; if (var_v0_real < 0) { var_v0_real *= -1; @@ -508,11 +508,11 @@ void func_80B3487C(EnWf* this, PlayState* play) { return; } } - prevFrame = (s32)this->unk188.curFrame; - SkelAnime_Update(&this->unk188); - absPlaySpeed = ABS(this->unk188.playSpeed); - beforeCurFrame = (s32)(this->unk188.curFrame - absPlaySpeed); - absPlaySpeed = ABS(this->unk188.playSpeed); + prevFrame = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + absPlaySpeed = ABS(this->skelAnime.playSpeed); + beforeCurFrame = (s32)(this->skelAnime.curFrame - absPlaySpeed); + absPlaySpeed = ABS(this->skelAnime.playSpeed); if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { if (Rand_ZeroOne() > 0.5f) { func_80B34F28(this); @@ -536,7 +536,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } - if ((prevFrame != (s32)this->unk188.curFrame) && (beforeCurFrame <= 0) && + if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && (((s32)absPlaySpeed + prevFrame) > 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); @@ -546,7 +546,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { } void func_80B34CFC(EnWf* this) { - Animation_MorphToLoop(&this->unk188, &object_wf_Anim_0098C8, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &object_wf_Anim_0098C8, -4.0f); this->unk2D4 = 0xA; func_80B33CB0(this, func_80B34D48); } @@ -576,8 +576,8 @@ void func_80B34D48(EnWf* this, PlayState* play) { var_fv1 = -1.0f; } } - this->unk188.playSpeed = -var_fv1; - SkelAnime_Update(&this->unk188); + this->skelAnime.playSpeed = -var_fv1; + SkelAnime_Update(&this->skelAnime); if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.8f) { func_80B34F28(this); @@ -592,15 +592,15 @@ void func_80B34D48(EnWf* this, PlayState* play) { } void func_80B34F28(EnWf* this) { - Animation_Change(&this->unk188, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), - ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, + Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); if (Rand_ZeroOne() > 0.5f) { this->unk2FE = 0x3E80; } else { this->unk2FE = -0x3E80; } this->actor.speed = 6.0f; - this->unk188.playSpeed = this->actor.speed * 0.175f; + this->skelAnime.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; this->unk2E8 = (Rand_ZeroOne() * 30.0f) + 30.0f; this->unk2D4 = 0xB; @@ -650,16 +650,16 @@ void func_80B35024(EnWf* this, PlayState* play) { this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk2EC; } if (ABS(this->unk2EC) < ABS(this->actor.speed)) { - this->unk188.playSpeed = this->actor.speed * 0.175f; + this->skelAnime.playSpeed = this->actor.speed * 0.175f; } else { - this->unk188.playSpeed = this->unk2EC * 0.175f; + this->skelAnime.playSpeed = this->unk2EC * 0.175f; } - this->unk188.playSpeed = CLAMP(this->unk188.playSpeed, -3.0f, 3.0f); - prevFrame = (s32)this->unk188.curFrame; - SkelAnime_Update(&this->unk188); - beforeCurFrame = (s32)(this->unk188.curFrame - ABS(this->unk188.playSpeed)); - absPlaySpeed = new_var = (s32)ABS(this->unk188.playSpeed); - if ((prevFrame != (s32)this->unk188.curFrame) && (beforeCurFrame <= 0) && ((absPlaySpeed + prevFrame) > 0)) { + this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); + prevFrame = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); + absPlaySpeed = new_var = (s32)ABS(this->skelAnime.playSpeed); + if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && ((absPlaySpeed + prevFrame) > 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); } @@ -684,13 +684,13 @@ void func_80B35024(EnWf* this, PlayState* play) { } void func_80B35540(EnWf* this) { - Animation_PlayOnce(&this->unk188, &object_wf_Anim_004638); + Animation_PlayOnce(&this->skelAnime, &object_wf_Anim_004638); this->unk304.base.atFlags &= ~4; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->unk2D4 = 8; this->unk2FA = 0; this->unk2E8 = 7; - this->unk188.endFrame = 20.0f; + this->skelAnime.endFrame = 20.0f; this->actor.speed = 0.0f; func_80B33CB0(this, func_80B355BC); } @@ -703,7 +703,7 @@ void func_80B355BC(EnWf* this, PlayState* play) { sp42 = player->actor.shape.rot.y - this->actor.shape.rot.y; sp40 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - var_a2_sp3C = (s32)this->unk188.curFrame; + var_a2_sp3C = (s32)this->skelAnime.curFrame; sp42 = ABS(sp42); sp40 = ABS(sp40); this->actor.speed = 0.0f; @@ -717,7 +717,7 @@ void func_80B355BC(EnWf* this, PlayState* play) { } if (((var_a2_sp3C == 0xF) && !Actor_IsLockedOn(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || - SkelAnime_Update(&this->unk188)) { + SkelAnime_Update(&this->skelAnime)) { if ((var_a2_sp3C != 0xF) && (this->unk2E8 != 0)) { this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->unk2E8 - 4) * 0.4f))); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); @@ -757,10 +757,10 @@ void func_80B3590C(EnWf* this) { f32 var_fv0; var_fv0 = 1.0f; - if ((s32)this->unk188.curFrame >= 16) { + if ((s32)this->skelAnime.curFrame >= 16) { var_fv0 = 15.0f; } - Animation_Change(&this->unk188, &object_wf_Anim_004638, -0.5f, this->unk188.curFrame - 1.0f, var_fv0, + Animation_Change(&this->skelAnime, &object_wf_Anim_004638, -0.5f, this->skelAnime.curFrame - 1.0f, var_fv0, ANIMMODE_ONCE_INTERP, 0.0f); this->unk2D4 = 0xC; this->unk2F8 = 0; @@ -780,7 +780,7 @@ void func_80B359A8(EnWf* this, PlayState* play) { if (var_a3 < 0) { var_a3 *= -1; } - if (SkelAnime_Update(&this->unk188)) { + if (SkelAnime_Update(&this->skelAnime)) { if (!Actor_IsFacingPlayer(&this->actor, 0x1554)) { func_80B3455C(this); this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; @@ -809,7 +809,7 @@ void func_80B359A8(EnWf* this, PlayState* play) { } void func_80B35B94(EnWf* this) { - Animation_MorphToPlayOnce(&this->unk188, &object_wf_Anim_004AD0, -3.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_004AD0, -3.0f); this->unk2E8 = 0; this->unk300 = 1; this->unk2D4 = 5; @@ -820,7 +820,7 @@ void func_80B35B94(EnWf* this) { } void func_80B35C10(EnWf* this, PlayState* play) { - if (SkelAnime_Update(&this->unk188)) { + if (SkelAnime_Update(&this->skelAnime)) { if (!Actor_OtherIsLockedOn(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { func_80B347FC(this, play); @@ -840,7 +840,7 @@ void func_80B35D18(EnWf* this) { this->actor.speed = 0.0f; } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - Animation_PlayOnceSetSpeed(&this->unk188, &object_wf_Anim_009B20, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &object_wf_Anim_009B20, 0.0f); this->unk2D4 = 0xF; func_80B33CB0(this, func_80B35D90); } @@ -865,7 +865,7 @@ void func_80B35D90(EnWf* this, PlayState* play) { } void func_80B35E4C(EnWf* this) { - Animation_MorphToPlayOnce(&this->unk188, &object_wf_Anim_009B20, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_009B20, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk300 = 0; this->actor.speed = -4.0f; @@ -892,7 +892,7 @@ void func_80B35EE4(EnWf* this, PlayState* play) { this->unk300 = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if ((func_80B33FB0(play, this, 0) == 0) && SkelAnime_Update(&this->unk188) && + if ((func_80B33FB0(play, this, 0) == 0) && SkelAnime_Update(&this->skelAnime) && (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) != 0))) { var_v1 = this->actor.wallYaw - this->actor.shape.rot.y; if (var_v1 < 0) { @@ -917,8 +917,8 @@ void func_80B35EE4(EnWf* this, PlayState* play) { } void func_80B360E8(EnWf* this) { - Animation_Change(&this->unk188, &object_wf_Anim_004AD0, -1.0f, Animation_GetLastFrame(&object_wf_Anim_004AD0), 0.0f, - ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &object_wf_Anim_004AD0, -1.0f, Animation_GetLastFrame(&object_wf_Anim_004AD0), + 0.0f, ANIMMODE_ONCE, -3.0f); this->unk2E8 = 0; this->unk300 = 0; this->unk2D4 = 4; @@ -935,7 +935,7 @@ void func_80B361A0(EnWf* this, PlayState* play) { func_800355B8(play, &this->unk4C8); func_800355B8(play, &this->unk4BC); } - if (SkelAnime_Update(&this->unk188) && + if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->actor.shape.rot.x = 0; this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -960,7 +960,7 @@ void func_80B36288(EnWf* this) { this->actor.speed = 0.0f; this->unk2D4 = 7; this->unk2E8 = 0xA; - Animation_Change(&this->unk188, &object_wf_Anim_004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &object_wf_Anim_004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); func_80B33CB0(this, func_80B36328); } @@ -975,9 +975,9 @@ void func_80B36328(EnWf* this, PlayState* play) { if (this->unk2E8 != 0) { this->unk2E8 -= 1; } else { - this->unk188.playSpeed = 1.0f; + this->skelAnime.playSpeed = 1.0f; } - if (SkelAnime_Update(&this->unk188)) { + if (SkelAnime_Update(&this->skelAnime)) { temp_v0_2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(temp_v0_2) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { @@ -1017,8 +1017,8 @@ void func_80B365A8(EnWf* this, PlayState* play) { s16 temp_v1_sp36; Player* player; - Animation_Change(&this->unk188, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), - ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, + Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); player = GET_PLAYER(play); temp_v1_sp36 = player->actor.shape.rot.y + this->unk2FE; if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) > 0.0f) { @@ -1031,7 +1031,7 @@ void func_80B365A8(EnWf* this, PlayState* play) { this->unk2FE = -0x3E80; } this->actor.speed = 6.0f; - this->unk188.playSpeed = this->actor.speed * 0.175f; + this->skelAnime.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; this->unk2EC = 0.0f; this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 5.0f; @@ -1081,15 +1081,15 @@ void func_80B36740(EnWf* this, PlayState* play) { this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk2EC; } if (ABS(this->unk2EC) < ABS(this->actor.speed)) { - this->unk188.playSpeed = this->actor.speed * 0.175f; + this->skelAnime.playSpeed = this->actor.speed * 0.175f; } else { - this->unk188.playSpeed = this->unk2EC * 0.175f; + this->skelAnime.playSpeed = this->unk2EC * 0.175f; } - this->unk188.playSpeed = CLAMP(this->unk188.playSpeed, -3.0f, 3.0f); - prevFrame = (s32)this->unk188.curFrame; - SkelAnime_Update(&this->unk188); - beforeCurFrame = (s32)(this->unk188.curFrame - ABS(this->unk188.playSpeed)); - absPlaySpeed = new_var = ABS(this->unk188.playSpeed); + this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); + prevFrame = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); + absPlaySpeed = new_var = ABS(this->skelAnime.playSpeed); if (func_80B33FB0(play, this, 0) == 0) { this->unk2E8 -= 1; if (this->unk2E8 == 0) { @@ -1112,7 +1112,7 @@ void func_80B36740(EnWf* this, PlayState* play) { } } } - if ((prevFrame != (s32)this->unk188.curFrame) && (beforeCurFrame <= 0) && + if ((prevFrame != (s32)this->skelAnime.curFrame) && (beforeCurFrame <= 0) && (((s32)absPlaySpeed + prevFrame) > 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_WALK); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 20.0f, 3, 3.0f, 50, 50, true); @@ -1124,7 +1124,7 @@ void func_80B36740(EnWf* this, PlayState* play) { } void func_80B36C8C(EnWf* this) { - Animation_MorphToPlayOnce(&this->unk188, &object_wf_Anim_005430, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_005430, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->unk300 = 0; @@ -1134,7 +1134,7 @@ void func_80B36C8C(EnWf* this) { } this->unk2D4 = 2; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk2E8 = this->unk188.animLength; + this->unk2E8 = this->skelAnime.animLength; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); func_80B33CB0(this, func_80B36D3C); } @@ -1148,7 +1148,7 @@ void func_80B36D3C(EnWf* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); this->unk300 = 0; } - if (SkelAnime_Update(&this->unk188)) { + if (SkelAnime_Update(&this->skelAnime)) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_13, false)); if (this->unk2FC != 0xFF) { @@ -1162,7 +1162,7 @@ void func_80B36D3C(EnWf* this, PlayState* play) { sp7C = D_80B37AD0; this->unk2E8 -= 1; - for (var_s0 = ((s32)this->unk188.animLength - this->unk2E8) >> 1; var_s0 >= 0; var_s0--) { + for (var_s0 = ((s32)this->skelAnime.animLength - this->unk2E8) >> 1; var_s0 >= 0; var_s0--) { sp88.x = this->actor.world.pos.x + Rand_CenteredFloat(60.0f); sp88.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); sp88.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); @@ -1349,7 +1349,7 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { } else { gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37B04[this->unk302])); } - SkelAnime_DrawFlexOpa(play, this->unk188.skeleton, this->unk188.jointTable, this->unk188.dListCount, + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B37454, func_80B37494, this); if (this->unk2E4 != 0) { this->actor.colorFilterTimer++; 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 fc16aa59938..faf02e1b618 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -9,7 +9,7 @@ struct EnWf; typedef struct EnWf { /* 0x000 */ Actor actor; /* 0x14C */ Vec3s unk14C[10]; - /* 0x188 */ SkelAnime unk188; + /* 0x188 */ SkelAnime skelAnime; /* 0x1CC */ Vec3s unk1CC[22]; /* 0x250 */ Vec3s unk250[22]; /* 0x2D4 */ s32 unk2D4; 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 694507ada39..24c76b152af 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -267,13 +267,13 @@ void EnZf_Init(Actor* thisx, PlayState* play) { if (this->actor.params == -2) { this->actor.colChkInfo.health = 12; this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; - SkelAnime_Init(play, &this->unk14C, &object_zf_Skel_006690, &object_zf_Anim_00B10C, this->unk190, this->unk2B6, - 0x31); + SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_006690, &object_zf_Anim_00B10C, this->unk190, + this->unk2B6, 0x31); } else { this->actor.colChkInfo.health = 6; this->actor.naviEnemyId = NAVI_ENEMY_LIZALFOS; - SkelAnime_Init(play, &this->unk14C, &object_zf_Skel_0104B8, &object_zf_Anim_00B10C, this->unk190, this->unk2B6, - 0x31); + SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_0104B8, &object_zf_Anim_00B10C, this->unk190, + this->unk2B6, 0x31); } if (this->actor.params < 0) { this->unk3FE = -1; @@ -569,8 +569,8 @@ s32 func_80B44E8C(PlayState* play, EnZf* this) { } void func_80B450AC(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_009530, 0.0f, 9.0f, Animation_GetLastFrame(&object_zf_Anim_009530), - ANIMMODE_LOOP, 0.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_009530, 0.0f, 9.0f, + Animation_GetLastFrame(&object_zf_Anim_009530), ANIMMODE_LOOP, 0.0f); this->actor.world.pos.y = this->actor.floorHeight + 300.0f; this->unk404 = this->actor.shape.shadowAlpha = 0; this->unk3F0 = 0xA; @@ -606,7 +606,7 @@ void func_80B45174(EnZf* this, PlayState* play) { } if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->unk3E4 != 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ONGND); - Animation_Change(&this->unk14C, &object_zf_Anim_008C6C, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_008C6C, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); this->unk3E4 = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; @@ -614,7 +614,7 @@ void func_80B45174(EnZf* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4F0, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { this->unk404 = 0xFF; if (this->actor.params > 0) { func_80B47360(this, play); @@ -626,8 +626,8 @@ void func_80B45174(EnZf* this, PlayState* play) { } void func_80B45384(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_00B10C, 1.0f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_00B10C), - ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_00B10C, 1.0f, 0.0f, + Animation_GetLastFrame(&object_zf_Anim_00B10C), ANIMMODE_LOOP_INTERP, -4.0f); this->unk3DC = 3; this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; @@ -644,7 +644,7 @@ void func_80B4543C(EnZf* this, PlayState* play) { player = GET_PLAYER(play); var_v1_sp26 = (this->actor.yawTowardsPlayer - this->unk3EC) - this->actor.shape.rot.y; var_v1_sp26 = ABS(var_v1_sp26); - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); if (!func_80B49C2C(play, this)) { if (this->actor.params == -2) { if (this->unk3F4 != 0) { @@ -692,7 +692,7 @@ void func_80B4543C(EnZf* this, PlayState* play) { } void func_80B456B4(EnZf* this, PlayState* play) { - Animation_MorphToLoop(&this->unk14C, &object_zf_Anim_008138, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &object_zf_Anim_008138, -4.0f); this->unk3DC = 5; if (this->actor.params >= 0) { this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); @@ -764,7 +764,7 @@ void func_80B45748(EnZf* this, PlayState* play) { } else { Math_SmoothStepToF(&this->actor.speed, 8.0f, 1.0f, 0.5f, 0.0f); } - this->unk14C.playSpeed = this->actor.speed * 1.2f; + this->skelAnime.playSpeed = this->actor.speed * 1.2f; var_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; if (var_v1 < 0) { var_v1 *= -1; @@ -777,10 +777,10 @@ void func_80B45748(EnZf* this, PlayState* play) { return; } } - prevFrame = (s32)this->unk14C.curFrame; - SkelAnime_Update(&this->unk14C); - beforeCurFrame = (s32)(this->unk14C.curFrame - ABS(this->unk14C.playSpeed)); - absPlaySpeed = ((void)0, ABS(this->unk14C.playSpeed)); //! FAKE + prevFrame = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); + absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE if (sp48 == this->unk3FE) { if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { if (Rand_ZeroOne() > 0.5f) { @@ -824,7 +824,7 @@ void func_80B45748(EnZf* this, PlayState* play) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - if ((prevFrame != (s32)this->unk14C.curFrame) && + if ((prevFrame != (s32)this->skelAnime.curFrame) && (((beforeCurFrame < 2) && (((s32)absPlaySpeed + prevFrame) >= 4)) || ((beforeCurFrame < 0x20) && (((s32)absPlaySpeed + prevFrame) >= 0x22)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); @@ -833,7 +833,7 @@ void func_80B45748(EnZf* this, PlayState* play) { } void func_80B45E30(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0; this->unk3E4 = 1; this->actor.velocity.y = 15.0f; @@ -856,9 +856,9 @@ void func_80B45EF0(EnZf* this, PlayState* play) { this->actor.speed = 0.0f; } } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (this->unk3F0 == 0) { - Animation_Change(&this->unk14C, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0xA; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else { @@ -880,7 +880,7 @@ void func_80B45EF0(EnZf* this, PlayState* play) { } void func_80B4604C(EnZf* this) { - Animation_MorphToLoop(&this->unk14C, &object_zf_Anim_008138, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &object_zf_Anim_008138, -4.0f); this->unk3DC = 6; func_80B44050(this, func_80B46098); } @@ -913,8 +913,8 @@ void func_80B46098(EnZf* this, PlayState* play) { var_fv1 = -2.0f; } } - this->unk14C.playSpeed = -var_fv1; - SkelAnime_Update(&this->unk14C); + this->skelAnime.playSpeed = -var_fv1; + SkelAnime_Update(&this->skelAnime); if (this->actor.params >= 0) { this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); if (func_80B446A8(&player->actor.world.pos, -1) != this->unk3FE) { @@ -939,7 +939,7 @@ void func_80B462E4(EnZf* this, PlayState* play) { if ((this->actor.params < 0) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { - Animation_PlayLoop(&this->unk14C, &object_zf_Anim_016388); + Animation_PlayLoop(&this->skelAnime, &object_zf_Anim_016388); this->actor.speed = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 20.0f; @@ -1022,17 +1022,17 @@ void func_80B463E4(EnZf* this, PlayState* play) { this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk408; } if (ABS(this->actor.speed) >= ABS(this->unk408)) { - this->unk14C.playSpeed = this->actor.speed * 0.75f; - } else if (this->unk14C.playSpeed < 0.0f) { - this->unk14C.playSpeed = this->unk408 * -0.75f; + this->skelAnime.playSpeed = this->actor.speed * 0.75f; + } else if (this->skelAnime.playSpeed < 0.0f) { + this->skelAnime.playSpeed = this->unk408 * -0.75f; } else { - this->unk14C.playSpeed = this->unk408 * 0.75f; + this->skelAnime.playSpeed = this->unk408 * 0.75f; } - prevFrame = (s32)this->unk14C.curFrame; - SkelAnime_Update(&this->unk14C); - beforeCurFrame = (s32)(this->unk14C.curFrame - ABS(this->unk14C.playSpeed)); - absPlaySpeed = ABS(this->unk14C.playSpeed); - if ((prevFrame != (s32)this->unk14C.curFrame) && + prevFrame = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); + absPlaySpeed = ABS(this->skelAnime.playSpeed); + if ((prevFrame != (s32)this->skelAnime.curFrame) && (((beforeCurFrame < 0xE) && (((s32)absPlaySpeed + prevFrame) >= 0x10)) || ((beforeCurFrame < 0x1B) && (((s32)absPlaySpeed + prevFrame) >= 0x1D)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); @@ -1055,10 +1055,10 @@ void func_80B463E4(EnZf* this, PlayState* play) { } void func_80B46A24(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_00A3D4, 1.25f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_00A3D4), - ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_00A3D4, 1.25f, 0.0f, + Animation_GetLastFrame(&object_zf_Anim_00A3D4), ANIMMODE_ONCE, -4.0f); if (this->actor.params == -2) { - this->unk14C.playSpeed = 1.75f; + this->skelAnime.playSpeed = 1.75f; } this->unk464.base.atFlags &= ~AT_BOUNCED; this->unk3DC = 9; @@ -1074,10 +1074,10 @@ void func_80B46AE0(EnZf* this, PlayState* play) { player = GET_PLAYER(play); this->actor.speed = 0.0f; - if ((s32)this->unk14C.curFrame == 10) { + if ((s32)this->skelAnime.curFrame == 10) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { EffectBlure_AddSpace(Effect_GetByIndex(this->unk414)); if ((this->actor.params == -2) && !Actor_IsFacingPlayer(&this->actor, 0x1554)) { func_80B45384(this); @@ -1118,15 +1118,15 @@ void func_80B46AE0(EnZf* this, PlayState* play) { } void func_80B46D64(EnZf* this) { - f32 f = this->unk14C.curFrame - 3.0f; + f32 f = this->skelAnime.curFrame - 3.0f; - Animation_Change(&this->unk14C, &object_zf_Anim_00A3D4, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_00A3D4, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); this->unk3DC = 8; func_80B44050(this, func_80B46DD4); } void func_80B46DD4(EnZf* this, PlayState* play) { - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { func_80B45384(this); } else if ((Rand_ZeroOne() > 0.2f) && func_80B44CF0(play, this)) { @@ -1138,7 +1138,7 @@ void func_80B46DD4(EnZf* this, PlayState* play) { } void func_80B46E8C(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_009530, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_009530, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0; this->unk3E4 = 1; this->unk3DC = 0xB; @@ -1157,9 +1157,9 @@ void func_80B46F2C(EnZf* this, PlayState* play) { this->actor.speed = 0.0f; } } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (this->unk3F0 == 0) { - Animation_Change(&this->unk14C, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0xA; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else if ((play->gameplayFrames % 2) != 0) { @@ -1184,7 +1184,7 @@ void func_80B47050(EnZf* this) { if (this->unk410 == 0xF) { this->unk3F6 = 0x24; } else { - Animation_PlayOnceSetSpeed(&this->unk14C, &object_zf_Anim_0157F8, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &object_zf_Anim_0157F8, 0.0f); } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->unk3DC = 0xE; @@ -1240,7 +1240,7 @@ void func_80B47360(EnZf* this, PlayState* play) { if (this->unk3DC < 0x11) { var_fv0 = -4.0f; } - Animation_Change(&this->unk14C, &object_zf_Anim_0119F4, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); + Animation_Change(&this->skelAnime, &object_zf_Anim_0119F4, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); this->unk3DC = 0x12; this->actor.speed = 0.0f; this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); @@ -1255,7 +1255,7 @@ void func_80B4743C(EnZf* this, PlayState* play) { temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, temp_v1, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = temp_v1 - 0x8000; func_80B4779C(this, play); this->unk3FA = 1; @@ -1264,7 +1264,7 @@ void func_80B4743C(EnZf* this, PlayState* play) { void func_80B474E4(EnZf* this) { this->unk3E4 = 0; - Animation_MorphToPlayOnce(&this->unk14C, D_80B4A280[0], -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, D_80B4A280[0], -4.0f); this->unk3DC = 0x14; this->actor.speed = 0.0f; this->unk40C = 0.0f; @@ -1289,7 +1289,7 @@ void func_80B47544(EnZf* this, PlayState* play) { if (this->unk3E4 != 1) { func_80B49E4C(play, this); } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { this->unk3E4 += 1; if (this->unk3E4 >= 3) { this->unk3E4 = 0; @@ -1316,7 +1316,7 @@ void func_80B47544(EnZf* this, PlayState* play) { this->actor.world.pos.y = this->actor.floorHeight; break; } - Animation_Change(&this->unk14C, D_80B4A280[this->unk3E4], 1.5f, 0.0f, var_fv0, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, D_80B4A280[this->unk3E4], 1.5f, 0.0f, var_fv0, ANIMMODE_ONCE, 0.0f); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1326,7 +1326,7 @@ void func_80B47544(EnZf* this, PlayState* play) { void func_80B4779C(EnZf* this, PlayState* play) { this->unk3E4 = 0; - Animation_PlayOnce(&this->unk14C, D_80B4A280[0]); + Animation_PlayOnce(&this->skelAnime, D_80B4A280[0]); this->unk3DC = 0x13; this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); @@ -1430,19 +1430,19 @@ void func_80B4781C(EnZf* this, PlayState* play) { break; case 2: - if (this->unk14C.curFrame == this->unk14C.endFrame) { + if (this->skelAnime.curFrame == this->skelAnime.endFrame) { this->unk3E4 = 0; } break; } if (sp54 != this->unk3E4) { - Animation_PlayOnceSetSpeed(&this->unk14C, D_80B4A280[this->unk3E4], sp70); + Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->unk3E4], sp70); } - SkelAnime_Update(&this->unk14C); + SkelAnime_Update(&this->skelAnime); } void func_80B47C64(EnZf* this, PlayState* play) { - Animation_PlayOnce(&this->unk14C, &object_zf_Anim_01366C); + Animation_PlayOnce(&this->skelAnime, &object_zf_Anim_01366C); this->actor.world.rot.y += 0x8000; this->unk3DC = 0x15; this->actor.speed = 0.0f; @@ -1455,23 +1455,23 @@ void func_80B47CF8(EnZf* this, PlayState* play) { s16 sp2E; sp2E = this->actor.yawTowardsPlayer; - if (this->unk14C.curFrame >= 26.0f) { + if (this->skelAnime.curFrame >= 26.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, sp2E, 1, 0x1770, 0); } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.world.rot.y = sp2E; this->unk3E4 = -1; func_80B45384(this); } - if (this->unk14C.curFrame == 22.0f) { + if (this->skelAnime.curFrame == 22.0f) { this->unk3FA = 0; } } void func_80B47DA8(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_0157F8, 1.5f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_0157F8), - ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_0157F8, 1.5f, 0.0f, + Animation_GetLastFrame(&object_zf_Anim_0157F8), ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = -4.0f; @@ -1480,7 +1480,7 @@ void func_80B47DA8(EnZf* this) { this->unk3E4 = 1; } if (this->actor.params == -2) { - this->unk14C.playSpeed = 4.5f; + this->skelAnime.playSpeed = 4.5f; } if (this->actor.params < 0) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -1503,7 +1503,7 @@ void func_80B47EB4(EnZf* this, PlayState* play) { this->unk3E4 = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (((this->actor.params != -2) || !func_80B44E8C(play, this)) && SkelAnime_Update(&this->unk14C) && + if (((this->actor.params != -2) || !func_80B44E8C(play, this)) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (D_80B4A1B4 != -1) { if (this->unk410 == 0xD) { @@ -1546,7 +1546,7 @@ void func_80B47EB4(EnZf* this, PlayState* play) { } void func_80B48210(EnZf* this) { - Animation_Change(&this->unk14C, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); this->unk3F0 = 0; this->unk3E4 = 1; this->unk3DC = 0x16; @@ -1563,9 +1563,9 @@ void func_80B482B8(EnZf* this, PlayState* play) { func_800355B8(play, &this->unk4F0); func_800355B8(play, &this->unk4E4); } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (this->unk3F0 == 0) { - Animation_Change(&this->unk14C, &object_zf_Anim_00A3D4, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_00A3D4, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); this->unk3F0 = 0xA; } else if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -1574,7 +1574,7 @@ void func_80B482B8(EnZf* this, PlayState* play) { this->actor.world.pos.y = this->actor.floorHeight; func_80B46A24(this); Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); - this->unk14C.curFrame = 13.0f; + this->skelAnime.curFrame = 13.0f; } } } @@ -1587,7 +1587,7 @@ void func_80B483E4(EnZf* this, PlayState* play) { if ((this->actor.params < 0) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { - Animation_PlayLoop(&this->unk14C, &object_zf_Anim_016388); + Animation_PlayLoop(&this->skelAnime, &object_zf_Anim_016388); player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); temp_v1_sp2E = player->actor.shape.rot.y; @@ -1673,18 +1673,18 @@ void func_80B48578(EnZf* this, PlayState* play) { this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk408; } if (ABS(this->actor.speed) >= ABS(this->unk408)) { - this->unk14C.playSpeed = -this->actor.speed * 0.75f; + this->skelAnime.playSpeed = -this->actor.speed * 0.75f; } else { - if (this->unk14C.playSpeed < 0.0f) { - this->unk14C.playSpeed = this->unk408 * -0.75f; + if (this->skelAnime.playSpeed < 0.0f) { + this->skelAnime.playSpeed = this->unk408 * -0.75f; } else { - this->unk14C.playSpeed = this->unk408 * 0.75f; + this->skelAnime.playSpeed = this->unk408 * 0.75f; } } - prevFrame = (s32)this->unk14C.curFrame; - SkelAnime_Update(&this->unk14C); - beforeCurFrame = (s32)(this->unk14C.curFrame - ABS(this->unk14C.playSpeed)); - absPlaySpeed = ((void)0, ABS(this->unk14C.playSpeed)); //! FAKE + prevFrame = (s32)this->skelAnime.curFrame; + SkelAnime_Update(&this->skelAnime); + beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); + absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); if (func_80B446A8(&player->actor.world.pos, -1) != this->unk3FE) { this->actor.speed = 0.0f; @@ -1726,7 +1726,7 @@ void func_80B48578(EnZf* this, PlayState* play) { } else { this->unk3F0 -= 1; } - if ((prevFrame != (s32)this->unk14C.curFrame) && + if ((prevFrame != (s32)this->skelAnime.curFrame) && (((beforeCurFrame < 0xE) && (((s32)absPlaySpeed + prevFrame) >= 0x10)) || ((beforeCurFrame < 0x1B) && (((s32)absPlaySpeed + prevFrame) >= 0x1D)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); @@ -1747,8 +1747,8 @@ typedef struct UnkActor { void func_80B48CEC(EnZf* this) { Actor* temp_v0; - Animation_Change(&this->unk14C, &object_zf_Anim_014E60, 1.5f, 0.0f, Animation_GetLastFrame(&object_zf_Anim_014E60), - ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &object_zf_Anim_014E60, 1.5f, 0.0f, + Animation_GetLastFrame(&object_zf_Anim_014E60), ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; @@ -1789,7 +1789,7 @@ void func_80B48E50(EnZf* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.15f, 0.0f); this->unk3E4 = 0; } - if (SkelAnime_Update(&this->unk14C)) { + if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.category != ACTORCAT_PROP) { if ((this->actor.params >= 0) && (D_80B4A1B4 == -1)) { Flags_SetSwitch(play, this->unk3FC); @@ -1806,7 +1806,7 @@ void func_80B48E50(EnZf* this, PlayState* play) { Actor_Kill(&this->actor); } } else { - temp_ft1 = (s32)this->unk14C.curFrame; + temp_ft1 = (s32)this->skelAnime.curFrame; if ((temp_ft1 == 10) || (temp_ft1 == 18)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DOWN); } @@ -1935,7 +1935,7 @@ void EnZf_Update(Actor* thisx, PlayState* play) { } } } - if ((this->unk3DC == 9) && ((this->unk14C.curFrame >= 14.0f)) && (this->unk14C.curFrame <= 20.0f)) { + if ((this->unk3DC == 9) && ((this->skelAnime.curFrame >= 14.0f)) && (this->skelAnime.curFrame <= 20.0f)) { if (!(this->unk464.base.atFlags & AT_BOUNCED) && !(this->unk464.base.acFlags & AC_HIT)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk464.base); } else { @@ -1986,9 +1986,9 @@ void func_80B49688(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thi Matrix_MultVec3f(&D_80B4A2A4, &sp54); Matrix_MultVec3f(&D_80B4A2B0, &sp48); if (this->unk3DC == 9) { - if (this->unk14C.curFrame < 14.0f) { + if (this->skelAnime.curFrame < 14.0f) { EffectBlure_AddSpace(Effect_GetByIndex(this->unk414)); - } else if (this->unk14C.curFrame < 20.0f) { + } else if (this->skelAnime.curFrame < 20.0f) { EffectBlure_AddVertex(Effect_GetByIndex(this->unk414), &sp54, &sp48); } } @@ -2051,7 +2051,7 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk404); gSPSegment(POLY_OPA_DISP++, 9, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80B495FC, + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80B495FC, func_80B49688, this, POLY_OPA_DISP); if (this->unk3F6 != 0) { thisx->colorFilterTimer += 1; @@ -2067,14 +2067,14 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { gDPPipeSync(POLY_XLU_DISP++); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk404); gSPSegment(POLY_XLU_DISP++, 9, D_80116280); - POLY_XLU_DISP = SkelAnime_Draw(play, this->unk14C.skeleton, this->unk14C.jointTable, func_80B495FC, + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80B495FC, func_80B49688, this, POLY_XLU_DISP); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3601); } void func_80B49B60(EnZf* this, f32 arg1) { - Animation_MorphToLoop(&this->unk14C, &object_zf_Anim_016388, -1.0f); + Animation_MorphToLoop(&this->skelAnime, &object_zf_Anim_016388, -1.0f); this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 8.0f; if (this->actor.params == -2) { this->actor.speed = 2.0f * arg1; 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 f0776da3788..67c914407be 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -8,7 +8,7 @@ struct EnZf; typedef struct EnZf { /* 0x000 */ Actor actor; - /* 0x14C */ SkelAnime unk14C; + /* 0x14C */ SkelAnime skelAnime; /* 0x190 */ Vec3s unk190[49]; /* 0x2B6 */ Vec3s unk2B6[49]; /* 0x3DC */ s32 unk3DC; From f4b706d9e7cc493abb24ba356aacf4d0b166aa2f Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:19:03 +0200 Subject: [PATCH 027/150] Vec3s {jointTable,morphTable}[N]; --- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 4 ++-- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 4 ++-- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c | 4 ++-- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h | 4 ++-- src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 2 +- src/overlays/actors/ovl_En_Firefly/z_en_firefly.h | 4 ++-- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 4 ++-- src/overlays/actors/ovl_En_Skb/z_en_skb.h | 4 ++-- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 4 ++-- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 4 ++-- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 8 ++++---- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 4 ++-- 12 files changed, 25 insertions(+), 25 deletions(-) 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 92c805b571e..fa1f6d1e813 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -106,8 +106,8 @@ void EnBili_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_809C1698); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->unk198, this->unk1B6, - 5); + SkelAnime_Init(play, &this->skelAnime, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->jointTable, + this->morphTable, 5); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_809C1678, &D_809C166C); 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 40df10b2ef7..a7b09741b29 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -13,8 +13,8 @@ typedef struct EnBili { /* 0x194 */ u8 unk194; /* 0x195 */ u8 unk195; /* 0x196 */ s16 unk196; - /* 0x198 */ Vec3s unk198[5]; - /* 0x1B6 */ Vec3s unk1B6[5]; + /* 0x198 */ Vec3s jointTable[5]; + /* 0x1B6 */ Vec3s morphTable[5]; /* 0x1D4 */ ColliderCylinder collider; } EnBili; // size = 0x220 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 0db6c3e1a85..e9f48da2bc2 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -176,8 +176,8 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_809E9020); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->unk1D0, - this->unk200, 8); + SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, + this->morphTable, 8); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params == 1) { 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 6ee7a3827ca..ca347698324 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -17,8 +17,8 @@ typedef struct EnDekubaba { /* 0x1C6 */ s16 unk1C6; /* 0x1C8 */ s16 unk1C8; /* 0x1CA */ s16 unk1CA_arr[3]; - /* 0x1D0 */ Vec3s unk1D0[8]; - /* 0x200 */ Vec3s unk200[8]; + /* 0x1D0 */ Vec3s jointTable[8]; + /* 0x200 */ Vec3s morphTable[8]; /* 0x230 */ f32 unk230; /* 0x234 */ struct CollisionPoly* unk234; /* 0x238 */ ColliderJntSph collider; 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 3f0394fa969..55ac689270e 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -100,7 +100,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_80A14F8C); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->unk1BE, this->unk266, 0x1C); + SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 0x1C); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80A14F6C, &D_80A14F64); 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 146027067bb..bf99a120c8a 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -24,8 +24,8 @@ typedef struct EnFirefly { /* 0x1B9 */ u8 unk1B9; /* 0x1BA */ s16 unk1BA_timer; /* 0x1BC */ s16 unk1BC_targetRotX; - /* 0x1BE */ Vec3s unk1BE[0x1C]; - /* 0x266 */ Vec3s unk266[0x1C]; + /* 0x1BE */ Vec3s jointTable[0x1C]; + /* 0x266 */ Vec3s morphTable[0x1C]; /* 0x310 */ f32 unk310_homeY; /* 0x314 */ ColliderJntSph collider; /* 0x334 */ ColliderJntSphElement colliderElements[1]; 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 11e9169d063..e2dfa5f4ad5 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -154,8 +154,8 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(play, &this->skelAnime, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->unk190, this->unk208, - 20); + SkelAnime_Init(play, &this->skelAnime, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->jointTable, + this->morphTable, 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index 7afa04728de..c767aa65b9b 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -9,8 +9,8 @@ struct EnSkb; typedef struct EnSkb { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ Vec3s unk190[20]; - /* 0x208 */ Vec3s unk208[20]; + /* 0x190 */ Vec3s jointTable[20]; + /* 0x208 */ Vec3s morphTable[20]; /* 0x280 */ u8 actionState; /* 0x281 */ u8 setColliderAT; /* 0x282 */ u8 lastDamageReaction; 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 11bbaefe343..b35633e139a 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -116,8 +116,8 @@ void EnVali_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, D_80B28944); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->unk198, - this->unk246, 29); + SkelAnime_Init(play, &this->skelAnime, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->jointTable, + this->morphTable, 29); Collider_InitQuad(play, &this->unk2FC); Collider_SetQuad(play, &this->unk2FC, &this->actor, &sColliderQuadInit); Collider_InitQuad(play, &this->unk37C); 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 6e41e572dba..5c1806197c4 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -13,8 +13,8 @@ typedef struct EnVali { /* 0x194 */ u8 unk194; /* 0x195 */ u8 unk195; /* 0x196 */ s16 unk196; - /* 0x198 */ Vec3s unk198[29]; - /* 0x246 */ Vec3s unk246[29]; + /* 0x198 */ Vec3s jointTable[29]; + /* 0x246 */ Vec3s morphTable[29]; /* 0x2F4 */ f32 unk2F4; /* 0x2F8 */ f32 unk2F8; /* 0x2FC */ ColliderQuad unk2FC; 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 24c76b152af..ab6601ddad5 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -267,13 +267,13 @@ void EnZf_Init(Actor* thisx, PlayState* play) { if (this->actor.params == -2) { this->actor.colChkInfo.health = 12; this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; - SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_006690, &object_zf_Anim_00B10C, this->unk190, - this->unk2B6, 0x31); + SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_006690, &object_zf_Anim_00B10C, this->jointTable, + this->morphTable, 0x31); } else { this->actor.colChkInfo.health = 6; this->actor.naviEnemyId = NAVI_ENEMY_LIZALFOS; - SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_0104B8, &object_zf_Anim_00B10C, this->unk190, - this->unk2B6, 0x31); + SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_0104B8, &object_zf_Anim_00B10C, this->jointTable, + this->morphTable, 0x31); } if (this->actor.params < 0) { this->unk3FE = -1; 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 67c914407be..5c8c22edf57 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -9,8 +9,8 @@ struct EnZf; typedef struct EnZf { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ Vec3s unk190[49]; - /* 0x2B6 */ Vec3s unk2B6[49]; + /* 0x190 */ Vec3s jointTable[49]; + /* 0x2B6 */ Vec3s morphTable[49]; /* 0x3DC */ s32 unk3DC; /* 0x3E0 */ s32 unk3E0; /* 0x3E4 */ s32 unk3E4; From 7151e701bed4969a1a9b5b3ebef76f9821d57d01 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:28:17 +0200 Subject: [PATCH 028/150] reextract and name damage tables --- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 40 +++++++++-- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 72 ++++++++++++++++--- src/overlays/actors/ovl_En_Dh/z_en_dh.c | 4 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 39 ++++++++-- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 40 +++++++++-- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 40 +++++++++-- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 40 +++++++++-- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 40 +++++++++-- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 40 +++++++++-- 9 files changed, 304 insertions(+), 51 deletions(-) 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 fa1f6d1e813..ad6399c0932 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -87,11 +87,39 @@ static ColliderCylinderInit sCylinderInit = { }; static CollisionCheckInfoInit2 D_809C166C = { 1, 9, 0x1C, -0x14, 0x1E }; -static DamageTable D_809C1678 = { - { - 0x10, 2, 0xE0, 2, 1, 2, 2, 2, 0xF1, 0xF2, 0xF4, 0x24, 0x34, 2, 2, 2, - 2, 0x24, 0x34, 0, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(0, 0xE), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(1, 0x0), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(2, 0x0), + /* Kokiri sword */ DMG_ENTRY(1, 0xF), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(4, 0xF), + /* Fire arrow */ DMG_ENTRY(4, 0x2), + /* Ice arrow */ DMG_ENTRY(4, 0x3), + /* Light arrow */ DMG_ENTRY(2, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), + /* Fire magic */ DMG_ENTRY(4, 0x2), + /* Ice magic */ DMG_ENTRY(4, 0x3), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0x0), + /* Giant spin */ DMG_ENTRY(4, 0x0), + /* Master spin */ DMG_ENTRY(2, 0x0), + /* Kokiri jump */ DMG_ENTRY(2, 0x0), + /* Giant jump */ DMG_ENTRY(8, 0x0), + /* Master jump */ DMG_ENTRY(4, 0x0), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static InitChainEntry D_809C1698[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIRI, ICHAIN_CONTINUE), @@ -110,7 +138,7 @@ void EnBili_Init(Actor* thisx, PlayState* play) { this->morphTable, 5); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, &D_809C1678, &D_809C166C); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &D_809C166C); this->unk195 = 0; if (this->actor.params == -1) { func_809BF9BC(this); 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 e9f48da2bc2..07fe09c8d01 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -148,16 +148,72 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit D_809E8FD8 = { 2, 0x19, 0x19, 0xFF }; static DamageTable D_809E8FE0 = { - { - 0x10, 2, 1, 2, 0xE2, 2, 2, 2, 0xF1, 0xF2, 0xF4, 0x24, 2, 2, 2, 2, - 2, 0x24, 0, 0, 0, 0, 0xF1, 0xF4, 0xF2, 0xF2, 0xF8, 0xF4, 0, 0, 4, 0, - }, + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(1, 0x0), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(2, 0xE), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(2, 0x0), + /* Kokiri sword */ DMG_ENTRY(1, 0xF), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(4, 0xF), + /* Fire arrow */ DMG_ENTRY(4, 0x2), + /* Ice arrow */ DMG_ENTRY(2, 0x0), + /* Light arrow */ DMG_ENTRY(2, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), + /* Fire magic */ DMG_ENTRY(4, 0x2), + /* Ice magic */ DMG_ENTRY(0, 0x0), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0xF), + /* Giant spin */ DMG_ENTRY(4, 0xF), + /* Master spin */ DMG_ENTRY(2, 0xF), + /* Kokiri jump */ DMG_ENTRY(2, 0xF), + /* Giant jump */ DMG_ENTRY(8, 0xF), + /* Master jump */ DMG_ENTRY(4, 0xF), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static DamageTable D_809E9000 = { - { - 0x10, 2, 1, 2, 0xE2, 2, 2, 0x10, 0xF1, 0xF2, 0xF4, 0x24, 2, 2, 2, 2, - 2, 0x24, 0, 0, 0, 0, 0xF1, 0xF4, 0xF2, 0xF2, 0xF8, 0xF4, 0, 0, 4, 0, - }, + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(1, 0x0), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(2, 0xE), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(0, 0x1), + /* Kokiri sword */ DMG_ENTRY(1, 0xF), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(4, 0xF), + /* Fire arrow */ DMG_ENTRY(4, 0x2), + /* Ice arrow */ DMG_ENTRY(2, 0x0), + /* Light arrow */ DMG_ENTRY(2, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), + /* Fire magic */ DMG_ENTRY(4, 0x2), + /* Ice magic */ DMG_ENTRY(0, 0x0), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0xF), + /* Giant spin */ DMG_ENTRY(4, 0xF), + /* Master spin */ DMG_ENTRY(2, 0xF), + /* Kokiri jump */ DMG_ENTRY(2, 0xF), + /* Giant jump */ DMG_ENTRY(8, 0xF), + /* Master jump */ DMG_ENTRY(4, 0xF), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static InitChainEntry D_809E9020[] = { ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP), 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 84749916815..1e6685e4a51 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -118,7 +118,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static DamageTable D_809EC620 = { +static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x0), /* Deku stick */ DMG_ENTRY(2, 0xF), /* Slingshot */ DMG_ENTRY(0, 0x0), @@ -168,7 +168,7 @@ void EnDh_Init(Actor* thisx, PlayState* play) { EnDh* this = (EnDh*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); - this->actor.colChkInfo.damageTable = &D_809EC620; + this->actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &object_dh_Skel_007E88, &object_dh_Anim_005880, this->jointTable, this->limbRotTable, 16); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 64.0f); 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 55ac689270e..5fc8413f388 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -57,10 +57,39 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { }; static ColliderJntSphInit sJntSphInit = { { 3, 0x11, 9, 0x39, 0x10, 0 }, 1, sJntSphElementsInit }; static CollisionCheckInfoInit D_80A14F64 = { 1, 0xA, 0xA, 0x1E }; -static DamageTable D_80A14F6C = { - { - 0x10, 2, 1, 2, 1, 2, 2, 2, 1, 2, 4, 0xF2, 0x34, 2, 2, 2, 2, 0x20, 0x34, 0, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(1, 0x0), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(1, 0x0), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(2, 0x0), + /* Kokiri sword */ DMG_ENTRY(1, 0x0), + /* Master sword */ DMG_ENTRY(2, 0x0), + /* Giant's Knife */ DMG_ENTRY(4, 0x0), + /* Fire arrow */ DMG_ENTRY(2, 0xF), + /* Ice arrow */ DMG_ENTRY(4, 0x3), + /* Light arrow */ DMG_ENTRY(2, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), + /* Fire magic */ DMG_ENTRY(0, 0x2), + /* Ice magic */ DMG_ENTRY(4, 0x3), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0x0), + /* Giant spin */ DMG_ENTRY(4, 0x0), + /* Master spin */ DMG_ENTRY(2, 0x0), + /* Kokiri jump */ DMG_ENTRY(2, 0x0), + /* Giant jump */ DMG_ENTRY(8, 0x0), + /* Master jump */ DMG_ENTRY(4, 0x0), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static InitChainEntry D_80A14F8C[5] = { ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), @@ -103,7 +132,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 0x1C); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80A14F6C, &D_80A14F64); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &D_80A14F64); if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; thisx->draw = EnFirefly_DrawXlu; 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 e2dfa5f4ad5..0c78fa878fe 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -94,11 +94,39 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static DamageTable D_80AFE078 = { - { - 0x10, 0xF2, 0xF1, 0xF2, 0x10, 0xF2, 0xF2, 0x10, 0xE1, 0xF2, 0xF4, 0x74, 0xF2, 0xF2, 0xF2, 0, - 0, 0x74, 0x60, 0xD3, 0, 0, 0xD1, 0xF4, 0xF2, 0xF2, 0xF8, 0xF4, 0, 0, 0xF4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0xF), + /* Slingshot */ DMG_ENTRY(1, 0xF), + /* Explosive */ DMG_ENTRY(2, 0xF), + /* Boomerang */ DMG_ENTRY(0, 0x1), + /* Normal arrow */ DMG_ENTRY(2, 0xF), + /* Hammer swing */ DMG_ENTRY(2, 0xF), + /* Hookshot */ DMG_ENTRY(0, 0x1), + /* Kokiri sword */ DMG_ENTRY(1, 0xE), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(4, 0xF), + /* Fire arrow */ DMG_ENTRY(4, 0x7), + /* Ice arrow */ DMG_ENTRY(2, 0xF), + /* Light arrow */ DMG_ENTRY(2, 0xF), + /* Unk arrow 1 */ DMG_ENTRY(2, 0xF), + /* Unk arrow 2 */ DMG_ENTRY(0, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(0, 0x0), + /* Fire magic */ DMG_ENTRY(4, 0x7), + /* Ice magic */ DMG_ENTRY(0, 0x6), + /* Light magic */ DMG_ENTRY(3, 0xD), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0xD), + /* Giant spin */ DMG_ENTRY(4, 0xF), + /* Master spin */ DMG_ENTRY(2, 0xF), + /* Kokiri jump */ DMG_ENTRY(2, 0xF), + /* Giant jump */ DMG_ENTRY(8, 0xF), + /* Master jump */ DMG_ENTRY(4, 0xF), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0xF), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; ActorProfile En_Skb_Profile = { @@ -148,7 +176,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; Actor_ProcessInitChain(&this->actor, D_80AFE0D0); - this->actor.colChkInfo.damageTable = &D_80AFE078; + this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.focus.pos = this->actor.world.pos; this->actor.colChkInfo.mass = MASS_HEAVY; 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 7010d27373b..1240e03433a 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -88,11 +88,39 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static DamageTable D_80B22AC4 = { - { - 0x10, 0xF2, 0, 0, 0xF1, 0, 0xE2, 0, 0xE1, 0xE2, 0xE4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0xE1, 0xE4, 0xE2, 0xE2, 0xE8, 0xE4, 0, 0, 0xE4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0xF), + /* Slingshot */ DMG_ENTRY(0, 0x0), + /* Explosive */ DMG_ENTRY(0, 0x0), + /* Boomerang */ DMG_ENTRY(1, 0xF), + /* Normal arrow */ DMG_ENTRY(0, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0xE), + /* Hookshot */ DMG_ENTRY(0, 0x0), + /* Kokiri sword */ DMG_ENTRY(1, 0xE), + /* Master sword */ DMG_ENTRY(2, 0xE), + /* Giant's Knife */ DMG_ENTRY(4, 0xE), + /* Fire arrow */ DMG_ENTRY(0, 0x0), + /* Ice arrow */ DMG_ENTRY(0, 0x0), + /* Light arrow */ DMG_ENTRY(0, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(0, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(0, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(0, 0x0), + /* Fire magic */ DMG_ENTRY(0, 0x0), + /* Ice magic */ DMG_ENTRY(0, 0x0), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0xE), + /* Giant spin */ DMG_ENTRY(4, 0xE), + /* Master spin */ DMG_ENTRY(2, 0xE), + /* Kokiri jump */ DMG_ENTRY(2, 0xE), + /* Giant jump */ DMG_ENTRY(8, 0xE), + /* Master jump */ DMG_ENTRY(4, 0xE), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0xE), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static InitChainEntry D_80B22AE4[] = { ICHAIN_F32(lockOnArrowOffset, 10, ICHAIN_STOP), @@ -112,7 +140,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { Actor_ProcessInitChain(&this->actor, D_80B22AE4); this->actor.attentionRangeType = ATTENTION_RANGE_3; - this->actor.colChkInfo.damageTable = &D_80B22AC4; + this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.14f); this->unk150 = 0; this->actor.colChkInfo.health = 1; 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 b35633e139a..f6fb81547eb 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -94,11 +94,39 @@ static ColliderCylinderInit sCylinderInit = { }; static CollisionCheckInfoInit D_80B2891C = { 2, 0x12, 0x20, 0xFE }; -static DamageTable D_80B28924 = { - { - 0x10, 2, 0xE0, 2, 0x10, 2, 2, 2, 0xF1, 0xF2, 0xF4, 0x24, 0x34, 2, 2, 2, - 2, 0x24, 0x34, 0, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(0, 0xE), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(0, 0x1), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(2, 0x0), + /* Kokiri sword */ DMG_ENTRY(1, 0xF), + /* Master sword */ DMG_ENTRY(2, 0xF), + /* Giant's Knife */ DMG_ENTRY(4, 0xF), + /* Fire arrow */ DMG_ENTRY(4, 0x2), + /* Ice arrow */ DMG_ENTRY(4, 0x3), + /* Light arrow */ DMG_ENTRY(2, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), + /* Fire magic */ DMG_ENTRY(4, 0x2), + /* Ice magic */ DMG_ENTRY(4, 0x3), + /* Light magic */ DMG_ENTRY(0, 0x0), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0x0), + /* Giant spin */ DMG_ENTRY(4, 0x0), + /* Master spin */ DMG_ENTRY(2, 0x0), + /* Kokiri jump */ DMG_ENTRY(2, 0x0), + /* Giant jump */ DMG_ENTRY(8, 0x0), + /* Master jump */ DMG_ENTRY(4, 0x0), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static InitChainEntry D_80B28944[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BARI, ICHAIN_CONTINUE), @@ -124,7 +152,7 @@ void EnVali_Init(Actor* thisx, PlayState* play) { Collider_SetQuad(play, &this->unk37C, &this->actor, &sColliderQuadInit); Collider_InitCylinder(play, &this->unk3FC); Collider_SetCylinder(play, &this->unk3FC, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_80B28924, &D_80B2891C); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &D_80B2891C); func_80B26878(this); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.floorHeight = 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 0b3c7f671ae..f08cca4475d 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -160,11 +160,39 @@ static ColliderCylinderInit D_80B37A5C = { { 15, 20, -15, { 0, 0, 0 } }, }; -static DamageTable D_80B37A88 = { - { - 0x10, 2, 1, 2, 0x10, 2, 2, 0x10, 1, 2, 4, 0xE4, 2, 2, 2, 2, - 2, 0xE4, 0x60, 0xD3, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(1, 0x0), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(0, 0x1), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(0, 0x1), + /* Kokiri sword */ DMG_ENTRY(1, 0x0), + /* Master sword */ DMG_ENTRY(2, 0x0), + /* Giant's Knife */ DMG_ENTRY(4, 0x0), + /* Fire arrow */ DMG_ENTRY(4, 0xE), + /* Ice arrow */ DMG_ENTRY(2, 0x0), + /* Light arrow */ DMG_ENTRY(2, 0x0), + /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), + /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), + /* Fire magic */ DMG_ENTRY(4, 0xE), + /* Ice magic */ DMG_ENTRY(0, 0x6), + /* Light magic */ DMG_ENTRY(3, 0xD), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0x0), + /* Giant spin */ DMG_ENTRY(4, 0x0), + /* Master spin */ DMG_ENTRY(2, 0x0), + /* Kokiri jump */ DMG_ENTRY(2, 0x0), + /* Giant jump */ DMG_ENTRY(8, 0x0), + /* Master jump */ DMG_ENTRY(4, 0x0), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; ActorProfile En_Wf_Profile = { @@ -198,7 +226,7 @@ void EnWf_Init(Actor* thisx, PlayState* play) { s32 pad; Actor_ProcessInitChain(&this->actor, D_80B37AC8); - this->actor.colChkInfo.damageTable = &D_80B37A88; + this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.focus.pos = this->actor.world.pos; this->actor.colChkInfo.mass = MASS_HEAVY; 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 ab6601ddad5..0c88164dcf3 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -133,11 +133,39 @@ static ColliderQuadInit sColliderQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -static DamageTable D_80B4A254 = { - { - 0x10, 2, 0xD1, 2, 0x10, 2, 2, 0x10, 1, 2, 4, 0xD2, 0xF4, 0xD2, 0xD2, 0xD2, - 0xD2, 0x60, 0xF3, 0x60, 0, 0, 1, 4, 2, 2, 8, 4, 0, 0, 4, 0, - }, +static DamageTable sDamageTable = { + /* Deku nut */ DMG_ENTRY(0, 0x1), + /* Deku stick */ DMG_ENTRY(2, 0x0), + /* Slingshot */ DMG_ENTRY(1, 0xD), + /* Explosive */ DMG_ENTRY(2, 0x0), + /* Boomerang */ DMG_ENTRY(0, 0x1), + /* Normal arrow */ DMG_ENTRY(2, 0x0), + /* Hammer swing */ DMG_ENTRY(2, 0x0), + /* Hookshot */ DMG_ENTRY(0, 0x1), + /* Kokiri sword */ DMG_ENTRY(1, 0x0), + /* Master sword */ DMG_ENTRY(2, 0x0), + /* Giant's Knife */ DMG_ENTRY(4, 0x0), + /* Fire arrow */ DMG_ENTRY(2, 0xD), + /* Ice arrow */ DMG_ENTRY(4, 0xF), + /* Light arrow */ DMG_ENTRY(2, 0xD), + /* Unk arrow 1 */ DMG_ENTRY(2, 0xD), + /* Unk arrow 2 */ DMG_ENTRY(2, 0xD), + /* Unk arrow 3 */ DMG_ENTRY(2, 0xD), + /* Fire magic */ DMG_ENTRY(0, 0x6), + /* Ice magic */ DMG_ENTRY(3, 0xF), + /* Light magic */ DMG_ENTRY(0, 0x6), + /* Shield */ DMG_ENTRY(0, 0x0), + /* Mirror Ray */ DMG_ENTRY(0, 0x0), + /* Kokiri spin */ DMG_ENTRY(1, 0x0), + /* Giant spin */ DMG_ENTRY(4, 0x0), + /* Master spin */ DMG_ENTRY(2, 0x0), + /* Kokiri jump */ DMG_ENTRY(2, 0x0), + /* Giant jump */ DMG_ENTRY(8, 0x0), + /* Master jump */ DMG_ENTRY(4, 0x0), + /* Unknown 1 */ DMG_ENTRY(0, 0x0), + /* Unblockable */ DMG_ENTRY(0, 0x0), + /* Hammer jump */ DMG_ENTRY(4, 0x0), + /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; static InitChainEntry D_80B4A274[3] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), @@ -243,7 +271,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); this->unk3E0 = 0; this->actor.colChkInfo.mass = MASS_HEAVY; - this->actor.colChkInfo.damageTable = &D_80B4A254; + this->actor.colChkInfo.damageTable = &sDamageTable; sp4C.p1StartColor[0] = sp4C.p1StartColor[1] = sp4C.p1StartColor[2] = sp4C.p1StartColor[3] = sp4C.p2StartColor[0] = sp4C.p2StartColor[1] = sp4C.p2StartColor[2] = sp4C.p1EndColor[0] = sp4C.p1EndColor[1] = sp4C.p1EndColor[2] = sp4C.p2EndColor[0] = sp4C.p2EndColor[1] = sp4C.p2EndColor[2] = 255; From 946a1b5c91bf165fdfcb6dd4172f81388a73fc88 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:32:51 +0200 Subject: [PATCH 029/150] InitChainEntry sInitChain[] --- src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 4 ++-- src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 4 ++-- .../actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c | 4 ++-- src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c | 4 ++-- src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c | 4 ++-- src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c | 4 ++-- .../actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c | 4 ++-- src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 4 ++-- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 4 ++-- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c | 4 ++-- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 4 ++-- src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 4 ++-- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 4 ++-- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 4 ++-- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 4 ++-- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 4 ++-- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 4 ++-- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 4 ++-- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 4 ++-- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 ++-- src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c | 4 ++-- src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c | 4 ++-- src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 4 ++-- 23 files changed, 46 insertions(+), 46 deletions(-) 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 be84c272a0b..efd4d0862dd 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 @@ -39,7 +39,7 @@ ActorProfile Bg_Haka_Huta_Profile = { /**/ BgHakaHuta_Update, /**/ BgHakaHuta_Draw, }; -static InitChainEntry D_8087D940[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; static Vec3f D_8087D944 = { 0.0f, 0.0f, 0.0f }; @@ -52,7 +52,7 @@ void BgHakaHuta_Init(Actor* thisx, PlayState* play) { CollisionHeader* sp24; sp24 = NULL; - Actor_ProcessInitChain(&this->dyna.actor, D_8087D940); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &sp24); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp24); diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 86c38871097..43ad3a8db58 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -115,7 +115,7 @@ static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { static ColliderTrisInit sSpikedWallTrisInit = { { 0xA, 0, 9, 0, 0x20, 2 }, 2, sSpikedWallTrisElementsInit }; CollisionCheckInfoInit D_80881008 = { 0, 0x50, 0x64, 0xFF }; -InitChainEntry D_80881010[] = { +InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; @@ -127,7 +127,7 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { CollisionHeader* sp2C; sp2C = NULL; - Actor_ProcessInitChain(&this->dyna.actor, D_80881010); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.params &= 0xFF; spikedCrusherFlipPtr = &sSpikedCrusherFlip; if (this->dyna.actor.params != BG_HAKA_TRAP_FAN_BLADE) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index 2ccc88c8aef..1d9e302273f 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -64,7 +64,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[6] = { }, }; static ColliderJntSphInit sJntSphInit = { { 0xA, 0x11, 0, 0, 0x20, 0 }, 6, sJntSphElementsInit }; -InitChainEntry D_8088CD68[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 400, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1500, ICHAIN_STOP), @@ -82,7 +82,7 @@ void BgHidanRsekizou_Init(Actor* thisx, PlayState* play) { CollisionHeader* sp30; sp30 = NULL; - Actor_ProcessInitChain(&this->dyna.actor, D_8088CD68); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&gFireTempleSpinningFlamethrowerCol, &sp30); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); diff --git a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c index 93f54574382..bee52bcc467 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c +++ b/src/overlays/actors/ovl_Bg_Ice_Turara/z_bg_ice_turara.c @@ -59,7 +59,7 @@ ActorProfile Bg_Ice_Turara_Profile = { /**/ BgIceTurara_Update, /**/ BgIceTurara_Draw, }; -static InitChainEntry D_8089266C[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeScale, 600, ICHAIN_CONTINUE), ICHAIN_F32(gravity, -3, ICHAIN_CONTINUE), ICHAIN_F32(minVelocityY, -30, ICHAIN_CONTINUE), @@ -75,7 +75,7 @@ void BgIceTurara_Init(Actor* thisx, PlayState* play) { CollisionHeader* sp24; sp24 = NULL; - Actor_ProcessInitChain(&this->dyna.actor, D_8089266C); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); CollisionHeader_GetVirtual(&object_ice_objects_Col_002594, &sp24); Collider_InitCylinder(play, &this->collider); diff --git a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c index 5f1206d5b5c..394bdf54984 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c +++ b/src/overlays/actors/ovl_Bg_Jya_Haheniron/z_bg_jya_haheniron.c @@ -51,7 +51,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { }; static ColliderJntSphInit sJntSphInit = { { 0xA, 0x11, 1, 0, 0, 0 }, 1, sJntSphElementsInit }; static s16 D_80898774[5] = { 5, 8, 0xB, 0xE, 0x11 }; -static InitChainEntry D_80898780[5] = { +static InitChainEntry sInitChain[5] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -15000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 500, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 1000, ICHAIN_STOP), @@ -104,7 +104,7 @@ void func_80898114(PlayState* play, Vec3f* arg1, Vec3f* arg2) { void BgJyaHaheniron_Init(Actor* thisx, PlayState* play) { BgJyaHaheniron* this = (BgJyaHaheniron*)thisx; - Actor_ProcessInitChain(&this->actor, D_80898780); + Actor_ProcessInitChain(&this->actor, sInitChain); Actor_SetScale(&this->actor, D_80898794[this->actor.params]); if (this->actor.params == 0) { func_808980C0(this, play); 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 10572b11f64..f57417ed3c4 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 @@ -63,7 +63,7 @@ ActorProfile Bg_Po_Syokudai_Profile = { /**/ BgPoSyokudai_Draw, }; -static InitChainEntry D_808A89CC[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; @@ -71,7 +71,7 @@ void BgPoSyokudai_Init(Actor* thisx, PlayState* play) { BgPoSyokudai* this = (BgPoSyokudai*)thisx; s32 pad; - Actor_ProcessInitChain(&this->actor, D_808A89CC); + Actor_ProcessInitChain(&this->actor, sInitChain); this->unk14C = PARAMS_GET_U(thisx->params, 8, 8); this->actor.params &= 0x3F; this->actor.colChkInfo.mass = 0xFF; 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 d81922c0314..8b76c60cf8f 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 @@ -47,7 +47,7 @@ static f32 D_808B16C8[3] = { 1.4285714e-8f, 5.714286e-9f, 1.4285715e-9f }; static f32 D_808B16D4[3] = { 0.96f, 0.96f, 0.98f }; static f32 D_808B16E0[3] = { 0.22495104f, 0.22495104f, 0.03489947f }; static f32 D_808B16EC[3] = { 0.97437006f, 0.97437006f, 0.99939084f }; -static InitChainEntry D_808B16F8[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDistance, 3000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 1000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 2200, ICHAIN_STOP), @@ -286,7 +286,7 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { Actor_Kill(&this->dyna.actor); return; } - Actor_ProcessInitChain(&this->dyna.actor, D_808B16F8); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) { case 0: Actor_SetScale(&this->dyna.actor, 0.2f); 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 0b6dadc4392..8df36fa8296 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 @@ -35,7 +35,7 @@ ActorProfile Bg_Toki_Hikari_Profile = { /**/ BgTokiHikari_Draw, }; -static InitChainEntry D_808BAC70[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; @@ -46,7 +46,7 @@ void BgTokiHikari_Init(Actor* thisx, PlayState* play) { temp_v0 = this->actor.params; switch (temp_v0) { /* irregular */ case 0: - Actor_ProcessInitChain(&this->actor, D_808BAC70); + Actor_ProcessInitChain(&this->actor, sInitChain); this->unk150 = func_808B9F98; return; case 1: 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 ad6399c0932..e545e613e62 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -121,7 +121,7 @@ static DamageTable sDamageTable = { /* Hammer jump */ DMG_ENTRY(4, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static InitChainEntry D_809C1698[] = { +static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIRI, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_STOP), }; @@ -131,7 +131,7 @@ static Color_RGBA8 D_809C16A4 = { 0xC8, 0xFF, 0xFF, 0xFF }; void EnBili_Init(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; - Actor_ProcessInitChain(&this->actor, D_809C1698); + Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; SkelAnime_Init(play, &this->skelAnime, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->jointTable, 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 07fe09c8d01..952048e0aad 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -215,7 +215,7 @@ static DamageTable D_809E9000 = { /* Hammer jump */ DMG_ENTRY(4, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static InitChainEntry D_809E9020[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP), }; static Color_RGBA8 D_809E9024 = { 0x69, 0xFF, 0x69, 0xFF }; @@ -230,7 +230,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { s32 var_a0; EnDekubaba* this = (EnDekubaba*)thisx; - Actor_ProcessInitChain(&this->actor, D_809E9020); + Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, this->morphTable, 8); diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index db2bb8f54f2..ac3482c92ee 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -154,7 +154,7 @@ static EnDnsPurchaseInfo* sEnDnsPurchaseInfos[] = { &sItemDekuStickUpgrade, // DNS_TYPE_DEKU_STICK_UPGRADE &sItemDekuNutUpgrade, // DNS_TYPE_DEKU_NUT_UPGRADE }; -static InitChainEntry D_809F052C[3] = { +static InitChainEntry sInitChain[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 30, ICHAIN_STOP), @@ -178,7 +178,7 @@ void EnDns_Init(Actor* thisx, PlayState* play) { this->actor.params = DNS_TYPE_DEKU_SEEDS_30; } PRINTF("\x1b[32m◆◆◆ 売りナッツ『%s』 ◆◆◆\x1b[m\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); - Actor_ProcessInitChain(&this->actor, D_809F052C); + Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, this->unk1FC, 0x12); Collider_InitCylinder(play, &this->collider); 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 5fc8413f388..24b2390797a 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -91,7 +91,7 @@ static DamageTable sDamageTable = { /* Hammer jump */ DMG_ENTRY(4, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static InitChainEntry D_80A14F8C[5] = { +static InitChainEntry sInitChain[5] = { ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(minVelocityY, -4, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 4000, ICHAIN_STOP), @@ -127,7 +127,7 @@ void func_80A13098_Ignite_(EnFirefly* this) { void EnFirefly_Init(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - Actor_ProcessInitChain(&this->actor, D_80A14F8C); + Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 0x1C); Collider_InitJntSph(play, &this->collider); diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index afd7b71a4f2..991d9d27510 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -96,7 +96,7 @@ ActorProfile En_Fish_Profile = { /**/ EnFish_Draw, }; -static InitChainEntry D_80A17070[4] = { +static InitChainEntry sInitChain[4] = { ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 900, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 40, ICHAIN_CONTINUE), @@ -165,7 +165,7 @@ void EnFish_Init(Actor* thisx, PlayState* play) { s16 sp3A; sp3A = this->actor.params; - Actor_ProcessInitChain(&this->actor, D_80A17070); + Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); 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 eb4d1d99477..7a5febc565e 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -190,7 +190,7 @@ static ColliderCylinderInit sCylinderInit = { { 170, 150, 0, { 0, 0, 0 } }, }; -static InitChainEntry D_80A88CE0[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 87, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 4000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 3300, ICHAIN_CONTINUE), @@ -209,7 +209,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { CollisionHeader* sp4C; sp4C = NULL; - Actor_ProcessInitChain(&this->dyna.actor, D_80A88CE0); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); switch (this->dyna.actor.params) { case -1: 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 f736be5eb94..2d7917fb7e8 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -89,7 +89,7 @@ static Vec3f sUnitDirections[4] = { static s16 sFragmentScales[8] = { 0x6C, 0x66, 0x60, 0x54, 0x42, 0x37, 0x2A, 0x26, }; -static InitChainEntry D_80A9C27C[6] = { +static InitChainEntry sInitChain[6] = { ICHAIN_VEC3F_DIV1000(scale, 400, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -17000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1200, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 120, ICHAIN_STOP), @@ -227,7 +227,7 @@ void func_80A9B630(Actor* thisx, PlayState* play) { void EnKusa_Init(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - Actor_ProcessInitChain(&this->actor, D_80A9C27C); + Actor_ProcessInitChain(&this->actor, sInitChain); if (play->csCtx.state != CS_STATE_IDLE) { this->actor.cullingVolumeDistance += 1000.0f; } 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 0c78fa878fe..a5f9f5e1315 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -143,7 +143,7 @@ ActorProfile En_Skb_Profile = { static Vec3f D_80AFE0B8 = { 0.0f, 8.0f, 0.0f }; static Vec3f D_80AFE0C4 = { 0.0f, -1.5f, 0.0f }; -static InitChainEntry D_80AFE0D0[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; @@ -175,7 +175,7 @@ void func_80AFC9A8(PlayState* play, EnSkb* this, Vec3f* arg2) { void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; - Actor_ProcessInitChain(&this->actor, D_80AFE0D0); + Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.focus.pos = this->actor.world.pos; 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 1240e03433a..227c7b42d69 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -122,7 +122,7 @@ static DamageTable sDamageTable = { /* Hammer jump */ DMG_ENTRY(4, 0xE), /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static InitChainEntry D_80B22AE4[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 10, ICHAIN_STOP), }; @@ -138,7 +138,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { PlayState* play = play2; s64 new_var; - Actor_ProcessInitChain(&this->actor, D_80B22AE4); + Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.attentionRangeType = ATTENTION_RANGE_3; this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.14f); 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 f6fb81547eb..b7f7fde08b5 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -128,7 +128,7 @@ static DamageTable sDamageTable = { /* Hammer jump */ DMG_ENTRY(4, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static InitChainEntry D_80B28944[3] = { +static InitChainEntry sInitChain[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BARI, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 5000, ICHAIN_STOP), @@ -141,7 +141,7 @@ void EnVali_Init(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; s32 sp34; - Actor_ProcessInitChain(&this->actor, D_80B28944); + Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; SkelAnime_Init(play, &this->skelAnime, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->jointTable, 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 f08cca4475d..763c0ffd89e 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -207,7 +207,7 @@ ActorProfile En_Wf_Profile = { /**/ EnWf_Draw, }; -static InitChainEntry D_80B37AC8[2] = { +static InitChainEntry sInitChain[2] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3000, ICHAIN_STOP), }; @@ -225,7 +225,7 @@ void EnWf_Init(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; s32 pad; - Actor_ProcessInitChain(&this->actor, D_80B37AC8); + Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f); this->actor.focus.pos = this->actor.world.pos; 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 0c88164dcf3..3a9495281b2 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -167,7 +167,7 @@ static DamageTable sDamageTable = { /* Hammer jump */ DMG_ENTRY(4, 0x0), /* Unknown 2 */ DMG_ENTRY(0, 0x0), }; -static InitChainEntry D_80B4A274[3] = { +static InitChainEntry sInitChain[3] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP), @@ -261,7 +261,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; player = GET_PLAYER(play); - Actor_ProcessInitChain(&this->actor, D_80B4A274); + Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.attentionRangeType = ATTENTION_RANGE_3; this->unk3FC = PARAMS_GET_S(thisx->params, 8, 8); this->actor.params &= 0xFF; 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 9e72d83b1d1..42b8b703f26 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -216,7 +216,7 @@ static struct_80B8E6F8 D_80B8E6F8[0xA] = { UNK1F_0 | UNK1F_1, }, }; -static InitChainEntry D_80B8E838[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 0, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 4000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 1000, ICHAIN_CONTINUE), @@ -278,7 +278,7 @@ void MirRay_Init(Actor* thisx, PlayState* play) { MirRay* this = (MirRay*)thisx; temp_s1 = &D_80B8E6F8[this->actor.params]; - Actor_ProcessInitChain(&this->actor, D_80B8E838); + Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); PRINTF("反射用 光の発生!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); #if DEBUG_FEATURES 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 fc8578878df..5da8817fcc9 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -59,7 +59,7 @@ typedef struct struct_80BA0AF0 { } struct_80BA0AF0; struct_80BA0AF0 D_80BA0AF0[2] = { { 1.0f, 60.0f, 0x18 }, { 0.6f, 40.0f, 0x19 } }; static f32 D_80BA0B08[8] = { 60.0f, 100.0f, 140.0f, 180.0f, 220.0f, 260.0f, 300.0f, 300.0f }; -static InitChainEntry D_80BA0B28[4] = { +static InitChainEntry sInitChain[4] = { ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1800, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 300, ICHAIN_CONTINUE), @@ -122,7 +122,7 @@ void ObjTimeblock_Init(Actor* thisx, PlayState* play) { this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; CollisionHeader_GetVirtual(&gSongOfTimeBlockCol, &sp2C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp2C); - Actor_ProcessInitChain(&this->dyna.actor, D_80BA0B28); + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); Actor_SetScale(&this->dyna.actor, D_80BA0AF0[PARAMS_GET_U(this->dyna.actor.params, 8, 1)].unk0); if (PARAMS_GET_U(this->dyna.actor.params, 6, 1)) { this->unk177 = 0; 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 4235f14ada6..84d8343d3f1 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -79,7 +79,7 @@ static ColliderCylinderInit sCylinderInit = { }; static CollisionCheckInfoInit D_80BA1BC0 = { 0, 0xC, 0x3C, MASS_IMMOVABLE }; -static InitChainEntry D_80BA1BC8[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -20000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 150, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 900, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 800, ICHAIN_STOP), @@ -133,7 +133,7 @@ void func_80BA0E98(ObjTsubo* this2, PlayState* play) { void ObjTsubo_Init(Actor* thisx, PlayState* play) { ObjTsubo* this = (ObjTsubo*)thisx; - Actor_ProcessInitChain(&this->actor, D_80BA1BC8); + Actor_ProcessInitChain(&this->actor, sInitChain); func_80BA0E98(this, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_80BA1BC0); if (func_80BA0DF4(this, play) == 0) { From dbe95aff7873ce2d42bbca3bdf63c538bdca6e5e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:38:50 +0200 Subject: [PATCH 030/150] cleanup CollisionCheckInfoInit* data --- src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 6 +++--- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 4 ++-- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c | 6 +++--- src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 4 ++-- src/overlays/actors/ovl_En_Fw/z_en_fw.c | 4 ++-- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 4 ++-- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 4 ++-- src/overlays/actors/ovl_En_Md/z_en_md.c | 5 +++-- src/overlays/actors/ovl_En_Mu/z_en_mu.c | 4 ++-- src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c | 6 +++--- src/overlays/actors/ovl_En_Si/z_en_si.c | 4 ++-- src/overlays/actors/ovl_En_Sw/z_en_sw.c | 4 ++-- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 4 ++-- src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c | 4 ++-- 14 files changed, 32 insertions(+), 31 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 43ad3a8db58..a3678248259 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -113,9 +113,9 @@ static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { }; static ColliderTrisInit sSpikedWallTrisInit = { { 0xA, 0, 9, 0, 0x20, 2 }, 2, sSpikedWallTrisElementsInit }; -CollisionCheckInfoInit D_80881008 = { 0, 0x50, 0x64, 0xFF }; +static CollisionCheckInfoInit sColChkInfoInit = { 0, 80, 100, MASS_IMMOVABLE }; -InitChainEntry sInitChain[] = { +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; @@ -195,7 +195,7 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { this->actionFunc = &BgHakaTrap_FanBlade_Idle; this->dyna.actor.cullingVolumeScale = 500.0f; } - CollisionCheck_SetInfo(&this->dyna.actor.colChkInfo, NULL, &D_80881008); + CollisionCheck_SetInfo(&this->dyna.actor.colChkInfo, NULL, &sColChkInfoInit); } void BgHakaTrap_Destroy(Actor* thisx, PlayState* play) { 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 e545e613e62..316c3ea73c3 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -86,7 +86,7 @@ static ColliderCylinderInit sCylinderInit = { { 9, 28, -20, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit2 D_809C166C = { 1, 9, 0x1C, -0x14, 0x1E }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 9, 28, -20, 30 }; static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x1), /* Deku stick */ DMG_ENTRY(2, 0x0), @@ -138,7 +138,7 @@ void EnBili_Init(Actor* thisx, PlayState* play) { this->morphTable, 5); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &D_809C166C); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->unk195 = 0; if (this->actor.params == -1) { func_809BF9BC(this); 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 952048e0aad..adee7e3f4f4 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -146,7 +146,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static CollisionCheckInfoInit D_809E8FD8 = { 2, 0x19, 0x19, 0xFF }; +static CollisionCheckInfoInit sColChkInfoInit = { 2, 25, 25, MASS_IMMOVABLE }; static DamageTable D_809E8FE0 = { /* Deku nut */ DMG_ENTRY(0, 0x1), /* Deku stick */ DMG_ENTRY(2, 0x0), @@ -246,7 +246,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { if (!LINK_IS_ADULT) { D_809E9000.table[0x1B] = 4; } - CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E9000, &D_809E8FD8); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E9000, &sColChkInfoInit); this->actor.colChkInfo.health = 4; this->actor.naviEnemyId = NAVI_ENEMY_BIG_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_2; @@ -259,7 +259,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { if (!LINK_IS_ADULT) { D_809E8FE0.table[0x1B] = 4; } - CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E8FE0, &D_809E8FD8); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E8FE0, &sColChkInfoInit); this->actor.naviEnemyId = NAVI_ENEMY_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_1; } 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 24b2390797a..ad5e3487935 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -56,7 +56,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[1] = { }, }; static ColliderJntSphInit sJntSphInit = { { 3, 0x11, 9, 0x39, 0x10, 0 }, 1, sJntSphElementsInit }; -static CollisionCheckInfoInit D_80A14F64 = { 1, 0xA, 0xA, 0x1E }; +static CollisionCheckInfoInit sColChkInfoInit = { 1, 10, 10, 30 }; static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x1), /* Deku stick */ DMG_ENTRY(2, 0x0), @@ -132,7 +132,7 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 0x1C); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &D_80A14F64); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); if (PARAMS_GET_NOSHIFT(this->actor.params, 15, 1)) { this->actor.flags |= ACTOR_FLAG_REACT_TO_LENS; thisx->draw = EnFirefly_DrawXlu; 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 afa6ee7fa34..2348f61502e 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -73,7 +73,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static CollisionCheckInfoInit2 D_80A1FB94 = { 8, 2, 25, 25, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 8, 2, 25, 25, MASS_IMMOVABLE }; typedef enum EnFwAnimation { /* 0 */ ENFW_ANIM_0, @@ -202,7 +202,7 @@ void EnFw_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x10), &D_80A1FB94); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0x10), &sColChkInfoInit); Actor_SetScale(&this->actor, 0.01f); this->runDirection = -this->actor.params; this->actionFunc = EnFw_Bounce; 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 9d26b06bf62..d0d41423099 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -170,7 +170,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static CollisionCheckInfoInit D_80A65F38 = { 10, 35, 100, MASS_HEAVY }; +static CollisionCheckInfoInit sColChkInfoInit = { 10, 35, 100, MASS_HEAVY }; typedef struct EnHorseSpawnpoint { /* 0x0 */ s16 sceneId; @@ -841,7 +841,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Collider_SetCylinder(play, &this->colliderCylinder2, &this->actor, &sCylinderInit2); Collider_InitJntSph(play, &this->colliderJntSph); Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); - CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(0xB), &D_80A65F38); + CollisionCheck_SetInfo(&this->actor.colChkInfo, DamageTable_Get(0xB), &sColChkInfoInit); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 70.0f; this->playerControlled = false; 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 2d7917fb7e8..f9c6aa4583d 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -79,7 +79,7 @@ static ColliderCylinderInit sCylinderInit = { }, { 12, 44, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit D_80A9C234 = { 0, 0xC, 0x1E, 0xFF }; +static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 30, MASS_IMMOVABLE }; static Vec3f sUnitDirections[4] = { { 0.0f, 0.7071f, 0.7071f }, { 0.7071f, 0.7071f, 0.0f }, @@ -232,7 +232,7 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { this->actor.cullingVolumeDistance += 1000.0f; } func_80A9B630(&this->actor, play); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_80A9C234); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.home.rot.y = this->actor.world.rot.y = (s16)(s32)Rand_ZeroFloat(65536.0f); } 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 17320deeb9a..38402c9da1b 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -1,4 +1,5 @@ #include "z_en_md.h" +#include "actor.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "libc64/math64.h" @@ -65,7 +66,7 @@ static ColliderCylinderInit sCylinderInit = { }, { 36, 46, 0, { 0, 0, 0 } }, }; -CollisionCheckInfoInit2 D_80AAC33C = { 0, 0, 0, 0, 0xFF }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum EnMdAnimSequence { /* 0x0 */ ENMD_ANIM_SEQ_NONE, @@ -680,7 +681,7 @@ void EnMd_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AAC33C); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (func_80AAB03C(this, play) == 0) { Actor_Kill(&this->actor); return; diff --git a/src/overlays/actors/ovl_En_Mu/z_en_mu.c b/src/overlays/actors/ovl_En_Mu/z_en_mu.c index 92ee117161a..0b78ad59a51 100644 --- a/src/overlays/actors/ovl_En_Mu/z_en_mu.c +++ b/src/overlays/actors/ovl_En_Mu/z_en_mu.c @@ -46,7 +46,7 @@ static ColliderCylinderInit sCylinderInit = { { 100, 70, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit2 D_80AB0BFC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; ActorProfile En_Mu_Profile = { /**/ ACTOR_EN_MU, @@ -147,7 +147,7 @@ void EnMu_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &object_mu_Skel_004F70, &object_mu_Anim_0003F4, NULL, NULL, 0); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AB0BFC); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); this->actor.attentionRangeType = ATTENTION_RANGE_6; Actor_SetScale(&this->actor, 0.01f); EnMu_Interact(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 34ca4d2a89b..8de3a622a9a 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 @@ -102,7 +102,7 @@ static ColliderCylinderInit D_80AD70AC = { { 10, 30, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit D_80AD70D8 = { 4, 25, 50, 40 }; +static CollisionCheckInfoInit sColChkInfoInit = { 4, 25, 50, 40 }; static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x0), @@ -187,7 +187,7 @@ void EnPoField_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->actor, &D_80AD7080); Collider_InitCylinder(play, &this->flameCollider); Collider_SetCylinder(play, &this->flameCollider, &this->actor, &D_80AD70AC); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &D_80AD70D8); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); this->lightNode = LightContext_InsertLight(play, &play->lightCtx, &this->lightInfo); Lights_PointGlowSetInfo(&this->lightInfo, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, 255, 255, 255, 0); @@ -215,7 +215,7 @@ void EnPoField_SetupWaitForSpawn(EnPoField* this, PlayState* play) { this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED); this->collider.base.acFlags &= ~AC_ON; this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_ALL; - this->actor.colChkInfo.health = D_80AD70D8.health; + this->actor.colChkInfo.health = sColChkInfoInit.health; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actionFunc = EnPoField_WaitForSpawn; 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 5ee82311b25..8668b21efba 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -46,7 +46,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 18, 2, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit2 D_80AFBADC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; ActorProfile En_Si_Profile = { /**/ ACTOR_EN_SI, @@ -65,7 +65,7 @@ void EnSi_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &D_80AFBADC); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Actor_SetScale(&this->actor, 0.025f); this->unk_19C = 0; this->actionFunc = func_80AFB768; 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 b2a2ecdd94f..48709915edb 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -76,7 +76,7 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; -static CollisionCheckInfoInit2 D_80B0F074 = { 1, 2, 25, 25, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 2, 25, 25, MASS_IMMOVABLE }; typedef enum EnSwAnimation { /* 0 */ ENSW_ANIM_0, @@ -272,7 +272,7 @@ void EnSw_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xE), &D_80B0F074); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, DamageTable_Get(0xE), &sColChkInfoInit); this->actor.scale.x = 0.02f; if (PARAMS_GET_S(thisx->params, 13, 3) == 0) { 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 b7f7fde08b5..620b09fc212 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -93,7 +93,7 @@ static ColliderCylinderInit sCylinderInit = { { 17, 35, -15, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit D_80B2891C = { 2, 0x12, 0x20, 0xFE }; +static CollisionCheckInfoInit sColChkInfoInit = { 2, 18, 32, MASS_HEAVY }; static DamageTable sDamageTable = { /* Deku nut */ DMG_ENTRY(0, 0x1), /* Deku stick */ DMG_ENTRY(2, 0x0), @@ -152,7 +152,7 @@ void EnVali_Init(Actor* thisx, PlayState* play) { Collider_SetQuad(play, &this->unk37C, &this->actor, &sColliderQuadInit); Collider_InitCylinder(play, &this->unk3FC); Collider_SetCylinder(play, &this->unk3FC, &this->actor, &sCylinderInit); - CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &D_80B2891C); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); func_80B26878(this); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.floorHeight = 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 84d8343d3f1..47fa5add567 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -78,7 +78,7 @@ static ColliderCylinderInit sCylinderInit = { { 9, 26, 0, { 0, 0, 0 } }, }; -static CollisionCheckInfoInit D_80BA1BC0 = { 0, 0xC, 0x3C, MASS_IMMOVABLE }; +static CollisionCheckInfoInit sColChkInfoInit = { 0, 0xC, 0x3C, MASS_IMMOVABLE }; static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -20000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 150, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 900, ICHAIN_CONTINUE), @@ -135,7 +135,7 @@ void ObjTsubo_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); func_80BA0E98(this, play); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &D_80BA1BC0); + CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (func_80BA0DF4(this, play) == 0) { Actor_Kill(&this->actor); } else { From c501dc6d37b373eb700aebdec0a84c167d3d44c4 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:51:51 +0200 Subject: [PATCH 031/150] use names for atFlags, acFlags --- src/overlays/actors/ovl_En_Anubice/z_en_anubice.c | 4 ++-- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 6 +++--- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c | 2 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 ++-- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 4 ++-- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) 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 3b30029d236..b28a15e0f85 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -387,8 +387,8 @@ void EnAnubice_Update(Actor* thisx, PlayState* play) { } } - if (this->col.base.acFlags & 2) { - this->col.base.acFlags &= ~2; + if (this->col.base.acFlags & AC_HIT) { + this->col.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageReaction == 2) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; 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 316c3ea73c3..7a066cd6f8d 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -201,7 +201,7 @@ void func_809BFB5C(EnBili* this) { this->unk196 = 0x60; this->actor.speed = 0.9f; this->actor.home.pos.y = this->actor.world.pos.y; - this->collider.base.atFlags |= 1; + this->collider.base.atFlags |= AT_ON; this->unk190 = func_809C0600; } @@ -597,10 +597,10 @@ void EnBili_Update(Actor* thisx, PlayState* play2) { Actor_UpdateBgCheckInfo(play, &this->actor, 5.0f, this->collider.dim.radius, this->collider.dim.height, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); Collider_UpdateCylinder(&this->actor, &this->collider); - if (this->collider.base.atFlags & 1) { + if (this->collider.base.atFlags & AT_ON) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->collider.base.acFlags & 1) { + if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); 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 adee7e3f4f4..87d25e03bd6 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -1031,7 +1031,7 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } - if (this->collider.base.acFlags & 1) { + if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } if (this->unk1C0 != func_809E80D8) { 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 86742a2d9dc..1d9b863c35a 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -228,7 +228,7 @@ void func_80A30F48(EnGe1* this, PlayState* play) { if ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 100.0f)) { func_80A30EE8(this, play); } - if (this->collider.base.acFlags & 2) { + if (this->collider.base.acFlags & AC_HIT) { func_80A30EE8(this, play); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); @@ -269,7 +269,7 @@ void func_80A310C4(EnGe1* this, PlayState* play) { if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 400.0f))) { func_80A30EE8(this, play); } - if (this->collider.base.acFlags & 2) { + if (this->collider.base.acFlags & AC_HIT) { func_80A30EE8(this, play); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); 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 227c7b42d69..85d9f54ed17 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -151,7 +151,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { if (this->actor.params < 0) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; this->unk15A = 0; - this->collider.base.acFlags |= 4; + this->collider.base.acFlags |= AC_HARD; this->collider.elements[0].dim.worldSphere.radius = 8; this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius; func_80B21B90(this); @@ -532,7 +532,7 @@ void func_80B221E8(EnTp* this, PlayState* play) { if (this->actor.params < 0) { var_s2 = 1; } - this->collider.base.acFlags &= ~2; + this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); this->unk158 = this->actor.colChkInfo.damageReaction; if (this->actor.colChkInfo.damageReaction != 0) { 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 763c0ffd89e..74fcc595b1c 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -713,7 +713,7 @@ void func_80B35024(EnWf* this, PlayState* play) { void func_80B35540(EnWf* this) { Animation_PlayOnce(&this->skelAnime, &object_wf_Anim_004638); - this->unk304.base.atFlags &= ~4; + this->unk304.base.atFlags &= ~AT_BOUNCED; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->unk2D4 = 8; this->unk2FA = 0; From 711a7ba51961c834e7fa77e5a13d6e801c0cbadf Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 14:59:48 +0200 Subject: [PATCH 032/150] z_en_tp.c cleanup --- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) 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 85d9f54ed17..ff6e81341ca 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -145,7 +145,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { this->unk150 = 0; this->actor.colChkInfo.health = 1; var_s5 = this; - this->unk15E = 0xFF; + this->unk15E = 255; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params < 0) { @@ -175,8 +175,8 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { } temp_v0_2->unk15C = var_s1 * -5; temp_v0_2->unk15A = var_s1 * -5; - var_s5 = (EnTp*)temp_v0_2; - temp_v0_2->unk16C = (f32)(6.0f - ((f32)var_s1 * 0.75f)); + var_s5 = temp_v0_2; + temp_v0_2->unk16C = 6.0f - ((f32)var_s1 * 0.75f); } } } else if (this->actor.params == 0) { @@ -246,8 +246,8 @@ void func_80B212C0(EnTp* this, PlayState* play) { this->unk15A = 1; } } - if (this->unk160 < 0xFF) { - this->unk160 += 0xF; + if (this->unk160 < 255) { + this->unk160 += 15; } if (Math_CosF(this->unk168) == 0.0f) { this->unk170 = 2.0f * Rand_ZeroOne(); @@ -295,11 +295,11 @@ void func_80B214CC(EnTp* this, PlayState* play) { sp6C.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; sp6C.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; sp6C.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; - EffectSsDeadDb_Spawn(play, (Vec3f*)&sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); sp6C.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; sp6C.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; sp6C.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; - EffectSsDeadDb_Spawn(play, (Vec3f*)&sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); + EffectSsDeadDb_Spawn(play, &sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); } else { @@ -313,7 +313,7 @@ void func_80B214CC(EnTp* this, PlayState* play) { this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xA); if (temp_v0 != NULL) { Actor_SetScale(&temp_v0->actor, this->actor.scale.z * 0.5f); - temp_v0->unk160 = (s16)this->unk160; + temp_v0->unk160 = this->unk160; } } } @@ -341,8 +341,8 @@ void func_80B217FC(EnTp* this) { void func_80B21900(EnTp* this, PlayState* play) { Actor_UpdatePos(&this->actor); - this->unk15E -= 0x14; - if (this->unk15E < 0x14) { + this->unk15E -= 20; + if (this->unk15E < 20) { this->unk15E = 0; Actor_Kill(&this->actor); } @@ -370,7 +370,7 @@ void func_80B219A8(EnTp* this, PlayState* play) { } } if (this->unk160 != 0) { - this->unk160 -= 0xF; + this->unk160 -= 15; } if (Math_CosF(this->unk168) == 0.0f) { this->unk170 = Rand_ZeroOne() * 4.0f; @@ -453,8 +453,8 @@ void func_80B21EE8(EnTp* this) { void func_80B21F18(EnTp* this, PlayState* play) { static Vec3f D_80B22B00 = { 0.0f, -0.5f, 0.0f }; - static Color_RGBA8 D_80B22B0C = { 0xFF, 0xFF, 0xFF, 0xFF }; - static Color_RGBA8 D_80B22B10 = { 0x96, 0x96, 0x96, 0 }; + static Color_RGBA8 D_80B22B0C = { 255, 255, 255, 255 }; + static Color_RGBA8 D_80B22B10 = { 150, 150, 150, 0 }; Vec3f sp54; Vec3f sp48; s32 sp44; @@ -497,7 +497,7 @@ void func_80B21F18(EnTp* this, PlayState* play) { this->actor.shape.rot.x -= 0x400; } if (this->unk160 != 0) { - this->unk160 -= 0xF; + this->unk160 -= 15; } this->actor.speed = 2.0f * Math_CosS(this->actor.shape.rot.x); this->actor.velocity.y = Math_SinS(this->actor.shape.rot.x) * -2.0f; @@ -670,14 +670,14 @@ void EnTp_Draw(Actor* thisx, PlayState* play) { s16 temp_v0; EnTp* this = (EnTp*)thisx; - OPEN_DISPS(play->state.gfxCtx, "../z_en_tp.c", 0x5AB); + OPEN_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1451); if (this->unk150 != 2) { temp_v0 = this->actor.params; if ((temp_v0 < 0) || (temp_v0 == 0xC)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_tp.c", 1459); gSPDisplayList(POLY_OPA_DISP++, object_tp_0008D0_DL); - Matrix_Translate(0.0f, 0.0f, 8.0f, 1U); + Matrix_Translate(0.0f, 0.0f, 8.0f, MTXMODE_APPLY); } else { Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); @@ -693,7 +693,7 @@ void EnTp_Draw(Actor* thisx, PlayState* play) { gSPDisplayList(POLY_XLU_DISP++, object_tp_000000_DL); } } - CLOSE_DISPS(play->state.gfxCtx, "../z_en_tp.c", 0x5D7); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1495); if ((this->actor.params <= 0) || (this->actor.params == 0xB)) { Collider_UpdateSpheres(0, &this->collider); } From 30c307508aece3ca99c4af8d1d102c5d0f637877 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 15:01:39 +0200 Subject: [PATCH 033/150] EnTp: use unk_ and pad_ --- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 194 ++++++++++++------------ src/overlays/actors/ovl_En_Tp/z_en_tp.h | 32 ++-- 2 files changed, 113 insertions(+), 113 deletions(-) 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 ff6e81341ca..b78a5450bf1 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -127,7 +127,7 @@ static InitChainEntry sInitChain[] = { }; void func_80B20DE0(EnTp* this, void (*arg1)(EnTp*, PlayState*)) { - this->unk154 = arg1; + this->unk_154 = arg1; } void EnTp_Init(Actor* thisx, PlayState* play2) { @@ -142,15 +142,15 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { this->actor.attentionRangeType = ATTENTION_RANGE_3; this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.14f); - this->unk150 = 0; + this->unk_150 = 0; this->actor.colChkInfo.health = 1; var_s5 = this; - this->unk15E = 255; + this->unk_15E = 255; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params < 0) { this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; - this->unk15A = 0; + this->unk_15A = 0; this->collider.base.acFlags |= AC_HARD; this->collider.elements[0].dim.worldSphere.radius = 8; this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius; @@ -165,18 +165,18 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { if (temp_v0_2 != NULL) { var_s5->actor.child = &temp_v0_2->actor; temp_v0_2->actor.parent = &var_s5->actor; - temp_v0_2->unk162 = (s16)(var_s1 + 1); - temp_v0_2->unk1D4 = this; + temp_v0_2->unk_162 = (s16)(var_s1 + 1); + temp_v0_2->unk_1D4 = this; Actor_SetScale(&temp_v0_2->actor, 0.3f); if (var_s1 == 2) { temp_v0_2->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED; - temp_v0_2->unk150 = 1; + temp_v0_2->unk_150 = 1; } - temp_v0_2->unk15C = var_s1 * -5; - temp_v0_2->unk15A = var_s1 * -5; + temp_v0_2->unk_15C = var_s1 * -5; + temp_v0_2->unk_15A = var_s1 * -5; var_s5 = temp_v0_2; - temp_v0_2->unk16C = 6.0f - ((f32)var_s1 * 0.75f); + temp_v0_2->unk_16C = 6.0f - ((f32)var_s1 * 0.75f); } } } else if (this->actor.params == 0) { @@ -193,7 +193,7 @@ void EnTp_Destroy(Actor* thisx, PlayState* play) { } void func_80B21084(EnTp* this) { - this->unk14C = 2; + this->unk_14C = 2; func_80B20DE0(this, func_80B210B0); } @@ -202,35 +202,35 @@ void func_80B210B0(EnTp* this, PlayState* play) { s16 temp_a0_sp34; if (this->actor.params == 0xB) { - this->unk14C = 1; + this->unk_14C = 1; if (this->actor.parent == NULL) { func_80B21454(this); } } else { - if (this->unk150 != 0) { + if (this->unk_150 != 0) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } - if (this->unk1D4->unk150 != 0) { - this->actor.speed = this->unk160 = this->actor.velocity.y = this->unk168 = 0.0f; - if (this->actor.world.pos.y < this->unk1D4->actor.home.pos.y) { + if (this->unk_1D4->unk_150 != 0) { + this->actor.speed = this->unk_160 = this->actor.velocity.y = this->unk_168 = 0.0f; + if (this->actor.world.pos.y < this->unk_1D4->actor.home.pos.y) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } this->actor.world.pos = this->actor.parent->prevPos; } else { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.parent->world.pos.y - 4.0f, 1.0f, 1.0f, 0.0f); - sp36 = this->unk1D4->actor.shape.rot.y + 0x4000; - temp_a0_sp34 = (this->unk1D4->unk15C + this->unk15A) * 0x7D0; + sp36 = this->unk_1D4->actor.shape.rot.y + 0x4000; + temp_a0_sp34 = (this->unk_1D4->unk_15C + this->unk_15A) * 0x7D0; this->actor.world.pos.x = - (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->unk16C)) + this->actor.home.pos.x; + (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->unk_16C)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->unk16C)) + this->actor.home.pos.z; + (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->unk_16C)) + this->actor.home.pos.z; } } } void func_80B2128C(EnTp* this) { - this->unk14C = 7; - this->unk15A = 0xC8; + this->unk_14C = 7; + this->unk_15A = 0xC8; func_80B20DE0(this, func_80B212C0); } @@ -243,20 +243,20 @@ void func_80B212C0(EnTp* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - this->unk15A = 1; + this->unk_15A = 1; } } - if (this->unk160 < 255) { - this->unk160 += 15; + if (this->unk_160 < 255) { + this->unk_160 += 15; } - if (Math_CosF(this->unk168) == 0.0f) { - this->unk170 = 2.0f * Rand_ZeroOne(); + if (Math_CosF(this->unk_168) == 0.0f) { + this->unk_170 = 2.0f * Rand_ZeroOne(); } - this->actor.world.pos.y += Math_CosF(this->unk168) * (2.0f + this->unk170); - this->unk168 += 0.2f; + this->actor.world.pos.y += Math_CosF(this->unk_168) * (2.0f + this->unk_170); + this->unk_168 += 0.2f; Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); - this->unk15A -= 1; - if (this->unk15A != 0) { + this->unk_15A -= 1; + if (this->unk_15A != 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.shape.rot.y = this->actor.world.rot.y; } else { @@ -267,7 +267,7 @@ void func_80B212C0(EnTp* this, PlayState* play) { void func_80B21454(EnTp* this) { Actor* var_v0; - this->unk15A = 2; + this->unk_15A = 2; if (this->actor.params < 0) { var_v0 = this->actor.child; while (var_v0 != NULL) { @@ -275,10 +275,10 @@ void func_80B21454(EnTp* this) { var_v0->colChkInfo.health = 0; var_v0 = var_v0->child; } - this->unk15A = 0xD; + this->unk_15A = 0xD; Actor_PlaySfx(&this->actor, NA_SE_EN_TAIL_DEAD); } - this->unk14C = 1; + this->unk_14C = 1; func_80B20DE0(this, func_80B214CC); } @@ -289,8 +289,8 @@ void func_80B214CC(EnTp* this, PlayState* play) { Vec3f sp78 = { 0.0f, 0.5f, 0.0f }; Vec3f sp6C = { 0.0f, 0.0f, 0.0f }; - this->unk15A -= 1; - if (this->unk15A <= 0) { + this->unk_15A -= 1; + if (this->unk_15A <= 0) { if (this->actor.params == 0xC) { sp6C.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; sp6C.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; @@ -313,7 +313,7 @@ void func_80B214CC(EnTp* this, PlayState* play) { this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xA); if (temp_v0 != NULL) { Actor_SetScale(&temp_v0->actor, this->actor.scale.z * 0.5f); - temp_v0->unk160 = this->unk160; + temp_v0->unk_160 = this->unk_160; } } } @@ -322,13 +322,13 @@ void func_80B214CC(EnTp* this, PlayState* play) { this->actor.child->params = 0xB; this->actor.child->colChkInfo.health = 0; } - this->unk150 = 2; + this->unk_150 = 2; Actor_Kill(&this->actor); } } void func_80B217FC(EnTp* this) { - this->unk14C = 0; + this->unk_14C = 0; this->actor.world.pos.x += (Rand_ZeroOne() - 0.5f) * 5.0f; this->actor.world.pos.y += (Rand_ZeroOne() - 0.5f) * 5.0f; this->actor.world.pos.z += (Rand_ZeroOne() - 0.5f) * 5.0f; @@ -341,16 +341,16 @@ void func_80B217FC(EnTp* this) { void func_80B21900(EnTp* this, PlayState* play) { Actor_UpdatePos(&this->actor); - this->unk15E -= 20; - if (this->unk15E < 20) { - this->unk15E = 0; + this->unk_15E -= 20; + if (this->unk_15E < 20) { + this->unk_15E = 0; Actor_Kill(&this->actor); } } void func_80B2194C(EnTp* this) { - this->unk15A = (Rand_ZeroOne() * 15.0f) + 40.0f; - this->unk14C = 8; + this->unk_15A = (Rand_ZeroOne() * 15.0f) + 40.0f; + this->unk_14C = 8; func_80B20DE0(this, func_80B219A8); } @@ -360,41 +360,41 @@ void func_80B219A8(EnTp* this, PlayState* play) { player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); - Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->unk16C, 1.0f, + Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->unk_16C, 1.0f, this->actor.speed * 0.25f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - this->unk15C = 1; + this->unk_15C = 1; } } - if (this->unk160 != 0) { - this->unk160 -= 15; + if (this->unk_160 != 0) { + this->unk_160 -= 15; } - if (Math_CosF(this->unk168) == 0.0f) { - this->unk170 = Rand_ZeroOne() * 4.0f; + if (Math_CosF(this->unk_168) == 0.0f) { + this->unk_170 = Rand_ZeroOne() * 4.0f; } - this->actor.world.pos.y += Math_CosF(this->unk168) * ((this->actor.speed * 0.25f) + this->unk170); - this->actor.world.rot.y += this->unk164; - this->unk168 += 0.2f; - if (this->unk15A != 0) { - this->unk15A -= 1; + this->actor.world.pos.y += Math_CosF(this->unk_168) * ((this->actor.speed * 0.25f) + this->unk_170); + this->actor.world.rot.y += this->unk_164; + this->unk_168 += 0.2f; + if (this->unk_15A != 0) { + this->unk_15A -= 1; } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 1, 0x2EE, 0); - if (this->unk15A == 0) { + if (this->unk_15A == 0) { func_80B2128C(this); } this->actor.shape.rot.y = this->actor.world.rot.y; } void func_80B21B90(EnTp* this) { - this->unk14C = 4; - this->unk150 = 0; + this->unk_14C = 4; + this->unk_150 = 0; this->actor.shape.rot.x = -0x4000; - this->unk15A = 0x3C; - this->unk15C = 0; + this->unk_15A = 0x3C; + this->unk_15C = 0; this->actor.speed = 0.0f; func_80B20DE0(this, func_80B21BDC); } @@ -404,39 +404,39 @@ void func_80B21BDC(EnTp* this, PlayState* play) { s16 sp32; player = GET_PLAYER(play); - this->unk15C -= 1; + this->unk_15C -= 1; if (this->actor.xzDistToPlayer < 200.0f) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - this->unk15A = 0; + this->unk_15A = 0; } } - if (this->unk15A != 0) { - this->unk15A -= 1; + if (this->unk_15A != 0) { + this->unk_15A -= 1; Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x1F4, 0); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x5DC, 0); sp32 = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos) + 0x4000; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 30.0f, 0.3f, 1.0f, 0.3f); this->actor.world.pos.x = - (Math_SinS(this->unk15C * 0x7D0) * (Math_SinS(sp32) * this->unk16C)) + this->actor.home.pos.x; + (Math_SinS(this->unk_15C * 0x7D0) * (Math_SinS(sp32) * this->unk_16C)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(this->unk15C * 0x7D0) * (Math_CosS(sp32) * this->unk16C)) + this->actor.home.pos.z; + (Math_SinS(this->unk_15C * 0x7D0) * (Math_CosS(sp32) * this->unk_16C)) + this->actor.home.pos.z; } else { this->actor.shape.rot.x = 0; - this->unk150 = 1; + this->unk_150 = 1; func_80B2194C(this); } } else { Math_SmoothStepToS(&this->actor.shape.rot.x, -0x4000, 1, 0x1F4, 0); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.3f, 1.5f, 0.3f) == 0.0f) { - this->unk15A = 0x3C; + this->unk_15A = 0x3C; } else { sp32 = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); this->actor.world.pos.x = - (Math_SinS(this->unk15C * 0x7D0) * (Math_SinS(sp32) * 6.0f)) + this->actor.home.pos.x; + (Math_SinS(this->unk_15C * 0x7D0) * (Math_SinS(sp32) * 6.0f)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(this->unk15C * 0x7D0) * (Math_CosS(sp32) * 6.0f)) + this->actor.home.pos.z; + (Math_SinS(this->unk_15C * 0x7D0) * (Math_CosS(sp32) * 6.0f)) + this->actor.home.pos.z; } } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -446,8 +446,8 @@ void func_80B21BDC(EnTp* this, PlayState* play) { } void func_80B21EE8(EnTp* this) { - this->unk14C = 9; - this->unk15A = 0; + this->unk_14C = 9; + this->unk_15A = 0; func_80B20DE0(this, func_80B21F18); } @@ -462,21 +462,21 @@ void func_80B21F18(EnTp* this, PlayState* play) { s16 new_var; sp44 = 0; - this->unk15C -= 1; - if ((this->unk15A != 0) || ((this->actor.home.pos.y - this->actor.world.pos.y) > 60.0f)) { + this->unk_15C -= 1; + if ((this->unk_15A != 0) || ((this->actor.home.pos.y - this->actor.world.pos.y) > 60.0f)) { if (1) { - this->unk15A -= 1; + this->unk_15A -= 1; } - if ((new_var = this->unk15A) == 0) { + if ((new_var = this->unk_15A) == 0) { func_80B21B90(this); var_v0 = (EnTp*)this->actor.child; while (var_v0 != NULL) { - var_v0->unk15C = var_v0->unk15A; + var_v0->unk_15C = var_v0->unk_15A; var_v0 = (EnTp*)var_v0->actor.child; } } else { if (this->actor.shape.rot.x != -0x4000) { - this->unk15A = 0x50; + this->unk_15A = 0x50; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos = this->actor.home.pos; @@ -490,14 +490,14 @@ void func_80B21F18(EnTp* this, PlayState* play) { var_v0 = (EnTp*)var_v0->actor.child; } } - this->actor.world.pos.y = this->actor.home.pos.y - (f32)this->unk15A; + this->actor.world.pos.y = this->actor.home.pos.y - (f32)this->unk_15A; } } else { if (this->actor.shape.rot.x != 0x4000) { this->actor.shape.rot.x -= 0x400; } - if (this->unk160 != 0) { - this->unk160 -= 15; + if (this->unk_160 != 0) { + this->unk_160 -= 15; } this->actor.speed = 2.0f * Math_CosS(this->actor.shape.rot.x); this->actor.velocity.y = Math_SinS(this->actor.shape.rot.x) * -2.0f; @@ -526,7 +526,7 @@ void func_80B221E8(EnTp* this, PlayState* play) { s32 var_s4; EnTp* new_var; - if ((this->collider.base.acFlags & AC_HIT) && (this->unk14C >= 2)) { + if ((this->collider.base.acFlags & AC_HIT) && (this->unk_14C >= 2)) { var_s2 = 0; var_s4 = 0; if (this->actor.params < 0) { @@ -534,7 +534,7 @@ void func_80B221E8(EnTp* this, PlayState* play) { } this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); - this->unk158 = this->actor.colChkInfo.damageReaction; + this->unk_158 = this->actor.colChkInfo.damageReaction; if (this->actor.colChkInfo.damageReaction != 0) { if (this->actor.colChkInfo.damageReaction == 1) { var_s4 = 1; @@ -544,10 +544,10 @@ void func_80B221E8(EnTp* this, PlayState* play) { } if (this->actor.colChkInfo.health == 0) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - new_var = this->unk1D4; + new_var = this->unk_1D4; if (new_var->actor.params < 0) { func_80B21454(new_var); - new_var->unk158 = this->actor.colChkInfo.damageReaction; + new_var->unk_158 = this->actor.colChkInfo.damageReaction; new_var->actor.params = 0xC; } } else { @@ -612,15 +612,15 @@ void EnTp_Update(Actor* thisx, PlayState* play) { player = GET_PLAYER(play); if (player->stateFlags1 & PLAYER_STATE1_26) { - this->unk158 = 0; + this->unk_158 = 0; } if (this->actor.colChkInfo.health != 0) { func_80B221E8(this, play); } - this->unk154(this, play); + this->unk_154(this, play); if (this->actor.params < 0) { Actor_MoveXZGravity(&this->actor); - if (this->unk14C != 9) { + if (this->unk_14C != 9) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } @@ -639,20 +639,20 @@ void EnTp_Update(Actor* thisx, PlayState* play) { if (this->actor.shape.rot.z == 0) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_CRY); } - if (this->unk14C >= 2) { + if (this->unk_14C >= 2) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } if (this->actor.params != 0xB) { - this->unk162 -= 1; - this->unk162 &= 7; + this->unk_162 -= 1; + this->unk_162 &= 7; } this->actor.focus.pos = this->actor.world.pos; - if (this->unk158 == 0xE) { + if (this->unk_158 == 0xE) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if ((this->unk162 & 7) == 0) { - sp40.r = this->unk160; + if ((this->unk_162 & 7) == 0) { + sp40.r = this->unk_160; sp50.x = -this->actor.velocity.x * 0.25f; sp50.y = -this->actor.velocity.y * 0.25f; sp50.z = -this->actor.velocity.z * 0.25f; @@ -661,7 +661,7 @@ void EnTp_Update(Actor* thisx, PlayState* play) { sp44.z = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.z; EffectSsKiraKira_SpawnSmall(play, &sp44, &sp5C, &sp50, &sp40, &sp3C); } - if ((this->unk14C >= 2) && (this->actor.colChkInfo.health != 0)) { + if ((this->unk_14C >= 2) && (this->actor.colChkInfo.health != 0)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } @@ -671,7 +671,7 @@ void EnTp_Draw(Actor* thisx, PlayState* play) { EnTp* this = (EnTp*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1451); - if (this->unk150 != 2) { + if (this->unk_150 != 2) { temp_v0 = this->actor.params; if ((temp_v0 < 0) || (temp_v0 == 0xC)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); @@ -681,7 +681,7 @@ void EnTp_Draw(Actor* thisx, PlayState* play) { } else { Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->unk160, 0, 255, this->unk15E); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->unk_160, 0, 255, this->unk_15E); gDPPipeSync(POLY_XLU_DISP++); gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, 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 fdbe9d16695..0745f42d812 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -8,24 +8,24 @@ struct EnTp; typedef struct EnTp { /* 0x000 */ Actor actor; - /* 0x14C */ s32 unk14C; - /* 0x150 */ s32 unk150; - /* 0x154 */ void (*unk154)(struct EnTp*, struct PlayState*); - /* 0x158 */ u8 unk158; - /* 0x159 */ char pad159[1]; - /* 0x15A */ s16 unk15A; - /* 0x15C */ s16 unk15C; - /* 0x15E */ s16 unk15E; - /* 0x160 */ s16 unk160; - /* 0x162 */ s16 unk162; - /* 0x164 */ s16 unk164; - /* 0x166 */ char pad166[2]; - /* 0x168 */ f32 unk168; - /* 0x16C */ f32 unk16C; - /* 0x170 */ f32 unk170; + /* 0x14C */ s32 unk_14C; + /* 0x150 */ s32 unk_150; + /* 0x154 */ void (*unk_154)(struct EnTp*, struct PlayState*); + /* 0x158 */ u8 unk_158; + /* 0x159 */ char pad_159[1]; + /* 0x15A */ s16 unk_15A; + /* 0x15C */ s16 unk_15C; + /* 0x15E */ s16 unk_15E; + /* 0x160 */ s16 unk_160; + /* 0x162 */ s16 unk_162; + /* 0x164 */ s16 unk_164; + /* 0x166 */ char pad_166[2]; + /* 0x168 */ f32 unk_168; + /* 0x16C */ f32 unk_16C; + /* 0x170 */ f32 unk_170; /* 0x174 */ ColliderJntSph collider; /* 0x194 */ ColliderJntSphElement colliderElements[1]; - /* 0x1D4 */ struct EnTp* unk1D4; + /* 0x1D4 */ struct EnTp* unk_1D4; } EnTp; // size = 0x1D8 #endif From 82424f3d20a646228dc5546c90f86f54e11b9bbc Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 15:27:55 +0200 Subject: [PATCH 034/150] z_en_wf.c cleanup --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 80 ++++++++++++------------- 1 file changed, 38 insertions(+), 42 deletions(-) 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 74fcc595b1c..3ae19684052 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -5,6 +5,7 @@ */ #include "z_en_wf.h" +#include "src/overlays/actors/ovl_En_Encount1/z_en_encount1.h" #include "libc64/qrand.h" #include "array_count.h" @@ -17,6 +18,7 @@ #include "sequence.h" #include "sfx.h" #include "sys_matrix.h" +#include "terminal.h" #include "z_en_item00.h" #include "z_lib.h" #include "audio.h" @@ -215,7 +217,7 @@ static Vec3f D_80B37AD0 = { 0.0f, 0.5f, 0.0f }; static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; static Vec3f D_80B37AE8 = { 0.0f, 0.0f, 0.0f }; static s32 D_80B37AF4[4] = { 0x06007B68, 0x06008368, 0x06008568, 0x06008368 }; -static s32 D_80B37B04[7] = { 0x06000300, 0x060027D8, 0x060029D8, 0x060027D8, 0, 0, 0 }; +static s32 D_80B37B04[4] = { 0x06000300, 0x060027D8, 0x060029D8, 0x060027D8 }; void func_80B33CB0(EnWf* this, void (*arg1)(EnWf*, PlayState*)) { this->unk2DC = arg1; @@ -261,15 +263,9 @@ void EnWf_Init(Actor* thisx, PlayState* play) { } } -typedef struct UnkActor { - Actor actor; - char pad14C[0x152 - 0x14C]; - s16 unk152; -} UnkActor; - void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - UnkActor* temp_v1; + EnEncount1* temp_v1; Collider_DestroyJntSph(play, &this->unk304); Collider_DestroyCylinder(play, &this->unk424); @@ -278,14 +274,14 @@ void EnWf_Destroy(Actor* thisx, PlayState* play) { func_800F5B58(); } if ((this->actor.parent != NULL)) { - temp_v1 = (UnkActor*)this->actor.parent; + temp_v1 = (EnEncount1*)this->actor.parent; if ((temp_v1->actor.update != NULL)) { - if (temp_v1->unk152 > 0) { - temp_v1->unk152 -= 1; + if (temp_v1->curNumSpawn > 0) { + temp_v1->curNumSpawn--; } PRINTF("\n\n"); - PRINTF("\x1b[32m☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n\x1b[m", temp_v1->unk152); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, temp_v1->unk152); PRINTF("\n\n"); } } @@ -311,11 +307,11 @@ s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y) != 0) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { func_80B36288(this); - return 1; + return true; } if (play->gameplayFrames & 1) { func_80B36288(this); - return 1; + return true; } } @@ -324,19 +320,19 @@ s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if ((ABS(var_t0) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { func_80B360E8(this); - return 1; + return true; } } if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { func_80B36288(this); - return 1; + return true; } if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames & 1)) { func_80B36288(this); - return 1; + return true; } func_80B35B94(this); - return 1; + return true; } else { Actor* temp_v0_2; @@ -349,39 +345,39 @@ s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { if ((Actor_WorldDistXYZToActor(&this->actor, temp_v0_2) < 80.0f) && ((s16)(this->actor.shape.rot.y - temp_v0_2->world.rot.y + 0x8000) < 0x3E80)) { func_80B360E8(this); - return 1; + return true; } } func_80B365A8(this, play); - return 1; + return true; } func_80B35B94(this); - return 1; + return true; } } - if (arg2 != 0) { + if (arg2) { s16 temp_v1_3; if (var_v1 >= 0x1B58) { func_80B365A8(this, play); - return 1; + return true; } temp_v1_3 = player->actor.shape.rot.y - this->actor.shape.rot.y; if (this->actor.xzDistToPlayer <= 80.0f) { - if (Actor_OtherIsLockedOn(play, &this->actor) == 0) { + if (!Actor_OtherIsLockedOn(play, &this->actor)) { if ((play->gameplayFrames & 7) || (ABS(temp_v1_3) < 0x38E0)) { func_80B35540(this); - return 1; + return true; } } } func_80B34F28(this); - return 1; + return true; } - return 0; + return false; } void func_80B34380(EnWf* this) { @@ -450,7 +446,7 @@ void func_80B345E4(EnWf* this, PlayState* play) { if (var_v1_sp26 < 0) { var_v1_sp26 *= -1; } - if (func_80B37830(play, this) == 0) { + if (!func_80B37830(play, this)) { if (this->unk2E0 != 0) { this->unk2E0 -= 1; if (var_v1_sp26 < 0x1FFE) { @@ -458,7 +454,7 @@ void func_80B345E4(EnWf* this, PlayState* play) { } else { return; } - } else if (func_80B33FB0(play, this, 0) != 0) { + } else if (func_80B33FB0(play, this, false)) { return; } var_v1_sp26 = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -510,7 +506,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { sp50_real = 0.0f; sp48_real = GET_PLAYER(play); - if (func_80B37830(play, this) == 0) { + if (!func_80B37830(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if (Actor_OtherIsLockedOn(play, &this->actor)) { @@ -560,7 +556,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { } } } - if (func_80B33FB0(play, this, 0) == 0) { + if (!func_80B33FB0(play, this, false)) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } @@ -584,7 +580,7 @@ void func_80B34D48(EnWf* this, PlayState* play) { s16 temp_v0; s16 temp_v1; - if ((func_80B37830(play, this) == 0) && (func_80B33FB0(play, this, 0) == 0)) { + if (!func_80B37830(play, this) && !func_80B33FB0(play, this, false)) { temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp_v0 > 0) { temp_v1 = (temp_v0 * 0.25f) + 2000.0f; @@ -649,7 +645,7 @@ void func_80B35024(EnWf* this, PlayState* play) { sp4C_real = 0.0f; player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->unk2FE), 1, 0xFA0, 1); - if ((func_80B37830(play, this) == 0) && (func_80B33FB0(play, this, 0) == 0)) { + if (!func_80B37830(play, this) && !func_80B33FB0(play, this, false)) { this->actor.world.rot.y = this->actor.shape.rot.y; sp56_real = player->actor.shape.rot.y + this->unk2FE + 0x8000; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || @@ -750,7 +746,7 @@ void func_80B355BC(EnWf* this, PlayState* play) { this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->unk2E8 - 4) * 0.4f))); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); this->unk2E8 -= 1; - } else if ((Actor_IsFacingPlayer(&this->actor, 0x1554) == 0) && (var_a2_sp3C != 0xF)) { + } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (var_a2_sp3C != 0xF)) { func_80B3455C(this); this->unk2E8 = (s32)((Rand_ZeroOne() * 5.0f) + 5.0f); if (sp40 > 0x32C8) { @@ -770,7 +766,7 @@ void func_80B355BC(EnWf* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B34F28(this); } else { - func_80B33FB0(play, this, 1); + func_80B33FB0(play, this, true); } } else { func_80B34F28(this); @@ -827,7 +823,7 @@ void func_80B359A8(EnWf* this, PlayState* play) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B34F28(this); } else { - func_80B33FB0(play, this, 1); + func_80B33FB0(play, this, true); } } else { func_80B34F28(this); @@ -887,7 +883,7 @@ void func_80B35D90(EnWf* this, PlayState* play) { if (this->actor.colChkInfo.health == 0) { func_80B36C8C(this); } else { - func_80B33FB0(play, this, 1); + func_80B33FB0(play, this, true); } } } @@ -920,7 +916,7 @@ void func_80B35EE4(EnWf* this, PlayState* play) { this->unk300 = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if ((func_80B33FB0(play, this, 0) == 0) && SkelAnime_Update(&this->skelAnime) && + if (!func_80B33FB0(play, this, false) && SkelAnime_Update(&this->skelAnime) && (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) != 0))) { var_v1 = this->actor.wallYaw - this->actor.shape.rot.y; if (var_v1 < 0) { @@ -929,7 +925,7 @@ void func_80B35EE4(EnWf* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_v1) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { func_80B360E8(this); - } else if (func_80B37830(play, this) == 0) { + } else if (!func_80B37830(play, this)) { if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && ((play->gameplayFrames & 7) != 0)) { func_80B35540(this); @@ -1118,7 +1114,7 @@ void func_80B36740(EnWf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = new_var = ABS(this->skelAnime.playSpeed); - if (func_80B33FB0(play, this, 0) == 0) { + if (!func_80B33FB0(play, this, false)) { this->unk2E8 -= 1; if (this->unk2E8 == 0) { var_v0_2_probreal = player->actor.shape.rot.y - this->actor.yawTowardsPlayer; @@ -1415,7 +1411,7 @@ s32 func_80B37830(PlayState* play, EnWf* this) { func_80B35B94(this); } } - return 1; + return true; } - return 0; + return false; } From e8a1e510efc84db6447edcb030ee75cf9ec7a206 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 15:34:43 +0200 Subject: [PATCH 035/150] EnWf eye textures --- assets/xml/objects/object_wf.xml | 10 ++++++---- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index f9492168de7..3817f8a541f 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -5,7 +5,7 @@ - + @@ -62,7 +62,8 @@ - + + @@ -170,13 +171,14 @@ - + - + + 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 3ae19684052..968c80f7fd9 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -216,8 +216,8 @@ static InitChainEntry sInitChain[2] = { static Vec3f D_80B37AD0 = { 0.0f, 0.5f, 0.0f }; static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; static Vec3f D_80B37AE8 = { 0.0f, 0.0f, 0.0f }; -static s32 D_80B37AF4[4] = { 0x06007B68, 0x06008368, 0x06008568, 0x06008368 }; -static s32 D_80B37B04[4] = { 0x06000300, 0x060027D8, 0x060029D8, 0x060027D8 }; +static void* D_80B37AF4[4] = { object_wf_Tex_007B68, object_wf_Tex_008368, object_wf_Tex_008568, object_wf_Tex_008368 }; +static void* D_80B37B04[4] = { object_wf_Tex_000300, object_wf_Tex_0027D8, object_wf_Tex_0029D8, object_wf_Tex_0027D8 }; void func_80B33CB0(EnWf* this, void (*arg1)(EnWf*, PlayState*)) { this->unk2DC = arg1; From d2c58da64e56322746f2f64dffce8b788bb7d4b1 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 15:36:44 +0200 Subject: [PATCH 036/150] enwf {joint,morph}Table --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 8 ++++---- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) 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 968c80f7fd9..f2db984e30c 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -246,13 +246,13 @@ void EnWf_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->unk470); Collider_SetCylinder(play, &this->unk470, &this->actor, &D_80B37A5C); if (this->actor.params == 0) { - SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->unk1CC, - this->unk250, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->jointTable, + this->morphTable, 22); Actor_SetScale(&this->actor, 0.0075f); this->actor.naviEnemyId = NAVI_ENEMY_WOLFOS; } else { - SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->unk1CC, - this->unk250, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->jointTable, + this->morphTable, 22); Actor_SetScale(&this->actor, 0.01f); this->unk304.elements[0].base.atDmgInfo.damage = this->unk304.elements[1].base.atDmgInfo.damage = 8; this->actor.naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; 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 faf02e1b618..6fecc9f267b 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -10,8 +10,8 @@ typedef struct EnWf { /* 0x000 */ Actor actor; /* 0x14C */ Vec3s unk14C[10]; /* 0x188 */ SkelAnime skelAnime; - /* 0x1CC */ Vec3s unk1CC[22]; - /* 0x250 */ Vec3s unk250[22]; + /* 0x1CC */ Vec3s jointTable[22]; + /* 0x250 */ Vec3s morphTable[22]; /* 0x2D4 */ s32 unk2D4; /* 0x2D8 */ char pad2D8[4]; /* 0x2DC */ void (*unk2DC)(struct EnWf*, struct PlayState*); From 64bbdea0f73c592df27a1849f976513692c3dd18 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 15:39:06 +0200 Subject: [PATCH 037/150] EnWf: use unk_ and pad_ --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 367 ++++++++++++------------ src/overlays/actors/ovl_En_Wf/z_en_wf.h | 58 ++-- 2 files changed, 213 insertions(+), 212 deletions(-) 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 f2db984e30c..63b9398a25c 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 @@ static void* D_80B37AF4[4] = { object_wf_Tex_007B68, object_wf_Tex_008368, objec static void* D_80B37B04[4] = { object_wf_Tex_000300, object_wf_Tex_0027D8, object_wf_Tex_0029D8, object_wf_Tex_0027D8 }; void func_80B33CB0(EnWf* this, void (*arg1)(EnWf*, PlayState*)) { - this->unk2DC = arg1; + this->unk_2DC = arg1; } void EnWf_Init(Actor* thisx, PlayState* play) { @@ -235,16 +235,16 @@ void EnWf_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 8; this->actor.colChkInfo.cylRadius = 50; this->actor.colChkInfo.cylHeight = 100; - this->unk2FC = PARAMS_GET_U(thisx->params, 8, 8); + this->unk_2FC = PARAMS_GET_U(thisx->params, 8, 8); this->actor.params &= 0xFF; - this->unk302 = 0; - this->unk2F4 = 10.0f; - Collider_InitJntSph(play, &this->unk304); - Collider_SetJntSph(play, &this->unk304, &this->actor, &sJntSphInit, this->unk324); - Collider_InitCylinder(play, &this->unk424); - Collider_SetCylinder(play, &this->unk424, &this->actor, &D_80B37A30); - Collider_InitCylinder(play, &this->unk470); - Collider_SetCylinder(play, &this->unk470, &this->actor, &D_80B37A5C); + this->unk_302 = 0; + this->unk_2F4 = 10.0f; + Collider_InitJntSph(play, &this->unk_304); + Collider_SetJntSph(play, &this->unk_304, &this->actor, &sJntSphInit, this->unk_324); + Collider_InitCylinder(play, &this->unk_424); + Collider_SetCylinder(play, &this->unk_424, &this->actor, &D_80B37A30); + Collider_InitCylinder(play, &this->unk_470); + Collider_SetCylinder(play, &this->unk_470, &this->actor, &D_80B37A5C); if (this->actor.params == 0) { SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->jointTable, this->morphTable, 22); @@ -254,11 +254,11 @@ void EnWf_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->jointTable, this->morphTable, 22); Actor_SetScale(&this->actor, 0.01f); - this->unk304.elements[0].base.atDmgInfo.damage = this->unk304.elements[1].base.atDmgInfo.damage = 8; + this->unk_304.elements[0].base.atDmgInfo.damage = this->unk_304.elements[1].base.atDmgInfo.damage = 8; this->actor.naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; } func_80B34380(this); - if ((this->unk2FC != 0xFF) && Flags_GetSwitch(play, this->unk2FC)) { + if ((this->unk_2FC != 0xFF) && Flags_GetSwitch(play, this->unk_2FC)) { Actor_Kill(&this->actor); } } @@ -267,10 +267,10 @@ void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; EnEncount1* temp_v1; - Collider_DestroyJntSph(play, &this->unk304); - Collider_DestroyCylinder(play, &this->unk424); - Collider_DestroyCylinder(play, &this->unk470); - if ((this->actor.params != 0) && (this->unk2FC != 0xFF)) { + Collider_DestroyJntSph(play, &this->unk_304); + Collider_DestroyCylinder(play, &this->unk_424); + Collider_DestroyCylinder(play, &this->unk_470); + if ((this->actor.params != 0) && (this->unk_2FC != 0xFF)) { func_800F5B58(); } if ((this->actor.parent != NULL)) { @@ -383,9 +383,9 @@ s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { void func_80B34380(EnWf* this) { Animation_Change(&this->skelAnime, &object_wf_Anim_005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; - this->unk2E8 = 0x14; - this->unk300 = 0; - this->unk2D4 = 0; + this->unk_2E8 = 0x14; + this->unk_300 = 0; + this->unk_2D4 = 0; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.scale.y = 0.0f; this->actor.gravity = 0.0f; @@ -394,21 +394,21 @@ void func_80B34380(EnWf* this) { void func_80B34428(EnWf* this, PlayState* play) { - if (this->unk2E8 >= 6) { + if (this->unk_2E8 >= 6) { this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; if (this->actor.xzDistToPlayer < 240.0f) { - this->unk2E8 = 5; + this->unk_2E8 = 5; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - if ((this->actor.params != 0) && (this->unk2FC != 0xFF)) { + if ((this->actor.params != 0) && (this->unk_2FC != 0xFF)) { func_800F5ACC(NA_BGM_MINI_BOSS); } } - } else if (this->unk2E8 != 0) { + } else if (this->unk_2E8 != 0) { this->actor.scale.y += this->actor.scale.x * 0.2f; this->actor.world.pos.y += 0.5f; Math_SmoothStepToF(&this->actor.shape.shadowScale, 70.0f, 1.0f, 14.0f, 0.0f); - this->unk2E8 -= 1; - if (this->unk2E8 == 0) { + this->unk_2E8 -= 1; + if (this->unk_2E8 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); } } else if (SkelAnime_Update(&this->skelAnime)) { @@ -420,8 +420,8 @@ void func_80B34428(EnWf* this, PlayState* play) { void func_80B3455C(EnWf* this) { Animation_MorphToLoop(&this->skelAnime, &object_wf_Anim_00A4AC, -4.0f); - this->unk2D4 = 6; - this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 2.0f; + this->unk_2D4 = 6; + this->unk_2E8 = (Rand_ZeroOne() * 10.0f) + 2.0f; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; func_80B33CB0(this, func_80B345E4); @@ -434,23 +434,23 @@ void func_80B345E4(EnWf* this, PlayState* play) { player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (this->unk2E2 != 0) { - var_v1_sp26 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk4D6; + if (this->unk_2E2 != 0) { + var_v1_sp26 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_4D6; if (ABS(var_v1_sp26) >= 0x2001) { - this->unk2E2 -= 1; + this->unk_2E2 -= 1; return; } - this->unk2E2 = 0; + this->unk_2E2 = 0; } var_v1_sp26 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (var_v1_sp26 < 0) { var_v1_sp26 *= -1; } if (!func_80B37830(play, this)) { - if (this->unk2E0 != 0) { - this->unk2E0 -= 1; + if (this->unk_2E0 != 0) { + this->unk_2E0 -= 1; if (var_v1_sp26 < 0x1FFE) { - this->unk2E0 = 0; + this->unk_2E0 = 0; } else { return; } @@ -465,8 +465,8 @@ void func_80B345E4(EnWf* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B34F28(this); } else { - this->unk2E8 -= 1; - if (this->unk2E8 == 0) { + this->unk_2E8 -= 1; + if (this->unk_2E8 == 0) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.3f) { func_80B347FC(this, play); @@ -487,7 +487,7 @@ void func_80B345E4(EnWf* this, PlayState* play) { void func_80B347FC(EnWf* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); - this->unk2D4 = 9; + this->unk_2D4 = 9; func_80B33CB0(this, func_80B3487C); } @@ -571,7 +571,7 @@ void func_80B3487C(EnWf* this, PlayState* play) { void func_80B34CFC(EnWf* this) { Animation_MorphToLoop(&this->skelAnime, &object_wf_Anim_0098C8, -4.0f); - this->unk2D4 = 0xA; + this->unk_2D4 = 0xA; func_80B33CB0(this, func_80B34D48); } @@ -619,16 +619,16 @@ void func_80B34F28(EnWf* this) { Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); if (Rand_ZeroOne() > 0.5f) { - this->unk2FE = 0x3E80; + this->unk_2FE = 0x3E80; } else { - this->unk2FE = -0x3E80; + this->unk_2FE = -0x3E80; } this->actor.speed = 6.0f; this->skelAnime.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk2E8 = (Rand_ZeroOne() * 30.0f) + 30.0f; - this->unk2D4 = 0xB; - this->unk2EC = 0.0f; + this->unk_2E8 = (Rand_ZeroOne() * 30.0f) + 30.0f; + this->unk_2D4 = 0xB; + this->unk_2EC = 0.0f; func_80B33CB0(this, func_80B35024); } @@ -644,39 +644,39 @@ void func_80B35024(EnWf* this, PlayState* play) { sp4C_real = 0.0f; player = GET_PLAYER(play); - Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->unk2FE), 1, 0xFA0, 1); + Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->unk_2FE), 1, 0xFA0, 1); if (!func_80B37830(play, this) && !func_80B33FB0(play, this, false)) { this->actor.world.rot.y = this->actor.shape.rot.y; - sp56_real = player->actor.shape.rot.y + this->unk2FE + 0x8000; + sp56_real = player->actor.shape.rot.y + this->unk_2FE + 0x8000; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - var_v0_2_real = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk2FE; + var_v0_2_real = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk_2FE; } else { var_v0_2_real = 0; } if (ABS(var_v0_2_real) > 0x2EE0) { - this->unk2FE = -this->unk2FE; + this->unk_2FE = -this->unk_2FE; } } if (Actor_OtherIsLockedOn(play, &this->actor)) { sp4C_real = 150.0f; } if (this->actor.xzDistToPlayer <= (60.0f + sp4C_real)) { - Math_SmoothStepToF(&this->unk2EC, -4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->unk_2EC, -4.0f, 1.0f, 1.5f, 0.0f); } else if (this->actor.xzDistToPlayer > (80.0f + sp4C_real)) { - Math_SmoothStepToF(&this->unk2EC, 4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->unk_2EC, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk2EC, 0.0f, 1.0f, 6.65f, 0.0f); + Math_SmoothStepToF(&this->unk_2EC, 0.0f, 1.0f, 6.65f, 0.0f); } - if (this->unk2EC != 0.0f) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk2EC; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk2EC; + if (this->unk_2EC != 0.0f) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2EC; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2EC; } - if (ABS(this->unk2EC) < ABS(this->actor.speed)) { + if (ABS(this->unk_2EC) < ABS(this->actor.speed)) { this->skelAnime.playSpeed = this->actor.speed * 0.175f; } else { - this->skelAnime.playSpeed = this->unk2EC * 0.175f; + this->skelAnime.playSpeed = this->unk_2EC * 0.175f; } this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); prevFrame = (s32)this->skelAnime.curFrame; @@ -694,13 +694,13 @@ void func_80B35024(EnWf* this, PlayState* play) { (this->actor.xzDistToPlayer <= 80.0f)) { func_80B35540(this); } else { - this->unk2E8 -= 1; - if (this->unk2E8 == 0) { + this->unk_2E8 -= 1; + if (this->unk_2E8 == 0) { if (Actor_OtherIsLockedOn(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { func_80B35B94(this); } else { func_80B3455C(this); - this->unk2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; + this->unk_2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; } } } @@ -709,11 +709,11 @@ void func_80B35024(EnWf* this, PlayState* play) { void func_80B35540(EnWf* this) { Animation_PlayOnce(&this->skelAnime, &object_wf_Anim_004638); - this->unk304.base.atFlags &= ~AT_BOUNCED; + this->unk_304.base.atFlags &= ~AT_BOUNCED; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->unk2D4 = 8; - this->unk2FA = 0; - this->unk2E8 = 7; + this->unk_2D4 = 8; + this->unk_2FA = 0; + this->unk_2E8 = 7; this->skelAnime.endFrame = 20.0f; this->actor.speed = 0.0f; func_80B33CB0(this, func_80B355BC); @@ -732,30 +732,30 @@ void func_80B355BC(EnWf* this, PlayState* play) { sp40 = ABS(sp40); this->actor.speed = 0.0f; if (((var_a2_sp3C >= 9) && (var_a2_sp3C <= 12)) || ((var_a2_sp3C >= 17) && (var_a2_sp3C <= 19))) { - if (this->unk2F8 == 0) { + if (this->unk_2F8 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_ATTACK); } - this->unk2F8 = 1; + this->unk_2F8 = 1; } else { - this->unk2F8 = 0; + this->unk_2F8 = 0; } if (((var_a2_sp3C == 0xF) && !Actor_IsLockedOn(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || SkelAnime_Update(&this->skelAnime)) { - if ((var_a2_sp3C != 0xF) && (this->unk2E8 != 0)) { - this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->unk2E8 - 4) * 0.4f))); + if ((var_a2_sp3C != 0xF) && (this->unk_2E8 != 0)) { + this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->unk_2E8 - 4) * 0.4f))); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); - this->unk2E8 -= 1; + this->unk_2E8 -= 1; } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (var_a2_sp3C != 0xF)) { func_80B3455C(this); - this->unk2E8 = (s32)((Rand_ZeroOne() * 5.0f) + 5.0f); + this->unk_2E8 = (s32)((Rand_ZeroOne() * 5.0f) + 5.0f); if (sp40 > 0x32C8) { - this->unk2E2 = 7; + this->unk_2E2 = 7; } } else { if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { func_80B3455C(this); - this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { @@ -786,8 +786,8 @@ void func_80B3590C(EnWf* this) { } Animation_Change(&this->skelAnime, &object_wf_Anim_004638, -0.5f, this->skelAnime.curFrame - 1.0f, var_fv0, ANIMMODE_ONCE_INTERP, 0.0f); - this->unk2D4 = 0xC; - this->unk2F8 = 0; + this->unk_2D4 = 0xC; + this->unk_2F8 = 0; func_80B33CB0(this, func_80B359A8); } @@ -807,13 +807,13 @@ void func_80B359A8(EnWf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (!Actor_IsFacingPlayer(&this->actor, 0x1554)) { func_80B3455C(this); - this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; if (var_a3 > 0x32C8) { - this->unk2E2 = 0x1E; + this->unk_2E2 = 0x1E; } } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { func_80B3455C(this); - this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { @@ -834,9 +834,9 @@ void func_80B359A8(EnWf* this, PlayState* play) { void func_80B35B94(EnWf* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_004AD0, -3.0f); - this->unk2E8 = 0; - this->unk300 = 1; - this->unk2D4 = 5; + this->unk_2E8 = 0; + this->unk_300 = 1; + this->unk_2D4 = 5; this->actor.speed = -6.0f; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); @@ -865,7 +865,7 @@ void func_80B35D18(EnWf* this) { } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); Animation_PlayOnceSetSpeed(&this->skelAnime, &object_wf_Anim_009B20, 0.0f); - this->unk2D4 = 0xF; + this->unk_2D4 = 0xF; func_80B33CB0(this, func_80B35D90); } @@ -877,7 +877,7 @@ void func_80B35D90(EnWf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->unk300 = 0; + this->unk_300 = 0; } if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { @@ -891,15 +891,15 @@ void func_80B35D90(EnWf* this, PlayState* play) { void func_80B35E4C(EnWf* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_009B20, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk300 = 0; + this->unk_300 = 0; this->actor.speed = -4.0f; } else { - this->unk300 = 1; + this->unk_300 = 1; } - this->unk2E2 = 0; + this->unk_2E2 = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DAMAGE); - this->unk2D4 = 3; + this->unk_2D4 = 3; func_80B33CB0(this, func_80B35EE4); } @@ -913,7 +913,7 @@ void func_80B35EE4(EnWf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->unk300 = 0; + this->unk_300 = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); if (!func_80B33FB0(play, this, false) && SkelAnime_Update(&this->skelAnime) && @@ -931,8 +931,8 @@ void func_80B35EE4(EnWf* this, PlayState* play) { func_80B35540(this); } else if (Rand_ZeroOne() > 0.5f) { func_80B3455C(this); - this->unk2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; - this->unk2E2 = 0x1E; + this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->unk_2E2 = 0x1E; } else { func_80B35B94(this); } @@ -943,9 +943,9 @@ void func_80B35EE4(EnWf* this, PlayState* play) { void func_80B360E8(EnWf* this) { Animation_Change(&this->skelAnime, &object_wf_Anim_004AD0, -1.0f, Animation_GetLastFrame(&object_wf_Anim_004AD0), 0.0f, ANIMMODE_ONCE, -3.0f); - this->unk2E8 = 0; - this->unk300 = 0; - this->unk2D4 = 4; + this->unk_2E8 = 0; + this->unk_300 = 0; + this->unk_2D4 = 4; this->actor.speed = 6.5f; this->actor.velocity.y = 15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); @@ -956,8 +956,8 @@ void func_80B360E8(EnWf* this) { void func_80B361A0(EnWf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(play, &this->unk4C8); - func_800355B8(play, &this->unk4BC); + func_800355B8(play, &this->unk_4C8); + func_800355B8(play, &this->unk_4BC); } if (SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { @@ -978,12 +978,12 @@ void func_80B36288(EnWf* this) { f32 temp_fv1; temp_fv1 = (f32)Animation_GetLastFrame(&object_wf_Anim_004CA4); - if (this->unk2F8 != 0) { - this->unk2F8 = -1; + if (this->unk_2F8 != 0) { + this->unk_2F8 = -1; } this->actor.speed = 0.0f; - this->unk2D4 = 7; - this->unk2E8 = 0xA; + this->unk_2D4 = 7; + this->unk_2E8 = 0xA; Animation_Change(&this->skelAnime, &object_wf_Anim_004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); func_80B33CB0(this, func_80B36328); } @@ -996,8 +996,8 @@ void func_80B36328(EnWf* this, PlayState* play) { s16 temp_v0_2; player = GET_PLAYER(play); - if (this->unk2E8 != 0) { - this->unk2E8 -= 1; + if (this->unk_2E8 != 0) { + this->unk_2E8 -= 1; } else { this->skelAnime.playSpeed = 1.0f; } @@ -1025,7 +1025,7 @@ void func_80B36328(EnWf* this, PlayState* play) { } else { func_80B34F28(this); } - } else if ((this->unk2E8 == 0) && + } else if ((this->unk_2E8 == 0) && ((func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0))) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { func_80B36288(this); @@ -1044,22 +1044,22 @@ void func_80B365A8(EnWf* this, PlayState* play) { Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); player = GET_PLAYER(play); - temp_v1_sp36 = player->actor.shape.rot.y + this->unk2FE; + temp_v1_sp36 = player->actor.shape.rot.y + this->unk_2FE; if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) > 0.0f) { - this->unk2FE = 0x3E80; + this->unk_2FE = 0x3E80; } else if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) < 0.0f) { - this->unk2FE = -0x3E80; + this->unk_2FE = -0x3E80; } else if (Rand_ZeroOne() > 0.5f) { - this->unk2FE = 0x3E80; + this->unk_2FE = 0x3E80; } else { - this->unk2FE = -0x3E80; + this->unk_2FE = -0x3E80; } this->actor.speed = 6.0f; this->skelAnime.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk2EC = 0.0f; - this->unk2E8 = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->unk2D4 = 0xE; + this->unk_2EC = 0.0f; + this->unk_2E8 = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->unk_2D4 = 0xE; func_80B33CB0(this, func_80B36740); } @@ -1077,16 +1077,16 @@ void func_80B36740(EnWf* this, PlayState* play) { player = GET_PLAYER(play); sp58_real = 0.0f; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk2FE, 1, 0xBB8, 1); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_2FE, 1, 0xBB8, 1); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - var_v0_probreal = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk2FE; + var_v0_probreal = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk_2FE; } else { var_v0_probreal = 0; } if (ABS(var_v0_probreal) > 0x2EE0) { - this->unk2FE = -this->unk2FE; + this->unk_2FE = -this->unk_2FE; } } this->actor.world.rot.y = this->actor.shape.rot.y; @@ -1094,20 +1094,20 @@ void func_80B36740(EnWf* this, PlayState* play) { sp58_real = 150.0f; } if (this->actor.xzDistToPlayer <= (60.0f + sp58_real)) { - Math_SmoothStepToF(&this->unk2EC, -4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->unk_2EC, -4.0f, 1.0f, 1.5f, 0.0f); } else if (this->actor.xzDistToPlayer > (80.0f + sp58_real)) { - Math_SmoothStepToF(&this->unk2EC, 4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->unk_2EC, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk2EC, 0.0f, 1.0f, 6.65f, 0.0f); + Math_SmoothStepToF(&this->unk_2EC, 0.0f, 1.0f, 6.65f, 0.0f); } - if (this->unk2EC != 0.0f) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk2EC; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk2EC; + if (this->unk_2EC != 0.0f) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2EC; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2EC; } - if (ABS(this->unk2EC) < ABS(this->actor.speed)) { + if (ABS(this->unk_2EC) < ABS(this->actor.speed)) { this->skelAnime.playSpeed = this->actor.speed * 0.175f; } else { - this->skelAnime.playSpeed = this->unk2EC * 0.175f; + this->skelAnime.playSpeed = this->unk_2EC * 0.175f; } this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); prevFrame = (s32)this->skelAnime.curFrame; @@ -1115,15 +1115,15 @@ void func_80B36740(EnWf* this, PlayState* play) { beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = new_var = ABS(this->skelAnime.playSpeed); if (!func_80B33FB0(play, this, false)) { - this->unk2E8 -= 1; - if (this->unk2E8 == 0) { + this->unk_2E8 -= 1; + if (this->unk_2E8 == 0) { var_v0_2_probreal = player->actor.shape.rot.y - this->actor.yawTowardsPlayer; if (var_v0_2_probreal < 0) { var_v0_2_probreal *= -1; } if (var_v0_2_probreal >= 0x3A98) { func_80B3455C(this); - this->unk2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; + this->unk_2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { player2 = GET_PLAYER(play); temp_a2_sp4E = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; @@ -1151,14 +1151,14 @@ void func_80B36C8C(EnWf* this) { Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_005430, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk300 = 0; + this->unk_300 = 0; this->actor.speed = -6.0f; } else { - this->unk300 = 1; + this->unk_300 = 1; } - this->unk2D4 = 2; + this->unk_2D4 = 2; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk2E8 = this->skelAnime.animLength; + this->unk_2E8 = this->skelAnime.animLength; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); func_80B33CB0(this, func_80B36D3C); } @@ -1170,13 +1170,13 @@ void func_80B36D3C(EnWf* this, PlayState* play) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); - this->unk300 = 0; + this->unk_300 = 0; } if (SkelAnime_Update(&this->skelAnime)) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_13, false)); - if (this->unk2FC != 0xFF) { - Flags_SetSwitch(play, (s32)this->unk2FC); + if (this->unk_2FC != 0xFF) { + Flags_SetSwitch(play, (s32)this->unk_2FC); } Actor_Kill(&this->actor); } else { @@ -1185,8 +1185,8 @@ void func_80B36D3C(EnWf* this, PlayState* play) { Vec3f sp7C; sp7C = D_80B37AD0; - this->unk2E8 -= 1; - for (var_s0 = ((s32)this->skelAnime.animLength - this->unk2E8) >> 1; var_s0 >= 0; var_s0--) { + this->unk_2E8 -= 1; + for (var_s0 = ((s32)this->skelAnime.animLength - this->unk_2E8) >> 1; var_s0 >= 0; var_s0--) { sp88.x = this->actor.world.pos.x + Rand_CenteredFloat(60.0f); sp88.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); sp88.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); @@ -1196,14 +1196,14 @@ void func_80B36D3C(EnWf* this, PlayState* play) { } void func_80B36F40(EnWf* this, PlayState* play) { - if ((this->unk2D4 == 6) && (this->unk2E2 != 0)) { - this->unk4D6 = Math_SinS(this->unk2E2 * 0x1068) * 8920.0f; - } else if (this->unk2D4 != 0xF) { - if (this->unk2D4 != 8) { - Math_SmoothStepToS(&this->unk4D6, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 1, 0x5DC, 0); - this->unk4D6 = CLAMP(this->unk4D6, -0x3127, 0x3127); + if ((this->unk_2D4 == 6) && (this->unk_2E2 != 0)) { + this->unk_4D6 = Math_SinS(this->unk_2E2 * 0x1068) * 8920.0f; + } else if (this->unk_2D4 != 0xF) { + if (this->unk_2D4 != 8) { + Math_SmoothStepToS(&this->unk_4D6, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 1, 0x5DC, 0); + this->unk_4D6 = CLAMP(this->unk_4D6, -0x3127, 0x3127); } else { - this->unk4D6 = 0; + this->unk_4D6 = 0; } } } @@ -1211,34 +1211,35 @@ void func_80B36F40(EnWf* this, PlayState* play) { void func_80B37038(EnWf* this, PlayState* play) { s16 temp_v1; - if (this->unk304.base.acFlags & AC_BOUNCED) { - this->unk304.base.acFlags &= ~(AC_HIT | AC_BOUNCED); - this->unk424.base.acFlags &= ~AC_HIT; - this->unk470.base.acFlags &= ~AC_HIT; - } else if (((this->unk424.base.acFlags & AC_HIT) || (this->unk470.base.acFlags & AC_HIT)) && (this->unk2D4 >= 6)) { + if (this->unk_304.base.acFlags & AC_BOUNCED) { + this->unk_304.base.acFlags &= ~(AC_HIT | AC_BOUNCED); + this->unk_424.base.acFlags &= ~AC_HIT; + this->unk_470.base.acFlags &= ~AC_HIT; + } else if (((this->unk_424.base.acFlags & AC_HIT) || (this->unk_470.base.acFlags & AC_HIT)) && + (this->unk_2D4 >= 6)) { temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (!((this->unk424.base.acFlags & AC_HIT) || !(this->unk470.base.acFlags & AC_HIT)) || + if (!((this->unk_424.base.acFlags & AC_HIT) || !(this->unk_470.base.acFlags & AC_HIT)) || (ABS(temp_v1) > 0x4A38)) { this->actor.colChkInfo.damage *= 4; } - this->unk424.base.acFlags &= ~AC_HIT; - this->unk470.base.acFlags &= ~AC_HIT; + this->unk_424.base.acFlags &= ~AC_HIT; + this->unk_470.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageReaction != 6) { - this->unk2E6 = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->unk424.elem, true); + this->unk_2E6 = this->actor.colChkInfo.damageReaction; + Actor_SetDropFlag(&this->actor, &this->unk_424.elem, true); #if OOT_VERSION >= PAL_1_0 - this->unk2F8 = 0; + this->unk_2F8 = 0; #endif if ((this->actor.colChkInfo.damageReaction == 1) || (this->actor.colChkInfo.damageReaction == 0xF)) { - if (this->unk2D4 != 0xF) { + if (this->unk_2D4 != 0xF) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); Actor_ApplyDamage(&this->actor); func_80B35D18(this); } } else { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - if (this->unk2E6 == 0xE) { - this->unk2E4 = 0x28; + if (this->unk_2E6 == 0xE) { + this->unk_2E4 = 0x28; } if (Actor_ApplyDamage(&this->actor) == 0) { func_80B36C8C(this); @@ -1261,7 +1262,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->unk2DC(this, play); + this->unk_2DC(this, play); func_80B36F40(this, play); } if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { @@ -1270,30 +1271,30 @@ void EnWf_Update(Actor* thisx, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x3E8, 0); Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0x3E8, 0); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk304.base); - if ((this->unk2D4 >= 6) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - Collider_UpdateCylinder(&this->actor, &this->unk424); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk470.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk424.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_304.base); + if ((this->unk_2D4 >= 6) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { + Collider_UpdateCylinder(&this->actor, &this->unk_424); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_470.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_424.base); } - if (this->unk2D4 == 7) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk304.base); + if (this->unk_2D4 == 7) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_304.base); } - if (this->unk2F8 > 0) { - if (!(this->unk304.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk304.base); + if (this->unk_2F8 > 0) { + if (!(this->unk_304.base.atFlags & AT_BOUNCED)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_304.base); } else { func_80B3590C(this); } } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 25.0f; - if (this->unk302 == 0) { + if (this->unk_302 == 0) { if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { - this->unk302 += 1; + this->unk_302 += 1; } } else { - this->unk302 = (this->unk302 + 1) & 3; + this->unk_302 = (this->unk_302 + 1) & 3; } } @@ -1301,7 +1302,7 @@ s32 func_80B37454(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg EnWf* this = thisx; if ((arg1 == 0x11) || (arg1 == 0x12)) { - arg4->y -= this->unk4D6; + arg4->y -= this->unk_4D6; } return 0; } @@ -1313,14 +1314,14 @@ void func_80B37494(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thi Vec3f sp18; var_v1_sp30 = -1; - Collider_UpdateSpheres(arg1, &this->unk304); + Collider_UpdateSpheres(arg1, &this->unk_304); if (arg1 == 6) { Matrix_MultVec3f(&D_80B37ADC, &sp24); - this->unk470.dim.pos.x = sp24.x; - this->unk470.dim.pos.y = sp24.y; - this->unk470.dim.pos.z = sp24.z; + this->unk_470.dim.pos.x = sp24.x; + this->unk_470.dim.pos.y = sp24.y; + this->unk_470.dim.pos.z = sp24.z; } - if ((this->unk2E4 != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { + if ((this->unk_2E4 != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { switch (arg1) { case 18: var_v1_sp30 = 0; @@ -1355,9 +1356,9 @@ void func_80B37494(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thi } if (var_v1_sp30 >= 0) { Matrix_MultVec3f(&D_80B37AE8, &sp18); - this->unk14C[var_v1_sp30].x = sp18.x; - this->unk14C[var_v1_sp30].y = sp18.y; - this->unk14C[var_v1_sp30].z = sp18.z; + this->unk_14C[var_v1_sp30].x = sp18.x; + this->unk_14C[var_v1_sp30].y = sp18.y; + this->unk_14C[var_v1_sp30].z = sp18.z; } } } @@ -1366,23 +1367,23 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2157); - if ((this->unk2D4 != 0) || (this->unk300 == 0)) { + if ((this->unk_2D4 != 0) || (this->unk_300 == 0)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); if (this->actor.params == 0) { - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37AF4[this->unk302])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37AF4[this->unk_302])); } else { - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37B04[this->unk302])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37B04[this->unk_302])); } SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, func_80B37454, func_80B37494, this); - if (this->unk2E4 != 0) { + if (this->unk_2E4 != 0) { this->actor.colorFilterTimer++; if (1) {} - this->unk2E4 -= 1; - if ((this->unk2E4 & 3) == 0) { - s32 v = this->unk2E4 >> 2; + this->unk_2E4 -= 1; + if ((this->unk_2E4 & 3) == 0) { + s32 v = this->unk_2E4 >> 2; - EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->unk14C[v], 75, 0, 0, v); + EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->unk_14C[v], 75, 0, 0, v); } } } 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 6fecc9f267b..3b361b35834 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -8,38 +8,38 @@ struct EnWf; typedef struct EnWf { /* 0x000 */ Actor actor; - /* 0x14C */ Vec3s unk14C[10]; + /* 0x14C */ Vec3s unk_14C[10]; /* 0x188 */ SkelAnime skelAnime; /* 0x1CC */ Vec3s jointTable[22]; /* 0x250 */ Vec3s morphTable[22]; - /* 0x2D4 */ s32 unk2D4; - /* 0x2D8 */ char pad2D8[4]; - /* 0x2DC */ void (*unk2DC)(struct EnWf*, struct PlayState*); - /* 0x2E0 */ s16 unk2E0; - /* 0x2E2 */ s16 unk2E2; - /* 0x2E4 */ s16 unk2E4; - /* 0x2E6 */ u8 unk2E6; - /* 0x2E7 */ char pad2E7[1]; - /* 0x2E8 */ s32 unk2E8; - /* 0x2EC */ f32 unk2EC; - /* 0x2F0 */ char pad2F0[4]; - /* 0x2F4 */ f32 unk2F4; - /* 0x2F8 */ s16 unk2F8; - /* 0x2FA */ s16 unk2FA; - /* 0x2FC */ s16 unk2FC; - /* 0x2FE */ s16 unk2FE; - /* 0x300 */ s16 unk300; - /* 0x302 */ u8 unk302; - /* 0x303 */ char pad303[1]; - /* 0x304 */ ColliderJntSph unk304; - /* 0x324 */ ColliderJntSphElement unk324[4]; - /* 0x424 */ ColliderCylinder unk424; - /* 0x470 */ ColliderCylinder unk470; - /* 0x4BC */ Vec3f unk4BC; - /* 0x4C8 */ Vec3f unk4C8; - /* 0x4D4 */ char pad4D4[2]; - /* 0x4D6 */ s16 unk4D6; - /* 0x4D8 */ char pad4D8[4]; + /* 0x2D4 */ s32 unk_2D4; + /* 0x2D8 */ char pad_2D8[4]; + /* 0x2DC */ void (*unk_2DC)(struct EnWf*, struct PlayState*); + /* 0x2E0 */ s16 unk_2E0; + /* 0x2E2 */ s16 unk_2E2; + /* 0x2E4 */ s16 unk_2E4; + /* 0x2E6 */ u8 unk_2E6; + /* 0x2E7 */ char pad_2E7[1]; + /* 0x2E8 */ s32 unk_2E8; + /* 0x2EC */ f32 unk_2EC; + /* 0x2F0 */ char pad_2F0[4]; + /* 0x2F4 */ f32 unk_2F4; + /* 0x2F8 */ s16 unk_2F8; + /* 0x2FA */ s16 unk_2FA; + /* 0x2FC */ s16 unk_2FC; + /* 0x2FE */ s16 unk_2FE; + /* 0x300 */ s16 unk_300; + /* 0x302 */ u8 unk_302; + /* 0x303 */ char pad_303[1]; + /* 0x304 */ ColliderJntSph unk_304; + /* 0x324 */ ColliderJntSphElement unk_324[4]; + /* 0x424 */ ColliderCylinder unk_424; + /* 0x470 */ ColliderCylinder unk_470; + /* 0x4BC */ Vec3f unk_4BC; + /* 0x4C8 */ Vec3f unk_4C8; + /* 0x4D4 */ char pad_4D4[2]; + /* 0x4D6 */ s16 unk_4D6; + /* 0x4D8 */ char pad_4D8[4]; } EnWf; // size = 0x4DC #endif From 89d9c2f19a67adedace0ae91996ecfb9f81addd5 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 15:42:43 +0200 Subject: [PATCH 038/150] fixup --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 63b9398a25c..6591af5bc4e 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -281,7 +281,7 @@ void EnWf_Destroy(Actor* thisx, PlayState* play) { temp_v1->curNumSpawn--; } PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, temp_v1->unk152); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, temp_v1->curNumSpawn); PRINTF("\n\n"); } } From 131067f42dcfba68a34be6765bc09b4a84ba373f Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 17:34:34 +0200 Subject: [PATCH 039/150] doc kanji_tex --- include/code_800D71F0.h | 8 - include/kanji_tex.h | 8 + spec/spec | 2 +- src/code/code_800D71F0.s | 1359 -------------------------------------- src/code/kanji_tex.s | 173 +++++ src/code/z_kanfont.c | 15 +- 6 files changed, 191 insertions(+), 1374 deletions(-) delete mode 100644 include/code_800D71F0.h create mode 100644 include/kanji_tex.h delete mode 100644 src/code/code_800D71F0.s create mode 100644 src/code/kanji_tex.s diff --git a/include/code_800D71F0.h b/include/code_800D71F0.h deleted file mode 100644 index 2e6977f8f9b..00000000000 --- a/include/code_800D71F0.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CODE_800D71F0_H -#define CODE_800D71F0_H - -#include "ultra64/ultratypes.h" - -s32 func_800D71F0(s32 character); - -#endif diff --git a/include/kanji_tex.h b/include/kanji_tex.h new file mode 100644 index 00000000000..6d79c0d0ce4 --- /dev/null +++ b/include/kanji_tex.h @@ -0,0 +1,8 @@ +#ifndef KANJI_TEX_H +#define KANJI_TEX_H + +#include "ultra64/ultratypes.h" + +s32 KanjiTex_CodepointToOffset(s32 codepoint); + +#endif diff --git a/spec/spec b/spec/spec index 3b397692685..3bb910ac94e 100644 --- a/spec/spec +++ b/spec/spec @@ -657,7 +657,7 @@ beginseg include "$(BUILD_DIR)/src/code/fault_gc.o" include "$(BUILD_DIR)/src/code/fault_gc_drawer.o" #endif - include "$(BUILD_DIR)/src/code/code_800D71F0.o" + include "$(BUILD_DIR)/src/code/kanji_tex.o" #if DEBUG_FEATURES include "$(BUILD_DIR)/src/code/ucode_disas.o" #endif diff --git a/src/code/code_800D71F0.s b/src/code/code_800D71F0.s deleted file mode 100644 index a5a1fe63dd9..00000000000 --- a/src/code/code_800D71F0.s +++ /dev/null @@ -1,1359 +0,0 @@ -#include "ultra64/asm.h" -#include "ultra64/regdef.h" - -.text - -LEAF(func_800D71F0) - li a2, 188 - blt a0, 0x8800, .L800D723C - srl a1, a0, 8 - addi a1, a1, -0x88 - andi a3, a0, 0xFF - addi a3, a3, -0x40 - mul a2, a2, a1 - blt a3, 0x40, .L800D722C - addi a3, a3, -1 -.L800D722C: - mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ - addi a3, a3, 0x30A - add a3, a3, a2 - sll v0, a3, 7 - jr ra - -.L800D723C: - srl a1, a0, 8 - addi a1, a1, -0x81 - andi a3, a0, 0xFF - addi a3, a3, -0x40 - mul a2, a2, a1 - blt a3, 0x40, .L800D7268 - addi a3, a3, -1 -.L800D7268: - mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ - add a3, a3, a2 - sll a3, a3, 1 - la a2, D_800D7288 - add a3, a3, a2 - lh a2, (a3) - sll v0, a2, 7 - jr ra -END(func_800D71F0) - -DATA(D_800D7288) - .half 0x0000 - .half 0x0001 - .half 0x0002 - .half 0x0003 - .half 0x0004 - .half 0x0005 - .half 0x0006 - .half 0x0007 - .half 0x0008 - .half 0x0009 - .half 0x000A - .half 0x000B - .half 0x000C - .half 0x000D - .half 0x000E - .half 0x000F - .half 0x0010 - .half 0x0011 - .half 0x0012 - .half 0x0013 - .half 0x0014 - .half 0x0015 - .half 0x0016 - .half 0x0017 - .half 0x0018 - .half 0x0019 - .half 0x001A - .half 0x001B - .half 0x001C - .half 0x001D - .half 0x001E - .half 0x001F - .half 0x0020 - .half 0x0021 - .half 0x0022 - .half 0x0023 - .half 0x0024 - .half 0x0025 - .half 0x0026 - .half 0x0027 - .half 0x0028 - .half 0x0029 - .half 0x002A - .half 0x002B - .half 0x002C - .half 0x002D - .half 0x002E - .half 0x002F - .half 0x0030 - .half 0x0031 - .half 0x0032 - .half 0x0033 - .half 0x0034 - .half 0x0035 - .half 0x0036 - .half 0x0037 - .half 0x0038 - .half 0x0039 - .half 0x003A - .half 0x003B - .half 0x003C - .half 0x003D - .half 0x003E - .half 0x003F - .half 0x0040 - .half 0x0041 - .half 0x0042 - .half 0x0043 - .half 0x0044 - .half 0x0045 - .half 0x0046 - .half 0x0047 - .half 0x0048 - .half 0x0049 - .half 0x004A - .half 0x004B - .half 0x004C - .half 0x004D - .half 0x004E - .half 0x004F - .half 0x0050 - .half 0x0051 - .half 0x0052 - .half 0x0053 - .half 0x0054 - .half 0x0055 - .half 0x0056 - .half 0x0057 - .half 0x0058 - .half 0x0059 - .half 0x005A - .half 0x005B - .half 0x005C - .half 0x005D - .half 0x005E - .half 0x005F - .half 0x0060 - .half 0x0061 - .half 0x0062 - .half 0x0063 - .half 0x0064 - .half 0x0065 - .half 0x0066 - .half 0x0067 - .half 0x0068 - .half 0x0069 - .half 0x006A - .half 0x006B - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x006C - .half 0x006D - .half 0x006E - .half 0x006F - .half 0x0070 - .half 0x0071 - .half 0x0072 - .half 0x0073 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0074 - .half 0x0075 - .half 0x0076 - .half 0x0077 - .half 0x0078 - .half 0x0079 - .half 0x007A - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x007B - .half 0x007C - .half 0x007D - .half 0x007E - .half 0x007F - .half 0x0080 - .half 0x0081 - .half 0x0082 - .half 0x0083 - .half 0x0084 - .half 0x0085 - .half 0x0086 - .half 0x0087 - .half 0x0088 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0089 - .half 0x008A - .half 0x008B - .half 0x008C - .half 0x008D - .half 0x008E - .half 0x008F - .half 0x0090 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0091 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0092 - .half 0x0093 - .half 0x0094 - .half 0x0095 - .half 0x0096 - .half 0x0097 - .half 0x0098 - .half 0x0099 - .half 0x009A - .half 0x009B - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x009C - .half 0x009D - .half 0x009E - .half 0x009F - .half 0x00A0 - .half 0x00A1 - .half 0x00A2 - .half 0x00A3 - .half 0x00A4 - .half 0x00A5 - .half 0x00A6 - .half 0x00A7 - .half 0x00A8 - .half 0x00A9 - .half 0x00AA - .half 0x00AB - .half 0x00AC - .half 0x00AD - .half 0x00AE - .half 0x00AF - .half 0x00B0 - .half 0x00B1 - .half 0x00B2 - .half 0x00B3 - .half 0x00B4 - .half 0x00B5 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x00B6 - .half 0x00B7 - .half 0x00B8 - .half 0x00B9 - .half 0x00BA - .half 0x00BB - .half 0x00BC - .half 0x00BD - .half 0x00BE - .half 0x00BF - .half 0x00C0 - .half 0x00C1 - .half 0x00C2 - .half 0x00C3 - .half 0x00C4 - .half 0x00C5 - .half 0x00C6 - .half 0x00C7 - .half 0x00C8 - .half 0x00C9 - .half 0x00CA - .half 0x00CB - .half 0x00CC - .half 0x00CD - .half 0x00CE - .half 0x00CF - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x00D0 - .half 0x00D1 - .half 0x00D2 - .half 0x00D3 - .half 0x00D4 - .half 0x00D5 - .half 0x00D6 - .half 0x00D7 - .half 0x00D8 - .half 0x00D9 - .half 0x00DA - .half 0x00DB - .half 0x00DC - .half 0x00DD - .half 0x00DE - .half 0x00DF - .half 0x00E0 - .half 0x00E1 - .half 0x00E2 - .half 0x00E3 - .half 0x00E4 - .half 0x00E5 - .half 0x00E6 - .half 0x00E7 - .half 0x00E8 - .half 0x00E9 - .half 0x00EA - .half 0x00EB - .half 0x00EC - .half 0x00ED - .half 0x00EE - .half 0x00EF - .half 0x00F0 - .half 0x00F1 - .half 0x00F2 - .half 0x00F3 - .half 0x00F4 - .half 0x00F5 - .half 0x00F6 - .half 0x00F7 - .half 0x00F8 - .half 0x00F9 - .half 0x00FA - .half 0x00FB - .half 0x00FC - .half 0x00FD - .half 0x00FE - .half 0x00FF - .half 0x0100 - .half 0x0101 - .half 0x0102 - .half 0x0103 - .half 0x0104 - .half 0x0105 - .half 0x0106 - .half 0x0107 - .half 0x0108 - .half 0x0109 - .half 0x010A - .half 0x010B - .half 0x010C - .half 0x010D - .half 0x010E - .half 0x010F - .half 0x0110 - .half 0x0111 - .half 0x0112 - .half 0x0113 - .half 0x0114 - .half 0x0115 - .half 0x0116 - .half 0x0117 - .half 0x0118 - .half 0x0119 - .half 0x011A - .half 0x011B - .half 0x011C - .half 0x011D - .half 0x011E - .half 0x011F - .half 0x0120 - .half 0x0121 - .half 0x0122 - .half 0x0123 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0124 - .half 0x0125 - .half 0x0126 - .half 0x0127 - .half 0x0128 - .half 0x0129 - .half 0x012A - .half 0x012B - .half 0x012C - .half 0x012D - .half 0x012E - .half 0x012F - .half 0x0130 - .half 0x0131 - .half 0x0132 - .half 0x0133 - .half 0x0134 - .half 0x0135 - .half 0x0136 - .half 0x0137 - .half 0x0138 - .half 0x0139 - .half 0x013A - .half 0x013B - .half 0x013C - .half 0x013D - .half 0x013E - .half 0x013F - .half 0x0140 - .half 0x0141 - .half 0x0142 - .half 0x0143 - .half 0x0144 - .half 0x0145 - .half 0x0146 - .half 0x0147 - .half 0x0148 - .half 0x0149 - .half 0x014A - .half 0x014B - .half 0x014C - .half 0x014D - .half 0x014E - .half 0x014F - .half 0x0150 - .half 0x0151 - .half 0x0152 - .half 0x0153 - .half 0x0154 - .half 0x0155 - .half 0x0156 - .half 0x0157 - .half 0x0158 - .half 0x0159 - .half 0x015A - .half 0x015B - .half 0x015C - .half 0x015D - .half 0x015E - .half 0x015F - .half 0x0160 - .half 0x0161 - .half 0x0162 - .half 0x0163 - .half 0x0164 - .half 0x0165 - .half 0x0166 - .half 0x0167 - .half 0x0168 - .half 0x0169 - .half 0x016A - .half 0x016B - .half 0x016C - .half 0x016D - .half 0x016E - .half 0x016F - .half 0x0170 - .half 0x0171 - .half 0x0172 - .half 0x0173 - .half 0x0174 - .half 0x0175 - .half 0x0176 - .half 0x0177 - .half 0x0178 - .half 0x0179 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x017A - .half 0x017B - .half 0x017C - .half 0x017D - .half 0x017E - .half 0x017F - .half 0x0180 - .half 0x0181 - .half 0x0182 - .half 0x0183 - .half 0x0184 - .half 0x0185 - .half 0x0186 - .half 0x0187 - .half 0x0188 - .half 0x0189 - .half 0x018A - .half 0x018B - .half 0x018C - .half 0x018D - .half 0x018E - .half 0x018F - .half 0x0190 - .half 0x0191 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0192 - .half 0x0193 - .half 0x0194 - .half 0x0195 - .half 0x0196 - .half 0x0197 - .half 0x0198 - .half 0x0199 - .half 0x019A - .half 0x019B - .half 0x019C - .half 0x019D - .half 0x019E - .half 0x019F - .half 0x01A0 - .half 0x01A1 - .half 0x01A2 - .half 0x01A3 - .half 0x01A4 - .half 0x01A5 - .half 0x01A6 - .half 0x01A7 - .half 0x01A8 - .half 0x01A9 - .half 0x01AA - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x01AB - .half 0x01AC - .half 0x01AD - .half 0x01AE - .half 0x01AF - .half 0x01B0 - .half 0x01B1 - .half 0x01B2 - .half 0x01B3 - .half 0x01B4 - .half 0x01B5 - .half 0x01B6 - .half 0x01B7 - .half 0x01B8 - .half 0x01B9 - .half 0x01BA - .half 0x01BB - .half 0x01BC - .half 0x01BD - .half 0x01BE - .half 0x01BF - .half 0x01C0 - .half 0x01C1 - .half 0x01C2 - .half 0x01C3 - .half 0x01C4 - .half 0x01C5 - .half 0x01C6 - .half 0x01C7 - .half 0x01C8 - .half 0x01C9 - .half 0x01CA - .half 0x01CB - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x01CC - .half 0x01CD - .half 0x01CE - .half 0x01CF - .half 0x01D0 - .half 0x01D1 - .half 0x01D2 - .half 0x01D3 - .half 0x01D4 - .half 0x01D5 - .half 0x01D6 - .half 0x01D7 - .half 0x01D8 - .half 0x01D9 - .half 0x01DA - .half 0x01DB - .half 0x01DC - .half 0x01DD - .half 0x01DE - .half 0x01DF - .half 0x01E0 - .half 0x01E1 - .half 0x01E2 - .half 0x01E3 - .half 0x01E4 - .half 0x01E5 - .half 0x01E6 - .half 0x01E7 - .half 0x01E8 - .half 0x01E9 - .half 0x01EA - .half 0x01EB - .half 0x01EC - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x01ED - .half 0x01EE - .half 0x01EF - .half 0x01F0 - .half 0x01F1 - .half 0x01F2 - .half 0x01F3 - .half 0x01F4 - .half 0x01F5 - .half 0x01F6 - .half 0x01F7 - .half 0x01F8 - .half 0x01F9 - .half 0x01FA - .half 0x01FB - .half 0x01FC - .half 0x01FD - .half 0x01FE - .half 0x01FF - .half 0x0200 - .half 0x0201 - .half 0x0202 - .half 0x0203 - .half 0x0204 - .half 0x0205 - .half 0x0206 - .half 0x0207 - .half 0x0208 - .half 0x0209 - .half 0x020A - .half 0x020B - .half 0x020C - .half 0x020D - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x020E - .half 0x020F - .half 0x0210 - .half 0x0211 - .half 0x0212 - .half 0x0213 - .half 0x0214 - .half 0x0215 - .half 0x0216 - .half 0x0217 - .half 0x0218 - .half 0x0219 - .half 0x021A - .half 0x021B - .half 0x021C - .half 0x021D - .half 0x021E - .half 0x021F - .half 0x0220 - .half 0x0221 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0222 - .half 0x0223 - .half 0x0224 - .half 0x0225 - .half 0x0226 - .half 0x0227 - .half 0x0228 - .half 0x0229 - .half 0x022A - .half 0x022B - .half 0x022C - .half 0x022D - .half 0x022E - .half 0x022F - .half 0x0230 - .half 0x0231 - .half 0x0232 - .half 0x0233 - .half 0x0234 - .half 0x0235 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0236 - .half 0x0237 - .half 0x0238 - .half 0x0239 - .half 0x023A - .half 0x023B - .half 0x023C - .half 0x023D - .half 0x023E - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x023F - .half 0x0240 - .half 0x0241 - .half 0x0242 - .half 0x0243 - .half 0x0244 - .half 0x0245 - .half 0x0246 - .half 0x0247 - .half 0x0248 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0249 - .half 0x024A - .half 0x024B - .half 0x024C - .half 0x024D - .half 0x024E - .half 0x024F - .half 0x0250 - .half 0x0251 - .half 0x0252 - .half 0x0253 - .half 0x0254 - .half 0x0255 - .half 0x0256 - .half 0x0257 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0258 - .half 0x0259 - .half 0x025A - .half 0x025B - .half 0x025C - .half 0x025D - .half 0x025E - .half 0x025F - .half 0x0260 - .half 0x0261 - .half 0x0262 - .half 0x0263 - .half 0x0264 - .half 0x0265 - .half 0x0266 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0267 - .half 0x0268 - .half 0x0269 - .half 0x026A - .half 0x026B - .half 0x026C - .half 0x026D - .half 0x026E - .half 0x026F - .half 0x0270 - .half 0x0271 - .half 0x0272 - .half 0x0273 - .half 0x0274 - .half 0x0275 - .half 0x0276 - .half 0x0277 - .half 0x0278 - .half 0x0279 - .half 0x027A - .half 0x027B - .half 0x027C - .half 0x027D - .half 0x027E - .half 0x027F - .half 0x0280 - .half 0x0281 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0282 - .half 0x0283 - .half 0x0284 - .half 0x0285 - .half 0x0286 - .half 0x0287 - .half 0x0288 - .half 0x0289 - .half 0x028A - .half 0x028B - .half 0x028C - .half 0x028D - .half 0x028E - .half 0x028F - .half 0x0290 - .half 0x0291 - .half 0x0292 - .half 0x0293 - .half 0x0294 - .half 0x0295 - .half 0x0296 - .half 0x0297 - .half 0x0298 - .half 0x0299 - .half 0x029A - .half 0x029B - .half 0x029C - .half 0x029D - .half 0x029E - .half 0x029F - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x02A0 - .half 0x02A1 - .half 0x02A2 - .half 0x02A3 - .half 0x02A4 - .half 0x02A5 - .half 0x02A6 - .half 0x02A7 - .half 0x02A8 - .half 0x02A9 - .half 0x02AA - .half 0x02AB - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x02AC - .half 0x02AD - .half 0x02AE - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x02AF - .half 0x02B0 - .half 0x02B1 - .half 0x02B2 - .half 0x02B3 - .half 0x02B4 - .half 0x02B5 - .half 0x02B6 - .half 0x02B7 - .half 0x02B8 - .half 0x02B9 - .half 0x02BA - .half 0x02BB - .half 0x02BC - .half 0x02BD - .half 0x02BE - .half 0x02BF - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x02C0 - .half 0x02C1 - .half 0x02C2 - .half 0x02C3 - .half 0x02C4 - .half 0x02C5 - .half 0x02C6 - .half 0x02C7 - .half 0x02C8 - .half 0x02C9 - .half 0x02CA - .half 0x02CB - .half 0x02CC - .half 0x02CD - .half 0x02CE - .half 0x02CF - .half 0x02D0 - .half 0x02D1 - .half 0x02D2 - .half 0x02D3 - .half 0x02D4 - .half 0x02D5 - .half 0x02D6 - .half 0x02D7 - .half 0x02D8 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x02D9 - .half 0x02DA - .half 0x02DB - .half 0x02DC - .half 0x02DD - .half 0x02DE - .half 0x02DF - .half 0x02E0 - .half 0x02E1 - .half 0x02E2 - .half 0x02E3 - .half 0x02E4 - .half 0x02E5 - .half 0x02E6 - .half 0x02E7 - .half 0x02E8 - .half 0x02E9 - .half 0x02EA - .half 0x02EB - .half 0x02EC - .half 0x02ED - .half 0x02EE - .half 0x02EF - .half 0x02F0 - .half 0x02F1 - .half 0x02F2 - .half 0x02F3 - .half 0x02F4 - .half 0x02F5 - .half 0x02F6 - .half 0x02F7 - .half 0x02F8 - .half 0x02F9 - .half 0x02FA - .half 0x02FB - .half 0x02FC - .half 0x02FD - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x02FE - .half 0x02FF - .half 0x0300 - .half 0x0301 - .half 0x0302 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0303 - .half 0x0304 - .half 0x0305 - .half 0x0306 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0000 - .half 0x0307 - .half 0x0308 - .half 0x0309 -ENDDATA(D_800D7288) diff --git a/src/code/kanji_tex.s b/src/code/kanji_tex.s new file mode 100644 index 00000000000..cf8e6c61974 --- /dev/null +++ b/src/code/kanji_tex.s @@ -0,0 +1,173 @@ +#include "ultra64/asm.h" +#include "ultra64/regdef.h" + +.text + +/* +This function takes as input a codepoint and returns the corresponding offset into the kanji textures segment. +It only accepts codepoints starting from 0x8140. + +Equivalent C code: + +extern s16 low_codepoints_lookup_table[]; +s32 KanjiTex_CodepointToOffset(s32 codepoint) { + if (codepoint < 0x8800) { + i = (codepoint & 0xFF) - 0x40; + if (i >= 0x40) { + i -= 1; + } + i += ((codepoint >> 8) - 0x81) * 0xBC; + return low_codepoints_lookup_table[i] * FONT_CHAR_TEX_SIZE; + } else { + i = (codepoint & 0xFF) - 0x40; + if (i >= 0x40) { + i -= 1; + } + i += 0x30A; + i += ((codepoint >> 8) - 0x88) * 0xBC; + return i * FONT_CHAR_TEX_SIZE; + } +} +*/ + +LEAF(KanjiTex_CodepointToOffset) + li a2, 188 + blt a0, 0x8800, low_codepoint + srl a1, a0, 8 + addi a1, a1, -0x88 + andi a3, a0, 0xFF + addi a3, a3, -0x40 + mul a2, a2, a1 + blt a3, 0x40, 1f + addi a3, a3, -1 +1: + mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ + addi a3, a3, 0x030A + add a3, a3, a2 + sll v0, a3, 7 + jr ra + +low_codepoint: + srl a1, a0, 8 + addi a1, a1, -0x81 + andi a3, a0, 0xFF + addi a3, a3, -0x40 + mul a2, a2, a1 + blt a3, 0x40, 1f + addi a3, a3, -1 +1: + mflo a2 /* Unncessary mflo: the pseudo-op `mul` already performs mflo */ + add a3, a3, a2 + sll a3, a3, 1 + la a2, low_codepoints_lookup_table + add a3, a3, a2 + lh a2, (a3) + sll v0, a2, 7 + jr ra +END(KanjiTex_CodepointToOffset) + +/* +This is a sparse lookup table composed of 7 0xBC-long blocks. +Each block corresponds to codepoints 0x8X40..0x8X7E, 0x8X80..0x8XFC +(ommitting 0x8X7F, 0x8XFD, 0x8XFE and 0x8XFF), with X starting at 1. +Each value is an index into the kanji textures segment. +*/ +DATA(low_codepoints_lookup_table) + /* 0x8140..0x81FC */ + .half 0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F + .half 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F + .half 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F + .half 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E + .half 0x003F, 0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004A, 0x004B, 0x004C, 0x004D, 0x004E + .half 0x004F, 0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005A, 0x005B, 0x005C, 0x005D, 0x005E + .half 0x005F, 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006C, 0x006D, 0x006E, 0x006F, 0x0070, 0x0071, 0x0072, 0x0073 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F + .half 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, 0x0090, 0x0000, 0x0000, 0x0000, 0x0000, 0x0091 + + /* 0x8240..0x82FC */ + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092 + .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB + .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4 + .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0 + .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0 + .half 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, 0x00F0 + .half 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, 0x0100 + .half 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F, 0x0110 + .half 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, 0x011F, 0x0120 + .half 0x0121, 0x0122, 0x0123, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + + /* 0x8340..0x83FC */ + .half 0x0124, 0x0125, 0x0126, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0x0130, 0x0131, 0x0132, 0x0133 + .half 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143 + .half 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x014F, 0x0150, 0x0151, 0x0152, 0x0153 + .half 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, 0x0160, 0x0161, 0x0162 + .half 0x0163, 0x0164, 0x0165, 0x0166, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, 0x0170, 0x0171, 0x0172 + .half 0x0173, 0x0174, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x017A + .half 0x017B, 0x017C, 0x017D, 0x017E, 0x017F, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, 0x0186, 0x0187, 0x0188, 0x0189, 0x018A + .half 0x018B, 0x018C, 0x018D, 0x018E, 0x018F, 0x0190, 0x0191, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192 + .half 0x0193, 0x0194, 0x0195, 0x0196, 0x0197, 0x0198, 0x0199, 0x019A, 0x019B, 0x019C, 0x019D, 0x019E, 0x019F, 0x01A0, 0x01A1, 0x01A2 + .half 0x01A3, 0x01A4, 0x01A5, 0x01A6, 0x01A7, 0x01A8, 0x01A9, 0x01AA, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + + /* 0x8440..0x84FC */ + .half 0x01AB, 0x01AC, 0x01AD, 0x01AE, 0x01AF, 0x01B0, 0x01B1, 0x01B2, 0x01B3, 0x01B4, 0x01B5, 0x01B6, 0x01B7, 0x01B8, 0x01B9, 0x01BA + .half 0x01BB, 0x01BC, 0x01BD, 0x01BE, 0x01BF, 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C5, 0x01C6, 0x01C7, 0x01C8, 0x01C9, 0x01CA + .half 0x01CB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x01CC, 0x01CD, 0x01CE, 0x01CF, 0x01D0, 0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA + .half 0x01DB, 0x01DC, 0x01DD, 0x01DE, 0x01DF, 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E4, 0x01E5, 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA + .half 0x01EB, 0x01EC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x01ED + .half 0x01EE, 0x01EF, 0x01F0, 0x01F1, 0x01F2, 0x01F3, 0x01F4, 0x01F5, 0x01F6, 0x01F7, 0x01F8, 0x01F9, 0x01FA, 0x01FB, 0x01FC, 0x01FD + .half 0x01FE, 0x01FF, 0x0200, 0x0201, 0x0202, 0x0203, 0x0204, 0x0205, 0x0206, 0x0207, 0x0208, 0x0209, 0x020A, 0x020B, 0x020C, 0x020D + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + + /* 0x8540..0x85FC */ + .half 0x020E, 0x020F, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021A, 0x021B, 0x021C, 0x021D + .half 0x021E, 0x021F, 0x0220, 0x0221, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0222, 0x0223 + .half 0x0224, 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022A, 0x022B, 0x022C, 0x022D, 0x022E, 0x022F, 0x0230, 0x0231, 0x0232, 0x0233 + .half 0x0234, 0x0235, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0236, 0x0237, 0x0238 + .half 0x0239, 0x023A, 0x023B, 0x023C, 0x023D, 0x023E, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x023F, 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, 0x0248, 0x0000, 0x0000, 0x0000, 0x0000, 0x0249 + .half 0x024A, 0x024B, 0x024C, 0x024D, 0x024E, 0x024F, 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0257, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0258, 0x0259, 0x025A, 0x025B, 0x025C, 0x025D, 0x025E, 0x025F, 0x0260, 0x0261, 0x0262, 0x0263, 0x0264 + .half 0x0265, 0x0266, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0267, 0x0268, 0x0269, 0x026A, 0x026B + .half 0x026C, 0x026D, 0x026E, 0x026F, 0x0270, 0x0271, 0x0272, 0x0273, 0x0274, 0x0275, 0x0276, 0x0277, 0x0278, 0x0279, 0x027A, 0x027B + .half 0x027C, 0x027D, 0x027E, 0x027F, 0x0280, 0x0281, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + + /* 0x8640..0x86FC */ + .half 0x0282, 0x0283, 0x0284, 0x0285, 0x0286, 0x0287, 0x0288, 0x0289, 0x028A, 0x028B, 0x028C, 0x028D, 0x028E, 0x028F, 0x0290, 0x0291 + .half 0x0292, 0x0293, 0x0294, 0x0295, 0x0296, 0x0297, 0x0298, 0x0299, 0x029A, 0x029B, 0x029C, 0x029D, 0x029E, 0x029F, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02A0, 0x02A1, 0x02A2, 0x02A3, 0x02A4 + .half 0x02A5, 0x02A6, 0x02A7, 0x02A8, 0x02A9, 0x02AA, 0x02AB, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x02AC, 0x02AD, 0x02AE, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02AF, 0x02B0, 0x02B1, 0x02B2, 0x02B3, 0x02B4, 0x02B5, 0x02B6, 0x02B7 + .half 0x02B8, 0x02B9, 0x02BA, 0x02BB, 0x02BC, 0x02BD, 0x02BE, 0x02BF, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + + /* 0x8740..0x87FC */ + .half 0x02C0, 0x02C1, 0x02C2, 0x02C3, 0x02C4, 0x02C5, 0x02C6, 0x02C7, 0x02C8, 0x02C9, 0x02CA, 0x02CB, 0x02CC, 0x02CD, 0x02CE, 0x02CF + .half 0x02D0, 0x02D1, 0x02D2, 0x02D3, 0x02D4, 0x02D5, 0x02D6, 0x02D7, 0x02D8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x02D9, 0x02DA, 0x02DB, 0x02DC, 0x02DD, 0x02DE, 0x02DF, 0x02E0, 0x02E1, 0x02E2, 0x02E3, 0x02E4, 0x02E5, 0x02E6, 0x02E7 + .half 0x02E8, 0x02E9, 0x02EA, 0x02EB, 0x02EC, 0x02ED, 0x02EE, 0x02EF, 0x02F0, 0x02F1, 0x02F2, 0x02F3, 0x02F4, 0x02F5, 0x02F6, 0x02F7 + .half 0x02F8, 0x02F9, 0x02FA, 0x02FB, 0x02FC, 0x02FD, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02FE, 0x02FF, 0x0300 + .half 0x0301, 0x0302, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0303, 0x0304, 0x0305, 0x0306, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 + .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0307, 0x0308, 0x0309 +ENDDATA(D_800D7288) diff --git a/src/code/z_kanfont.c b/src/code/z_kanfont.c index 85b3a11ad9a..60eab022b9d 100644 --- a/src/code/z_kanfont.c +++ b/src/code/z_kanfont.c @@ -1,9 +1,11 @@ -#include "code_800D71F0.h" +#include "versions.h" +#if OOT_NTSC +#include "kanji_tex.h" +#endif #include "message_data_static.h" #include "printf.h" #include "segment_symbols.h" #include "translation.h" -#include "versions.h" #include "dma.h" #include "font.h" #include "message.h" @@ -14,8 +16,9 @@ */ void Font_LoadCharWide(Font* font, u16 character, u16 codePointIndex) { #if OOT_NTSC - DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], (uintptr_t)_kanjiSegmentRomStart + func_800D71F0(character), - FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); + DMA_REQUEST_SYNC(&font->charTexBuf[codePointIndex], + (uintptr_t)_kanjiSegmentRomStart + KanjiTex_CodepointToOffset(character), FONT_CHAR_TEX_SIZE, + "../z_kanfont.c", UNK_LINE); #endif } @@ -82,7 +85,7 @@ void Font_LoadOrderedFont(Font* font) { } if (font->msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) { - offset = func_800D71F0(font->msgBufWide[codePointIndex]); + offset = KanjiTex_CodepointToOffset(font->msgBufWide[codePointIndex]); DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); fontBufIndex += FONT_CHAR_TEX_SIZE / 8; @@ -134,7 +137,7 @@ void Font_LoadOrderedFont(Font* font) { } if (msgBufWide[codePointIndex] != MESSAGE_WIDE_NEWLINE) { - offset = func_800D71F0(msgBufWide[codePointIndex]); + offset = KanjiTex_CodepointToOffset(msgBufWide[codePointIndex]); DMA_REQUEST_SYNC(&font->fontBuf[fontBufIndex * 8], (uintptr_t)_kanjiSegmentRomStart + offset, FONT_CHAR_TEX_SIZE, "../z_kanfont.c", UNK_LINE); fontBufIndex += FONT_CHAR_TEX_SIZE / 8; From eedbbab7ce2d699142e474cac627bf227708d6c7 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 17:35:57 +0200 Subject: [PATCH 040/150] fixup --- src/code/kanji_tex.s | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/code/kanji_tex.s b/src/code/kanji_tex.s index cf8e6c61974..b7fda6948f1 100644 --- a/src/code/kanji_tex.s +++ b/src/code/kanji_tex.s @@ -11,6 +11,8 @@ Equivalent C code: extern s16 low_codepoints_lookup_table[]; s32 KanjiTex_CodepointToOffset(s32 codepoint) { + s32 i; + if (codepoint < 0x8800) { i = (codepoint & 0xFF) - 0x40; if (i >= 0x40) { From a6e6495be204362ee2774de68d54dd25b5453482 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 20:12:20 +0200 Subject: [PATCH 041/150] wip EnFish docs --- assets/objects/gameplay_keep/gFish1Anim.c | 13 - assets/objects/gameplay_keep/gFish1Anim.h | 10 - assets/objects/gameplay_keep/gFish2Anim.c | 13 - assets/objects/gameplay_keep/gFish2Anim.h | 10 - assets/objects/gameplay_keep/gFishInAirAnim.c | 13 + assets/objects/gameplay_keep/gFishInAirAnim.h | 10 + .../objects/gameplay_keep/gFishInWaterAnim.c | 13 + .../objects/gameplay_keep/gFishInWaterAnim.h | 10 + assets/objects/gameplay_keep/gameplay_keep.h | 4 +- assets/xml/objects/gameplay_keep.xml | 4 +- spec/objects.inc | 4 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 623 +++++++++--------- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 22 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 3 +- .../actors/ovl_player_actor/z_player.c | 3 +- 15 files changed, 377 insertions(+), 378 deletions(-) delete mode 100644 assets/objects/gameplay_keep/gFish1Anim.c delete mode 100644 assets/objects/gameplay_keep/gFish1Anim.h delete mode 100644 assets/objects/gameplay_keep/gFish2Anim.c delete mode 100644 assets/objects/gameplay_keep/gFish2Anim.h create mode 100644 assets/objects/gameplay_keep/gFishInAirAnim.c create mode 100644 assets/objects/gameplay_keep/gFishInAirAnim.h create mode 100644 assets/objects/gameplay_keep/gFishInWaterAnim.c create mode 100644 assets/objects/gameplay_keep/gFishInWaterAnim.h diff --git a/assets/objects/gameplay_keep/gFish1Anim.c b/assets/objects/gameplay_keep/gFish1Anim.c deleted file mode 100644 index 64dc61543db..00000000000 --- a/assets/objects/gameplay_keep/gFish1Anim.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "gFish1Anim.h" - -s16 gFish1FrameData[] = { -#include "assets/objects/gameplay_keep/gFish1FrameData.inc.c" -}; - -JointIndex gFish1JointIndices[] = { -#include "assets/objects/gameplay_keep/gFish1JointIndices.inc.c" -}; - -AnimationHeader gFish1Anim = { -#include "assets/objects/gameplay_keep/gFish1Anim.inc.c" -}; diff --git a/assets/objects/gameplay_keep/gFish1Anim.h b/assets/objects/gameplay_keep/gFish1Anim.h deleted file mode 100644 index 91e9beec1b7..00000000000 --- a/assets/objects/gameplay_keep/gFish1Anim.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GAMEPLAY_KEEP_GFISH1ANIM_H -#define GAMEPLAY_KEEP_GFISH1ANIM_H - -#include "animation.h" - -extern s16 gFish1FrameData[]; -extern JointIndex gFish1JointIndices[]; -extern AnimationHeader gFish1Anim; - -#endif diff --git a/assets/objects/gameplay_keep/gFish2Anim.c b/assets/objects/gameplay_keep/gFish2Anim.c deleted file mode 100644 index fce5a386ac3..00000000000 --- a/assets/objects/gameplay_keep/gFish2Anim.c +++ /dev/null @@ -1,13 +0,0 @@ -#include "gFish2Anim.h" - -s16 gFish2FrameData[] = { -#include "assets/objects/gameplay_keep/gFish2FrameData.inc.c" -}; - -JointIndex gFish2JointIndices[] = { -#include "assets/objects/gameplay_keep/gFish2JointIndices.inc.c" -}; - -AnimationHeader gFish2Anim = { -#include "assets/objects/gameplay_keep/gFish2Anim.inc.c" -}; diff --git a/assets/objects/gameplay_keep/gFish2Anim.h b/assets/objects/gameplay_keep/gFish2Anim.h deleted file mode 100644 index d23dfdd127a..00000000000 --- a/assets/objects/gameplay_keep/gFish2Anim.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef GAMEPLAY_KEEP_GFISH2ANIM_H -#define GAMEPLAY_KEEP_GFISH2ANIM_H - -#include "animation.h" - -extern s16 gFish2FrameData[]; -extern JointIndex gFish2JointIndices[]; -extern AnimationHeader gFish2Anim; - -#endif diff --git a/assets/objects/gameplay_keep/gFishInAirAnim.c b/assets/objects/gameplay_keep/gFishInAirAnim.c new file mode 100644 index 00000000000..edd8b8084ff --- /dev/null +++ b/assets/objects/gameplay_keep/gFishInAirAnim.c @@ -0,0 +1,13 @@ +#include "gFishInAirAnim.h" + +s16 gFishInAirFrameData[] = { +#include "assets/objects/gameplay_keep/gFishInAirFrameData.inc.c" +}; + +JointIndex gFishInAirJointIndices[] = { +#include "assets/objects/gameplay_keep/gFishInAirJointIndices.inc.c" +}; + +AnimationHeader gFishInAirAnim = { +#include "assets/objects/gameplay_keep/gFishInAirAnim.inc.c" +}; diff --git a/assets/objects/gameplay_keep/gFishInAirAnim.h b/assets/objects/gameplay_keep/gFishInAirAnim.h new file mode 100644 index 00000000000..da6c526f1cd --- /dev/null +++ b/assets/objects/gameplay_keep/gFishInAirAnim.h @@ -0,0 +1,10 @@ +#ifndef GAMEPLAY_KEEP_GFISHINAIRANIM_H +#define GAMEPLAY_KEEP_GFISHINAIRANIM_H + +#include "animation.h" + +extern s16 gFishInAirFrameData[]; +extern JointIndex gFishInAirJointIndices[]; +extern AnimationHeader gFishInAirAnim; + +#endif diff --git a/assets/objects/gameplay_keep/gFishInWaterAnim.c b/assets/objects/gameplay_keep/gFishInWaterAnim.c new file mode 100644 index 00000000000..10c6afb9f1e --- /dev/null +++ b/assets/objects/gameplay_keep/gFishInWaterAnim.c @@ -0,0 +1,13 @@ +#include "gFishInWaterAnim.h" + +s16 gFishInWaterFrameData[] = { +#include "assets/objects/gameplay_keep/gFishInWaterFrameData.inc.c" +}; + +JointIndex gFishInWaterJointIndices[] = { +#include "assets/objects/gameplay_keep/gFishInWaterJointIndices.inc.c" +}; + +AnimationHeader gFishInWaterAnim = { +#include "assets/objects/gameplay_keep/gFishInWaterAnim.inc.c" +}; diff --git a/assets/objects/gameplay_keep/gFishInWaterAnim.h b/assets/objects/gameplay_keep/gFishInWaterAnim.h new file mode 100644 index 00000000000..956d54c2ba6 --- /dev/null +++ b/assets/objects/gameplay_keep/gFishInWaterAnim.h @@ -0,0 +1,10 @@ +#ifndef GAMEPLAY_KEEP_GFISHINWATERANIM_H +#define GAMEPLAY_KEEP_GFISHINWATERANIM_H + +#include "animation.h" + +extern s16 gFishInWaterFrameData[]; +extern JointIndex gFishInWaterJointIndices[]; +extern AnimationHeader gFishInWaterAnim; + +#endif diff --git a/assets/objects/gameplay_keep/gameplay_keep.h b/assets/objects/gameplay_keep/gameplay_keep.h index 8f28bc92159..b9abeab5221 100644 --- a/assets/objects/gameplay_keep/gameplay_keep.h +++ b/assets/objects/gameplay_keep/gameplay_keep.h @@ -44,9 +44,9 @@ #include "gameplay_keep_0x16A50.h" #include "hilite4_tex.h" #include "gameplay_keep_0x173D0.h" -#include "gFish1Anim.h" +#include "gFishInAirAnim.h" #include "gameplay_keep_0x18610.h" -#include "gFish2Anim.h" +#include "gFishInWaterAnim.h" #include "eff_shockwave.h" #include "eff_bubble.h" #include "eff_fire_footprint.h" diff --git a/assets/xml/objects/gameplay_keep.xml b/assets/xml/objects/gameplay_keep.xml index 97d1bebaef6..87788a8bab1 100644 --- a/assets/xml/objects/gameplay_keep.xml +++ b/assets/xml/objects/gameplay_keep.xml @@ -846,7 +846,7 @@ - + @@ -868,7 +868,7 @@ - + diff --git a/spec/objects.inc b/spec/objects.inc index 5b9aceda4ea..3f3d3790ac5 100644 --- a/spec/objects.inc +++ b/spec/objects.inc @@ -44,9 +44,9 @@ beginseg include "$(BUILD_DIR)/assets/objects/gameplay_keep/gameplay_keep_0x16A50.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/hilite4_tex.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/gameplay_keep_0x173D0.o" - include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFish1Anim.o" + include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFishInAirAnim.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/gameplay_keep_0x18610.o" - include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFish2Anim.o" + include "$(BUILD_DIR)/assets/objects/gameplay_keep/gFishInWaterAnim.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/eff_shockwave.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/eff_bubble.o" include "$(BUILD_DIR)/assets/objects/gameplay_keep/eff_fire_footprint.o" diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 991d9d27510..fe920184fbf 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -11,8 +11,8 @@ #include "play_state.h" #include "player.h" -#include "assets/objects/gameplay_keep/gFish1Anim.h" -#include "assets/objects/gameplay_keep/gFish2Anim.h" +#include "assets/objects/gameplay_keep/gFishInAirAnim.h" +#include "assets/objects/gameplay_keep/gFishInWaterAnim.h" #include "assets/objects/gameplay_keep/gameplay_keep_0x18610.h" #define FLAGS 0 @@ -22,40 +22,31 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2); void EnFish_Update(Actor* thisx, PlayState* play); void EnFish_Draw(Actor* thisx, PlayState* play); -f32 func_80A15280(Vec3f* arg0, Vec3f* arg1); -void func_80A152AC(EnFish* this); -void func_80A15310(EnFish* this); -void func_80A15374(EnFish* this); -void func_80A153AC(EnFish* this2); -void func_80A15444(EnFish* this); -void func_80A155D0(EnFish* this); -s32 func_80A15688(EnFish* this, PlayState* play); -s32 func_80A15774(EnFish* this, PlayState* play); -void func_80A157A4(EnFish* this); -void func_80A157FC(EnFish* this, PlayState* play); -void func_80A158EC(EnFish* this); -void func_80A15944(EnFish* this, PlayState* play); -void func_80A15AD4(EnFish* this); -void func_80A15B2C(EnFish* this, PlayState* play); -void func_80A15D18(EnFish* this); -void func_80A15D68(EnFish* this, PlayState* play); -void func_80A15F24(EnFish* this); -void func_80A15F84(EnFish* this, PlayState* play); -void func_80A160BC(EnFish* this); -void func_80A16200(EnFish* this, PlayState* play); -void func_80A163DC(EnFish* this); -void func_80A16450(EnFish* this, PlayState* play); -void func_80A16618(EnFish* this); -void func_80A16670(EnFish* this, PlayState* play); -void func_80A16898(EnFish* this, PlayState* play); -void func_80A169C8(EnFish* this, PlayState* play); -void func_80A16A64(EnFish* this, PlayState* play); -void func_80A16C68(EnFish* this, PlayState* play); -void func_80A16DEC(EnFish* this, PlayState* play); - -static EnFish* D_80A17010 = NULL; -static f32 D_80A17014 = 0.0f; -static f32 D_80A17018 = 0.0f; +void EnFish_SetupStay________(EnFish* this); +void EnFish_Stay_______(EnFish* this, PlayState* play); +void EnFish_SetupFollowOtherFishIfAny________________(EnFish* this); +void EnFish_FollowOtherFishIfAny________________(EnFish* this, PlayState* play); +void EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this); +void EnFish_SwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this, PlayState* play); +void EnFish_SetupFollowPlayer_____________(EnFish* this); +void EnFish_FollowPlayer______________(EnFish* this, PlayState* play); +void EnFish_SetupDropped(EnFish* this); +void EnFish_Dropped_(EnFish* this, PlayState* play); +void EnFish_SetupOnGround______(EnFish* this); +void EnFish_OnGround_________(EnFish* this, PlayState* play); +void EnFish_SetupInWater__(EnFish* this); +void EnFish_EventuallyDispawn___(EnFish* this, PlayState* play); +void EnFish_Setup1_80A16618(EnFish* this); +void EnFish_SwimTinyPond___(EnFish* this, PlayState* play); +void EnFish_JabuCutsceneCue1_(EnFish* this, PlayState* play); +void EnFish_JabuCutsceneCue2_(EnFish* this, PlayState* play); +void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play); +void EnFish_UpdateImpl_(EnFish* this, PlayState* play); +void EnFish_UpdateWaitReappear_(EnFish* this, PlayState* play); + +static EnFish* sJabuCutsceneFish___ = NULL; +static f32 sJabuCutsceneOffsetY____ = 0.0f; +static f32 sJabuCutsceneOffsetYSpeed____ = 0.0f; static ColliderJntSphElementInit sJntSphElementsInit[] = { { @@ -104,82 +95,82 @@ static InitChainEntry sInitChain[4] = { }; typedef struct struct_80A17080 { - /* 0x0 */ f32 unk0; - /* 0x4 */ f32 unk4; - /* 0x8 */ f32 unk8; -} struct_80A17080; // size = 0xC -static struct_80A17080 D_80A17080 = { 0.0f, 0.04f, 0.09f }; -static struct_80A17080 D_80A1708C = { 0.5f, 0.1f, 0.15f }; + /* 0x0 */ f32 target; + /* 0x4 */ f32 fraction; + /* 0x8 */ f32 step; +} EnFishSpeedParams; // size = 0xC +static EnFishSpeedParams sStaySpeedParams = { 0.0f, 0.04f, 0.09f }; +static EnFishSpeedParams sMoveSpeedParams = { 0.5f, 0.1f, 0.15f }; -f32 func_80A15280(Vec3f* arg0, Vec3f* arg1) { - f32 temp_fa0; - f32 temp_fv1; +f32 EnFish_DistXZSq(Vec3f* posA, Vec3f* posB) { + f32 dz; + f32 dx; - temp_fv1 = arg0->x - arg1->x; - temp_fa0 = arg0->z - arg1->z; - return SQ(temp_fv1) + SQ(temp_fa0); + dx = posA->x - posB->x; + dz = posA->z - posB->z; + return SQ(dx) + SQ(dz); } -void func_80A152AC(EnFish* this) { - Animation_Change(&this->skelAnime, &gFish2Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish2Anim), +void EnFish_ChangeAnimInWater(EnFish* this) { + Animation_Change(&this->skelAnime, &gFishInWaterAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gFishInWaterAnim), ANIMMODE_LOOP_INTERP, 2.0f); } -void func_80A15310(EnFish* this) { - Animation_Change(&this->skelAnime, &gFish1Anim, 1.0f, 0.0f, Animation_GetLastFrame(&gFish1Anim), +void EnFish_ChangeAnimInAir(EnFish* this) { + Animation_Change(&this->skelAnime, &gFishInAirAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gFishInAirAnim), ANIMMODE_LOOP_INTERP, 2.0f); } -void func_80A15374(EnFish* this) { - this->unk24A = 0x190; +void EnFish_Disappear_(EnFish* this) { + this->reappearTimer = 400; Actor_SetScale(&this->actor, 0.001f); this->actor.draw = NULL; } -void func_80A153AC(EnFish* this2) { +void EnFish_SetupForJabuCutscene____(EnFish* this2) { EnFish* this = this2; - if (D_80A17010 == NULL) { - D_80A17010 = this; + if (sJabuCutsceneFish___ == NULL) { + sJabuCutsceneFish___ = this; Actor_SetScale(&this->actor, 0.01f); this->actor.draw = EnFish_Draw; this->actor.shape.rot.x = 0; this->actor.shape.rot.y = -0x6410; this->actor.shape.rot.z = 0x4000; this->actor.shape.yOffset = 600.0f; - D_80A17014 = 10.0f; - D_80A17018 = 0.0f; + sJabuCutsceneOffsetY____ = 10.0f; + sJabuCutsceneOffsetYSpeed____ = 0.0f; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - func_80A15310(this); + EnFish_ChangeAnimInAir(this); } } -void func_80A15444(EnFish* this) { - D_80A17010 = NULL; - D_80A17014 = 0.0f; - D_80A17018 = 0.0f; +void EnFish_JabuCutsceneClear____(EnFish* this) { + sJabuCutsceneFish___ = NULL; + sJabuCutsceneOffsetY____ = 0.0f; + sJabuCutsceneOffsetYSpeed____ = 0.0f; } void EnFish_Init(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - s16 sp3A; + s16 type; - sp3A = this->actor.params; + type = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFish2Anim, this->unk1F0, this->unk21A, 7); + SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, 7); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - this->actor.colChkInfo.mass = 0x32; - this->unk24C = (s16)(s32)(Rand_ZeroOne() * 65535.5f); - this->unk24E = (s16)(s32)(Rand_ZeroOne() * 65535.5f); - if (sp3A == 0) { + this->actor.colChkInfo.mass = 50; + this->phase1 = (s16)(s32)(Rand_ZeroOne() * 65535.5f); + this->phase2 = (s16)(s32)(Rand_ZeroOne() * 65535.5f); + if (type == EN_FISH_TYPE_DROPPED) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 8.0f); - func_80A15F24(this); - } else if (sp3A == 1) { - func_80A16618(this); + EnFish_SetupDropped(this); + } else if (type == EN_FISH_TYPE_1) { + EnFish_Setup1_80A16618(this); } else { - func_80A157A4(this); + EnFish_SetupStay________(this); } } @@ -190,197 +181,195 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2) { Collider_DestroyJntSph(play, &this->collider); } -void func_80A155D0(EnFish* this) { - this->actor.shape.yOffset += (Math_SinS(this->unk24C) * 10.0f) + (Math_SinS(this->unk24E) * 5.0f); +void EnFish_UpdateBobbing_(EnFish* this) { + this->actor.shape.yOffset += (Math_SinS(this->phase1) * 10.0f) + (Math_SinS(this->phase2) * 5.0f); this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -200.0f, 200.0f); } -s32 func_80A15688(EnFish* this, PlayState* play) { +s32 EnFish_IsInRangeForCatch_(EnFish* this, PlayState* play) { s32 pad; - Actor* temp_v0; - Vec3f sp1C; + Player* player; + Vec3f playerPos; - temp_v0 = play->actorCtx.actorLists[2].head; + player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 32.0f) { - sp1C.x = (Math_SinS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + temp_v0->world.pos.x; - sp1C.y = temp_v0->world.pos.y; - sp1C.z = (Math_CosS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + temp_v0->world.pos.z; - if (func_80A15280(&sp1C, &this->actor.world.pos) <= SQ(20.0f)) { - return 1; + // Add a slight offset towards the fish to the player position. + playerPos.x = (Math_SinS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + player->actor.world.pos.x; + playerPos.y = player->actor.world.pos.y; + playerPos.z = (Math_CosS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + player->actor.world.pos.z; + if (EnFish_DistXZSq(&playerPos, &this->actor.world.pos) <= SQ(20.0f)) { + return true; } } - return 0; + return false; } -s32 func_80A15774(EnFish* this, PlayState* play) { +s32 EnFish_IsCloseToPlayer__(EnFish* this, PlayState* play) { return this->actor.xzDistToPlayer < 60.0f; } -void func_80A157A4(EnFish* this) { +void EnFish_SetupStay________(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->unk248 = Rand_S16Offset(5, 0x23); - this->unk250 = 0; - func_80A152AC(this); - this->unk244 = func_80A157FC; + this->timer = Rand_S16Offset(5, 35); + this->updBgCheckInfoFlags = 0; + EnFish_ChangeAnimInWater(this); + this->actionFunc = EnFish_Stay_______; } -void func_80A157FC(EnFish* this, PlayState* play) { - func_80A155D0(this); +void EnFish_Stay_______(EnFish* this, PlayState* play) { + EnFish_UpdateBobbing_(this); Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.05f, 0.3f, 0.0f); this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.4f) + 0.8f, 2.0f); SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y = this->actor.world.rot.y; - if (this->unk248 <= 0) { - func_80A158EC(this); + if (this->timer <= 0) { + EnFish_SetupFollowOtherFishIfAny________________(this); } else if (this->actor.child == &this->actor) { - func_80A15D18(this); - } else if (func_80A15774(this, play)) { - func_80A15AD4(this); + EnFish_SetupFollowPlayer_____________(this); + } else if (EnFish_IsCloseToPlayer__(this, play)) { + EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(this); } } -void func_80A158EC(EnFish* this) { +void EnFish_SetupFollowOtherFishIfAny________________(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->unk248 = Rand_S16Offset(0xF, 0x2D); - this->unk250 = 0; - func_80A152AC(this); - this->unk244 = func_80A15944; + this->timer = Rand_S16Offset(15, 45); + this->updBgCheckInfoFlags = 0; + EnFish_ChangeAnimInWater(this); + this->actionFunc = EnFish_FollowOtherFishIfAny________________; } -void func_80A15944(EnFish* this, PlayState* play) { +void EnFish_FollowOtherFishIfAny________________(EnFish* this, PlayState* play) { s32 pad; - func_80A155D0(this); + EnFish_UpdateBobbing_(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.08f, 0.4f, 0.0f); - if ((func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) || (this->unk248 < 4)) { + if ((EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) || (this->timer < 4)) { Math_StepToAngleS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 0xBB8); - } else { - if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { - Math_StepToAngleS(&this->actor.world.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos), 0xBB8); - } + } else if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { + Math_StepToAngleS(&this->actor.world.rot.y, + Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos), 0xBB8); } this->actor.shape.rot.y = this->actor.world.rot.y; this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); SkelAnime_Update(&this->skelAnime); - if (this->unk248 <= 0) { - func_80A157A4(this); + if (this->timer <= 0) { + EnFish_SetupStay________(this); } else if (this->actor.child == &this->actor) { - func_80A15D18(this); - } else if (func_80A15774(this, play)) { - func_80A15AD4(this); + EnFish_SetupFollowPlayer_____________(this); + } else if (EnFish_IsCloseToPlayer__(this, play)) { + EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(this); } } -void func_80A15AD4(EnFish* this) { +void EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->unk248 = Rand_S16Offset(0xA, 0x28); - this->unk250 = 0; - func_80A152AC(this); - this->unk244 = func_80A15B2C; + this->timer = Rand_S16Offset(10, 40); + this->updBgCheckInfoFlags = 0; + EnFish_ChangeAnimInWater(this); + this->actionFunc = EnFish_SwimFastFollowOtherIfAnyFleePlayer____________; } -void func_80A15B2C(EnFish* this, PlayState* play) { - s16 temp_v0_2; - s16 var_a1; +void EnFish_SwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this, PlayState* play) { + s16 frames; + s16 yaw; s32 pad2; s16 pad; - s16 sp34; + s16 isCloseToPlayer__; - func_80A155D0(this); - sp34 = func_80A15774(this, play); + EnFish_UpdateBobbing_(this); + isCloseToPlayer__ = EnFish_IsCloseToPlayer__(this, play); Math_SmoothStepToF(&this->actor.speed, 4.2f, 0.08f, 1.4f, 0.0f); - if (func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { - var_a1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); - Math_StepToAngleS(&this->actor.world.rot.y, var_a1, 0xBB8); - } else { - if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { - var_a1 = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos); - Math_StepToAngleS(&this->actor.world.rot.y, var_a1, 0x7D0); - } else if (sp34) { - temp_v0_2 = play->state.frames; - if (play) {} - var_a1 = this->actor.yawTowardsPlayer + 0x8000; - if (temp_v0_2 & 0x10) { - if (temp_v0_2 & 0x20) { - var_a1 += 0x2000; - } - } else { - if (temp_v0_2 & 0x20) { - var_a1 -= 0x2000; - } + if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); + Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0xBB8); + } else if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos); + Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0x7D0); + } else if (isCloseToPlayer__) { + frames = play->state.frames; + if (play) {} + yaw = this->actor.yawTowardsPlayer + 0x8000; + if (frames & 0x10) { + if (frames & 0x20) { + yaw += 0x2000; + } + } else { + if (frames & 0x20) { + yaw -= 0x2000; } - Math_StepToAngleS(&this->actor.world.rot.y, var_a1, 0x7D0); } + Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0x7D0); } this->actor.shape.rot.y = this->actor.world.rot.y; this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); SkelAnime_Update(&this->skelAnime); - if ((this->unk248 <= 0) || !sp34) { - func_80A157A4(this); + if ((this->timer <= 0) || !isCloseToPlayer__) { + EnFish_SetupStay________(this); } else if (this->actor.child == &this->actor) { - func_80A15D18(this); + EnFish_SetupFollowPlayer_____________(this); } } -void func_80A15D18(EnFish* this) { +void EnFish_SetupFollowPlayer_____________(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - func_80A152AC(this); - this->unk248 = Rand_S16Offset(0xA, 0x28); - this->unk250 = 0; - this->unk244 = func_80A15D68; + EnFish_ChangeAnimInWater(this); + this->timer = Rand_S16Offset(0xA, 0x28); + this->updBgCheckInfoFlags = 0; + this->actionFunc = EnFish_FollowPlayer______________; } -void func_80A15D68(EnFish* this, PlayState* play) { +void EnFish_FollowPlayer______________(EnFish* this, PlayState* play) { s32 pad; - Player* sp48; + Player* player; s32 pad2; - Vec3f sp38; - s16 v; - s16 temp_a0_2; + Vec3f playerPos; + s16 yaw; + s16 angle; - sp48 = GET_PLAYER(play); - func_80A155D0(this); + player = GET_PLAYER(play); + EnFish_UpdateBobbing_(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.1f, 0.5f, 0.0f); - if (func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) { - v = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); - Math_StepToAngleS(&this->actor.world.rot.y, v, 0xBB8); + if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) { + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); + Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0xBB8); } else { if ((s16)play->state.frames & 0x40) { - temp_a0_2 = (this->actor.yawTowardsPlayer + 0x9000); + angle = (this->actor.yawTowardsPlayer + 0x9000); } else { - temp_a0_2 = (this->actor.yawTowardsPlayer + 0x7000); + angle = (this->actor.yawTowardsPlayer + 0x7000); } - sp38.x = (Math_SinS(temp_a0_2) * 20.0f) + sp48->actor.world.pos.x; - sp38.y = sp48->actor.world.pos.y; - sp38.z = (Math_CosS(temp_a0_2) * 20.0f) + sp48->actor.world.pos.z; - v = Math_Vec3f_Yaw(&this->actor.world.pos, &sp38); - Math_StepToAngleS(&this->actor.world.rot.y, v, 0xBB8); + // Add a slight offset approximately towards the fish to the player position. + playerPos.x = (Math_SinS(angle) * 20.0f) + player->actor.world.pos.x; + playerPos.y = player->actor.world.pos.y; + playerPos.z = (Math_CosS(angle) * 20.0f) + player->actor.world.pos.z; + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &playerPos); + Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0xBB8); } this->actor.shape.rot.y = this->actor.world.rot.y; this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); SkelAnime_Update(&this->skelAnime); - if (this->unk248 <= 0) { - func_80A157A4(this); + if (this->timer <= 0) { + EnFish_SetupStay________(this); } } -void func_80A15F24(EnFish* this) { +void EnFish_SetupDropped(EnFish* this) { this->actor.gravity = -1.0f; this->actor.minVelocityY = -10.0f; this->actor.shape.yOffset = 0.0f; - func_80A15310(this); - this->unk250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; - this->unk244 = func_80A15F84; - this->unk248 = 0x12C; + EnFish_ChangeAnimInAir(this); + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; + this->actionFunc = EnFish_Dropped_; + this->timer = 300; } -void func_80A15F84(EnFish* this, PlayState* play) { +void EnFish_Dropped_(EnFish* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.1f, 0.0f); Math_StepToAngleS(&this->actor.world.rot.x, 0x4000, 0x64); Math_StepToAngleS(&this->actor.world.rot.z, -0x4000, 0x64); @@ -389,11 +378,11 @@ void func_80A15F84(EnFish* this, PlayState* play) { this->actor.shape.rot.z = this->actor.world.rot.z; SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk248 = 0x190; - func_80A160BC(this); + this->timer = 400; + EnFish_SetupOnGround______(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - func_80A163DC(this); - } else if ((this->unk248 <= 0) && (this->actor.params == 0) && + EnFish_SetupInWater__(this); + } else if ((this->timer <= 0) && (this->actor.params == EN_FISH_TYPE_DROPPED) && (this->actor.floorHeight < (BGCHECK_Y_MIN + 10.0f))) { PRINTF_COLOR_WARNING(); PRINTF("BG 抜け? Actor_delete します(%s %d)\n", "../z_en_sakana.c", 822); @@ -402,84 +391,84 @@ void func_80A15F84(EnFish* this, PlayState* play) { } } -void func_80A160BC(EnFish* this) { +void EnFish_SetupOnGround______(EnFish* this) { s32 pad[2]; - s32 var_v0; - f32 temp_fv0; + s32 playLeapSfx; + f32 rng; this->actor.gravity = -1.0f; this->actor.minVelocityY = -10.0f; - temp_fv0 = Rand_ZeroOne(); - if (temp_fv0 < 0.1f) { + rng = Rand_ZeroOne(); + if (rng < 0.1f) { this->actor.velocity.y = (Rand_ZeroOne() * 3.0f) + 2.5f; - var_v0 = 1; - } else if (temp_fv0 < 0.2f) { + playLeapSfx = true; + } else if (rng < 0.2f) { this->actor.velocity.y = (Rand_ZeroOne() * 1.2f) + 0.2f; - var_v0 = 1; + playLeapSfx = true; } else { this->actor.velocity.y = 0.0f; if (Rand_ZeroOne() < 0.2f) { - var_v0 = 1; + playLeapSfx = true; } else { - var_v0 = 0; + playLeapSfx = false; } } this->actor.shape.yOffset = 300.0f; - func_80A15310(this); - this->unk244 = func_80A16200; - this->unk250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; - if ((var_v0 != 0) && (this->actor.draw != NULL)) { + EnFish_ChangeAnimInAir(this); + this->actionFunc = EnFish_OnGround_________; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; + if (playLeapSfx && (this->actor.draw != NULL)) { Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); } } -void func_80A16200(EnFish* this, PlayState* play) { - s16 temp_ft1; +void EnFish_OnGround_________(EnFish* this, PlayState* play) { + s16 targetRotX; s16 pad; - s16 temp_v0_sp42; + s16 frames; - temp_v0_sp42 = play->state.frames; // unk9E; + frames = play->state.frames; Math_SmoothStepToF(&this->actor.speed, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); - temp_ft1 = (s16)(s32)((s16)((((temp_v0_sp42 >> 5) & 2) | ((temp_v0_sp42 >> 2) & 1)) * 0x800) * 0.3f); - if (temp_v0_sp42 & 4) { - temp_ft1 = temp_ft1 * -1; + targetRotX = (s16)(s32)((s16)((((frames >> 5) & 2) | ((frames >> 2) & 1)) * 0x800) * 0.3f); + if (frames & 4) { + targetRotX *= -1; } - Math_StepToAngleS(&this->actor.world.rot.x, temp_ft1, 0xFA0); + Math_StepToAngleS(&this->actor.world.rot.x, targetRotX, 0xFA0); Math_StepToAngleS(&this->actor.world.rot.z, 0x4000, 0x3E8); this->actor.world.rot.y += - (s16)(s32)(((Math_SinS(this->unk24C) * 2000.0f) + (Math_SinS(this->unk24E) * 1000.0f)) * Rand_ZeroOne()); + (s16)(s32)(((Math_SinS(this->phase1) * 2000.0f) + (Math_SinS(this->phase2) * 1000.0f)) * Rand_ZeroOne()); this->actor.shape.rot = this->actor.world.rot; SkelAnime_Update(&this->skelAnime); - if (this->unk248 <= 0) { + if (this->timer <= 0) { Actor_Kill(&this->actor); return; } - if (this->unk248 < 0x3D) { - if (temp_v0_sp42 & 4) { + if (this->timer <= 60) { + if (frames & 4) { this->actor.draw = EnFish_Draw; } else { this->actor.draw = NULL; } } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - func_80A163DC(this); + EnFish_SetupInWater__(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - func_80A160BC(this); + EnFish_SetupOnGround______(this); } } -void func_80A163DC(EnFish* this) { +void EnFish_SetupInWater__(EnFish* this) { this->actor.home.pos = this->actor.world.pos; this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->actor.shape.yOffset = 0.0f; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->unk248 = 0xC8; - func_80A152AC(this); - this->unk244 = func_80A16450; - this->unk250 = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; + this->timer = 200; + EnFish_ChangeAnimInWater(this); + this->actionFunc = EnFish_EventuallyDispawn___; + this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; } -void func_80A16450(EnFish* this, PlayState* play) { +void EnFish_EventuallyDispawn___(EnFish* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speed, 2.8f, 0.1f, 0.4f, 0.0f); @@ -496,138 +485,140 @@ void func_80A16450(EnFish* this, PlayState* play) { } else { Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y - 10.0f, 2.0f); } - if (this->unk248 < 0x64) { + if (this->timer < 100) { Actor_SetScale(&this->actor, this->actor.scale.x * 0.982f); } this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 1.0f, 4.0f); SkelAnime_Update(&this->skelAnime); - if (this->unk248 <= 0) { + if (this->timer <= 0) { Actor_Kill(&this->actor); } } -void func_80A16618(EnFish* this) { +void EnFish_Setup1_80A16618(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->unk248 = Rand_S16Offset(5, 0x23); - this->unk250 = 0; - func_80A152AC(this); - this->unk244 = func_80A16670; + this->timer = Rand_S16Offset(5, 0x23); + this->updBgCheckInfoFlags = 0; + EnFish_ChangeAnimInWater(this); + this->actionFunc = EnFish_SwimTinyPond___; } -void func_80A16670(EnFish* this, PlayState* play) { +void EnFish_SwimTinyPond___(EnFish* this, PlayState* play) { s32 pad2; - u32 sp50; - struct_80A17080* var_v0_sp4C; + u32 frames; + EnFishSpeedParams* speedParams; s32 pad3; - f32 sp44; + f32 animPlaySpeedBoost; s32 pad; - sp50 = play->gameplayFrames; + frames = play->gameplayFrames; if (this->actor.xzDistToPlayer < 60.0f) { - if (this->unk248 < 0xC) { - var_v0_sp4C = &D_80A1708C; + if (this->timer < 12) { + speedParams = &sMoveSpeedParams; } else { - var_v0_sp4C = &D_80A17080; + speedParams = &sStaySpeedParams; } } else { - if (this->unk248 < 4) { - var_v0_sp4C = &D_80A1708C; + if (this->timer < 4) { + speedParams = &sMoveSpeedParams; } else { - var_v0_sp4C = &D_80A17080; + speedParams = &sStaySpeedParams; } } - func_80A155D0(this); - Math_SmoothStepToF(&this->actor.speed, var_v0_sp4C->unk0, var_v0_sp4C->unk4, var_v0_sp4C->unk8, 0.0f); - sp44 = 0.0f; - if (func_80A15280(&this->actor.world.pos, &this->actor.home.pos) > SQ(15.0f)) { + EnFish_UpdateBobbing_(this); + Math_SmoothStepToF(&this->actor.speed, speedParams->target, speedParams->fraction, speedParams->step, 0.0f); + animPlaySpeedBoost = 0.0f; + if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(15.0f)) { if (!Math_ScaledStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 0xC8)) { - sp44 = 0.5f; + animPlaySpeedBoost = 0.5f; + } + } else if (this->timer < 4) { + if (!Math_ScaledStepToS(&this->actor.world.rot.y, frames * 0x80, 0x64)) { + animPlaySpeedBoost = 0.5f; } - } else if ((this->unk248 < 4) && !Math_ScaledStepToS(&this->actor.world.rot.y, sp50 * 0x80, 0x64)) { - sp44 = 0.5f; } this->actor.shape.rot.y = this->actor.world.rot.y; //! @bug swapped min and max clamp bounds - this->skelAnime.playSpeed = CLAMP((this->actor.speed * 1.2f) + 0.2f + sp44, 1.5f, 0.5); + this->skelAnime.playSpeed = CLAMP((this->actor.speed * 1.2f) + 0.2f + animPlaySpeedBoost, 1.5f, 0.5); SkelAnime_Update(&this->skelAnime); - if (this->unk248 <= 0) { - this->unk248 = Rand_S16Offset(5, 0x50); + if (this->timer <= 0) { + this->timer = Rand_S16Offset(5, 80); } } -void func_80A16898(EnFish* this, PlayState* play) { +void EnFish_JabuCutsceneCue1_(EnFish* this, PlayState* play) { f32 sp24; f32 sp20; - sp24 = Math_SinS(this->unk24C); - sp20 = Math_SinS(this->unk24E); - D_80A17014 += D_80A17018; - if (D_80A17014 <= 1.0f) { - D_80A17014 = 1.0f; + sp24 = Math_SinS(this->phase1); + sp20 = Math_SinS(this->phase2); + sJabuCutsceneOffsetY____ += sJabuCutsceneOffsetYSpeed____; + if (sJabuCutsceneOffsetY____ <= 1.0f) { + sJabuCutsceneOffsetY____ = 1.0f; if (Rand_ZeroOne() < 0.1f) { - D_80A17018 = (Rand_ZeroOne() * 3.0f) + 2.0f; + sJabuCutsceneOffsetYSpeed____ = (Rand_ZeroOne() * 3.0f) + 2.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); } else { - D_80A17018 = 0.0f; + sJabuCutsceneOffsetYSpeed____ = 0.0f; } } else { - D_80A17018 -= 0.4f; + sJabuCutsceneOffsetYSpeed____ -= 0.4f; } this->skelAnime.playSpeed = ((sp24 + sp20) * 0.5f) + 2.0f; SkelAnime_Update(&this->skelAnime); } -void func_80A169C8(EnFish* this, PlayState* play) { +void EnFish_JabuCutsceneCue2_(EnFish* this, PlayState* play) { s32 pad; f32 sp28; f32 sp24; - sp28 = Math_SinS(this->unk24C); - sp24 = Math_SinS(this->unk24E); + sp28 = Math_SinS(this->phase1); + sp24 = Math_SinS(this->phase2); this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.z += 0x64; - Math_StepToF(&D_80A17014, 0.0f, 1.0f); + Math_StepToF(&sJabuCutsceneOffsetY____, 0.0f, 1.0f); this->skelAnime.playSpeed = ((sp28 + sp24) * 0.5f) + 2.0f; SkelAnime_Update(&this->skelAnime); } -void func_80A16A64(EnFish* this, PlayState* play) { - f32 temp_fv0; +void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play) { + f32 factor; s32 pad; - CsCmdActorCue* sp4C; - Vec3f sp40; - Vec3f sp34; + CsCmdActorCue* cue; + Vec3f startPos; + Vec3f endPos; s32 pad2; - s32 sp2C; + s32 bgId; if (play) {} if (play) {} - sp4C = play->csCtx.actorCues[1]; - if (sp4C == NULL) { + cue = play->csCtx.actorCues[1]; + if (cue == NULL) { if (1) {} PRINTF("Warning : dousa 3 消滅 が呼ばれずにデモが終了した(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1169, this->actor.params); - func_80A15444(this); + EnFish_JabuCutsceneClear____(this); Actor_Kill(&this->actor); return; } - this->unk24C += 0x111; - this->unk24E += 0x500; - switch (sp4C->id) { + this->phase1 += 0x111; + this->phase2 += 0x500; + switch (cue->id) { case 1: - func_80A16898(this, play); + EnFish_JabuCutsceneCue1_(this, play); break; case 2: - func_80A169C8(this, play); + EnFish_JabuCutsceneCue2_(this, play); break; case 3: PRINTF("デモ魚消滅\n"); - func_80A15444(this); + EnFish_JabuCutsceneClear____(this); Actor_Kill(&this->actor); return; @@ -635,33 +626,33 @@ void func_80A16A64(EnFish* this, PlayState* play) { PRINTF("不正なデモ動作(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1200, this->actor.params); break; } - sp40.x = sp4C->startPos.x; - sp40.y = sp4C->startPos.y; - sp40.z = sp4C->startPos.z; - sp34.x = sp4C->endPos.x; - sp34.y = sp4C->endPos.y; - sp34.z = sp4C->endPos.z; - temp_fv0 = Environment_LerpWeight(sp4C->endFrame, sp4C->startFrame, play->csCtx.curFrame); - this->actor.world.pos.x = ((sp34.x - sp40.x) * temp_fv0) + sp40.x; - this->actor.world.pos.y = ((sp34.y - sp40.y) * temp_fv0) + sp40.y + D_80A17014; - this->actor.world.pos.z = ((sp34.z - sp40.z) * temp_fv0) + sp40.z; + startPos.x = cue->startPos.x; + startPos.y = cue->startPos.y; + startPos.z = cue->startPos.z; + endPos.x = cue->endPos.x; + endPos.y = cue->endPos.y; + endPos.z = cue->endPos.z; + factor = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); + this->actor.world.pos.x = ((endPos.x - startPos.x) * factor) + startPos.x; + this->actor.world.pos.y = ((endPos.y - startPos.y) * factor) + startPos.y + sJabuCutsceneOffsetY____; + this->actor.world.pos.z = ((endPos.z - startPos.z) * factor) + startPos.z; this->actor.floorHeight = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &sp2C, &this->actor, &this->actor.world.pos); + BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); } -void func_80A16C68(EnFish* this, PlayState* play) { - if (this->unk248 > 0) { - this->unk248--; +void EnFish_UpdateImpl_(EnFish* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; } - this->unk24C += 0x111; - this->unk24E += 0x500; + this->phase1 += 0x111; + this->phase2 += 0x500; if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { this->actor.child = NULL; } - if ((this->unk244 == NULL) || (this->unk244(this, play), (this->actor.update != NULL))) { + if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveXZGravity(&this->actor); - if (this->unk250 != 0) { - Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->unk250); + if (this->updBgCheckInfoFlags != 0) { + Actor_UpdateBgCheckInfo(play, &this->actor, 17.5f, 4.0f, 0.0f, this->updBgCheckInfoFlags); } if (this->actor.xzDistToPlayer < 70.0f) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); @@ -669,36 +660,36 @@ void func_80A16C68(EnFish* this, PlayState* play) { Actor_SetFocus(&this->actor, this->actor.shape.yOffset * 0.01f); if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - if (this->actor.params == 0) { + if (this->actor.params == EN_FISH_TYPE_DROPPED) { Actor_Kill(&this->actor); } else { - func_80A15374(this); + EnFish_Disappear_(this); } - } else if (func_80A15688(this, play) != 0) { + } else if (EnFish_IsInRangeForCatch_(this, play)) { Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 20.0f); } } } -void func_80A16DEC(EnFish* this, PlayState* play) { - f32 var_fv1; +void EnFish_UpdateWaitReappear_(EnFish* this, PlayState* play) { + f32 scale; - if (this->actor.params == 1) { + if (this->actor.params == EN_FISH_TYPE_1) { Actor_Kill(&this->actor); return; } if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { this->actor.child = NULL; } - if ((this->unk244 == NULL) || (this->unk244(this, play), (this->actor.update != NULL))) { + if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveXZGravity(&this->actor); - if (this->unk24A == 0x14) { + if (this->reappearTimer == 20) { this->actor.draw = EnFish_Draw; - } else if (this->unk24A == 0) { + } else if (this->reappearTimer == 0) { Actor_SetScale(&this->actor, 0.01f); - } else if (this->unk24A < 0x14) { - var_fv1 = CLAMP_MAX(this->actor.scale.x + 0.001f, 0.01f); - Actor_SetScale(&this->actor, var_fv1); + } else if (this->reappearTimer < 20) { + scale = CLAMP_MAX(this->actor.scale.x + 0.001f, 0.01f); + Actor_SetScale(&this->actor, scale); } } } @@ -706,17 +697,17 @@ void func_80A16DEC(EnFish* this, PlayState* play) { void EnFish_Update(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - if ((D_80A17010 == NULL) && (this->actor.params == 0) && (play->csCtx.state != CS_STATE_IDLE) && - (play->csCtx.actorCues[1] != NULL)) { - func_80A153AC(this); + if ((sJabuCutsceneFish___ == NULL) && (this->actor.params == EN_FISH_TYPE_DROPPED) && + (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[1] != NULL)) { + EnFish_SetupForJabuCutscene____(this); } - if ((D_80A17010 != NULL) && (D_80A17010 == this)) { - func_80A16A64(this, play); - } else if (this->unk24A > 0) { - this->unk24A--; - func_80A16DEC(this, play); + if ((sJabuCutsceneFish___ != NULL) && (sJabuCutsceneFish___ == this)) { + EnFish_JabuCutsceneUpdate____(this, play); + } else if (this->reappearTimer > 0) { + this->reappearTimer--; + EnFish_UpdateWaitReappear_(this, play); } else { - func_80A16C68(this, play); + EnFish_UpdateImpl_(this, play); } } 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 64eb3e68616..319ce9c3d49 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -4,6 +4,12 @@ #include "ultra64.h" #include "actor.h" +typedef enum EnFishType { + EN_FISH_TYPE_NEG1 = -1, + EN_FISH_TYPE_DROPPED, + EN_FISH_TYPE_1 +} EnFishType; + struct EnFish; typedef struct EnFish { @@ -11,14 +17,14 @@ typedef struct EnFish { /* 0x14C */ ColliderJntSph collider; /* 0x16C */ ColliderJntSphElement colliderElements[1]; /* 0x1AC */ SkelAnime skelAnime; - /* 0x1F0 */ Vec3s unk1F0[7]; - /* 0x21A */ Vec3s unk21A[7]; - /* 0x244 */ void (*unk244)(struct EnFish*, struct PlayState*); - /* 0x248 */ s16 unk248; - /* 0x24A */ s16 unk24A; - /* 0x24C */ s16 unk24C; - /* 0x24E */ s16 unk24E; - /* 0x250 */ s32 unk250; + /* 0x1F0 */ Vec3s jointTable[7]; + /* 0x21A */ Vec3s morphTable[7]; + /* 0x244 */ void (*actionFunc)(struct EnFish*, struct PlayState*); + /* 0x248 */ s16 timer; + /* 0x24A */ s16 reappearTimer; + /* 0x24C */ s16 phase1; + /* 0x24E */ s16 phase2; + /* 0x250 */ s32 updBgCheckInfoFlags; } EnFish; // size = 0x254 #endif 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 238bf69cf6f..ecad3dc55fa 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -5,6 +5,7 @@ */ #include "z_obj_mure.h" +#include "overlays/actors/ovl_En_Fish/z_en_fish.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "libc64/qrand.h" @@ -57,7 +58,7 @@ static s32 sMaxChildSpawns[] = { 12, 9, 8, 0 }; static s16 sSpawnActorIds[] = { ACTOR_EN_KUSA, 0, ACTOR_EN_FISH, ACTOR_EN_INSECT, ACTOR_EN_BUTTE }; -static s16 sSpawnParams[] = { 0, 2, -1, INSECT_TYPE_PERMANENT, -1 }; +static s16 sSpawnParams[] = { 0, 2, EN_FISH_TYPE_NEG1, INSECT_TYPE_PERMANENT, -1 }; static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDistance, 1200, ICHAIN_CONTINUE), diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 18ff635a2d8..a358ff05d55 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -11,6 +11,7 @@ #include "overlays/actors/ovl_En_Box/z_en_box.h" #include "overlays/actors/ovl_En_Door/z_en_door.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "overlays/actors/ovl_En_Fish/z_en_fish.h" #include "overlays/actors/ovl_En_Horse/z_en_horse.h" #include "overlays/actors/ovl_En_Insect/z_en_insect.h" #include "overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.h" @@ -14141,7 +14142,7 @@ void Player_Action_8084EED8(Player* this, PlayState* play) { } static BottleDropInfo D_80854A28[] = { - { ACTOR_EN_FISH, 0 }, + { ACTOR_EN_FISH, EN_FISH_TYPE_DROPPED }, { ACTOR_EN_ICE_HONO, 0 }, { ACTOR_EN_INSECT, INSECT_TYPE_FIRST_DROPPED }, }; From 235368ff73640cfd1a8d255cfb4e2506e6ba1a7e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 30 Jul 2026 20:32:51 +0200 Subject: [PATCH 042/150] fixup --- src/code/kanji_tex.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code/kanji_tex.s b/src/code/kanji_tex.s index b7fda6948f1..cb640a54f37 100644 --- a/src/code/kanji_tex.s +++ b/src/code/kanji_tex.s @@ -172,4 +172,4 @@ DATA(low_codepoints_lookup_table) .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0303, 0x0304, 0x0305, 0x0306, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0307, 0x0308, 0x0309 -ENDDATA(D_800D7288) +ENDDATA(low_codepoints_lookup_table) From adf9d340daef7d968d0079e7d5b5ed8cac4523df Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 07:21:35 +0200 Subject: [PATCH 043/150] finish doc EnFish --- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 253 +++++++++--------- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 6 +- src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c | 2 +- 3 files changed, 137 insertions(+), 124 deletions(-) diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index fe920184fbf..e241830e0c8 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -22,31 +22,31 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2); void EnFish_Update(Actor* thisx, PlayState* play); void EnFish_Draw(Actor* thisx, PlayState* play); -void EnFish_SetupStay________(EnFish* this); -void EnFish_Stay_______(EnFish* this, PlayState* play); -void EnFish_SetupFollowOtherFishIfAny________________(EnFish* this); -void EnFish_FollowOtherFishIfAny________________(EnFish* this, PlayState* play); -void EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this); -void EnFish_SwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this, PlayState* play); -void EnFish_SetupFollowPlayer_____________(EnFish* this); -void EnFish_FollowPlayer______________(EnFish* this, PlayState* play); -void EnFish_SetupDropped(EnFish* this); -void EnFish_Dropped_(EnFish* this, PlayState* play); -void EnFish_SetupOnGround______(EnFish* this); -void EnFish_OnGround_________(EnFish* this, PlayState* play); -void EnFish_SetupInWater__(EnFish* this); -void EnFish_EventuallyDispawn___(EnFish* this, PlayState* play); -void EnFish_Setup1_80A16618(EnFish* this); -void EnFish_SwimTinyPond___(EnFish* this, PlayState* play); -void EnFish_JabuCutsceneCue1_(EnFish* this, PlayState* play); -void EnFish_JabuCutsceneCue2_(EnFish* this, PlayState* play); -void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play); -void EnFish_UpdateImpl_(EnFish* this, PlayState* play); -void EnFish_UpdateWaitReappear_(EnFish* this, PlayState* play); - -static EnFish* sJabuCutsceneFish___ = NULL; -static f32 sJabuCutsceneOffsetY____ = 0.0f; -static f32 sJabuCutsceneOffsetYSpeed____ = 0.0f; +void EnFish_Normal_SetupStay(EnFish* this); +void EnFish_Normal_Stay(EnFish* this, PlayState* play); +void EnFish_Normal_SetupSwim(EnFish* this); +void EnFish_Normal_Swim(EnFish* this, PlayState* play); +void EnFish_Normal_SetupFleePlayer(EnFish* this); +void EnFish_Normal_FleePlayer(EnFish* this, PlayState* play); +void EnFish_Normal_SetupFollowPlayer(EnFish* this); +void EnFish_Normal_FollowPlayer(EnFish* this, PlayState* play); +void EnFish_Dropped_SetupFall(EnFish* this); +void EnFish_Dropped_Fall(EnFish* this, PlayState* play); +void EnFish_Dropped_SetupFlapOnGround(EnFish* this); +void EnFish_Dropped_FlapOnGround(EnFish* this, PlayState* play); +void EnFish_Dropped_SetupSwim(EnFish* this); +void EnFish_Dropped_Swim(EnFish* this, PlayState* play); +void EnFish_TinyPond_SetupSwim(EnFish* this); +void EnFish_TinyPond_Swim(EnFish* this, PlayState* play); +void EnFish_JabuCutscene_CueFlapOnGround(EnFish* this, PlayState* play); +void EnFish_JabuCutscene_CueFly(EnFish* this, PlayState* play); +void EnFish_JabuCutscene_Update(EnFish* this, PlayState* play); +void EnFish_UpdateImpl(EnFish* this, PlayState* play); +void EnFish_UpdateWaitReappear(EnFish* this, PlayState* play); + +static EnFish* sJabuCutsceneFish = NULL; +static f32 sJabuCutsceneOffsetY = 0.0f; +static f32 sJabuCutsceneOffsetYSpeed = 0.0f; static ColliderJntSphElementInit sJntSphElementsInit[] = { { @@ -121,34 +121,34 @@ void EnFish_ChangeAnimInAir(EnFish* this) { ANIMMODE_LOOP_INTERP, 2.0f); } -void EnFish_Disappear_(EnFish* this) { +void EnFish_Disappear(EnFish* this) { this->reappearTimer = 400; Actor_SetScale(&this->actor, 0.001f); this->actor.draw = NULL; } -void EnFish_SetupForJabuCutscene____(EnFish* this2) { +void EnFish_JabuCutscene_Enter(EnFish* this2) { EnFish* this = this2; - if (sJabuCutsceneFish___ == NULL) { - sJabuCutsceneFish___ = this; + if (sJabuCutsceneFish == NULL) { + sJabuCutsceneFish = this; Actor_SetScale(&this->actor, 0.01f); this->actor.draw = EnFish_Draw; this->actor.shape.rot.x = 0; this->actor.shape.rot.y = -0x6410; this->actor.shape.rot.z = 0x4000; this->actor.shape.yOffset = 600.0f; - sJabuCutsceneOffsetY____ = 10.0f; - sJabuCutsceneOffsetYSpeed____ = 0.0f; + sJabuCutsceneOffsetY = 10.0f; + sJabuCutsceneOffsetYSpeed = 0.0f; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; EnFish_ChangeAnimInAir(this); } } -void EnFish_JabuCutsceneClear____(EnFish* this) { - sJabuCutsceneFish___ = NULL; - sJabuCutsceneOffsetY____ = 0.0f; - sJabuCutsceneOffsetYSpeed____ = 0.0f; +void EnFish_JabuCutscene_Clear(EnFish* this) { + sJabuCutsceneFish = NULL; + sJabuCutsceneOffsetY = 0.0f; + sJabuCutsceneOffsetYSpeed = 0.0f; } void EnFish_Init(Actor* thisx, PlayState* play) { @@ -166,11 +166,11 @@ void EnFish_Init(Actor* thisx, PlayState* play) { if (type == EN_FISH_TYPE_DROPPED) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 8.0f); - EnFish_SetupDropped(this); - } else if (type == EN_FISH_TYPE_1) { - EnFish_Setup1_80A16618(this); - } else { - EnFish_SetupStay________(this); + EnFish_Dropped_SetupFall(this); + } else if (type == EN_FISH_TYPE_TINY_POND) { + EnFish_TinyPond_SetupSwim(this); + } else { // EN_FISH_TYPE_NORMAL + EnFish_Normal_SetupStay(this); } } @@ -181,12 +181,12 @@ void EnFish_Destroy(Actor* thisx, PlayState* play2) { Collider_DestroyJntSph(play, &this->collider); } -void EnFish_UpdateBobbing_(EnFish* this) { +void EnFish_UpdateBobbingUpDown(EnFish* this) { this->actor.shape.yOffset += (Math_SinS(this->phase1) * 10.0f) + (Math_SinS(this->phase2) * 5.0f); this->actor.shape.yOffset = CLAMP(this->actor.shape.yOffset, -200.0f, 200.0f); } -s32 EnFish_IsInRangeForCatch_(EnFish* this, PlayState* play) { +s32 EnFish_IsInRangeForCatch(EnFish* this, PlayState* play) { s32 pad; Player* player; Vec3f playerPos; @@ -204,52 +204,54 @@ s32 EnFish_IsInRangeForCatch_(EnFish* this, PlayState* play) { return false; } -s32 EnFish_IsCloseToPlayer__(EnFish* this, PlayState* play) { +s32 EnFish_IsCloseToPlayer(EnFish* this, PlayState* play) { return this->actor.xzDistToPlayer < 60.0f; } -void EnFish_SetupStay________(EnFish* this) { +void EnFish_Normal_SetupStay(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->timer = Rand_S16Offset(5, 35); this->updBgCheckInfoFlags = 0; EnFish_ChangeAnimInWater(this); - this->actionFunc = EnFish_Stay_______; + this->actionFunc = EnFish_Normal_Stay; } -void EnFish_Stay_______(EnFish* this, PlayState* play) { - EnFish_UpdateBobbing_(this); +void EnFish_Normal_Stay(EnFish* this, PlayState* play) { + EnFish_UpdateBobbingUpDown(this); Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.05f, 0.3f, 0.0f); this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.4f) + 0.8f, 2.0f); SkelAnime_Update(&this->skelAnime); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->timer <= 0) { - EnFish_SetupFollowOtherFishIfAny________________(this); - } else if (this->actor.child == &this->actor) { - EnFish_SetupFollowPlayer_____________(this); - } else if (EnFish_IsCloseToPlayer__(this, play)) { - EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(this); + EnFish_Normal_SetupSwim(this); + } else if (this->actor.child == &this->actor) { // see ObjMure + EnFish_Normal_SetupFollowPlayer(this); + } else if (EnFish_IsCloseToPlayer(this, play)) { + EnFish_Normal_SetupFleePlayer(this); } } -void EnFish_SetupFollowOtherFishIfAny________________(EnFish* this) { +void EnFish_Normal_SetupSwim(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->timer = Rand_S16Offset(15, 45); this->updBgCheckInfoFlags = 0; EnFish_ChangeAnimInWater(this); - this->actionFunc = EnFish_FollowOtherFishIfAny________________; + this->actionFunc = EnFish_Normal_Swim; } -void EnFish_FollowOtherFishIfAny________________(EnFish* this, PlayState* play) { +void EnFish_Normal_Swim(EnFish* this, PlayState* play) { s32 pad; - EnFish_UpdateBobbing_(this); + EnFish_UpdateBobbingUpDown(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.08f, 0.4f, 0.0f); if ((EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) || (this->timer < 4)) { + // Move towards home Math_StepToAngleS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 0xBB8); } else if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { + // Follow another fish Math_StepToAngleS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos), 0xBB8); } @@ -257,40 +259,45 @@ void EnFish_FollowOtherFishIfAny________________(EnFish* this, PlayState* play) this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); SkelAnime_Update(&this->skelAnime); if (this->timer <= 0) { - EnFish_SetupStay________(this); + EnFish_Normal_SetupStay(this); } else if (this->actor.child == &this->actor) { - EnFish_SetupFollowPlayer_____________(this); - } else if (EnFish_IsCloseToPlayer__(this, play)) { - EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(this); + EnFish_Normal_SetupFollowPlayer(this); + } else if (EnFish_IsCloseToPlayer(this, play)) { + EnFish_Normal_SetupFleePlayer(this); } } -void EnFish_SetupSwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this) { +void EnFish_Normal_SetupFleePlayer(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; this->timer = Rand_S16Offset(10, 40); this->updBgCheckInfoFlags = 0; EnFish_ChangeAnimInWater(this); - this->actionFunc = EnFish_SwimFastFollowOtherIfAnyFleePlayer____________; + this->actionFunc = EnFish_Normal_FleePlayer; } -void EnFish_SwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this, PlayState* play) { +/** + * Swim much faster until the player is not close or ObjMure signals to follow the player. + */ +void EnFish_Normal_FleePlayer(EnFish* this, PlayState* play) { s16 frames; s16 yaw; s32 pad2; s16 pad; - s16 isCloseToPlayer__; + s16 isCloseToPlayer; - EnFish_UpdateBobbing_(this); - isCloseToPlayer__ = EnFish_IsCloseToPlayer__(this, play); + EnFish_UpdateBobbingUpDown(this); + isCloseToPlayer = EnFish_IsCloseToPlayer(this, play); Math_SmoothStepToF(&this->actor.speed, 4.2f, 0.08f, 1.4f, 0.0f); if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(160.0f)) { + // Too far from home yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0xBB8); } else if ((this->actor.child != NULL) && (this->actor.child != &this->actor)) { + // Follow another fish yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.child->world.pos); Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0x7D0); - } else if (isCloseToPlayer__) { + } else if (isCloseToPlayer) { frames = play->state.frames; if (play) {} yaw = this->actor.yawTowardsPlayer + 0x8000; @@ -308,23 +315,23 @@ void EnFish_SwimFastFollowOtherIfAnyFleePlayer____________(EnFish* this, PlaySta this->actor.shape.rot.y = this->actor.world.rot.y; this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); SkelAnime_Update(&this->skelAnime); - if ((this->timer <= 0) || !isCloseToPlayer__) { - EnFish_SetupStay________(this); + if ((this->timer <= 0) || !isCloseToPlayer) { + EnFish_Normal_SetupStay(this); } else if (this->actor.child == &this->actor) { - EnFish_SetupFollowPlayer_____________(this); + EnFish_Normal_SetupFollowPlayer(this); } } -void EnFish_SetupFollowPlayer_____________(EnFish* this) { +void EnFish_Normal_SetupFollowPlayer(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; EnFish_ChangeAnimInWater(this); - this->timer = Rand_S16Offset(0xA, 0x28); + this->timer = Rand_S16Offset(10, 40); this->updBgCheckInfoFlags = 0; - this->actionFunc = EnFish_FollowPlayer______________; + this->actionFunc = EnFish_Normal_FollowPlayer; } -void EnFish_FollowPlayer______________(EnFish* this, PlayState* play) { +void EnFish_Normal_FollowPlayer(EnFish* this, PlayState* play) { s32 pad; Player* player; s32 pad2; @@ -333,12 +340,14 @@ void EnFish_FollowPlayer______________(EnFish* this, PlayState* play) { s16 angle; player = GET_PLAYER(play); - EnFish_UpdateBobbing_(this); + EnFish_UpdateBobbingUpDown(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.1f, 0.5f, 0.0f); if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) { + // Too far from home yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos); Math_StepToAngleS(&this->actor.world.rot.y, yaw, 0xBB8); } else { + // Follow the player if ((s16)play->state.frames & 0x40) { angle = (this->actor.yawTowardsPlayer + 0x9000); } else { @@ -355,21 +364,21 @@ void EnFish_FollowPlayer______________(EnFish* this, PlayState* play) { this->skelAnime.playSpeed = CLAMP_MAX((this->actor.speed * 1.5f) + 0.8f, 4.0f); SkelAnime_Update(&this->skelAnime); if (this->timer <= 0) { - EnFish_SetupStay________(this); + EnFish_Normal_SetupStay(this); } } -void EnFish_SetupDropped(EnFish* this) { +void EnFish_Dropped_SetupFall(EnFish* this) { this->actor.gravity = -1.0f; this->actor.minVelocityY = -10.0f; this->actor.shape.yOffset = 0.0f; EnFish_ChangeAnimInAir(this); this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; - this->actionFunc = EnFish_Dropped_; + this->actionFunc = EnFish_Dropped_Fall; this->timer = 300; } -void EnFish_Dropped_(EnFish* this, PlayState* play) { +void EnFish_Dropped_Fall(EnFish* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 0.1f, 0.1f, 0.0f); Math_StepToAngleS(&this->actor.world.rot.x, 0x4000, 0x64); Math_StepToAngleS(&this->actor.world.rot.z, -0x4000, 0x64); @@ -379,9 +388,9 @@ void EnFish_Dropped_(EnFish* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->timer = 400; - EnFish_SetupOnGround______(this); + EnFish_Dropped_SetupFlapOnGround(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - EnFish_SetupInWater__(this); + EnFish_Dropped_SetupSwim(this); } else if ((this->timer <= 0) && (this->actor.params == EN_FISH_TYPE_DROPPED) && (this->actor.floorHeight < (BGCHECK_Y_MIN + 10.0f))) { PRINTF_COLOR_WARNING(); @@ -391,7 +400,7 @@ void EnFish_Dropped_(EnFish* this, PlayState* play) { } } -void EnFish_SetupOnGround______(EnFish* this) { +void EnFish_Dropped_SetupFlapOnGround(EnFish* this) { s32 pad[2]; s32 playLeapSfx; f32 rng; @@ -415,14 +424,14 @@ void EnFish_SetupOnGround______(EnFish* this) { } this->actor.shape.yOffset = 300.0f; EnFish_ChangeAnimInAir(this); - this->actionFunc = EnFish_OnGround_________; + this->actionFunc = EnFish_Dropped_FlapOnGround; this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; if (playLeapSfx && (this->actor.draw != NULL)) { Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); } } -void EnFish_OnGround_________(EnFish* this, PlayState* play) { +void EnFish_Dropped_FlapOnGround(EnFish* this, PlayState* play) { s16 targetRotX; s16 pad; s16 frames; @@ -450,13 +459,13 @@ void EnFish_OnGround_________(EnFish* this, PlayState* play) { this->actor.draw = NULL; } } else if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER) { - EnFish_SetupInWater__(this); + EnFish_Dropped_SetupSwim(this); } else if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - EnFish_SetupOnGround______(this); + EnFish_Dropped_SetupFlapOnGround(this); } } -void EnFish_SetupInWater__(EnFish* this) { +void EnFish_Dropped_SetupSwim(EnFish* this) { this->actor.home.pos = this->actor.world.pos; this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; @@ -464,11 +473,11 @@ void EnFish_SetupInWater__(EnFish* this) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->timer = 200; EnFish_ChangeAnimInWater(this); - this->actionFunc = EnFish_EventuallyDispawn___; + this->actionFunc = EnFish_Dropped_Swim; this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2; } -void EnFish_EventuallyDispawn___(EnFish* this, PlayState* play) { +void EnFish_Dropped_Swim(EnFish* this, PlayState* play) { s32 pad; Math_SmoothStepToF(&this->actor.speed, 2.8f, 0.1f, 0.4f, 0.0f); @@ -495,16 +504,16 @@ void EnFish_EventuallyDispawn___(EnFish* this, PlayState* play) { } } -void EnFish_Setup1_80A16618(EnFish* this) { +void EnFish_TinyPond_SetupSwim(EnFish* this) { this->actor.gravity = 0.0f; this->actor.minVelocityY = 0.0f; - this->timer = Rand_S16Offset(5, 0x23); + this->timer = Rand_S16Offset(5, 35); this->updBgCheckInfoFlags = 0; EnFish_ChangeAnimInWater(this); - this->actionFunc = EnFish_SwimTinyPond___; + this->actionFunc = EnFish_TinyPond_Swim; } -void EnFish_SwimTinyPond___(EnFish* this, PlayState* play) { +void EnFish_TinyPond_Swim(EnFish* this, PlayState* play) { s32 pad2; u32 frames; EnFishSpeedParams* speedParams; @@ -526,7 +535,7 @@ void EnFish_SwimTinyPond___(EnFish* this, PlayState* play) { speedParams = &sStaySpeedParams; } } - EnFish_UpdateBobbing_(this); + EnFish_UpdateBobbingUpDown(this); Math_SmoothStepToF(&this->actor.speed, speedParams->target, speedParams->fraction, speedParams->step, 0.0f); animPlaySpeedBoost = 0.0f; if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(15.0f)) { @@ -548,29 +557,29 @@ void EnFish_SwimTinyPond___(EnFish* this, PlayState* play) { } } -void EnFish_JabuCutsceneCue1_(EnFish* this, PlayState* play) { +void EnFish_JabuCutscene_CueFlapOnGround(EnFish* this, PlayState* play) { f32 sp24; f32 sp20; sp24 = Math_SinS(this->phase1); sp20 = Math_SinS(this->phase2); - sJabuCutsceneOffsetY____ += sJabuCutsceneOffsetYSpeed____; - if (sJabuCutsceneOffsetY____ <= 1.0f) { - sJabuCutsceneOffsetY____ = 1.0f; + sJabuCutsceneOffsetY += sJabuCutsceneOffsetYSpeed; + if (sJabuCutsceneOffsetY <= 1.0f) { + sJabuCutsceneOffsetY = 1.0f; if (Rand_ZeroOne() < 0.1f) { - sJabuCutsceneOffsetYSpeed____ = (Rand_ZeroOne() * 3.0f) + 2.0f; + sJabuCutsceneOffsetYSpeed = (Rand_ZeroOne() * 3.0f) + 2.0f; Actor_PlaySfx(&this->actor, NA_SE_EV_FISH_LEAP); } else { - sJabuCutsceneOffsetYSpeed____ = 0.0f; + sJabuCutsceneOffsetYSpeed = 0.0f; } } else { - sJabuCutsceneOffsetYSpeed____ -= 0.4f; + sJabuCutsceneOffsetYSpeed -= 0.4f; } this->skelAnime.playSpeed = ((sp24 + sp20) * 0.5f) + 2.0f; SkelAnime_Update(&this->skelAnime); } -void EnFish_JabuCutsceneCue2_(EnFish* this, PlayState* play) { +void EnFish_JabuCutscene_CueFly(EnFish* this, PlayState* play) { s32 pad; f32 sp28; f32 sp24; @@ -579,12 +588,12 @@ void EnFish_JabuCutsceneCue2_(EnFish* this, PlayState* play) { sp24 = Math_SinS(this->phase2); this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.z += 0x64; - Math_StepToF(&sJabuCutsceneOffsetY____, 0.0f, 1.0f); + Math_StepToF(&sJabuCutsceneOffsetY, 0.0f, 1.0f); this->skelAnime.playSpeed = ((sp28 + sp24) * 0.5f) + 2.0f; SkelAnime_Update(&this->skelAnime); } -void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play) { +void EnFish_JabuCutscene_Update(EnFish* this, PlayState* play) { f32 factor; s32 pad; CsCmdActorCue* cue; @@ -601,7 +610,7 @@ void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play) { if (1) {} PRINTF("Warning : dousa 3 消滅 が呼ばれずにデモが終了した(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1169, this->actor.params); - EnFish_JabuCutsceneClear____(this); + EnFish_JabuCutscene_Clear(this); Actor_Kill(&this->actor); return; } @@ -609,16 +618,16 @@ void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play) { this->phase2 += 0x500; switch (cue->id) { case 1: - EnFish_JabuCutsceneCue1_(this, play); + EnFish_JabuCutscene_CueFlapOnGround(this, play); break; case 2: - EnFish_JabuCutsceneCue2_(this, play); + EnFish_JabuCutscene_CueFly(this, play); break; case 3: PRINTF("デモ魚消滅\n"); - EnFish_JabuCutsceneClear____(this); + EnFish_JabuCutscene_Clear(this); Actor_Kill(&this->actor); return; @@ -634,13 +643,13 @@ void EnFish_JabuCutsceneUpdate____(EnFish* this, PlayState* play) { endPos.z = cue->endPos.z; factor = Environment_LerpWeight(cue->endFrame, cue->startFrame, play->csCtx.curFrame); this->actor.world.pos.x = ((endPos.x - startPos.x) * factor) + startPos.x; - this->actor.world.pos.y = ((endPos.y - startPos.y) * factor) + startPos.y + sJabuCutsceneOffsetY____; + this->actor.world.pos.y = ((endPos.y - startPos.y) * factor) + startPos.y + sJabuCutsceneOffsetY; this->actor.world.pos.z = ((endPos.z - startPos.z) * factor) + startPos.z; this->actor.floorHeight = BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); } -void EnFish_UpdateImpl_(EnFish* this, PlayState* play) { +void EnFish_UpdateImpl(EnFish* this, PlayState* play) { if (this->timer > 0) { this->timer--; } @@ -663,24 +672,26 @@ void EnFish_UpdateImpl_(EnFish* this, PlayState* play) { if (this->actor.params == EN_FISH_TYPE_DROPPED) { Actor_Kill(&this->actor); } else { - EnFish_Disappear_(this); + EnFish_Disappear(this); } - } else if (EnFish_IsInRangeForCatch_(this, play)) { + } else if (EnFish_IsInRangeForCatch(this, play)) { Actor_OfferGetItem(&this->actor, play, GI_MAX, 80.0f, 20.0f); } } } -void EnFish_UpdateWaitReappear_(EnFish* this, PlayState* play) { +void EnFish_UpdateWaitReappear(EnFish* this, PlayState* play) { f32 scale; - if (this->actor.params == EN_FISH_TYPE_1) { + if (this->actor.params == EN_FISH_TYPE_TINY_POND) { Actor_Kill(&this->actor); return; } if ((this->actor.child != NULL) && (this->actor.child->update == NULL) && (this->actor.child != &this->actor)) { this->actor.child = NULL; } + // Note the actionFunc keeps running and the fish keeps moving + // in this state where the fish has disappeared (is invisible) if ((this->actionFunc == NULL) || (this->actionFunc(this, play), (this->actor.update != NULL))) { Actor_MoveXZGravity(&this->actor); if (this->reappearTimer == 20) { @@ -697,17 +708,19 @@ void EnFish_UpdateWaitReappear_(EnFish* this, PlayState* play) { void EnFish_Update(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - if ((sJabuCutsceneFish___ == NULL) && (this->actor.params == EN_FISH_TYPE_DROPPED) && + //! @bug The cutscene stuff is meant for the "give a fish to Jabu" cutscene, + //! but there is no e.g. scene check so the fish can react to other cutscenes too + if ((sJabuCutsceneFish == NULL) && (this->actor.params == EN_FISH_TYPE_DROPPED) && (play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[1] != NULL)) { - EnFish_SetupForJabuCutscene____(this); + EnFish_JabuCutscene_Enter(this); } - if ((sJabuCutsceneFish___ != NULL) && (sJabuCutsceneFish___ == this)) { - EnFish_JabuCutsceneUpdate____(this, play); + if ((sJabuCutsceneFish != NULL) && (sJabuCutsceneFish == this)) { + EnFish_JabuCutscene_Update(this, play); } else if (this->reappearTimer > 0) { this->reappearTimer--; - EnFish_UpdateWaitReappear_(this, play); + EnFish_UpdateWaitReappear(this, play); } else { - EnFish_UpdateImpl_(this, play); + EnFish_UpdateImpl(this, play); } } 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 319ce9c3d49..b1a1b127beb 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -5,9 +5,9 @@ #include "actor.h" typedef enum EnFishType { - EN_FISH_TYPE_NEG1 = -1, - EN_FISH_TYPE_DROPPED, - EN_FISH_TYPE_1 + EN_FISH_TYPE_NORMAL = -1, // Typically ObjMure-handled (also used in some Zora's fountain cutscene layers) + EN_FISH_TYPE_DROPPED, // Dropped by the player + EN_FISH_TYPE_TINY_POND // Used in grottos, the fish doesn't reappear } EnFishType; struct EnFish; 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 ecad3dc55fa..079660453a1 100644 --- a/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -58,7 +58,7 @@ static s32 sMaxChildSpawns[] = { 12, 9, 8, 0 }; static s16 sSpawnActorIds[] = { ACTOR_EN_KUSA, 0, ACTOR_EN_FISH, ACTOR_EN_INSECT, ACTOR_EN_BUTTE }; -static s16 sSpawnParams[] = { 0, 2, EN_FISH_TYPE_NEG1, INSECT_TYPE_PERMANENT, -1 }; +static s16 sSpawnParams[] = { 0, 2, EN_FISH_TYPE_NORMAL, INSECT_TYPE_PERMANENT, -1 }; static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDistance, 1200, ICHAIN_CONTINUE), From 1fbeb15db3c065265fa672414b443217c8f77c13 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 07:31:33 +0200 Subject: [PATCH 044/150] doc z_memory_utils.c --- src/code/z_memory_utils.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/code/z_memory_utils.c b/src/code/z_memory_utils.c index c48820af71e..1941122b0d1 100644 --- a/src/code/z_memory_utils.c +++ b/src/code/z_memory_utils.c @@ -1,5 +1,9 @@ #include "ultra64.h" +#include "memory_utils.h" +/** + * Copy `size` bytes from `src` to `dest`. + */ void* MemCopy(void* dest, void* src, s32 size) { u8* destu = (u8*)dest; u8* srcu = (u8*)src; @@ -12,6 +16,9 @@ void* MemCopy(void* dest, void* src, s32 size) { return dest; } +/** + * Set `size` bytes starting at `dest` to value `val`. + */ void* MemSet(void* dest, s32 val, s32 size) { u8* destu = (u8*)dest; s32 s = size; From 87be8a68d5a5cd065e01ef1c811444536978f1a2 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 07:54:31 +0200 Subject: [PATCH 045/150] vismono improvements --- src/code/game.c | 26 +++++++++++++------------- src/code/z_play.c | 10 +++++----- src/code/z_vismono.c | 11 +++++++++-- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/code/game.c b/src/code/game.c index 4dafafc5657..663825e1434 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -37,7 +37,7 @@ SpeedMeter D_801664D0; struct_801664F0 D_801664F0; struct_80166500 D_80166500; -VisMono sMonoColors; +VisMono sGameStateVisMono; ViMode sViMode; #if DEBUG_FEATURES @@ -80,16 +80,16 @@ void GameState_SetFBFilter(Gfx** gfx) { D_80166500.envColor.a = R_FB_FILTER_A; func_800AD958(&D_80166500, &gfxP); } else if (R_FB_FILTER_TYPE == 7) { - sMonoColors.unk_00 = 0; - sMonoColors.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sMonoColors.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sMonoColors.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sMonoColors.primColor.a = R_FB_FILTER_A; - sMonoColors.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sMonoColors.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sMonoColors.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sMonoColors.envColor.a = R_FB_FILTER_A; - VisMono_Draw(&sMonoColors, &gfxP); + sGameStateVisMono.unk_00 = 0; + sGameStateVisMono.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sGameStateVisMono.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sGameStateVisMono.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sGameStateVisMono.primColor.a = R_FB_FILTER_A; + sGameStateVisMono.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sGameStateVisMono.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sGameStateVisMono.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sGameStateVisMono.envColor.a = R_FB_FILTER_A; + VisMono_Draw(&sGameStateVisMono, &gfxP); } *gfx = gfxP; } @@ -497,7 +497,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g LOG_UTILS_CHECK_NULL_POINTER("this->cleanup", gameState->destroy, "../game.c", 1088); func_800ACE70(&D_801664F0); func_800AD920(&D_80166500); - VisMono_Init(&sMonoColors); + VisMono_Init(&sGameStateVisMono); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Init(&sViMode); } @@ -528,7 +528,7 @@ void GameState_Destroy(GameState* gameState) { SpeedMeter_Destroy(&D_801664D0); func_800ACE90(&D_801664F0); func_800AD950(&D_80166500); - VisMono_Destroy(&sMonoColors); + VisMono_Destroy(&sGameStateVisMono); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Destroy(&sViMode); } diff --git a/src/code/z_play.c b/src/code/z_play.c index 894d9a520e4..0baf1d8fd41 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -52,7 +52,7 @@ TransitionTile gTransitionTile; s32 gTransitionTileState; -VisMono D_80161498; +VisMono sPlayVisMono; Color_RGBA8_u32 gVisMonoColor; #if DEBUG_FEATURES @@ -261,7 +261,7 @@ void Play_Destroy(GameState* thisx) { Letterbox_Destroy(); TransitionFade_Destroy(&this->transitionFadeFlash); - VisMono_Destroy(&D_80161498); + VisMono_Destroy(&sPlayVisMono); if (gSaveContext.save.linkAge != this->linkAgeOnLoad) { Inventory_SwapAgeEquipment(); @@ -482,7 +482,7 @@ void Play_Init(GameState* thisx) { TransitionFade_SetType(&this->transitionFadeFlash, TRANS_INSTANCE_TYPE_FADE_FLASH); TransitionFade_SetColor(&this->transitionFadeFlash, RGBA8(160, 160, 160, 255)); TransitionFade_Start(&this->transitionFadeFlash); - VisMono_Init(&D_80161498); + VisMono_Init(&sPlayVisMono); gVisMonoColor.a = 0; CutsceneFlags_UnsetAll(this); @@ -1217,8 +1217,8 @@ void Play_Draw(PlayState* this) { if (gVisMonoColor.a > 0) #endif { - D_80161498.primColor.rgba = gVisMonoColor.rgba; - VisMono_Draw(&D_80161498, &gfxP); + sPlayVisMono.primColor.rgba = gVisMonoColor.rgba; + VisMono_Draw(&sPlayVisMono, &gfxP); } gSPEndDisplayList(gfxP++); diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index c21c2889471..ea93219a139 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,5 +1,11 @@ /** * Color frame buffer effect to desaturate the colors. + * + * This effect is achieved by making the RDP read the rgba16 framebuffer as a ci8 texture using a specific ia16 palette. + * For every two-bytes pixel in the rgba16 framebuffer, the palette maps in particular an intensity to the high byte and + * an alpha value to the low byte. The sum of those intensity and alpha value corresponds to the gray level of the + * desaturated color. This sum is done by the RDP with a clever setup of texture tiles and an adequate combiner. + * See the rest of the file for specifics. */ #include "libc64/malloc.h" @@ -11,8 +17,8 @@ // Height of the fragments the color frame buffer (CFB) is split into. // It is the maximum amount of lines such that all rgba16 SCREEN_WIDTH-long lines fit into -// the half of tmem (0x800 bytes) dedicated to color-indexed data. -#define VISMONO_CFBFRAG_HEIGHT (0x800 / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) +// the half of tmem dedicated to color-indexed data. +#define VISMONO_CFBFRAG_HEIGHT ((TMEM_SIZE / 2) / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES)) // Maximum size of the dlist written by `VisMono_DesaturateDList`. // `VisMono_DesaturateDList` consistently uses `VISMONO_DLSIZE - 2` double words, so this can be 2 less. @@ -99,6 +105,7 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) { // Set texel 1 to be a CI8 image with width `SCREEN_WIDTH * 2` and height `VISMONO_CFBFRAG_HEIGHT` // Its position in texture image space is shifted along +S by 1 + // (palette is set to 1 here but that's ignored in the case of CI8 where there is only one palette) gDPSetTile(gfx++, G_IM_FMT_CI, G_IM_SIZ_8b, SCREEN_WIDTH * 2 * G_IM_SIZ_8b_LINE_BYTES / 8, 0x0, 1, 1, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0, G_TX_NOMIRROR | G_TX_CLAMP, 0, 0); gDPSetTileSize(gfx++, 1, 1 << 2, 0, (SCREEN_WIDTH * 2) << 2, (height - 1) << 2); From 54a83e60f69c8faf6337468639abd4acce287c8c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 08:50:55 +0200 Subject: [PATCH 046/150] doc VisCvg --- include/vis.h | 19 +++++--- spec/spec | 2 +- src/code/game.c | 18 ++++---- src/code/z_play.c | 4 +- src/code/{code_800ACE70.c => z_viscvg.c} | 55 ++++++++++++++---------- 5 files changed, 57 insertions(+), 41 deletions(-) rename src/code/{code_800ACE70.c => z_viscvg.c} (67%) diff --git a/include/vis.h b/include/vis.h index 561dfe95ce6..07f2a3b8741 100644 --- a/include/vis.h +++ b/include/vis.h @@ -4,13 +4,20 @@ #include "ultra64.h" #include "color.h" -// Vis... -typedef struct struct_801664F0 { +typedef enum VisCvgType { + VISCVG_TYPE_NOP, + VISCVG_TYPE_MODULATE_FB, + VISCVG_TYPE_FADE_AND_MODULATE_FB, + VISCVG_TYPE_MODULATE_COLOR, + VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR +} VisCvgType; + +typedef struct VisCvg { /* 0x00 */ u32 type; /* 0x04 */ u32 setScissor; /* 0x08 */ Color_RGBA8_u32 color; /* 0x0C */ Color_RGBA8_u32 envColor; -} struct_801664F0; // size = 0x10 +} VisCvg; // size = 0x10 typedef struct VisMono { /* 0x00 */ u32 unk_00; @@ -29,9 +36,9 @@ typedef struct struct_80166500 { /* 0x08 */ Color_RGBA8_u32 envColor; } struct_80166500; // size = 0x10 -void func_800ACE70(struct_801664F0* this); -void func_800ACE90(struct_801664F0* this); -void func_800ACE98(struct_801664F0* this, Gfx** gfxp); +void VisCvg_Init(VisCvg* this); +void VisCvg_Destroy(VisCvg* this); +void VisCvg_Draw(VisCvg* this, Gfx** gfxp); void VisMono_Init(VisMono* this); void VisMono_Destroy(VisMono* this); void VisMono_Draw(VisMono* this, Gfx** gfxp); diff --git a/spec/spec b/spec/spec index 3bb910ac94e..05cac48d861 100644 --- a/spec/spec +++ b/spec/spec @@ -592,7 +592,7 @@ beginseg include "$(BUILD_DIR)/data/unk_8012ABC0.data.o" include "$(BUILD_DIR)/src/code/z_view.o" include "$(BUILD_DIR)/src/code/z_vimode.o" - include "$(BUILD_DIR)/src/code/code_800ACE70.o" + include "$(BUILD_DIR)/src/code/z_viscvg.o" include "$(BUILD_DIR)/src/code/z_vismono.o" include "$(BUILD_DIR)/src/code/code_800AD920.o" include "$(BUILD_DIR)/src/code/z_vr_box.o" diff --git a/src/code/game.c b/src/code/game.c index 663825e1434..7ca616e702b 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -35,7 +35,7 @@ #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" SpeedMeter D_801664D0; -struct_801664F0 D_801664F0; +VisCvg sGameStateVisCvg; struct_80166500 D_80166500; VisMono sGameStateVisMono; ViMode sViMode; @@ -62,12 +62,12 @@ void GameState_SetFBFilter(Gfx** gfx) { Gfx* gfxP = *gfx; if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) { - D_801664F0.type = R_FB_FILTER_TYPE; - D_801664F0.color.r = R_FB_FILTER_PRIM_COLOR(0); - D_801664F0.color.g = R_FB_FILTER_PRIM_COLOR(1); - D_801664F0.color.b = R_FB_FILTER_PRIM_COLOR(2); - D_801664F0.color.a = R_FB_FILTER_A; - func_800ACE98(&D_801664F0, &gfxP); + sGameStateVisCvg.type = R_FB_FILTER_TYPE; + sGameStateVisCvg.color.r = R_FB_FILTER_PRIM_COLOR(0); + sGameStateVisCvg.color.g = R_FB_FILTER_PRIM_COLOR(1); + sGameStateVisCvg.color.b = R_FB_FILTER_PRIM_COLOR(2); + sGameStateVisCvg.color.a = R_FB_FILTER_A; + VisCvg_Draw(&sGameStateVisCvg, &gfxP); } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { D_80166500.useRgba = (R_FB_FILTER_TYPE == 6); D_80166500.primColor.r = R_FB_FILTER_PRIM_COLOR(0); @@ -495,7 +495,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g startTime = endTime; LOG_UTILS_CHECK_NULL_POINTER("this->cleanup", gameState->destroy, "../game.c", 1088); - func_800ACE70(&D_801664F0); + VisCvg_Init(&sGameStateVisCvg); func_800AD920(&D_80166500); VisMono_Init(&sGameStateVisMono); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { @@ -526,7 +526,7 @@ void GameState_Destroy(GameState* gameState) { } Rumble_Destroy(); SpeedMeter_Destroy(&D_801664D0); - func_800ACE90(&D_801664F0); + VisCvg_Destroy(&sGameStateVisCvg); func_800AD950(&D_80166500); VisMono_Destroy(&sGameStateVisMono); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 0baf1d8fd41..7e88fa03a64 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -47,8 +47,8 @@ #include "save.h" #include "vis.h" -#pragma increment_block_number "gc-eu:227 gc-eu-mq:227 gc-jp:227 gc-jp-ce:227 gc-jp-mq:227 gc-us:227 gc-us-mq:227" \ - "ique-cn:227 ntsc-1.0:227 ntsc-1.1:227 ntsc-1.2:227 pal-1.0:227 pal-1.1:227" +#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ + "ique-cn:224 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" TransitionTile gTransitionTile; s32 gTransitionTileState; diff --git a/src/code/code_800ACE70.c b/src/code/z_viscvg.c similarity index 67% rename from src/code/code_800ACE70.c rename to src/code/z_viscvg.c index aa53aeb36fc..35bfec4b4b8 100644 --- a/src/code/code_800ACE70.c +++ b/src/code/z_viscvg.c @@ -1,11 +1,16 @@ +/** + * This file implements framebuffer effects relying on coverage. + * Coverage's primary use is performing antialiasing: it basically tracks how much of a pixel is covered by its current + * color. Coverage is stored in a rgba16 framebuffer as a 3 bits value. + * Coverage is typically partial on geometry outer edges and full elsewhere: this makes the framebuffer effects here + * usually highlight silhouettes. + */ + #include "ultra64.h" #include "gfx.h" #include "vis.h" -// Note : This file is related to z_vismono, the original name was probably z_vis - -Gfx D_8012AC00[] = { +Gfx sVisCvgModulateBlendColorDL[] = { gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_VISCVG | G_RM_VISCVG2), @@ -15,33 +20,36 @@ Gfx D_8012AC00[] = { gsSPEndDisplayList(), }; -Gfx D_8012AC28[] = { +Gfx sVisCvgModulateFramebufferAdditiveFogDL[] = { gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | + // Note: additive blending often overflows the blender, causing visual bugs GBL_c1(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM) | GBL_c2(G_BL_CLR_FOG, G_BL_A_FOG, G_BL_CLR_MEM, G_BL_A_MEM)), gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), gsSPEndDisplayList(), }; -Gfx D_8012AC40[] = { +Gfx sVisCvgModulateFramebufferDL[] = { gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM) | GBL_c2(G_BL_CLR_IN, G_BL_0, G_BL_CLR_MEM, G_BL_A_MEM)), - gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), gsSPEndDisplayList(), }; -Gfx D_8012AC58[] = { +Gfx sVisCvgFadeToPrimAndModulateFramebuffer[] = { + // Fade the framebuffer towards prim color gsDPSetCombineMode(G_CC_PRIMITIVE, G_CC_PRIMITIVE), gsDPSetOtherMode(G_AD_NOTPATTERN | G_CD_DISABLE | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, + // Note: G_RM_CLD_SURF sets CVG_DST_SAVE which preserves coverage G_AC_NONE | G_ZS_PRIM | G_RM_CLD_SURF | G_RM_CLD_SURF2), gsDPFillRectangle(0, 0, SCREEN_WIDTH - 1, SCREEN_HEIGHT - 1), + // Like sVisCvgModulateFramebufferDL gsDPSetOtherMode(G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | IM_RD | CVG_DST_CLAMP | ZMODE_OPA | FORCE_BL | @@ -51,9 +59,8 @@ Gfx D_8012AC58[] = { gsSPEndDisplayList(), }; -// Init -void func_800ACE70(struct_801664F0* this) { - this->type = 0; +void VisCvg_Init(VisCvg* this) { + this->type = VISCVG_TYPE_NOP; this->setScissor = false; this->color.r = 255; this->color.g = 255; @@ -61,15 +68,14 @@ void func_800ACE70(struct_801664F0* this) { this->color.a = 255; } -// Destroy -void func_800ACE90(struct_801664F0* this) { +void VisCvg_Destroy(VisCvg* this) { } -// Draw -void func_800ACE98(struct_801664F0* this, Gfx** gfxp) { +void VisCvg_Draw(VisCvg* this, Gfx** gfxp) { Gfx* gfx = *gfxp; gDPPipeSync(gfx++); + // Primitive depth and G_ZS_PRIM are set but this is useless since neither Z_CMD nor Z_UPD are set. gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); if (this->setScissor == true) { @@ -77,20 +83,23 @@ void func_800ACE98(struct_801664F0* this, Gfx** gfxp) { } switch (this->type) { - case 1: - gSPDisplayList(gfx++, D_8012AC40); + case VISCVG_TYPE_MODULATE_FB: + gSPDisplayList(gfx++, sVisCvgModulateFramebufferDL); break; - case 2: + + case VISCVG_TYPE_FADE_AND_MODULATE_FB: gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); - gSPDisplayList(gfx++, D_8012AC58); + gSPDisplayList(gfx++, sVisCvgFadeToPrimAndModulateFramebuffer); break; - case 3: + + case VISCVG_TYPE_MODULATE_COLOR: gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba); - gSPDisplayList(gfx++, D_8012AC00); + gSPDisplayList(gfx++, sVisCvgModulateBlendColorDL); break; - case 4: + + case VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR: gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba); - gSPDisplayList(gfx++, D_8012AC28); + gSPDisplayList(gfx++, sVisCvgModulateFramebufferAdditiveFogDL); break; } From 54fed584368c1c21b5ad1d8bbceb8cb4cb855e23 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 08:52:31 +0200 Subject: [PATCH 047/150] doc VisZBuffer --- include/vis.h | 13 +++++----- spec/spec | 2 +- src/code/game.c | 26 ++++++++++---------- src/code/{code_800AD920.c => z_viszbuffer.c} | 22 ++++++++++------- undefined_syms.txt | 2 +- 5 files changed, 35 insertions(+), 30 deletions(-) rename src/code/{code_800AD920.c => z_viszbuffer.c} (73%) diff --git a/include/vis.h b/include/vis.h index 07f2a3b8741..5ac68bbd796 100644 --- a/include/vis.h +++ b/include/vis.h @@ -28,22 +28,23 @@ typedef struct VisMono { /* 0x14 */ Gfx* dList; } VisMono; // size = 0x18 -// Vis... -typedef struct struct_80166500 { +typedef struct VisZBuffer { /* 0x00 */ u32 useRgba; /* 0x04 */ u32 setScissor; /* 0x08 */ Color_RGBA8_u32 primColor; /* 0x08 */ Color_RGBA8_u32 envColor; -} struct_80166500; // size = 0x10 +} VisZBuffer; // size = 0x10 void VisCvg_Init(VisCvg* this); void VisCvg_Destroy(VisCvg* this); void VisCvg_Draw(VisCvg* this, Gfx** gfxp); + void VisMono_Init(VisMono* this); void VisMono_Destroy(VisMono* this); void VisMono_Draw(VisMono* this, Gfx** gfxp); -void func_800AD920(struct_80166500* this); -void func_800AD950(struct_80166500* this); -void func_800AD958(struct_80166500* this, Gfx** gfxp); + +void VisZBuffer_Init(VisZBuffer* this); +void VisZBuffer_Destroy(VisZBuffer* this); +void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp); #endif diff --git a/spec/spec b/spec/spec index 05cac48d861..028ef286041 100644 --- a/spec/spec +++ b/spec/spec @@ -594,7 +594,7 @@ beginseg include "$(BUILD_DIR)/src/code/z_vimode.o" include "$(BUILD_DIR)/src/code/z_viscvg.o" include "$(BUILD_DIR)/src/code/z_vismono.o" - include "$(BUILD_DIR)/src/code/code_800AD920.o" + include "$(BUILD_DIR)/src/code/z_viszbuffer.o" include "$(BUILD_DIR)/src/code/z_vr_box.o" include "$(BUILD_DIR)/src/code/z_vr_box_draw.o" include "$(BUILD_DIR)/src/code/z_player_call.o" diff --git a/src/code/game.c b/src/code/game.c index 7ca616e702b..4050baf9e3d 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -36,7 +36,7 @@ SpeedMeter D_801664D0; VisCvg sGameStateVisCvg; -struct_80166500 D_80166500; +VisZBuffer sGameStateVisZBuffer; VisMono sGameStateVisMono; ViMode sViMode; @@ -69,16 +69,16 @@ void GameState_SetFBFilter(Gfx** gfx) { sGameStateVisCvg.color.a = R_FB_FILTER_A; VisCvg_Draw(&sGameStateVisCvg, &gfxP); } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { - D_80166500.useRgba = (R_FB_FILTER_TYPE == 6); - D_80166500.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - D_80166500.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - D_80166500.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - D_80166500.primColor.a = R_FB_FILTER_A; - D_80166500.envColor.r = R_FB_FILTER_ENV_COLOR(0); - D_80166500.envColor.g = R_FB_FILTER_ENV_COLOR(1); - D_80166500.envColor.b = R_FB_FILTER_ENV_COLOR(2); - D_80166500.envColor.a = R_FB_FILTER_A; - func_800AD958(&D_80166500, &gfxP); + sGameStateVisZBuffer.useRgba = (R_FB_FILTER_TYPE == 6); + sGameStateVisZBuffer.primColor.r = R_FB_FILTER_PRIM_COLOR(0); + sGameStateVisZBuffer.primColor.g = R_FB_FILTER_PRIM_COLOR(1); + sGameStateVisZBuffer.primColor.b = R_FB_FILTER_PRIM_COLOR(2); + sGameStateVisZBuffer.primColor.a = R_FB_FILTER_A; + sGameStateVisZBuffer.envColor.r = R_FB_FILTER_ENV_COLOR(0); + sGameStateVisZBuffer.envColor.g = R_FB_FILTER_ENV_COLOR(1); + sGameStateVisZBuffer.envColor.b = R_FB_FILTER_ENV_COLOR(2); + sGameStateVisZBuffer.envColor.a = R_FB_FILTER_A; + VisZBuffer_Draw(&sGameStateVisZBuffer, &gfxP); } else if (R_FB_FILTER_TYPE == 7) { sGameStateVisMono.unk_00 = 0; sGameStateVisMono.primColor.r = R_FB_FILTER_PRIM_COLOR(0); @@ -496,7 +496,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g startTime = endTime; LOG_UTILS_CHECK_NULL_POINTER("this->cleanup", gameState->destroy, "../game.c", 1088); VisCvg_Init(&sGameStateVisCvg); - func_800AD920(&D_80166500); + VisZBuffer_Init(&sGameStateVisZBuffer); VisMono_Init(&sGameStateVisMono); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Init(&sViMode); @@ -527,7 +527,7 @@ void GameState_Destroy(GameState* gameState) { Rumble_Destroy(); SpeedMeter_Destroy(&D_801664D0); VisCvg_Destroy(&sGameStateVisCvg); - func_800AD950(&D_80166500); + VisZBuffer_Destroy(&sGameStateVisZBuffer); VisMono_Destroy(&sGameStateVisMono); if ((R_VI_MODE_EDIT_STATE == VI_MODE_EDIT_STATE_INACTIVE) || !DEBUG_FEATURES) { ViMode_Destroy(&sViMode); diff --git a/src/code/code_800AD920.c b/src/code/z_viszbuffer.c similarity index 73% rename from src/code/code_800AD920.c rename to src/code/z_viszbuffer.c index e8ab7d04773..1d94a0c6efb 100644 --- a/src/code/code_800AD920.c +++ b/src/code/z_viszbuffer.c @@ -1,14 +1,20 @@ +/** + * This file implements a framebuffer effect relying on the depth buffer (Z buffer). + * It merely allows LERPing between two colors, using the Z buffer bytes (interpreted as either ia16 or rgba16) as the + * factor. + * Z buffer values are two bytes each. They are floating point, which makes the effect not that interesting for an + * actual application as that doesn't map well to be interpreted as ia16 or rgba16, though some discontinuous gradients + * can be seen. + */ + #include "ultra64.h" #include "gfx.h" #include "vis.h" -// Note : This file is related to z_vismono, the original name was probably z_vis - // z-buffer extern u16 D_0E000000[]; -// Init -void func_800AD920(struct_80166500* this) { +void VisZBuffer_Init(VisZBuffer* this) { this->useRgba = false; this->setScissor = false; this->primColor.r = 255; @@ -24,18 +30,16 @@ void func_800AD920(struct_80166500* this) { // clang-format on } -// Destroy -void func_800AD950(struct_80166500* this) { +void VisZBuffer_Destroy(VisZBuffer* this) { } -// Draw -void func_800AD958(struct_80166500* this, Gfx** gfxp) { +void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp) { Gfx* gfx = *gfxp; s32 pad; u16* tex = D_0E000000; s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA; s32 y; - s32 height = 6; + s32 height = TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES); gDPPipeSync(gfx++); if (this->setScissor == true) { diff --git a/undefined_syms.txt b/undefined_syms.txt index deba8affd06..15e395b2401 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -1,7 +1,7 @@ // z_kankyo, z_demo_kankyo, z_en_viewer, z_object_kankyo, z_eff_ss_dead_dd D_01000000 = 0x01000000; -// code_800AD920 +// z_viszbuffer D_0E000000 = 0x0E000000; // z_vismono From 81907fc1f10d60dca047ba3e736ae7cecefc6e55 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 09:12:57 +0200 Subject: [PATCH 048/150] common VisParams substruct --- include/regs.h | 4 ++-- include/vis.h | 30 +++++++++++++-------------- src/code/game.c | 46 ++++++++++++++++++++--------------------- src/code/z_play.c | 6 +++--- src/code/z_viscvg.c | 22 ++++++++++---------- src/code/z_vismono.c | 29 ++++++++++++++------------ src/code/z_viszbuffer.c | 33 +++++++++++++++-------------- 7 files changed, 86 insertions(+), 84 deletions(-) diff --git a/include/regs.h b/include/regs.h index 8d67563d29e..89f6a03267d 100644 --- a/include/regs.h +++ b/include/regs.h @@ -68,9 +68,9 @@ struct PlayState; #define R_VI_MODE_EDIT_ULX_ADJ SREG(53) #define R_VI_MODE_EDIT_LRX_ADJ SREG(54) #define R_FB_FILTER_TYPE SREG(80) -#define R_FB_FILTER_PRIM_COLOR(c) SREG(81 + (c)) +#define R_FB_FILTER_COLOR1(c) SREG(81 + (c)) #define R_FB_FILTER_A SREG(84) -#define R_FB_FILTER_ENV_COLOR(c) SREG(85 + (c)) +#define R_FB_FILTER_COLOR2(c) SREG(85 + (c)) #define R_ENABLE_FB_FILTER SREG(88) #define R_PAUSE_BG_PRERENDER_STATE SREG(94) // `PauseBgPreRenderState` #define R_CAM_XZ_OFFSET_UPDATE_RATE OREG(2) diff --git a/include/vis.h b/include/vis.h index 5ac68bbd796..2fdd3a1ef38 100644 --- a/include/vis.h +++ b/include/vis.h @@ -4,35 +4,33 @@ #include "ultra64.h" #include "color.h" +typedef struct VisParams { + /* 0x00 */ u32 type; + /* 0x04 */ u32 setScissor; + /* 0x08 */ Color_RGBA8_u32 color1; + /* 0x0C */ Color_RGBA8_u32 color2; +} VisParams; // size = 0x10 + typedef enum VisCvgType { VISCVG_TYPE_NOP, - VISCVG_TYPE_MODULATE_FB, - VISCVG_TYPE_FADE_AND_MODULATE_FB, - VISCVG_TYPE_MODULATE_COLOR, - VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR + VISCVG_TYPE_MODULATE_FB, // Multiply coverage with framebuffer + VISCVG_TYPE_FADE_AND_MODULATE_FB, // Also fade to color1 by color1.a + VISCVG_TYPE_MODULATE_COLOR, // Multiply coverage with color1 + VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR // Add color1 } VisCvgType; typedef struct VisCvg { - /* 0x00 */ u32 type; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 color; - /* 0x0C */ Color_RGBA8_u32 envColor; + /* 0x00 */ VisParams params; // params.color2 unused } VisCvg; // size = 0x10 typedef struct VisMono { - /* 0x00 */ u32 unk_00; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x0C */ Color_RGBA8_u32 envColor; + /* 0x00 */ VisParams params; // params.type unused /* 0x10 */ u16* tlut; /* 0x14 */ Gfx* dList; } VisMono; // size = 0x18 typedef struct VisZBuffer { - /* 0x00 */ u32 useRgba; - /* 0x04 */ u32 setScissor; - /* 0x08 */ Color_RGBA8_u32 primColor; - /* 0x08 */ Color_RGBA8_u32 envColor; + /* 0x00 */ VisParams params; } VisZBuffer; // size = 0x10 void VisCvg_Init(VisCvg* this); diff --git a/src/code/game.c b/src/code/game.c index 4050baf9e3d..5f43ead3eee 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -62,33 +62,33 @@ void GameState_SetFBFilter(Gfx** gfx) { Gfx* gfxP = *gfx; if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) { - sGameStateVisCvg.type = R_FB_FILTER_TYPE; - sGameStateVisCvg.color.r = R_FB_FILTER_PRIM_COLOR(0); - sGameStateVisCvg.color.g = R_FB_FILTER_PRIM_COLOR(1); - sGameStateVisCvg.color.b = R_FB_FILTER_PRIM_COLOR(2); - sGameStateVisCvg.color.a = R_FB_FILTER_A; + sGameStateVisCvg.params.type = R_FB_FILTER_TYPE; + sGameStateVisCvg.params.color1.r = R_FB_FILTER_COLOR1(0); + sGameStateVisCvg.params.color1.g = R_FB_FILTER_COLOR1(1); + sGameStateVisCvg.params.color1.b = R_FB_FILTER_COLOR1(2); + sGameStateVisCvg.params.color1.a = R_FB_FILTER_A; VisCvg_Draw(&sGameStateVisCvg, &gfxP); } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { - sGameStateVisZBuffer.useRgba = (R_FB_FILTER_TYPE == 6); - sGameStateVisZBuffer.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sGameStateVisZBuffer.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sGameStateVisZBuffer.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sGameStateVisZBuffer.primColor.a = R_FB_FILTER_A; - sGameStateVisZBuffer.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sGameStateVisZBuffer.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sGameStateVisZBuffer.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sGameStateVisZBuffer.envColor.a = R_FB_FILTER_A; + sGameStateVisZBuffer.params.type = (R_FB_FILTER_TYPE == 6); + sGameStateVisZBuffer.params.color1.r = R_FB_FILTER_COLOR1(0); + sGameStateVisZBuffer.params.color1.g = R_FB_FILTER_COLOR1(1); + sGameStateVisZBuffer.params.color1.b = R_FB_FILTER_COLOR1(2); + sGameStateVisZBuffer.params.color1.a = R_FB_FILTER_A; + sGameStateVisZBuffer.params.color2.r = R_FB_FILTER_COLOR2(0); + sGameStateVisZBuffer.params.color2.g = R_FB_FILTER_COLOR2(1); + sGameStateVisZBuffer.params.color2.b = R_FB_FILTER_COLOR2(2); + sGameStateVisZBuffer.params.color2.a = R_FB_FILTER_A; VisZBuffer_Draw(&sGameStateVisZBuffer, &gfxP); } else if (R_FB_FILTER_TYPE == 7) { - sGameStateVisMono.unk_00 = 0; - sGameStateVisMono.primColor.r = R_FB_FILTER_PRIM_COLOR(0); - sGameStateVisMono.primColor.g = R_FB_FILTER_PRIM_COLOR(1); - sGameStateVisMono.primColor.b = R_FB_FILTER_PRIM_COLOR(2); - sGameStateVisMono.primColor.a = R_FB_FILTER_A; - sGameStateVisMono.envColor.r = R_FB_FILTER_ENV_COLOR(0); - sGameStateVisMono.envColor.g = R_FB_FILTER_ENV_COLOR(1); - sGameStateVisMono.envColor.b = R_FB_FILTER_ENV_COLOR(2); - sGameStateVisMono.envColor.a = R_FB_FILTER_A; + sGameStateVisMono.params.type = 0; + sGameStateVisMono.params.color1.r = R_FB_FILTER_COLOR1(0); + sGameStateVisMono.params.color1.g = R_FB_FILTER_COLOR1(1); + sGameStateVisMono.params.color1.b = R_FB_FILTER_COLOR1(2); + sGameStateVisMono.params.color1.a = R_FB_FILTER_A; + sGameStateVisMono.params.color2.r = R_FB_FILTER_COLOR2(0); + sGameStateVisMono.params.color2.g = R_FB_FILTER_COLOR2(1); + sGameStateVisMono.params.color2.b = R_FB_FILTER_COLOR2(2); + sGameStateVisMono.params.color2.a = R_FB_FILTER_A; VisMono_Draw(&sGameStateVisMono, &gfxP); } *gfx = gfxP; diff --git a/src/code/z_play.c b/src/code/z_play.c index 7e88fa03a64..7ac82e385fc 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -47,8 +47,8 @@ #include "save.h" #include "vis.h" -#pragma increment_block_number "gc-eu:224 gc-eu-mq:224 gc-jp:224 gc-jp-ce:224 gc-jp-mq:224 gc-us:224 gc-us-mq:224" \ - "ique-cn:224 ntsc-1.0:224 ntsc-1.1:224 ntsc-1.2:224 pal-1.0:224 pal-1.1:224" +#pragma increment_block_number "gc-eu:221 gc-eu-mq:221 gc-jp:221 gc-jp-ce:221 gc-jp-mq:221 gc-us:221 gc-us-mq:221" \ + "ique-cn:221 ntsc-1.0:221 ntsc-1.1:221 ntsc-1.2:221 pal-1.0:221 pal-1.1:221" TransitionTile gTransitionTile; s32 gTransitionTileState; @@ -1217,7 +1217,7 @@ void Play_Draw(PlayState* this) { if (gVisMonoColor.a > 0) #endif { - sPlayVisMono.primColor.rgba = gVisMonoColor.rgba; + sPlayVisMono.params.color1.rgba = gVisMonoColor.rgba; VisMono_Draw(&sPlayVisMono, &gfxP); } diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index 35bfec4b4b8..34529a05d42 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -60,12 +60,12 @@ Gfx sVisCvgFadeToPrimAndModulateFramebuffer[] = { }; void VisCvg_Init(VisCvg* this) { - this->type = VISCVG_TYPE_NOP; - this->setScissor = false; - this->color.r = 255; - this->color.g = 255; - this->color.b = 255; - this->color.a = 255; + this->params.type = VISCVG_TYPE_NOP; + this->params.setScissor = false; + this->params.color1.r = 255; + this->params.color1.g = 255; + this->params.color1.b = 255; + this->params.color1.a = 255; } void VisCvg_Destroy(VisCvg* this) { @@ -78,27 +78,27 @@ void VisCvg_Draw(VisCvg* this, Gfx** gfxp) { // Primitive depth and G_ZS_PRIM are set but this is useless since neither Z_CMD nor Z_UPD are set. gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); - if (this->setScissor == true) { + if (this->params.setScissor == true) { gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } - switch (this->type) { + switch (this->params.type) { case VISCVG_TYPE_MODULATE_FB: gSPDisplayList(gfx++, sVisCvgModulateFramebufferDL); break; case VISCVG_TYPE_FADE_AND_MODULATE_FB: - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->color.rgba); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->params.color1.rgba); gSPDisplayList(gfx++, sVisCvgFadeToPrimAndModulateFramebuffer); break; case VISCVG_TYPE_MODULATE_COLOR: - gDPSetColor(gfx++, G_SETBLENDCOLOR, this->color.rgba); + gDPSetColor(gfx++, G_SETBLENDCOLOR, this->params.color1.rgba); gSPDisplayList(gfx++, sVisCvgModulateBlendColorDL); break; case VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR: - gDPSetColor(gfx++, G_SETFOGCOLOR, this->color.rgba); + gDPSetColor(gfx++, G_SETFOGCOLOR, this->params.color1.rgba); gSPDisplayList(gfx++, sVisCvgModulateFramebufferAdditiveFogDL); break; } diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index ea93219a139..ffe1fe7111b 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -1,6 +1,9 @@ /** * Color frame buffer effect to desaturate the colors. * + * The result of the desaturation is used to LERP from color2 (0) to color1 (1). + * In the simplest case, to get a grayscale result, set color1 to white and color2 to black. + * * This effect is achieved by making the RDP read the rgba16 framebuffer as a ci8 texture using a specific ia16 palette. * For every two-bytes pixel in the rgba16 framebuffer, the palette maps in particular an intensity to the high byte and * an alpha value to the low byte. The sum of those intensity and alpha value corresponds to the gray level of the @@ -37,16 +40,16 @@ extern u16 D_0F000000[]; void VisMono_Init(VisMono* this) { bzero(this, sizeof(VisMono)); - this->unk_00 = 0; - this->setScissor = false; - this->primColor.r = 255; - this->primColor.g = 255; - this->primColor.b = 255; - this->primColor.a = 255; - this->envColor.r = 0; - this->envColor.g = 0; - this->envColor.b = 0; - this->envColor.a = 0; + this->params.type = 0; + this->params.setScissor = false; + this->params.color1.r = 255; + this->params.color1.g = 255; + this->params.color1.b = 255; + this->params.color1.a = 255; + this->params.color2.r = 0; + this->params.color2.g = 0; + this->params.color2.b = 0; + this->params.color2.a = 0; } void VisMono_Destroy(VisMono* this) { @@ -170,12 +173,12 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) { gDPPipeSync(gfx++); - if (this->setScissor == true) { + if (this->params.setScissor == true) { gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); - gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->params.color1.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->params.color2.rgba); gDPLoadTLUT_pal256(gfx++, tlut); diff --git a/src/code/z_viszbuffer.c b/src/code/z_viszbuffer.c index 1d94a0c6efb..03f8f45eb56 100644 --- a/src/code/z_viszbuffer.c +++ b/src/code/z_viszbuffer.c @@ -1,7 +1,8 @@ /** * This file implements a framebuffer effect relying on the depth buffer (Z buffer). - * It merely allows LERPing between two colors, using the Z buffer bytes (interpreted as either ia16 or rgba16) as the - * factor. + * It merely allows LERPing between two colors (from color2 to color1), using the Z buffer bytes (interpreted as either + * ia16 or rgba16) as the factor. + * * Z buffer values are two bytes each. They are floating point, which makes the effect not that interesting for an * actual application as that doesn't map well to be interpreted as ia16 or rgba16, though some discontinuous gradients * can be seen. @@ -15,18 +16,18 @@ extern u16 D_0E000000[]; void VisZBuffer_Init(VisZBuffer* this) { - this->useRgba = false; - this->setScissor = false; - this->primColor.r = 255; - this->primColor.g = 255; - this->primColor.b = 255; - this->primColor.a = 255; + this->params.type = 0; + this->params.setScissor = false; + this->params.color1.r = 255; + this->params.color1.g = 255; + this->params.color1.b = 255; + this->params.color1.a = 255; // clang-format off - this->envColor.r = 0; \ - this->envColor.g = 0; \ - this->envColor.b = 0; \ - this->envColor.a = 255; + this->params.color2.r = 0; \ + this->params.color2.g = 0; \ + this->params.color2.b = 0; \ + this->params.color2.a = 255; // clang-format on } @@ -37,12 +38,12 @@ void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp) { Gfx* gfx = *gfxp; s32 pad; u16* tex = D_0E000000; - s32 fmt = !this->useRgba ? G_IM_FMT_IA : G_IM_FMT_RGBA; + s32 fmt = this->params.type == 0 ? G_IM_FMT_IA : G_IM_FMT_RGBA; s32 y; s32 height = TMEM_SIZE / (SCREEN_WIDTH * G_IM_SIZ_16b_BYTES); gDPPipeSync(gfx++); - if (this->setScissor == true) { + if (this->params.setScissor == true) { gDPSetScissor(gfx++, G_SC_NON_INTERLACE, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } @@ -53,8 +54,8 @@ void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp) { gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); - gDPSetColor(gfx++, G_SETPRIMCOLOR, this->primColor.rgba); - gDPSetColor(gfx++, G_SETENVCOLOR, this->envColor.rgba); + gDPSetColor(gfx++, G_SETPRIMCOLOR, this->params.color1.rgba); + gDPSetColor(gfx++, G_SETENVCOLOR, this->params.color2.rgba); for (y = 0; y <= SCREEN_HEIGHT - height; y += height) { gDPLoadTextureBlock(gfx++, tex, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP, From 784696a554eebada804e931e6da9e847fa2f6f5d Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 12:48:50 +0200 Subject: [PATCH 049/150] EnTp and object_tp docs --- assets/xml/objects/object_tp.xml | 24 +- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 614 +++++++++++++----------- src/overlays/actors/ovl_En_Tp/z_en_tp.h | 28 +- 3 files changed, 351 insertions(+), 315 deletions(-) diff --git a/assets/xml/objects/object_tp.xml b/assets/xml/objects/object_tp.xml index 27fafff4011..20d8fd50e4f 100644 --- a/assets/xml/objects/object_tp.xml +++ b/assets/xml/objects/object_tp.xml @@ -1,22 +1,22 @@ - - + + - + - + - - - - - - - - + + + + + + + + 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 b78a5450bf1..db0875dde3b 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -32,22 +32,28 @@ void EnTp_Destroy(Actor* thisx, PlayState* play); void EnTp_Update(Actor* thisx, PlayState* play); void EnTp_Draw(Actor* thisx, PlayState* play); -void func_80B20DE0(EnTp* this, void (*arg1)(EnTp*, PlayState*)); -void func_80B21084(EnTp* this); -void func_80B210B0(EnTp* this, PlayState* play); -void func_80B2128C(EnTp* this); -void func_80B212C0(EnTp* this, PlayState* play); -void func_80B21454(EnTp* this); -void func_80B214CC(EnTp* this, PlayState* play); -void func_80B217FC(EnTp* this); -void func_80B21900(EnTp* this, PlayState* play); -void func_80B2194C(EnTp* this); -void func_80B219A8(EnTp* this, PlayState* play); -void func_80B21B90(EnTp* this); -void func_80B21BDC(EnTp* this, PlayState* play); -void func_80B21EE8(EnTp* this); -void func_80B21F18(EnTp* this, PlayState* play); -void func_80B221E8(EnTp* this, PlayState* play); +void EnTp_SetupBodyElem(EnTp* this); +void EnTp_BodyElem(EnTp* this, PlayState* play); +void EnTp_Head_Attack(EnTp* this, PlayState* play); +void EnTp_SetupDying(EnTp* this); +void EnTp_Dying(EnTp* this, PlayState* play); +void EnTp_SetupBodyElemRemnant(EnTp* this); +void EnTp_BodyElemRemnant(EnTp* this, PlayState* play); +void EnTp_Head_Hover(EnTp* this, PlayState* play); +void EnTp_Head_SetupWaitPlayerAndRise(EnTp* this); +void EnTp_Head_WaitPlayerAndRise(EnTp* this, PlayState* play); +void EnTp_Head_SetupSinkIntoGroundAndReappear(EnTp* this); +void EnTp_Head_SinkIntoGroundAndReappear(EnTp* this, PlayState* play); + +typedef enum EnTpAction { + ENTP_ACTION_BODYELEMREMNANT, + ENTP_ACTION_DYING, + ENTP_ACTION_BODYELEM, + ENTP_ACTION_HEAD_WAIT_PLAYER_AND_RISE = 4, + ENTP_ACTION_HEAD_ATTACK = 7, + ENTP_ACTION_HEAD_8, + ENTP_ACTION_HEAD_SINK_INTO_GROUND_AND_REAPPEAR +} EnTpAction; ActorProfile En_Tp_Profile = { /**/ ACTOR_EN_TP, @@ -88,101 +94,108 @@ static ColliderJntSphInit sJntSphInit = { sJntSphElementsInit, }; +typedef enum EnTpDamageReaction { + ENTP_DMG_REACT_NO_EFFECT, + ENTP_DMG_REACT_STUN, + ENTP_DMG_REACT_MELEE_BACKLASH = 0xE, + ENTP_DMG_REACT_VULNERABLE +} EnTpDamageReaction; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0xF), - /* Slingshot */ DMG_ENTRY(0, 0x0), - /* Explosive */ DMG_ENTRY(0, 0x0), - /* Boomerang */ DMG_ENTRY(1, 0xF), - /* Normal arrow */ DMG_ENTRY(0, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0xE), - /* Hookshot */ DMG_ENTRY(0, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0xE), - /* Master sword */ DMG_ENTRY(2, 0xE), - /* Giant's Knife */ DMG_ENTRY(4, 0xE), - /* Fire arrow */ DMG_ENTRY(0, 0x0), - /* Ice arrow */ DMG_ENTRY(0, 0x0), - /* Light arrow */ DMG_ENTRY(0, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(0, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(0, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(0, 0x0), - /* Fire magic */ DMG_ENTRY(0, 0x0), - /* Ice magic */ DMG_ENTRY(0, 0x0), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0xE), - /* Giant spin */ DMG_ENTRY(4, 0xE), - /* Master spin */ DMG_ENTRY(2, 0xE), - /* Kokiri jump */ DMG_ENTRY(2, 0xE), - /* Giant jump */ DMG_ENTRY(8, 0xE), - /* Master jump */ DMG_ENTRY(4, 0xE), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0xE), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, ENTP_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, ENTP_DMG_REACT_VULNERABLE), + /* Slingshot */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Explosive */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Boomerang */ DMG_ENTRY(1, ENTP_DMG_REACT_VULNERABLE), + /* Normal arrow */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Hammer swing */ DMG_ENTRY(2, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Hookshot */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Kokiri sword */ DMG_ENTRY(1, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Master sword */ DMG_ENTRY(2, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Giant's Knife */ DMG_ENTRY(4, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Fire arrow */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Ice arrow */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Light arrow */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Unk arrow 1 */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Unk arrow 2 */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Unk arrow 3 */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Fire magic */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Ice magic */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Light magic */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Shield */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Mirror Ray */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Kokiri spin */ DMG_ENTRY(1, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Giant spin */ DMG_ENTRY(4, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Master spin */ DMG_ENTRY(2, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Kokiri jump */ DMG_ENTRY(2, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Giant jump */ DMG_ENTRY(8, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Master jump */ DMG_ENTRY(4, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Unknown 1 */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Unblockable */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), + /* Hammer jump */ DMG_ENTRY(4, ENTP_DMG_REACT_MELEE_BACKLASH), + /* Unknown 2 */ DMG_ENTRY(0, ENTP_DMG_REACT_NO_EFFECT), }; static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 10, ICHAIN_STOP), }; -void func_80B20DE0(EnTp* this, void (*arg1)(EnTp*, PlayState*)) { - this->unk_154 = arg1; +void EnTp_SetupAction(EnTp* this, void (*actionFunc)(EnTp*, PlayState*)) { + this->actionFunc = actionFunc; } void EnTp_Init(Actor* thisx, PlayState* play2) { - EnTp* temp_v0_2; - EnTp* var_s5; - s32 var_s1; + EnTp* newChild; + EnTp* prevChild; + s32 i; EnTp* this = (EnTp*)thisx; PlayState* play = play2; - s64 new_var; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.attentionRangeType = ATTENTION_RANGE_3; this->actor.colChkInfo.damageTable = &sDamageTable; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.14f); - this->unk_150 = 0; + this->modeVar = 0; this->actor.colChkInfo.health = 1; - var_s5 = this; - this->unk_15E = 255; + prevChild = this; + this->bodyElementAlpha_ = 255; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - if (this->actor.params < 0) { + if (this->actor.params < 0) { // ENTP_TYPE_HEAD this->actor.naviEnemyId = NAVI_ENEMY_TAILPASARAN; - this->unk_15A = 0; + this->timer = 0; this->collider.base.acFlags |= AC_HARD; this->collider.elements[0].dim.worldSphere.radius = 8; this->collider.elements[0].dim.modelSphere.radius = this->collider.elements[0].dim.worldSphere.radius; - func_80B21B90(this); + EnTp_Head_SetupWaitPlayerAndRise(this); this->actor.focus.pos = this->actor.world.pos; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED; Actor_SetScale(&this->actor, 1.5f); - for (var_s1 = 0; var_s1 < 7; var_s1++) { - if (((0 * var_s1) != 0) && ((0 * var_s1) != 0)) {} - temp_v0_2 = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0 * var_s1); - if (temp_v0_2 != NULL) { - var_s5->actor.child = &temp_v0_2->actor; - temp_v0_2->actor.parent = &var_s5->actor; - temp_v0_2->unk_162 = (s16)(var_s1 + 1); - temp_v0_2->unk_1D4 = this; - Actor_SetScale(&temp_v0_2->actor, 0.3f); - if (var_s1 == 2) { - temp_v0_2->actor.flags |= + for (i = 0; i < 7; i++) { + if (((0 * i) != 0) && ((0 * i) != 0)) {} + newChild = + (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 0 * i /* ENTP_TYPE_BODYELEM */); + if (newChild != NULL) { + prevChild->actor.child = &newChild->actor; + newChild->actor.parent = &prevChild->actor; + newChild->sparkTimer = i + 1; + newChild->headInstance = this; + Actor_SetScale(&newChild->actor, 0.3f); + if (i == 2) { + newChild->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_UPDATE_CULLING_DISABLED; - temp_v0_2->unk_150 = 1; + newChild->modeVar = 1; } - temp_v0_2->unk_15C = var_s1 * -5; - temp_v0_2->unk_15A = var_s1 * -5; - var_s5 = temp_v0_2; - temp_v0_2->unk_16C = 6.0f - ((f32)var_s1 * 0.75f); + newChild->timer2 = i * -5; + newChild->timer = i * -5; + prevChild = newChild; + newChild->bodyElemDist_ = 6.0f - ((f32)i * 0.75f); } } - } else if (this->actor.params == 0) { - func_80B21084(this); - } else { - func_80B217FC(this); + } else if (this->actor.params == ENTP_TYPE_BODYELEM) { + EnTp_SetupBodyElem(this); + } else { // ENTP_TYPE_BODYELEMREMNANT (only remaining params EnTp is spawned with) + EnTp_SetupBodyElemRemnant(this); } } @@ -192,49 +205,49 @@ void EnTp_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -void func_80B21084(EnTp* this) { - this->unk_14C = 2; - func_80B20DE0(this, func_80B210B0); +void EnTp_SetupBodyElem(EnTp* this) { + this->action = ENTP_ACTION_BODYELEM; + EnTp_SetupAction(this, EnTp_BodyElem); } -void func_80B210B0(EnTp* this, PlayState* play) { +void EnTp_BodyElem(EnTp* this, PlayState* play) { s16 sp36; s16 temp_a0_sp34; - if (this->actor.params == 0xB) { - this->unk_14C = 1; + if (this->actor.params == ENTP_TYPE_BODYELEM_DYING) { + this->action = ENTP_ACTION_DYING; if (this->actor.parent == NULL) { - func_80B21454(this); + EnTp_SetupDying(this); } } else { - if (this->unk_150 != 0) { + if (this->modeVar != 0) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; } - if (this->unk_1D4->unk_150 != 0) { - this->actor.speed = this->unk_160 = this->actor.velocity.y = this->unk_168 = 0.0f; - if (this->actor.world.pos.y < this->unk_1D4->actor.home.pos.y) { + if (this->headInstance->modeVar != 0) { + this->actor.speed = this->redShineAmount = this->actor.velocity.y = this->unk_168 = 0.0f; + if (this->actor.world.pos.y < this->headInstance->actor.home.pos.y) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } this->actor.world.pos = this->actor.parent->prevPos; } else { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.parent->world.pos.y - 4.0f, 1.0f, 1.0f, 0.0f); - sp36 = this->unk_1D4->actor.shape.rot.y + 0x4000; - temp_a0_sp34 = (this->unk_1D4->unk_15C + this->unk_15A) * 0x7D0; + sp36 = this->headInstance->actor.shape.rot.y + 0x4000; + temp_a0_sp34 = (this->headInstance->timer2 + this->timer) * 0x7D0; this->actor.world.pos.x = - (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->unk_16C)) + this->actor.home.pos.x; + (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->bodyElemDist_)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->unk_16C)) + this->actor.home.pos.z; + (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->bodyElemDist_)) + this->actor.home.pos.z; } } } -void func_80B2128C(EnTp* this) { - this->unk_14C = 7; - this->unk_15A = 0xC8; - func_80B20DE0(this, func_80B212C0); +void EnTp_Head_SetupAttack(EnTp* this) { + this->action = ENTP_ACTION_HEAD_ATTACK; + this->timer = 200; + EnTp_SetupAction(this, EnTp_Head_Attack); } -void func_80B212C0(EnTp* this, PlayState* play) { +void EnTp_Head_Attack(EnTp* this, PlayState* play) { Player* player; player = GET_PLAYER(play); @@ -243,11 +256,11 @@ void func_80B212C0(EnTp* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - this->unk_15A = 1; + this->timer = 1; } } - if (this->unk_160 < 255) { - this->unk_160 += 15; + if (this->redShineAmount < 255) { + this->redShineAmount += 15; } if (Math_CosF(this->unk_168) == 0.0f) { this->unk_170 = 2.0f * Rand_ZeroOne(); @@ -255,43 +268,43 @@ void func_80B212C0(EnTp* this, PlayState* play) { this->actor.world.pos.y += Math_CosF(this->unk_168) * (2.0f + this->unk_170); this->unk_168 += 0.2f; Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); - this->unk_15A -= 1; - if (this->unk_15A != 0) { + this->timer--; + if (this->timer != 0) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.shape.rot.y = this->actor.world.rot.y; } else { - func_80B21EE8(this); + EnTp_Head_SetupSinkIntoGroundAndReappear(this); } } -void func_80B21454(EnTp* this) { - Actor* var_v0; +void EnTp_SetupDying(EnTp* this) { + Actor* child; - this->unk_15A = 2; - if (this->actor.params < 0) { - var_v0 = this->actor.child; - while (var_v0 != NULL) { - var_v0->params = 0xB; - var_v0->colChkInfo.health = 0; - var_v0 = var_v0->child; + this->timer = 2; + if (this->actor.params < 0) { // ENTP_TYPE_HEAD + child = this->actor.child; + while (child != NULL) { + child->params = ENTP_TYPE_BODYELEM_DYING; + child->colChkInfo.health = 0; + child = child->child; } - this->unk_15A = 0xD; + this->timer = 13; Actor_PlaySfx(&this->actor, NA_SE_EN_TAIL_DEAD); } - this->unk_14C = 1; - func_80B20DE0(this, func_80B214CC); + this->action = ENTP_ACTION_DYING; + EnTp_SetupAction(this, EnTp_Dying); } -void func_80B214CC(EnTp* this, PlayState* play) { - s16 var_s1; - EnTp* temp_v0; +void EnTp_Dying(EnTp* this, PlayState* play) { + s16 i; + EnTp* actor; s32 pad; Vec3f sp78 = { 0.0f, 0.5f, 0.0f }; Vec3f sp6C = { 0.0f, 0.0f, 0.0f }; - this->unk_15A -= 1; - if (this->unk_15A <= 0) { - if (this->actor.params == 0xC) { + this->timer--; + if (this->timer <= 0) { + if (this->actor.params == ENTP_TYPE_HEAD_DYING) { sp6C.x = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.x; sp6C.z = ((Rand_ZeroOne() - 0.5f) * 15.0f) + this->actor.world.pos.z; sp6C.y = ((Rand_ZeroOne() - 0.5f) * 5.0f) + this->actor.world.pos.y; @@ -302,33 +315,34 @@ void func_80B214CC(EnTp* this, PlayState* play) { EffectSsDeadDb_Spawn(play, &sp6C, &sp78, &sp78, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); - } else { + } else { // ENTP_TYPE_BODYELEM_DYING #if OOT_VERSION < NTSC_1_1 - for (var_s1 = 0; var_s1 < 2; var_s1++) + for (i = 0; i < 2; i++) #else - for (var_s1 = 0; var_s1 < 1; var_s1++) + for (i = 0; i < 1; i++) #endif { - temp_v0 = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0xA); - if (temp_v0 != NULL) { - Actor_SetScale(&temp_v0->actor, this->actor.scale.z * 0.5f); - temp_v0->unk_160 = this->unk_160; + actor = (EnTp*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TP, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, + ENTP_TYPE_BODYELEMREMNANT); + if (actor != NULL) { + Actor_SetScale(&actor->actor, this->actor.scale.z * 0.5f); + actor->redShineAmount = this->redShineAmount; } } } if (this->actor.child != NULL) { this->actor.child->parent = NULL; - this->actor.child->params = 0xB; + this->actor.child->params = ENTP_TYPE_BODYELEM_DYING; this->actor.child->colChkInfo.health = 0; } - this->unk_150 = 2; + this->modeVar = 2; Actor_Kill(&this->actor); } } -void func_80B217FC(EnTp* this) { - this->unk_14C = 0; +void EnTp_SetupBodyElemRemnant(EnTp* this) { + this->action = ENTP_ACTION_BODYELEMREMNANT; this->actor.world.pos.x += (Rand_ZeroOne() - 0.5f) * 5.0f; this->actor.world.pos.y += (Rand_ZeroOne() - 0.5f) * 5.0f; this->actor.world.pos.z += (Rand_ZeroOne() - 0.5f) * 5.0f; @@ -336,107 +350,110 @@ void func_80B217FC(EnTp* this) { this->actor.velocity.y = (Rand_ZeroOne() - 0.5f) * 1.5f; this->actor.velocity.z = (Rand_ZeroOne() - 0.5f) * 1.5f; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - func_80B20DE0(this, func_80B21900); + EnTp_SetupAction(this, EnTp_BodyElemRemnant); } -void func_80B21900(EnTp* this, PlayState* play) { +void EnTp_BodyElemRemnant(EnTp* this, PlayState* play) { Actor_UpdatePos(&this->actor); - this->unk_15E -= 20; - if (this->unk_15E < 20) { - this->unk_15E = 0; + this->bodyElementAlpha_ -= 20; + if (this->bodyElementAlpha_ < 20) { + this->bodyElementAlpha_ = 0; Actor_Kill(&this->actor); } } -void func_80B2194C(EnTp* this) { - this->unk_15A = (Rand_ZeroOne() * 15.0f) + 40.0f; - this->unk_14C = 8; - func_80B20DE0(this, func_80B219A8); +void EnTp_Head_SetupHover(EnTp* this) { + this->timer = (Rand_ZeroOne() * 15.0f) + 40.0f; + this->action = ENTP_ACTION_HEAD_8; + EnTp_SetupAction(this, EnTp_Head_Hover); } -void func_80B219A8(EnTp* this, PlayState* play) { +void EnTp_Head_Hover(EnTp* this, PlayState* play) { s32 pad; Player* player; player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); - Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->unk_16C, 1.0f, + // bodyElemDist_ is always 0 here + Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->bodyElemDist_, 1.0f, this->actor.speed * 0.25f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - this->unk_15C = 1; + this->timer2 = 1; } } - if (this->unk_160 != 0) { - this->unk_160 -= 15; + if (this->redShineAmount != 0) { + this->redShineAmount -= 15; } if (Math_CosF(this->unk_168) == 0.0f) { this->unk_170 = Rand_ZeroOne() * 4.0f; } this->actor.world.pos.y += Math_CosF(this->unk_168) * ((this->actor.speed * 0.25f) + this->unk_170); + // unk_164 is always 0 this->actor.world.rot.y += this->unk_164; this->unk_168 += 0.2f; - if (this->unk_15A != 0) { - this->unk_15A -= 1; + if (this->timer != 0) { + this->timer--; } Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->actor.home.pos), 1, 0x2EE, 0); - if (this->unk_15A == 0) { - func_80B2128C(this); + if (this->timer == 0) { + EnTp_Head_SetupAttack(this); } this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80B21B90(EnTp* this) { - this->unk_14C = 4; - this->unk_150 = 0; +void EnTp_Head_SetupWaitPlayerAndRise(EnTp* this) { + this->action = ENTP_ACTION_HEAD_WAIT_PLAYER_AND_RISE; + this->modeVar = 0; this->actor.shape.rot.x = -0x4000; - this->unk_15A = 0x3C; - this->unk_15C = 0; + this->timer = 60; + this->timer2 = 0; this->actor.speed = 0.0f; - func_80B20DE0(this, func_80B21BDC); + EnTp_SetupAction(this, EnTp_Head_WaitPlayerAndRise); } -void func_80B21BDC(EnTp* this, PlayState* play) { +void EnTp_Head_WaitPlayerAndRise(EnTp* this, PlayState* play) { Player* player; s16 sp32; player = GET_PLAYER(play); - this->unk_15C -= 1; + this->timer2--; if (this->actor.xzDistToPlayer < 200.0f) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (&player->actor == this->collider.base.at) { - this->unk_15A = 0; + this->timer = 0; } } - if (this->unk_15A != 0) { - this->unk_15A -= 1; + if (this->timer != 0) { + this->timer--; Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x1F4, 0); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 1, 0x5DC, 0); sp32 = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos) + 0x4000; Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 30.0f, 0.3f, 1.0f, 0.3f); + // bodyElemDist_ is always 0 here this->actor.world.pos.x = - (Math_SinS(this->unk_15C * 0x7D0) * (Math_SinS(sp32) * this->unk_16C)) + this->actor.home.pos.x; + (Math_SinS(this->timer2 * 0x7D0) * (Math_SinS(sp32) * this->bodyElemDist_)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(this->unk_15C * 0x7D0) * (Math_CosS(sp32) * this->unk_16C)) + this->actor.home.pos.z; + (Math_SinS(this->timer2 * 0x7D0) * (Math_CosS(sp32) * this->bodyElemDist_)) + this->actor.home.pos.z; } else { this->actor.shape.rot.x = 0; - this->unk_150 = 1; - func_80B2194C(this); + this->modeVar = 1; + EnTp_Head_SetupHover(this); } } else { Math_SmoothStepToS(&this->actor.shape.rot.x, -0x4000, 1, 0x1F4, 0); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.3f, 1.5f, 0.3f) == 0.0f) { - this->unk_15A = 0x3C; + this->timer = 60; } else { sp32 = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); this->actor.world.pos.x = - (Math_SinS(this->unk_15C * 0x7D0) * (Math_SinS(sp32) * 6.0f)) + this->actor.home.pos.x; + (Math_SinS(this->timer2 * 0x7D0) * (Math_SinS(sp32) * 6.0f)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(this->unk_15C * 0x7D0) * (Math_CosS(sp32) * 6.0f)) + this->actor.home.pos.z; + (Math_SinS(this->timer2 * 0x7D0) * (Math_CosS(sp32) * 6.0f)) + this->actor.home.pos.z; } } this->actor.shape.rot.y = this->actor.world.rot.y; @@ -445,116 +462,125 @@ void func_80B21BDC(EnTp* this, PlayState* play) { } } -void func_80B21EE8(EnTp* this) { - this->unk_14C = 9; - this->unk_15A = 0; - func_80B20DE0(this, func_80B21F18); +void EnTp_Head_SetupSinkIntoGroundAndReappear(EnTp* this) { + this->action = ENTP_ACTION_HEAD_SINK_INTO_GROUND_AND_REAPPEAR; + this->timer = 0; + EnTp_SetupAction(this, EnTp_Head_SinkIntoGroundAndReappear); } -void func_80B21F18(EnTp* this, PlayState* play) { - static Vec3f D_80B22B00 = { 0.0f, -0.5f, 0.0f }; - static Color_RGBA8 D_80B22B0C = { 255, 255, 255, 255 }; - static Color_RGBA8 D_80B22B10 = { 150, 150, 150, 0 }; - Vec3f sp54; - Vec3f sp48; - s32 sp44; - EnTp* var_v0; - s16 new_var; - - sp44 = 0; - this->unk_15C -= 1; - if ((this->unk_15A != 0) || ((this->actor.home.pos.y - this->actor.world.pos.y) > 60.0f)) { +void EnTp_Head_SinkIntoGroundAndReappear(EnTp* this, PlayState* play) { + static Vec3f sBubbleAccel = { 0.0f, -0.5f, 0.0f }; + static Color_RGBA8 sBubblePrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; + Vec3f bubbleVel; + Vec3f bubblePos; + s32 isInsideGround; + EnTp* child; + s16 new_var; //! FAKE + + isInsideGround = false; + this->timer2--; + // timer is initialized to 0, + // so this runs due to the pos.y check once the actor is deep enough under ground (see other "plunge" branch below) + if ((this->timer != 0) || ((this->actor.home.pos.y - this->actor.world.pos.y) > 60.0f)) { if (1) { - this->unk_15A -= 1; + this->timer--; } - if ((new_var = this->unk_15A) == 0) { - func_80B21B90(this); - var_v0 = (EnTp*)this->actor.child; - while (var_v0 != NULL) { - var_v0->unk_15C = var_v0->unk_15A; - var_v0 = (EnTp*)var_v0->actor.child; + // The first time this is reached timer is -1, so the other branch runs + if ((new_var = this->timer) == 0) { + // 4. Finished reappearing + EnTp_Head_SetupWaitPlayerAndRise(this); + child = (EnTp*)this->actor.child; + while (child != NULL) { + child->timer2 = child->timer; + child = (EnTp*)child->actor.child; } } else { + // The first time this is reached shape.rot.x is 0x4000 (see below) + // and this block sets it to -0x4000, hence this block runs once if (this->actor.shape.rot.x != -0x4000) { - this->unk_15A = 0x50; + this->timer = 80; + // 2. Teleport the head (this) and all body elements to home this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos = this->actor.home.pos; this->actor.shape.rot.x = -0x4000; - var_v0 = (EnTp*)this->actor.child; - while (var_v0 != NULL) { - var_v0->actor.velocity.y = 0.0f; - var_v0->actor.speed = 0.0f; - var_v0->actor.world.pos = this->actor.home.pos; - var_v0->actor.world.pos.y = this->actor.home.pos.y - 80.0f; - var_v0 = (EnTp*)var_v0->actor.child; + child = (EnTp*)this->actor.child; + while (child != NULL) { + child->actor.velocity.y = 0.0f; + child->actor.speed = 0.0f; + child->actor.world.pos = this->actor.home.pos; + child->actor.world.pos.y = this->actor.home.pos.y - 80.0f; + child = (EnTp*)child->actor.child; } } - this->actor.world.pos.y = this->actor.home.pos.y - (f32)this->unk_15A; + // 3. Raise back up through the floor + this->actor.world.pos.y = this->actor.home.pos.y - (f32)this->timer; } } else { + // 1. Plunge towards and into the ground if (this->actor.shape.rot.x != 0x4000) { this->actor.shape.rot.x -= 0x400; } - if (this->unk_160 != 0) { - this->unk_160 -= 15; + if (this->redShineAmount != 0) { + this->redShineAmount -= 15; } this->actor.speed = 2.0f * Math_CosS(this->actor.shape.rot.x); this->actor.velocity.y = Math_SinS(this->actor.shape.rot.x) * -2.0f; if ((this->actor.world.pos.y - this->actor.floorHeight) < 20.0f) { - sp44 = 1; + isInsideGround = true; } if (this->actor.world.pos.y != this->actor.home.pos.y) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); } - if ((sp44 != 0) && (play->gameplayFrames & 1)) { - sp48 = this->actor.world.pos; - sp48.y = this->actor.floorHeight; - sp54.x = Rand_CenteredFloat(5.0f); - sp54.y = (Rand_ZeroOne() * 3.5f) + 1.5f; - sp54.z = Rand_CenteredFloat(5.0f); - EffectSsDtBubble_SpawnCustomColor(play, &sp48, &sp54, &D_80B22B00, &D_80B22B0C, &D_80B22B10, - Rand_S16Offset(100, 50), 20, 0); + if (isInsideGround && (play->gameplayFrames & 1)) { + bubblePos = this->actor.world.pos; + bubblePos.y = this->actor.floorHeight; + bubbleVel.x = Rand_CenteredFloat(5.0f); + bubbleVel.y = (Rand_ZeroOne() * 3.5f) + 1.5f; + bubbleVel.z = Rand_CenteredFloat(5.0f); + EffectSsDtBubble_SpawnCustomColor(play, &bubblePos, &bubbleVel, &sBubbleAccel, &sBubblePrimColor, + &sBubbleEnvColor, Rand_S16Offset(100, 50), 20, 0); } } } -void func_80B221E8(EnTp* this, PlayState* play) { - EnTp* var_s0; - EnTp* var_s0_2; - s32 var_s2; - s32 var_s4; - EnTp* new_var; - - if ((this->collider.base.acFlags & AC_HIT) && (this->unk_14C >= 2)) { - var_s2 = 0; - var_s4 = 0; - if (this->actor.params < 0) { - var_s2 = 1; +void EnTp_CheckCollide_(EnTp* this, PlayState* play) { + EnTp* parent; + EnTp* child; + s32 isHeadInstance; + s32 applyStun; + EnTp* headInstance; + + if ((this->collider.base.acFlags & AC_HIT) && (this->action >= ENTP_ACTION_BODYELEM)) { + isHeadInstance = false; + applyStun = false; + if (this->actor.params < 0) { // ENTP_TYPE_HEAD + isHeadInstance = true; } this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); this->unk_158 = this->actor.colChkInfo.damageReaction; - if (this->actor.colChkInfo.damageReaction != 0) { - if (this->actor.colChkInfo.damageReaction == 1) { - var_s4 = 1; + if (this->actor.colChkInfo.damageReaction != ENTP_DMG_REACT_NO_EFFECT) { + if (this->actor.colChkInfo.damageReaction == ENTP_DMG_REACT_STUN) { + applyStun = true; } - if (var_s2 == 0) { + if (!isHeadInstance) { Actor_ApplyDamage(&this->actor); } if (this->actor.colChkInfo.health == 0) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - new_var = this->unk_1D4; - if (new_var->actor.params < 0) { - func_80B21454(new_var); - new_var->unk_158 = this->actor.colChkInfo.damageReaction; - new_var->actor.params = 0xC; + headInstance = this->headInstance; + if (headInstance->actor.params < 0) { // ENTP_TYPE_HEAD + EnTp_SetupDying(headInstance); + headInstance->unk_158 = this->actor.colChkInfo.damageReaction; + headInstance->actor.params = ENTP_TYPE_HEAD_DYING; } } else { - if (var_s4 != 0) { + if (applyStun) { this->actor.freezeTimer = 80; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - if (var_s2 != 0) { + if (isHeadInstance) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); } else { @@ -562,36 +588,36 @@ void func_80B221E8(EnTp* this, PlayState* play) { 80); } } - var_s0 = (EnTp*)this->actor.parent; - while (var_s0 != NULL) { - var_s0->collider.base.acFlags &= ~AC_HIT; - if (var_s4 != 0) { - var_s0->actor.freezeTimer = 80; + parent = (EnTp*)this->actor.parent; + while (parent != NULL) { + parent->collider.base.acFlags &= ~AC_HIT; + if (applyStun) { + parent->actor.freezeTimer = 80; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - if (var_s2 != 0) { - Actor_SetColorFilter(&var_s0->actor, COLORFILTER_COLORFLAG_BLUE, 255, + if (isHeadInstance) { + Actor_SetColorFilter(&parent->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); } else { - Actor_SetColorFilter(&var_s0->actor, COLORFILTER_COLORFLAG_BLUE, 255, + Actor_SetColorFilter(&parent->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 80); } } - var_s0 = (EnTp*)var_s0->actor.parent; + parent = (EnTp*)parent->actor.parent; } - var_s0_2 = (EnTp*)this->actor.child; - while (var_s0_2 != NULL) { - var_s0_2->collider.base.acFlags &= ~AC_HIT; - if (var_s4 != 0) { - var_s0_2->actor.freezeTimer = 80; - if (var_s2 != 0) { - Actor_SetColorFilter(&var_s0_2->actor, COLORFILTER_COLORFLAG_BLUE, 255, + child = (EnTp*)this->actor.child; + while (child != NULL) { + child->collider.base.acFlags &= ~AC_HIT; + if (applyStun) { + child->actor.freezeTimer = 80; + if (isHeadInstance) { + Actor_SetColorFilter(&child->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); } else { - Actor_SetColorFilter(&var_s0_2->actor, COLORFILTER_COLORFLAG_BLUE, 255, + Actor_SetColorFilter(&child->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 80); } } - var_s0_2 = (EnTp*)var_s0_2->actor.child; + child = (EnTp*)child->actor.child; } } } @@ -601,26 +627,26 @@ void func_80B221E8(EnTp* this, PlayState* play) { void EnTp_Update(Actor* thisx, PlayState* play) { Player* player; s32 pad; - Vec3f sp5C = { 0.0f, 0.0f, 0.0f }; - Vec3f sp50 = { 0.0f, -0.6f, 0.0f }; - Vec3f sp44; - Color_RGBA8 sp40 = { 0, 0, 255, 255 }; - Color_RGBA8 sp3C = { 0, 0, 0, 0 }; + Vec3f sparkVel = { 0.0f, 0.0f, 0.0f }; + Vec3f sparkAccel = { 0.0f, -0.6f, 0.0f }; + Vec3f sparkPos; + Color_RGBA8 sparkPrimColor = { 0, 0, 255, 255 }; + Color_RGBA8 sparkEnvColor = { 0, 0, 0, 0 }; EnTp* this = (EnTp*)thisx; s16 v; player = GET_PLAYER(play); if (player->stateFlags1 & PLAYER_STATE1_26) { - this->unk_158 = 0; + this->unk_158 = ENTP_DMG_REACT_NO_EFFECT; } if (this->actor.colChkInfo.health != 0) { - func_80B221E8(this, play); + EnTp_CheckCollide_(this, play); } - this->unk_154(this, play); - if (this->actor.params < 0) { + this->actionFunc(this, play); + if (this->actor.params < 0) { // ENTP_TYPE_HEAD Actor_MoveXZGravity(&this->actor); - if (this->unk_14C != 9) { + if (this->action != ENTP_ACTION_HEAD_SINK_INTO_GROUND_AND_REAPPEAR) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); } @@ -639,62 +665,64 @@ void EnTp_Update(Actor* thisx, PlayState* play) { if (this->actor.shape.rot.z == 0) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_CRY); } - if (this->unk_14C >= 2) { + if (this->action >= ENTP_ACTION_BODYELEM) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } } - if (this->actor.params != 0xB) { - this->unk_162 -= 1; - this->unk_162 &= 7; + if (this->actor.params != ENTP_TYPE_BODYELEM_DYING) { + this->sparkTimer--; + this->sparkTimer &= 7; } this->actor.focus.pos = this->actor.world.pos; - if (this->unk_158 == 0xE) { + if (this->unk_158 == ENTP_DMG_REACT_MELEE_BACKLASH) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if ((this->unk_162 & 7) == 0) { - sp40.r = this->unk_160; - sp50.x = -this->actor.velocity.x * 0.25f; - sp50.y = -this->actor.velocity.y * 0.25f; - sp50.z = -this->actor.velocity.z * 0.25f; - sp44.x = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.x; - sp44.y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + this->actor.world.pos.y; - sp44.z = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.z; - EffectSsKiraKira_SpawnSmall(play, &sp44, &sp5C, &sp50, &sp40, &sp3C); + if ((this->sparkTimer & 7) == 0) { + sparkPrimColor.r = this->redShineAmount; + sparkAccel.x = -this->actor.velocity.x * 0.25f; + sparkAccel.y = -this->actor.velocity.y * 0.25f; + sparkAccel.z = -this->actor.velocity.z * 0.25f; + sparkPos.x = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.x; + sparkPos.y = ((Rand_ZeroOne() - 0.5f) * 20.0f) + this->actor.world.pos.y; + sparkPos.z = ((Rand_ZeroOne() - 0.5f) * 25.0f) + this->actor.world.pos.z; + EffectSsKiraKira_SpawnSmall(play, &sparkPos, &sparkVel, &sparkAccel, &sparkPrimColor, &sparkEnvColor); } - if ((this->unk_14C >= 2) && (this->actor.colChkInfo.health != 0)) { + if ((this->action >= ENTP_ACTION_BODYELEM) && (this->actor.colChkInfo.health != 0)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } } void EnTp_Draw(Actor* thisx, PlayState* play) { - s16 temp_v0; + s16 type; EnTp* this = (EnTp*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1451); - if (this->unk_150 != 2) { - temp_v0 = this->actor.params; - if ((temp_v0 < 0) || (temp_v0 == 0xC)) { + if (this->modeVar != 2) { + type = this->actor.params; + if ((type < 0) /* ENTP_TYPE_HEAD */ || (type == ENTP_TYPE_HEAD_DYING)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_tp.c", 1459); - gSPDisplayList(POLY_OPA_DISP++, object_tp_0008D0_DL); + gSPDisplayList(POLY_OPA_DISP++, gTailpasaranHeadDL); Matrix_Translate(0.0f, 0.0f, 8.0f, MTXMODE_APPLY); - } else { + } else { // ENTP_TYPE_BODYELEM, ENTP_TYPE_BODYELEMREMNANT, ENTP_TYPE_BODYELEM_DYING Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->unk_160, 0, 255, this->unk_15E); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->redShineAmount, 0, 255, this->bodyElementAlpha_); gDPPipeSync(POLY_XLU_DISP++); + // Note: gTailpasaranBodyElemDL overrides the combiner before drawing gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT); gDPPipeSync(POLY_XLU_DISP++); - gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(object_tp_000C68_Tex)); + gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(gTailpasaranBodyElemTex)); gDPPipeSync(POLY_XLU_DISP++); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_tp.c", 1480); - gSPDisplayList(POLY_XLU_DISP++, object_tp_000000_DL); + gSPDisplayList(POLY_XLU_DISP++, gTailpasaranBodyElemDL); } } CLOSE_DISPS(play->state.gfxCtx, "../z_en_tp.c", 1495); - if ((this->actor.params <= 0) || (this->actor.params == 0xB)) { + if ((this->actor.params <= 0) /* ENTP_TYPE_HEAD, ENTP_TYPE_BODYELEM */ || + (this->actor.params == ENTP_TYPE_BODYELEM_DYING)) { Collider_UpdateSpheres(0, &this->collider); } } 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 0745f42d812..2da4bbb8762 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -4,28 +4,36 @@ #include "ultra64.h" #include "actor.h" +typedef enum EnTpType { + ENTP_TYPE_HEAD = -1, // To be used for the initial spawn + ENTP_TYPE_BODYELEM, + ENTP_TYPE_BODYELEMREMNANT = 10, + ENTP_TYPE_BODYELEM_DYING, + ENTP_TYPE_HEAD_DYING +} EnTpType; + struct EnTp; typedef struct EnTp { /* 0x000 */ Actor actor; - /* 0x14C */ s32 unk_14C; - /* 0x150 */ s32 unk_150; - /* 0x154 */ void (*unk_154)(struct EnTp*, struct PlayState*); + /* 0x14C */ s32 action; + /* 0x150 */ s32 modeVar; + /* 0x154 */ void (*actionFunc)(struct EnTp*, struct PlayState*); /* 0x158 */ u8 unk_158; /* 0x159 */ char pad_159[1]; - /* 0x15A */ s16 unk_15A; - /* 0x15C */ s16 unk_15C; - /* 0x15E */ s16 unk_15E; - /* 0x160 */ s16 unk_160; - /* 0x162 */ s16 unk_162; + /* 0x15A */ s16 timer; + /* 0x15C */ s16 timer2; + /* 0x15E */ s16 bodyElementAlpha_; + /* 0x160 */ s16 redShineAmount; + /* 0x162 */ s16 sparkTimer; /* 0x164 */ s16 unk_164; /* 0x166 */ char pad_166[2]; /* 0x168 */ f32 unk_168; - /* 0x16C */ f32 unk_16C; + /* 0x16C */ f32 bodyElemDist_; /* 0x170 */ f32 unk_170; /* 0x174 */ ColliderJntSph collider; /* 0x194 */ ColliderJntSphElement colliderElements[1]; - /* 0x1D4 */ struct EnTp* unk_1D4; + /* 0x1D4 */ struct EnTp* headInstance; } EnTp; // size = 0x1D8 #endif From bdfd0417ead8f1b97ba2be78ebaca1f644293d43 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 31 Jul 2026 12:55:35 +0200 Subject: [PATCH 050/150] fixups --- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 22 +++++++++++----------- src/overlays/actors/ovl_En_Tp/z_en_tp.h | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) 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 db0875dde3b..1703df22b1c 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -157,7 +157,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { this->modeVar = 0; this->actor.colChkInfo.health = 1; prevChild = this; - this->bodyElementAlpha_ = 255; + this->bodyElemAlpha = 255; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); if (this->actor.params < 0) { // ENTP_TYPE_HEAD @@ -189,7 +189,7 @@ void EnTp_Init(Actor* thisx, PlayState* play2) { newChild->timer2 = i * -5; newChild->timer = i * -5; prevChild = newChild; - newChild->bodyElemDist_ = 6.0f - ((f32)i * 0.75f); + newChild->bodyElemDist = 6.0f - ((f32)i * 0.75f); } } } else if (this->actor.params == ENTP_TYPE_BODYELEM) { @@ -234,9 +234,9 @@ void EnTp_BodyElem(EnTp* this, PlayState* play) { sp36 = this->headInstance->actor.shape.rot.y + 0x4000; temp_a0_sp34 = (this->headInstance->timer2 + this->timer) * 0x7D0; this->actor.world.pos.x = - (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->bodyElemDist_)) + this->actor.home.pos.x; + (Math_SinS(temp_a0_sp34) * (Math_SinS(sp36) * this->bodyElemDist)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->bodyElemDist_)) + this->actor.home.pos.z; + (Math_SinS(temp_a0_sp34) * (Math_CosS(sp36) * this->bodyElemDist)) + this->actor.home.pos.z; } } } @@ -355,9 +355,9 @@ void EnTp_SetupBodyElemRemnant(EnTp* this) { void EnTp_BodyElemRemnant(EnTp* this, PlayState* play) { Actor_UpdatePos(&this->actor); - this->bodyElementAlpha_ -= 20; - if (this->bodyElementAlpha_ < 20) { - this->bodyElementAlpha_ = 0; + this->bodyElemAlpha -= 20; + if (this->bodyElemAlpha < 20) { + this->bodyElemAlpha = 0; Actor_Kill(&this->actor); } } @@ -375,7 +375,7 @@ void EnTp_Head_Hover(EnTp* this, PlayState* play) { player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); // bodyElemDist_ is always 0 here - Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->bodyElemDist_, 1.0f, + Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->bodyElemDist, 1.0f, this->actor.speed * 0.25f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); if (this->collider.base.atFlags & AT_HIT) { @@ -436,9 +436,9 @@ void EnTp_Head_WaitPlayerAndRise(EnTp* this, PlayState* play) { Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y + 30.0f, 0.3f, 1.0f, 0.3f); // bodyElemDist_ is always 0 here this->actor.world.pos.x = - (Math_SinS(this->timer2 * 0x7D0) * (Math_SinS(sp32) * this->bodyElemDist_)) + this->actor.home.pos.x; + (Math_SinS(this->timer2 * 0x7D0) * (Math_SinS(sp32) * this->bodyElemDist)) + this->actor.home.pos.x; this->actor.world.pos.z = - (Math_SinS(this->timer2 * 0x7D0) * (Math_CosS(sp32) * this->bodyElemDist_)) + this->actor.home.pos.z; + (Math_SinS(this->timer2 * 0x7D0) * (Math_CosS(sp32) * this->bodyElemDist)) + this->actor.home.pos.z; } else { this->actor.shape.rot.x = 0; this->modeVar = 1; @@ -707,7 +707,7 @@ void EnTp_Draw(Actor* thisx, PlayState* play) { } else { // ENTP_TYPE_BODYELEM, ENTP_TYPE_BODYELEMREMNANT, ENTP_TYPE_BODYELEM_DYING Gfx_SetupDL_25Xlu(play->state.gfxCtx); Matrix_ReplaceRotation(&play->billboardMtxF); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->redShineAmount, 0, 255, this->bodyElementAlpha_); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, this->redShineAmount, 0, 255, this->bodyElemAlpha); gDPPipeSync(POLY_XLU_DISP++); // Note: gTailpasaranBodyElemDL overrides the combiner before drawing gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, 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 2da4bbb8762..642a2c0864e 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -23,13 +23,13 @@ typedef struct EnTp { /* 0x159 */ char pad_159[1]; /* 0x15A */ s16 timer; /* 0x15C */ s16 timer2; - /* 0x15E */ s16 bodyElementAlpha_; + /* 0x15E */ s16 bodyElemAlpha; /* 0x160 */ s16 redShineAmount; /* 0x162 */ s16 sparkTimer; /* 0x164 */ s16 unk_164; /* 0x166 */ char pad_166[2]; /* 0x168 */ f32 unk_168; - /* 0x16C */ f32 bodyElemDist_; + /* 0x16C */ f32 bodyElemDist; /* 0x170 */ f32 unk_170; /* 0x174 */ ColliderJntSph collider; /* 0x194 */ ColliderJntSphElement colliderElements[1]; From 63dcad08088053a78910332ffbc0a6a8d29f13e1 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 08:44:40 +0200 Subject: [PATCH 051/150] doc EnWf, object_wf --- assets/xml/objects/object_wf.xml | 288 ++--- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 1333 ++++++++++++----------- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 40 +- 3 files changed, 861 insertions(+), 800 deletions(-) diff --git a/assets/xml/objects/object_wf.xml b/assets/xml/objects/object_wf.xml index 3817f8a541f..9d2d9d97f3b 100644 --- a/assets/xml/objects/object_wf.xml +++ b/assets/xml/objects/object_wf.xml @@ -1,231 +1,231 @@ - - - - - - - + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + 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 6591af5bc4e..0d156f101f5 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -35,34 +35,51 @@ void EnWf_Destroy(Actor* thisx, PlayState* play); void EnWf_Update(Actor* thisx, PlayState* play); void EnWf_Draw(Actor* thisx, PlayState* play); -void func_80B34380(EnWf* this); -void func_80B34428(EnWf* this, PlayState* play); -void func_80B3455C(EnWf* this); -void func_80B345E4(EnWf* this, PlayState* play); -void func_80B347FC(EnWf* this, PlayState* play); -void func_80B3487C(EnWf* this, PlayState* play); -void func_80B34CFC(EnWf* this); -void func_80B34D48(EnWf* this, PlayState* play); -void func_80B34F28(EnWf* this); -void func_80B35024(EnWf* this, PlayState* play); -void func_80B35540(EnWf* this); -void func_80B355BC(EnWf* this, PlayState* play); -void func_80B359A8(EnWf* this, PlayState* play); -void func_80B35B94(EnWf* this); -void func_80B35C10(EnWf* this, PlayState* play); -void func_80B35D90(EnWf* this, PlayState* play); -void func_80B35EE4(EnWf* this, PlayState* play); -void func_80B360E8(EnWf* this); -void func_80B361A0(EnWf* this, PlayState* play); -void func_80B36288(EnWf* this); -void func_80B36328(EnWf* this, PlayState* play); -void func_80B365A8(EnWf* this, PlayState* play); -void func_80B36740(EnWf* this, PlayState* play); -void func_80B36C8C(EnWf* this); -void func_80B36D3C(EnWf* this, PlayState* play); -s32 func_80B37830(PlayState* play, EnWf* this); - -static ColliderJntSphElementInit sJntSphElementsInit[] = { +void EnWf_SetupWaitAppear(EnWf* this); +void EnWf_WaitAppear(EnWf* this, PlayState* play); +void EnWf_SetupIdle(EnWf* this); +void EnWf_Idle(EnWf* this, PlayState* play); +void EnWf_SetupRunToAttack(EnWf* this, PlayState* play); +void EnWf_RunToAttack(EnWf* this, PlayState* play); +void EnWf_SetupTurnTowardsPlayer(EnWf* this); +void EnWf_TurnTowardsPlayer(EnWf* this, PlayState* play); +void EnWf_SetupCirclePlayer(EnWf* this); +void EnWf_CirclePlayer(EnWf* this, PlayState* play); +void EnWf_SetupAttack(EnWf* this); +void EnWf_Attack(EnWf* this, PlayState* play); +void EnWf_AttackBouncedOff(EnWf* this, PlayState* play); +void EnWf_SetupBackflipBackward(EnWf* this); +void EnWf_BackflipBackward(EnWf* this, PlayState* play); +void EnWf_Stunned(EnWf* this, PlayState* play); +void EnWf_Damaged(EnWf* this, PlayState* play); +void EnWf_SetupBackflipForward(EnWf* this); +void EnWf_BackflipForward(EnWf* this, PlayState* play); +void EnWf_SetupBlock(EnWf* this); +void EnWf_Block(EnWf* this, PlayState* play); +void EnWf_SetupShortCirclePlayer(EnWf* this, PlayState* play); +void EnWf_ShortCirclePlayer(EnWf* this, PlayState* play); +void EnWf_SetupDie(EnWf* this); +void EnWf_Die(EnWf* this, PlayState* play); +s32 EnWf_ReactToProjectile(PlayState* play, EnWf* this); + +typedef enum EnWfAction { + ENWF_ACTION_WAIT_APPEAR, + ENWF_ACTION_DIE = 2, + ENWF_ACTION_DAMAGED, + ENWF_ACTION_BACKFLIP_FORWARD, + ENWF_ACTION_BACKFLIP_BACKWARD, + ENWF_ACTION_IDLE, + ENWF_ACTION_BLOCK, + ENWF_ACTION_ATTACK, + ENWF_ACTION_RUN_TO_ATTACK, + ENWF_ACTION_TURN_TOWARDS_PLAYER, + ENWF_ACTION_CIRCLE_PLAYER, + ENWF_ACTION_ATTACK_BOUNCED_OFF, + ENWF_ACTION_SHORT_CIRCLE_PLAYER = 14, + ENWF_ACTION_STUNNED +} EnWfAction; + +static ColliderJntSphElementInit sAttackAndBlockJntSphElementsInit[] = { { { ELEM_MATERIAL_UNK0, @@ -72,7 +89,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_NONE, OCELEM_NONE, }, - { 15, { { 0, 0, 0 }, 15 }, 100 }, + { WOLFOS_LIMB_RIGHT_CLAWS, { { 0, 0, 0 }, 15 }, 100 }, }, { { @@ -83,7 +100,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_NONE, OCELEM_NONE, }, - { 21, { { 0, 0, 0 }, 15 }, 100 }, + { WOLFOS_LIMB_LEFT_CLAWS, { { 0, 0, 0 }, 15 }, 100 }, }, { { @@ -94,7 +111,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, - { 17, { { 800, 0, 0 }, 25 }, 100 }, + { WOLFOS_LIMB_HEAD, { { 800, 0, 0 }, 25 }, 100 }, }, { { @@ -105,11 +122,11 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, - { 12, { { 0, 0, 0 }, 30 }, 100 }, + { WOLFOS_LIMB_TORSO, { { 0, 0, 0 }, 30 }, 100 }, }, }; -static ColliderJntSphInit sJntSphInit = { +static ColliderJntSphInit sAttackAndBlockJntSphInit = { { COL_MATERIAL_METAL, AT_ON | AT_TYPE_ENEMY, @@ -118,11 +135,11 @@ static ColliderJntSphInit sJntSphInit = { OC2_TYPE_1, COLSHAPE_JNTSPH, }, - ARRAY_COUNT(sJntSphElementsInit), - sJntSphElementsInit, + ARRAY_COUNT(sAttackAndBlockJntSphElementsInit), + sAttackAndBlockJntSphElementsInit, }; -static ColliderCylinderInit D_80B37A30 = { +static ColliderCylinderInit sBodyCylinderInit = { { COL_MATERIAL_HIT5, AT_NONE, @@ -142,7 +159,7 @@ static ColliderCylinderInit D_80B37A30 = { { 20, 50, 0, { 0, 0, 0 } }, }; -static ColliderCylinderInit D_80B37A5C = { +static ColliderCylinderInit sTailCylinderInit = { { COL_MATERIAL_HIT5, AT_NONE, @@ -162,39 +179,48 @@ static ColliderCylinderInit D_80B37A5C = { { 15, 20, -15, { 0, 0, 0 } }, }; +typedef enum EnWfDamageReaction { + ENWF_DMG_REACT_NONE, + ENWF_DMG_REACT_STUN, + ENWF_DMG_REACT_6 = 6, + ENWF_DMG_REACT_D = 0xD, + ENWF_DMG_REACT_FIRE, + ENWF_DMG_REACT_F +} EnWfDamageReaction; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0x0), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(0, 0x1), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0x1), - /* Kokiri sword */ DMG_ENTRY(1, 0x0), - /* Master sword */ DMG_ENTRY(2, 0x0), - /* Giant's Knife */ DMG_ENTRY(4, 0x0), - /* Fire arrow */ DMG_ENTRY(4, 0xE), - /* Ice arrow */ DMG_ENTRY(2, 0x0), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(4, 0xE), - /* Ice magic */ DMG_ENTRY(0, 0x6), - /* Light magic */ DMG_ENTRY(3, 0xD), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0x0), - /* Giant spin */ DMG_ENTRY(4, 0x0), - /* Master spin */ DMG_ENTRY(2, 0x0), - /* Kokiri jump */ DMG_ENTRY(2, 0x0), - /* Giant jump */ DMG_ENTRY(8, 0x0), - /* Master jump */ DMG_ENTRY(4, 0x0), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, ENWF_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), + /* Explosive */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(0, ENWF_DMG_REACT_STUN), + /* Normal arrow */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(0, ENWF_DMG_REACT_STUN), + /* Kokiri sword */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), + /* Master sword */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Giant's Knife */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), + /* Fire arrow */ DMG_ENTRY(4, ENWF_DMG_REACT_FIRE), + /* Ice arrow */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Light arrow */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Unk arrow 1 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Unk arrow 2 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Unk arrow 3 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Fire magic */ DMG_ENTRY(4, ENWF_DMG_REACT_FIRE), + /* Ice magic */ DMG_ENTRY(0, ENWF_DMG_REACT_6), + /* Light magic */ DMG_ENTRY(3, ENWF_DMG_REACT_D), + /* Shield */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), + /* Giant spin */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), + /* Master spin */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Kokiri jump */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), + /* Giant jump */ DMG_ENTRY(8, ENWF_DMG_REACT_NONE), + /* Master jump */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), + /* Unknown 1 */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, ENWF_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), }; ActorProfile En_Wf_Profile = { @@ -215,12 +241,14 @@ static InitChainEntry sInitChain[2] = { }; static Vec3f D_80B37AD0 = { 0.0f, 0.5f, 0.0f }; static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; -static Vec3f D_80B37AE8 = { 0.0f, 0.0f, 0.0f }; -static void* D_80B37AF4[4] = { object_wf_Tex_007B68, object_wf_Tex_008368, object_wf_Tex_008568, object_wf_Tex_008368 }; -static void* D_80B37B04[4] = { object_wf_Tex_000300, object_wf_Tex_0027D8, object_wf_Tex_0029D8, object_wf_Tex_0027D8 }; - -void func_80B33CB0(EnWf* this, void (*arg1)(EnWf*, PlayState*)) { - this->unk_2DC = arg1; +static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; +static void* sWolfosGrayEyeTextures[4] = { gWolfosGrayEyeOpenTex, gWolfosGrayEyeHalfTex, gWolfosGrayEyeClosedTex, + gWolfosGrayEyeHalfTex }; +static void* sWolfosWhiteEyeTextures[4] = { gWolfosWhiteEyeOpenTex, gWolfosWhiteEyeHalfTex, gWolfosWhiteEyeClosedTex, + gWolfosWhiteEyeHalfTex }; + +void EnWf_SetupAction(EnWf* this, void (*actionFunc)(EnWf*, PlayState*)) { + this->actionFunc = actionFunc; } void EnWf_Init(Actor* thisx, PlayState* play) { @@ -235,246 +263,253 @@ void EnWf_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 8; this->actor.colChkInfo.cylRadius = 50; this->actor.colChkInfo.cylHeight = 100; - this->unk_2FC = PARAMS_GET_U(thisx->params, 8, 8); - this->actor.params &= 0xFF; - this->unk_302 = 0; + this->switchFlag = PARAMS_GET_U(thisx->params, 8, 8); + this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8); + this->eyeIndex = 0; this->unk_2F4 = 10.0f; - Collider_InitJntSph(play, &this->unk_304); - Collider_SetJntSph(play, &this->unk_304, &this->actor, &sJntSphInit, this->unk_324); - Collider_InitCylinder(play, &this->unk_424); - Collider_SetCylinder(play, &this->unk_424, &this->actor, &D_80B37A30); - Collider_InitCylinder(play, &this->unk_470); - Collider_SetCylinder(play, &this->unk_470, &this->actor, &D_80B37A5C); + Collider_InitJntSph(play, &this->attackAndBlockCollider); + Collider_SetJntSph(play, &this->attackAndBlockCollider, &this->actor, &sAttackAndBlockJntSphInit, + this->attackAndBlockColliderElements); + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyCylinderInit); + Collider_InitCylinder(play, &this->tailCollider); + Collider_SetCylinder(play, &this->tailCollider, &this->actor, &sTailCylinderInit); if (this->actor.params == 0) { - SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_009690, &object_wf_Anim_00A4AC, this->jointTable, - this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosGraySkel, &gWolfosIdleAnim, this->jointTable, + this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(&this->actor, 0.0075f); this->actor.naviEnemyId = NAVI_ENEMY_WOLFOS; } else { - SkelAnime_InitFlex(play, &this->skelAnime, &object_wf_Skel_003BC0, &object_wf_Anim_00A4AC, this->jointTable, - this->morphTable, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gWolfosWhiteSkel, &gWolfosIdleAnim, this->jointTable, + this->morphTable, WOLFOS_LIMB_MAX); Actor_SetScale(&this->actor, 0.01f); - this->unk_304.elements[0].base.atDmgInfo.damage = this->unk_304.elements[1].base.atDmgInfo.damage = 8; + this->attackAndBlockCollider.elements[0].base.atDmgInfo.damage = + this->attackAndBlockCollider.elements[1].base.atDmgInfo.damage = 8; this->actor.naviEnemyId = NAVI_ENEMY_WHITE_WOLFOS; } - func_80B34380(this); - if ((this->unk_2FC != 0xFF) && Flags_GetSwitch(play, this->unk_2FC)) { + EnWf_SetupWaitAppear(this); + if ((this->switchFlag != 0xFF) && Flags_GetSwitch(play, this->switchFlag)) { Actor_Kill(&this->actor); } } void EnWf_Destroy(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; - EnEncount1* temp_v1; + EnEncount1* parent; - Collider_DestroyJntSph(play, &this->unk_304); - Collider_DestroyCylinder(play, &this->unk_424); - Collider_DestroyCylinder(play, &this->unk_470); - if ((this->actor.params != 0) && (this->unk_2FC != 0xFF)) { + Collider_DestroyJntSph(play, &this->attackAndBlockCollider); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyCylinder(play, &this->tailCollider); + if ((this->actor.params != 0) && (this->switchFlag != 0xFF)) { func_800F5B58(); } - if ((this->actor.parent != NULL)) { - temp_v1 = (EnEncount1*)this->actor.parent; - if ((temp_v1->actor.update != NULL)) { + if (this->actor.parent != NULL) { + parent = (EnEncount1*)this->actor.parent; + if (parent->actor.update != NULL) { - if (temp_v1->curNumSpawn > 0) { - temp_v1->curNumSpawn--; + if (parent->curNumSpawn > 0) { + parent->curNumSpawn--; } PRINTF("\n\n"); - PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, temp_v1->curNumSpawn); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 同時発生数 ☆☆☆☆☆%d\n" VT_RST, parent->curNumSpawn); PRINTF("\n\n"); } } } -s32 func_80B33FB0(PlayState* play, EnWf* this, s16 arg2) { +/** + * Pick an action based on the player's current doings and location. + * @return true if an action was picked + */ +s32 EnWf_PickAction(PlayState* play, EnWf* this, s16 mustPick) { Player* player; s32 pad; - s16 var_t0; - s16 var_v1; + s16 absRelWallYaw; + s16 absRelYawTowardsPlayer; player = GET_PLAYER(play); - var_t0 = this->actor.wallYaw - this->actor.shape.rot.y; - if (var_t0 < 0) { - var_t0 *= -1; + absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; + if (absRelWallYaw < 0) { + absRelWallYaw *= -1; } - var_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (var_v1 < 0) { - var_v1 *= -1; + absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (absRelYawTowardsPlayer < 0) { + absRelYawTowardsPlayer *= -1; } - if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y) != 0) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - func_80B36288(this); + EnWf_SetupBlock(this); return true; } if (play->gameplayFrames & 1) { - func_80B36288(this); + EnWf_SetupBlock(this); return true; } } - if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y) != 0) { + if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if ((ABS(var_t0) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { - func_80B360E8(this); - return true; - } - } - if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - func_80B36288(this); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && + (this->actor.xzDistToPlayer < 120.0f)) { + EnWf_SetupBackflipForward(this); return true; - } - if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames & 1)) { - func_80B36288(this); + } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { + EnWf_SetupBlock(this); + return true; + } else if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames & 1)) { + EnWf_SetupBlock(this); + return true; + } else { + EnWf_SetupBackflipBackward(this); return true; } - func_80B35B94(this); - return true; } else { - Actor* temp_v0_2; + Actor* explosive; - temp_v0_2 = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); - if (temp_v0_2 != NULL) { + explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (explosive != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_t0 < 0x2EE0)) || - (temp_v0_2->id == ACTOR_EN_BOM_CHU)) { - if (temp_v0_2->id == ACTOR_EN_BOM_CHU) { - if ((Actor_WorldDistXYZToActor(&this->actor, temp_v0_2) < 80.0f) && - ((s16)(this->actor.shape.rot.y - temp_v0_2->world.rot.y + 0x8000) < 0x3E80)) { - func_80B360E8(this); - return true; - } + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (absRelWallYaw < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { + if ((explosive->id == ACTOR_EN_BOM_CHU) && + (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && + ((s16)(this->actor.shape.rot.y - explosive->world.rot.y + 0x8000) < 0x3E80)) { + EnWf_SetupBackflipForward(this); + return true; + } else { + EnWf_SetupShortCirclePlayer(this, play); + return true; } - func_80B365A8(this, play); + } else { + EnWf_SetupBackflipBackward(this); return true; } - func_80B35B94(this); - return true; } } - if (arg2) { - s16 temp_v1_3; + if (mustPick) { + s16 yawDiff; - if (var_v1 >= 0x1B58) { - func_80B365A8(this, play); + if (absRelYawTowardsPlayer >= 0x1B58) { + EnWf_SetupShortCirclePlayer(this, play); return true; } - temp_v1_3 = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (this->actor.xzDistToPlayer <= 80.0f) { - if (!Actor_OtherIsLockedOn(play, &this->actor)) { - if ((play->gameplayFrames & 7) || (ABS(temp_v1_3) < 0x38E0)) { - func_80B35540(this); - return true; - } - } + yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; + if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && + (((play->gameplayFrames & 7) != 0) || (ABS(yawDiff) < 0x38E0))) { + EnWf_SetupAttack(this); + return true; + } else { + EnWf_SetupCirclePlayer(this); + return true; } - func_80B34F28(this); - - return true; } return false; } -void func_80B34380(EnWf* this) { - Animation_Change(&this->skelAnime, &object_wf_Anim_005430, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); +/** + * Actor is squished underground and waits for the player to be in range to rise above ground. + */ +void EnWf_SetupWaitAppear(EnWf* this) { + Animation_Change(&this->skelAnime, &gWolfosHowlAnim, 0.5f, 0.0f, 7.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; - this->unk_2E8 = 0x14; - this->unk_300 = 0; - this->unk_2D4 = 0; + this->timer = 20; + this->unk_300 = false; + this->action = ENWF_ACTION_WAIT_APPEAR; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.scale.y = 0.0f; this->actor.gravity = 0.0f; - func_80B33CB0(this, func_80B34428); + EnWf_SetupAction(this, EnWf_WaitAppear); } -void func_80B34428(EnWf* this, PlayState* play) { - - if (this->unk_2E8 >= 6) { +void EnWf_WaitAppear(EnWf* this, PlayState* play) { + if (this->timer > 5) { this->actor.world.pos.y = this->actor.home.pos.y - 5.0f; if (this->actor.xzDistToPlayer < 240.0f) { - this->unk_2E8 = 5; + this->timer = 5; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - if ((this->actor.params != 0) && (this->unk_2FC != 0xFF)) { + if ((this->actor.params != 0) && (this->switchFlag != 0xFF)) { func_800F5ACC(NA_BGM_MINI_BOSS); } } - } else if (this->unk_2E8 != 0) { - this->actor.scale.y += this->actor.scale.x * 0.2f; + } else if (this->timer != 0) { + this->actor.scale.y += this->actor.scale.x * (1 / 5.0f); this->actor.world.pos.y += 0.5f; - Math_SmoothStepToF(&this->actor.shape.shadowScale, 70.0f, 1.0f, 14.0f, 0.0f); - this->unk_2E8 -= 1; - if (this->unk_2E8 == 0) { + Math_SmoothStepToF(&this->actor.shape.shadowScale, 70.0f, 1.0f, 70.0f / 5, 0.0f); + this->timer--; + if (this->timer == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_APPEAR); } - } else if (SkelAnime_Update(&this->skelAnime)) { - this->actor.scale.y = this->actor.scale.x; - this->actor.gravity = -2.0f; - func_80B3455C(this); + } else { + if (SkelAnime_Update(&this->skelAnime)) { + this->actor.scale.y = this->actor.scale.x; + this->actor.gravity = -2.0f; + EnWf_SetupIdle(this); + } } } -void func_80B3455C(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &object_wf_Anim_00A4AC, -4.0f); - this->unk_2D4 = 6; - this->unk_2E8 = (Rand_ZeroOne() * 10.0f) + 2.0f; +void EnWf_SetupIdle(EnWf* this) { + Animation_MorphToLoop(&this->skelAnime, &gWolfosIdleAnim, -4.0f); + this->action = ENWF_ACTION_IDLE; + this->timer = (Rand_ZeroOne() * 10.0f) + 2.0f; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B33CB0(this, func_80B345E4); + EnWf_SetupAction(this, EnWf_Idle); } -void func_80B345E4(EnWf* this, PlayState* play) { +void EnWf_Idle(EnWf* this, PlayState* play) { Player* player; s32 pad; - s16 var_v1_sp26; + s16 yaw; player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); - if (this->unk_2E2 != 0) { - var_v1_sp26 = (this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_4D6; - if (ABS(var_v1_sp26) >= 0x2001) { - this->unk_2E2 -= 1; + if (this->idleTimer != 0) { + yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->headRot; + if (ABS(yaw) > 0x2000) { + this->idleTimer--; return; } - this->unk_2E2 = 0; + this->idleTimer = 0; } - var_v1_sp26 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (var_v1_sp26 < 0) { - var_v1_sp26 *= -1; + yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (yaw < 0) { + yaw *= -1; } - if (!func_80B37830(play, this)) { + if (!EnWf_ReactToProjectile(play, this)) { + // unk_2E0 is always 0 if (this->unk_2E0 != 0) { - this->unk_2E0 -= 1; - if (var_v1_sp26 < 0x1FFE) { + this->unk_2E0--; + if (yaw < 0x1FFE) { this->unk_2E0 = 0; } else { return; } - } else if (func_80B33FB0(play, this, false)) { + } else if (EnWf_PickAction(play, this, false)) { return; } - var_v1_sp26 = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (var_v1_sp26 < 0) { - var_v1_sp26 *= -1; + yaw = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (yaw < 0) { + yaw *= -1; } - if ((this->actor.xzDistToPlayer < 80.0f) && (player->meleeWeaponState != 0) && (var_v1_sp26 >= 0x1F40)) { + if ((this->actor.xzDistToPlayer < 80.0f) && (player->meleeWeaponState != 0) && (yaw >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } else { - this->unk_2E8 -= 1; - if (this->unk_2E8 == 0) { + this->timer--; + if (this->timer == 0) { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.3f) { - func_80B347FC(this, play); + EnWf_SetupRunToAttack(this, play); } else { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } } else { - func_80B34CFC(this); + EnWf_SetupTurnTowardsPlayer(this); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); @@ -484,20 +519,23 @@ void func_80B345E4(EnWf* this, PlayState* play) { } } -void func_80B347FC(EnWf* this, PlayState* play) { - Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, - Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); - this->unk_2D4 = 9; - func_80B33CB0(this, func_80B3487C); +/** + * Run towards the player with the intent to attack. + */ +void EnWf_SetupRunToAttack(EnWf* this, PlayState* play) { + Animation_Change(&this->skelAnime, &gWolfosRunAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gWolfosRunAnim), + ANIMMODE_LOOP_INTERP, -4.0f); + this->action = ENWF_ACTION_RUN_TO_ATTACK; + EnWf_SetupAction(this, EnWf_RunToAttack); } -void func_80B3487C(EnWf* this, PlayState* play) { +void EnWf_RunToAttack(EnWf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad; f32 sp50_real; s32 pad2; - Player* sp48_real; + Player* player; s32 pad3; s16 temp_v1_real; s16 var_v0_real; @@ -505,8 +543,8 @@ void func_80B3487C(EnWf* this, PlayState* play) { s32 pad4; sp50_real = 0.0f; - sp48_real = GET_PLAYER(play); - if (!func_80B37830(play, this)) { + player = GET_PLAYER(play); + if (!EnWf_ReactToProjectile(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; if (Actor_OtherIsLockedOn(play, &this->actor)) { @@ -520,15 +558,15 @@ void func_80B3487C(EnWf* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 6.65f, 0.0f); } this->skelAnime.playSpeed = this->actor.speed * 0.175f; - var_v0_real = sp48_real->actor.shape.rot.y - this->actor.shape.rot.y; + var_v0_real = player->actor.shape.rot.y - this->actor.shape.rot.y; if (var_v0_real < 0) { var_v0_real *= -1; } - if ((this->actor.xzDistToPlayer < (150.0f + sp50_real)) && (sp48_real->meleeWeaponState != 0) && + if ((this->actor.xzDistToPlayer < (150.0f + sp50_real)) && (player->meleeWeaponState != 0) && (var_v0_real >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); return; } } @@ -537,26 +575,24 @@ void func_80B3487C(EnWf* this, PlayState* play) { absPlaySpeed = ABS(this->skelAnime.playSpeed); beforeCurFrame = (s32)(this->skelAnime.curFrame - absPlaySpeed); absPlaySpeed = ABS(this->skelAnime.playSpeed); - if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { + if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } else { - func_80B3455C(this); + EnWf_SetupIdle(this); } } else if (this->actor.xzDistToPlayer < (90.0f + sp50_real)) { - temp_v1_real = sp48_real->actor.shape.rot.y - this->actor.shape.rot.y; + temp_v1_real = player->actor.shape.rot.y - this->actor.shape.rot.y; if (!Actor_OtherIsLockedOn(play, &this->actor) && ((Rand_ZeroOne() > 0.03f) || ((this->actor.xzDistToPlayer <= 80.0f) && (ABS(temp_v1_real) < 0x38E0)))) { - func_80B35540(this); + EnWf_SetupAttack(this); + } else if ((Actor_OtherIsLockedOn(play, &this->actor)) && (Rand_ZeroOne() > 0.5f)) { + EnWf_SetupBackflipBackward(this); } else { - if ((Actor_OtherIsLockedOn(play, &this->actor)) && (Rand_ZeroOne() > 0.5f)) { - func_80B35B94(this); - } else { - func_80B34F28(this); - } + EnWf_SetupCirclePlayer(this); } } - if (!func_80B33FB0(play, this, false)) { + if (!EnWf_PickAction(play, this, false)) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_CRY); } @@ -569,44 +605,44 @@ void func_80B3487C(EnWf* this, PlayState* play) { } } -void func_80B34CFC(EnWf* this) { - Animation_MorphToLoop(&this->skelAnime, &object_wf_Anim_0098C8, -4.0f); - this->unk_2D4 = 0xA; - func_80B33CB0(this, func_80B34D48); +void EnWf_SetupTurnTowardsPlayer(EnWf* this) { + Animation_MorphToLoop(&this->skelAnime, &gWolfosSideStepAnim, -4.0f); + this->action = ENWF_ACTION_TURN_TOWARDS_PLAYER; + EnWf_SetupAction(this, EnWf_TurnTowardsPlayer); } -void func_80B34D48(EnWf* this, PlayState* play) { - f32 var_fv1; - s16 temp_v0; - s16 temp_v1; +void EnWf_TurnTowardsPlayer(EnWf* this, PlayState* play) { + f32 animPlaySpeed; + s16 relYawTowardsPlayer; + s16 yawSpeed; - if (!func_80B37830(play, this) && !func_80B33FB0(play, this, false)) { - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (temp_v0 > 0) { - temp_v1 = (temp_v0 * 0.25f) + 2000.0f; + if (!EnWf_ReactToProjectile(play, this) && !EnWf_PickAction(play, this, false)) { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (relYawTowardsPlayer > 0) { + yawSpeed = (relYawTowardsPlayer * 0.25f) + 2000.0f; } else { - temp_v1 = (temp_v0 * 0.25f) - 2000.0f; + yawSpeed = (relYawTowardsPlayer * 0.25f) - 2000.0f; } - this->actor.shape.rot.y += temp_v1; + this->actor.shape.rot.y += yawSpeed; this->actor.world.rot.y = this->actor.shape.rot.y; - if (temp_v0 > 0) { - var_fv1 = temp_v1 * 0.5f; - if (var_fv1 > 1.0f) { - var_fv1 = 1.0f; + if (relYawTowardsPlayer > 0) { + animPlaySpeed = yawSpeed * 0.5f; + if (animPlaySpeed > 1.0f) { + animPlaySpeed = 1.0f; } } else { - var_fv1 = temp_v1 * 0.5f; - if (var_fv1 < -1.0f) { - var_fv1 = -1.0f; + animPlaySpeed = yawSpeed * 0.5f; + if (animPlaySpeed < -1.0f) { + animPlaySpeed = -1.0f; } } - this->skelAnime.playSpeed = -var_fv1; + this->skelAnime.playSpeed = -animPlaySpeed; SkelAnime_Update(&this->skelAnime); if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.8f) { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } else { - func_80B347FC(this, play); + EnWf_SetupRunToAttack(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { @@ -615,68 +651,73 @@ void func_80B34D48(EnWf* this, PlayState* play) { } } -void func_80B34F28(EnWf* this) { - Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, - Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); +/** + * Run around the player in a circular fashion. + */ +void EnWf_SetupCirclePlayer(EnWf* this) { + Animation_Change(&this->skelAnime, &gWolfosRunAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gWolfosRunAnim), + ANIMMODE_LOOP_INTERP, -4.0f); if (Rand_ZeroOne() > 0.5f) { - this->unk_2FE = 0x3E80; + this->circlePlayerDirection = 0x3E80; } else { - this->unk_2FE = -0x3E80; + this->circlePlayerDirection = -0x3E80; } this->actor.speed = 6.0f; this->skelAnime.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_2E8 = (Rand_ZeroOne() * 30.0f) + 30.0f; - this->unk_2D4 = 0xB; - this->unk_2EC = 0.0f; - func_80B33CB0(this, func_80B35024); + this->timer = (Rand_ZeroOne() * 30.0f) + 30.0f; + this->action = ENWF_ACTION_CIRCLE_PLAYER; + this->circlePlayerExtraSpeed = 0.0f; + EnWf_SetupAction(this, EnWf_CirclePlayer); } -void func_80B35024(EnWf* this, PlayState* play) { +void EnWf_CirclePlayer(EnWf* this, PlayState* play) { s16 sp56_real; s32 new_var; - f32 sp4C_real; + f32 extraRadius; s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; Player* player; - s16 var_v0_2_real; + s16 yawWallRelToTarget; - sp4C_real = 0.0f; + extraRadius = 0.0f; player = GET_PLAYER(play); - Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->unk_2FE), 1, 0xFA0, 1); - if (!func_80B37830(play, this) && !func_80B33FB0(play, this, false)) { + Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->circlePlayerDirection), 1, + 0xFA0, 1); + if (!EnWf_ReactToProjectile(play, this) && !EnWf_PickAction(play, this, false)) { this->actor.world.rot.y = this->actor.shape.rot.y; - sp56_real = player->actor.shape.rot.y + this->unk_2FE + 0x8000; + sp56_real = player->actor.shape.rot.y + this->circlePlayerDirection + 0x8000; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y)) { + // If there's a wall in the way, switch direction if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - var_v0_2_real = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk_2FE; + yawWallRelToTarget = this->actor.wallYaw - this->actor.yawTowardsPlayer - this->circlePlayerDirection; } else { - var_v0_2_real = 0; + yawWallRelToTarget = 0; } - if (ABS(var_v0_2_real) > 0x2EE0) { - this->unk_2FE = -this->unk_2FE; + if (ABS(yawWallRelToTarget) > 0x2EE0) { + this->circlePlayerDirection = -this->circlePlayerDirection; } } if (Actor_OtherIsLockedOn(play, &this->actor)) { - sp4C_real = 150.0f; + extraRadius = 150.0f; } - if (this->actor.xzDistToPlayer <= (60.0f + sp4C_real)) { - Math_SmoothStepToF(&this->unk_2EC, -4.0f, 1.0f, 1.5f, 0.0f); - } else if (this->actor.xzDistToPlayer > (80.0f + sp4C_real)) { - Math_SmoothStepToF(&this->unk_2EC, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (60.0f + extraRadius)) { + Math_SmoothStepToF(&this->circlePlayerExtraSpeed, -4.0f, 1.0f, 1.5f, 0.0f); + } else if (this->actor.xzDistToPlayer > (80.0f + extraRadius)) { + Math_SmoothStepToF(&this->circlePlayerExtraSpeed, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk_2EC, 0.0f, 1.0f, 6.65f, 0.0f); + Math_SmoothStepToF(&this->circlePlayerExtraSpeed, 0.0f, 1.0f, 6.65f, 0.0f); } - if (this->unk_2EC != 0.0f) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2EC; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2EC; + if (this->circlePlayerExtraSpeed != 0.0f) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->circlePlayerExtraSpeed; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->circlePlayerExtraSpeed; } - if (ABS(this->unk_2EC) < ABS(this->actor.speed)) { + if (ABS(this->circlePlayerExtraSpeed) < ABS(this->actor.speed)) { this->skelAnime.playSpeed = this->actor.speed * 0.175f; } else { - this->skelAnime.playSpeed = this->unk_2EC * 0.175f; + this->skelAnime.playSpeed = this->circlePlayerExtraSpeed * 0.175f; } this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); prevFrame = (s32)this->skelAnime.curFrame; @@ -692,166 +733,162 @@ void func_80B35024(EnWf* this, PlayState* play) { } if ((Math_CosS(sp56_real - this->actor.shape.rot.y) < -0.85f) && !Actor_OtherIsLockedOn(play, &this->actor) && (this->actor.xzDistToPlayer <= 80.0f)) { - func_80B35540(this); + EnWf_SetupAttack(this); } else { - this->unk_2E8 -= 1; - if (this->unk_2E8 == 0) { + this->timer--; + if (this->timer == 0) { if (Actor_OtherIsLockedOn(play, &this->actor) && (Rand_ZeroOne() > 0.5f)) { - func_80B35B94(this); + EnWf_SetupBackflipBackward(this); } else { - func_80B3455C(this); - this->unk_2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 3.0f) + 1.0f; } } } } } -void func_80B35540(EnWf* this) { - Animation_PlayOnce(&this->skelAnime, &object_wf_Anim_004638); - this->unk_304.base.atFlags &= ~AT_BOUNCED; +void EnWf_SetupAttack(EnWf* this) { + Animation_PlayOnce(&this->skelAnime, &gWolfosAttackAnim); + this->attackAndBlockCollider.base.atFlags &= ~AT_BOUNCED; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->unk_2D4 = 8; + this->action = ENWF_ACTION_ATTACK; this->unk_2FA = 0; - this->unk_2E8 = 7; + this->timer = 7; this->skelAnime.endFrame = 20.0f; this->actor.speed = 0.0f; - func_80B33CB0(this, func_80B355BC); + EnWf_SetupAction(this, EnWf_Attack); } -void func_80B355BC(EnWf* this, PlayState* play) { +void EnWf_Attack(EnWf* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 sp42; - s16 sp40; - s32 var_a2_sp3C; - - sp42 = player->actor.shape.rot.y - this->actor.shape.rot.y; - sp40 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - var_a2_sp3C = (s32)this->skelAnime.curFrame; - sp42 = ABS(sp42); - sp40 = ABS(sp40); + s16 absYawDiffWithPlayer; + s16 absRelYawTowardsPlayer; + s32 animCurFrame; + + absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; + absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + animCurFrame = (s32)this->skelAnime.curFrame; + absYawDiffWithPlayer = ABS(absYawDiffWithPlayer); + absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); this->actor.speed = 0.0f; - if (((var_a2_sp3C >= 9) && (var_a2_sp3C <= 12)) || ((var_a2_sp3C >= 17) && (var_a2_sp3C <= 19))) { - if (this->unk_2F8 == 0) { + if (((animCurFrame >= 9) && (animCurFrame <= 12)) || ((animCurFrame >= 17) && (animCurFrame <= 19))) { + if (this->attackState == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_ATTACK); } - this->unk_2F8 = 1; + this->attackState = 1; } else { - this->unk_2F8 = 0; + this->attackState = 0; } - if (((var_a2_sp3C == 0xF) && !Actor_IsLockedOn(play, &this->actor) && + if (((animCurFrame == 15) && !Actor_IsLockedOn(play, &this->actor) && (!Actor_IsFacingPlayer(&this->actor, 0x2000) || (this->actor.xzDistToPlayer >= 100.0f))) || SkelAnime_Update(&this->skelAnime)) { - if ((var_a2_sp3C != 0xF) && (this->unk_2E8 != 0)) { - this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->unk_2E8 - 4) * 0.4f))); + if ((animCurFrame != 15) && (this->timer != 0)) { + this->actor.shape.rot.y += (s16)(s32)(3276.0f * (1.5f + ((this->timer - 4) * 0.4f))); Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 15.0f, 1, 2.0f, 50, 50, true); - this->unk_2E8 -= 1; - } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (var_a2_sp3C != 0xF)) { - func_80B3455C(this); - this->unk_2E8 = (s32)((Rand_ZeroOne() * 5.0f) + 5.0f); - if (sp40 > 0x32C8) { - this->unk_2E2 = 7; + this->timer--; + } else if (!Actor_IsFacingPlayer(&this->actor, 0x1554) && (animCurFrame != 15)) { + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; + if (absRelYawTowardsPlayer > 0x32C8) { + this->idleTimer = 7; } + } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { - if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { - func_80B3455C(this); - this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; - } else { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (Rand_ZeroOne() > 0.7f) { - func_80B365A8(this, play); + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + if (Rand_ZeroOne() > 0.7f) { + EnWf_SetupShortCirclePlayer(this, play); + } else if (absYawDiffWithPlayer <= 0x2710) { + if (absRelYawTowardsPlayer > 0x3E80) { + this->actor.world.rot.y = this->actor.yawTowardsPlayer; + EnWf_SetupCirclePlayer(this); } else { - if (sp42 <= 0x2710) { - if (sp40 > 0x3E80) { - this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B34F28(this); - } else { - func_80B33FB0(play, this, true); - } - } else { - func_80B34F28(this); - } + EnWf_PickAction(play, this, true); } + } else { + EnWf_SetupCirclePlayer(this); } } } } -void func_80B3590C(EnWf* this) { - f32 var_fv0; +void EnWf_SetupAttackBouncedOff(EnWf* this) { + f32 animEndFrame; - var_fv0 = 1.0f; + animEndFrame = 1.0f; if ((s32)this->skelAnime.curFrame >= 16) { - var_fv0 = 15.0f; + animEndFrame = 15.0f; } - Animation_Change(&this->skelAnime, &object_wf_Anim_004638, -0.5f, this->skelAnime.curFrame - 1.0f, var_fv0, + Animation_Change(&this->skelAnime, &gWolfosAttackAnim, -0.5f, this->skelAnime.curFrame - 1.0f, animEndFrame, ANIMMODE_ONCE_INTERP, 0.0f); - this->unk_2D4 = 0xC; - this->unk_2F8 = 0; - func_80B33CB0(this, func_80B359A8); + this->action = ENWF_ACTION_ATTACK_BOUNCED_OFF; + this->attackState = 0; + EnWf_SetupAction(this, EnWf_AttackBouncedOff); } -void func_80B359A8(EnWf* this, PlayState* play) { +void EnWf_AttackBouncedOff(EnWf* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 var_a2; - s16 var_a3; + s16 absYawDiffWithPlayer; + s16 absRelYawTowardsPlayer; - var_a2 = player->actor.shape.rot.y - this->actor.shape.rot.y; - var_a3 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (var_a2 < 0) { - var_a2 *= -1; + absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; + absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (absYawDiffWithPlayer < 0) { + absYawDiffWithPlayer *= -1; } - if (var_a3 < 0) { - var_a3 *= -1; + if (absRelYawTowardsPlayer < 0) { + absRelYawTowardsPlayer *= -1; } if (SkelAnime_Update(&this->skelAnime)) { if (!Actor_IsFacingPlayer(&this->actor, 0x1554)) { - func_80B3455C(this); - this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; - if (var_a3 > 0x32C8) { - this->unk_2E2 = 0x1E; + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; + if (absRelYawTowardsPlayer > 0x32C8) { + this->idleTimer = 30; } } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { - func_80B3455C(this); - this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B365A8(this, play); - } else if (var_a2 <= 0x2710) { - if (var_a3 > 0x3E80) { + EnWf_SetupShortCirclePlayer(this, play); + } else if (absYawDiffWithPlayer <= 0x2710) { + if (absRelYawTowardsPlayer > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } else { - func_80B33FB0(play, this, true); + EnWf_PickAction(play, this, true); } } else { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } } } } -void func_80B35B94(EnWf* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_004AD0, -3.0f); - this->unk_2E8 = 0; - this->unk_300 = 1; - this->unk_2D4 = 5; +void EnWf_SetupBackflipBackward(EnWf* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosBackflipAnim, -3.0f); + this->timer = 0; + this->unk_300 = true; + this->action = ENWF_ACTION_BACKFLIP_BACKWARD; this->actor.speed = -6.0f; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); - func_80B33CB0(this, func_80B35C10); + EnWf_SetupAction(this, EnWf_BackflipBackward); } -void func_80B35C10(EnWf* this, PlayState* play) { +void EnWf_BackflipBackward(EnWf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (!Actor_OtherIsLockedOn(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { - func_80B347FC(this, play); + EnWf_SetupRunToAttack(this, play); } else if (play->gameplayFrames & 1) { - func_80B365A8(this, play); + EnWf_SetupShortCirclePlayer(this, play); } else { - func_80B3455C(this); + EnWf_SetupIdle(this); } } if ((play->state.frames & 0x5F) == 0) { @@ -859,17 +896,17 @@ void func_80B35C10(EnWf* this, PlayState* play) { } } -void func_80B35D18(EnWf* this) { +void EnWf_SetupStunned(EnWf* this) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = 0.0f; } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - Animation_PlayOnceSetSpeed(&this->skelAnime, &object_wf_Anim_009B20, 0.0f); - this->unk_2D4 = 0xF; - func_80B33CB0(this, func_80B35D90); + Animation_PlayOnceSetSpeed(&this->skelAnime, &gWolfosDamagedAnim, 0.0f); + this->action = ENWF_ACTION_STUNNED; + EnWf_SetupAction(this, EnWf_Stunned); } -void func_80B35D90(EnWf* this, PlayState* play) { +void EnWf_Stunned(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } @@ -877,34 +914,34 @@ void func_80B35D90(EnWf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->unk_300 = 0; + this->unk_300 = false; } if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - func_80B36C8C(this); + EnWf_SetupDie(this); } else { - func_80B33FB0(play, this, true); + EnWf_PickAction(play, this, true); } } } -void func_80B35E4C(EnWf* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_009B20, -4.0f); +void EnWf_SetupDamaged(EnWf* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosDamagedAnim, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_300 = 0; + this->unk_300 = false; this->actor.speed = -4.0f; } else { - this->unk_300 = 1; + this->unk_300 = true; } - this->unk_2E2 = 0; + this->idleTimer = 0; this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DAMAGE); - this->unk_2D4 = 3; - func_80B33CB0(this, func_80B35EE4); + this->action = ENWF_ACTION_DAMAGED; + EnWf_SetupAction(this, EnWf_Damaged); } -void func_80B35EE4(EnWf* this, PlayState* play) { - s16 var_v1; +void EnWf_Damaged(EnWf* this, PlayState* play) { + s16 absRelWallYaw; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; @@ -913,226 +950,239 @@ void func_80B35EE4(EnWf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->unk_300 = 0; + this->unk_300 = false; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!func_80B33FB0(play, this, false) && SkelAnime_Update(&this->skelAnime) && - (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) != 0))) { - var_v1 = this->actor.wallYaw - this->actor.shape.rot.y; - if (var_v1 < 0) { - var_v1 *= -1; + if (!EnWf_PickAction(play, this, false) && SkelAnime_Update(&this->skelAnime) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; + if (absRelWallYaw < 0) { + absRelWallYaw *= -1; } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_v1) < 0x2EE0) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { - func_80B360E8(this); - } else if (!func_80B37830(play, this)) { + EnWf_SetupBackflipForward(this); + } else if (!EnWf_ReactToProjectile(play, this)) { if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && ((play->gameplayFrames & 7) != 0)) { - func_80B35540(this); + EnWf_SetupAttack(this); } else if (Rand_ZeroOne() > 0.5f) { - func_80B3455C(this); - this->unk_2E8 = (Rand_ZeroOne() * 5.0f) + 5.0f; - this->unk_2E2 = 0x1E; + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->idleTimer = 30; } else { - func_80B35B94(this); + EnWf_SetupBackflipBackward(this); } } } } -void func_80B360E8(EnWf* this) { - Animation_Change(&this->skelAnime, &object_wf_Anim_004AD0, -1.0f, Animation_GetLastFrame(&object_wf_Anim_004AD0), - 0.0f, ANIMMODE_ONCE, -3.0f); - this->unk_2E8 = 0; - this->unk_300 = 0; - this->unk_2D4 = 4; +void EnWf_SetupBackflipForward(EnWf* this) { + Animation_Change(&this->skelAnime, &gWolfosBackflipAnim, -1.0f, Animation_GetLastFrame(&gWolfosBackflipAnim), 0.0f, + ANIMMODE_ONCE, -3.0f); + this->timer = 0; + this->unk_300 = false; + this->action = ENWF_ACTION_BACKFLIP_FORWARD; this->actor.speed = 6.5f; this->actor.velocity.y = 15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_STAL_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B33CB0(this, func_80B361A0); + EnWf_SetupAction(this, EnWf_BackflipForward); } -void func_80B361A0(EnWf* this, PlayState* play) { +void EnWf_BackflipForward(EnWf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { + //! @bug unk_4C8 and unk_4BC are never set, so this spawns effects at 0,0,0 func_800355B8(play, &this->unk_4C8); func_800355B8(play, &this->unk_4BC); } if (SkelAnime_Update(&this->skelAnime) && - (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { + ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) != 0)) { this->actor.shape.rot.x = 0; this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; if (!Actor_OtherIsLockedOn(play, &this->actor)) { - func_80B35540(this); + EnWf_SetupAttack(this); } else { - func_80B3455C(this); + EnWf_SetupIdle(this); } } } -void func_80B36288(EnWf* this) { - f32 temp_fv1; +void EnWf_SetupBlock(EnWf* this) { + f32 animEndFrame; - temp_fv1 = (f32)Animation_GetLastFrame(&object_wf_Anim_004CA4); - if (this->unk_2F8 != 0) { - this->unk_2F8 = -1; + animEndFrame = (f32)Animation_GetLastFrame(&gWolfosBlockAnim); + if (this->attackState != 0) { + this->attackState = -1; } this->actor.speed = 0.0f; - this->unk_2D4 = 7; - this->unk_2E8 = 0xA; - Animation_Change(&this->skelAnime, &object_wf_Anim_004CA4, 0.0f, 0.0f, temp_fv1, ANIMMODE_ONCE_INTERP, -4.0f); - func_80B33CB0(this, func_80B36328); + this->action = ENWF_ACTION_BLOCK; + this->timer = 0xA; + Animation_Change(&this->skelAnime, &gWolfosBlockAnim, 0.0f, 0.0f, animEndFrame, ANIMMODE_ONCE_INTERP, -4.0f); + EnWf_SetupAction(this, EnWf_Block); } -void func_80B36328(EnWf* this, PlayState* play) { +void EnWf_Block(EnWf* this, PlayState* play) { Player* player; s32 pad; s16 pad2; - s16 temp_a2_sp2C; - s16 temp_v0_2; + s16 yawDiff; + s16 relYawTowardsPlayer; player = GET_PLAYER(play); - if (this->unk_2E8 != 0) { - this->unk_2E8 -= 1; + if (this->timer != 0) { + this->timer -= 1; } else { this->skelAnime.playSpeed = 1.0f; } if (SkelAnime_Update(&this->skelAnime)) { - temp_v0_2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(temp_v0_2) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(relYawTowardsPlayer) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) && (ABS(this->actor.yDistToPlayer) < 50.0f)) { - if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0) { + if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - func_80B36288(this); + EnWf_SetupBlock(this); } else if (play->gameplayFrames & 1) { - func_80B36288(this); + EnWf_SetupBlock(this); } else { - func_80B35B94(this); + EnWf_SetupBackflipBackward(this); } } else { - temp_a2_sp2C = player->actor.shape.rot.y - this->actor.shape.rot.y; + yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; if (!Actor_OtherIsLockedOn(play, &this->actor) && - ((play->gameplayFrames & 1) || (ABS(temp_a2_sp2C) < 0x38E0))) { - func_80B35540(this); + ((play->gameplayFrames & 1) || (ABS(yawDiff) < 0x38E0))) { + EnWf_SetupAttack(this); } else { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } } } else { - func_80B34F28(this); + EnWf_SetupCirclePlayer(this); } - } else if ((this->unk_2E8 == 0) && - ((func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y) != 0))) { + } else if ((this->timer == 0) && + func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - func_80B36288(this); + EnWf_SetupBlock(this); } else if (play->gameplayFrames & 1) { - func_80B36288(this); + EnWf_SetupBlock(this); } else { - func_80B35B94(this); + EnWf_SetupBackflipBackward(this); } } } -void func_80B365A8(EnWf* this, PlayState* play) { - s16 temp_v1_sp36; +/** + * Run a short circle arc around the player. + */ +void EnWf_SetupShortCirclePlayer(EnWf* this, PlayState* play) { + s16 angle; Player* player; - Animation_Change(&this->skelAnime, &object_wf_Anim_0057A0, 1.0f, 0.0f, - Animation_GetLastFrame(&object_wf_Anim_0057A0), ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &gWolfosRunAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gWolfosRunAnim), + ANIMMODE_LOOP_INTERP, -4.0f); player = GET_PLAYER(play); - temp_v1_sp36 = player->actor.shape.rot.y + this->unk_2FE; - if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) > 0.0f) { - this->unk_2FE = 0x3E80; - } else if (Math_SinS(temp_v1_sp36 - this->actor.yawTowardsPlayer) < 0.0f) { - this->unk_2FE = -0x3E80; - } else if (Rand_ZeroOne() > 0.5f) { - this->unk_2FE = 0x3E80; + angle = player->actor.shape.rot.y + this->circlePlayerDirection; + if (Math_SinS(angle - this->actor.yawTowardsPlayer) > 0.0f) { + this->circlePlayerDirection = 0x3E80; + } else if (Math_SinS(angle - this->actor.yawTowardsPlayer) < 0.0f) { + this->circlePlayerDirection = -0x3E80; } else { - this->unk_2FE = -0x3E80; + if (Rand_ZeroOne() > 0.5f) { + this->circlePlayerDirection = 0x3E80; + } else { + this->circlePlayerDirection = -0x3E80; + } } this->actor.speed = 6.0f; this->skelAnime.playSpeed = this->actor.speed * 0.175f; this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk_2EC = 0.0f; - this->unk_2E8 = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->unk_2D4 = 0xE; - func_80B33CB0(this, func_80B36740); + this->circlePlayerExtraSpeed = 0.0f; + this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->action = ENWF_ACTION_SHORT_CIRCLE_PLAYER; + EnWf_SetupAction(this, EnWf_ShortCirclePlayer); } -void func_80B36740(EnWf* this, PlayState* play) { +void EnWf_ShortCirclePlayer(EnWf* this, PlayState* play) { Player* player2; Player* player; s32 prevFrame; s32 beforeCurFrame; s32 new_var; - f32 sp58_real; + f32 extraRadius; s32 absPlaySpeed; - s16 var_v0_probreal; - s16 var_v0_2_probreal; - s16 temp_a2_sp4E; + s16 yawWallRelToTarget; + s16 behindPlayerYawAbs; + s16 behindPlayerYaw; player = GET_PLAYER(play); - sp58_real = 0.0f; - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->unk_2FE, 1, 0xBB8, 1); + extraRadius = 0.0f; + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->circlePlayerDirection, 1, 0xBB8, + 1); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y)) { + // If there's a wall in the way, switch direction if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - var_v0_probreal = (this->actor.wallYaw - this->actor.yawTowardsPlayer) - this->unk_2FE; + yawWallRelToTarget = this->actor.wallYaw - this->actor.yawTowardsPlayer - this->circlePlayerDirection; } else { - var_v0_probreal = 0; + yawWallRelToTarget = 0; } - if (ABS(var_v0_probreal) > 0x2EE0) { - this->unk_2FE = -this->unk_2FE; + if (ABS(yawWallRelToTarget) > 0x2EE0) { + this->circlePlayerDirection = -this->circlePlayerDirection; } } this->actor.world.rot.y = this->actor.shape.rot.y; if (Actor_OtherIsLockedOn(play, &this->actor)) { - sp58_real = 150.0f; + extraRadius = 150.0f; } - if (this->actor.xzDistToPlayer <= (60.0f + sp58_real)) { - Math_SmoothStepToF(&this->unk_2EC, -4.0f, 1.0f, 1.5f, 0.0f); - } else if (this->actor.xzDistToPlayer > (80.0f + sp58_real)) { - Math_SmoothStepToF(&this->unk_2EC, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (60.0f + extraRadius)) { + Math_SmoothStepToF(&this->circlePlayerExtraSpeed, -4.0f, 1.0f, 1.5f, 0.0f); + } else if (this->actor.xzDistToPlayer > (80.0f + extraRadius)) { + Math_SmoothStepToF(&this->circlePlayerExtraSpeed, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk_2EC, 0.0f, 1.0f, 6.65f, 0.0f); + Math_SmoothStepToF(&this->circlePlayerExtraSpeed, 0.0f, 1.0f, 6.65f, 0.0f); } - if (this->unk_2EC != 0.0f) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk_2EC; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk_2EC; + if (this->circlePlayerExtraSpeed != 0.0f) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->circlePlayerExtraSpeed; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->circlePlayerExtraSpeed; } - if (ABS(this->unk_2EC) < ABS(this->actor.speed)) { + if (ABS(this->circlePlayerExtraSpeed) < ABS(this->actor.speed)) { this->skelAnime.playSpeed = this->actor.speed * 0.175f; } else { - this->skelAnime.playSpeed = this->unk_2EC * 0.175f; + this->skelAnime.playSpeed = this->circlePlayerExtraSpeed * 0.175f; } this->skelAnime.playSpeed = CLAMP(this->skelAnime.playSpeed, -3.0f, 3.0f); prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = new_var = ABS(this->skelAnime.playSpeed); - if (!func_80B33FB0(play, this, false)) { - this->unk_2E8 -= 1; - if (this->unk_2E8 == 0) { - var_v0_2_probreal = player->actor.shape.rot.y - this->actor.yawTowardsPlayer; - if (var_v0_2_probreal < 0) { - var_v0_2_probreal *= -1; + if (!EnWf_PickAction(play, this, false)) { + this->timer--; + if (this->timer == 0) { + behindPlayerYawAbs = player->actor.shape.rot.y - this->actor.yawTowardsPlayer; + //! @bug behindPlayerYawAbs is a s16, so it can't hold 0x8000, the absolute value of -0x8000. + //! So -0x8000 just "stays" -0x8000, causing the behindPlayerYawAbs check below to wrongfully not pass. + //! behindPlayerYawAbs is typically exactly -0x8000 when locking on the actor. + //! Note the same problem of storing absolute angles into s16 variables happens elsewhere in this file, but + //! problematic -0x8000 happens rarely in those other spots. + if (behindPlayerYawAbs < 0) { + behindPlayerYawAbs *= -1; } - if (var_v0_2_probreal >= 0x3A98) { - func_80B3455C(this); - this->unk_2E8 = (Rand_ZeroOne() * 3.0f) + 1.0f; + if (behindPlayerYawAbs >= 0x3A98) { + EnWf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 3.0f) + 1.0f; } else { player2 = GET_PLAYER(play); - temp_a2_sp4E = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; + behindPlayerYaw = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - (((play->gameplayFrames & 3) == 0) || (ABS(temp_a2_sp4E) < 0x38E0))) { - func_80B35540(this); + (((play->gameplayFrames & 3) == 0) || (ABS(behindPlayerYaw) < 0x38E0))) { + EnWf_SetupAttack(this); } else { - func_80B347FC(this, play); + EnWf_SetupRunToAttack(this, play); } } } @@ -1147,105 +1197,105 @@ void func_80B36740(EnWf* this, PlayState* play) { } } -void func_80B36C8C(EnWf* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_wf_Anim_005430, -4.0f); +void EnWf_SetupDie(EnWf* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gWolfosHowlAnim, -4.0f); this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk_300 = 0; + this->unk_300 = false; this->actor.speed = -6.0f; } else { - this->unk_300 = 1; + this->unk_300 = true; } - this->unk_2D4 = 2; + this->action = ENWF_ACTION_DIE; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk_2E8 = this->skelAnime.animLength; + this->timer = this->skelAnime.animLength; Actor_PlaySfx(&this->actor, NA_SE_EN_WOLFOS_DEAD); - func_80B33CB0(this, func_80B36D3C); + EnWf_SetupAction(this, EnWf_Die); } -void func_80B36D3C(EnWf* this, PlayState* play) { - +void EnWf_Die(EnWf* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); - this->unk_300 = 0; + this->unk_300 = false; } if (SkelAnime_Update(&this->skelAnime)) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_13, false)); - if (this->unk_2FC != 0xFF) { - Flags_SetSwitch(play, (s32)this->unk_2FC); + if (this->switchFlag != 0xFF) { + Flags_SetSwitch(play, this->switchFlag); } Actor_Kill(&this->actor); } else { - s32 var_s0; - Vec3f sp88; - Vec3f sp7C; - - sp7C = D_80B37AD0; - this->unk_2E8 -= 1; - for (var_s0 = ((s32)this->skelAnime.animLength - this->unk_2E8) >> 1; var_s0 >= 0; var_s0--) { - sp88.x = this->actor.world.pos.x + Rand_CenteredFloat(60.0f); - sp88.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); - sp88.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); - EffectSsDeadDb_Spawn(play, &sp88, &sp7C, &sp7C, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); + s32 i; + Vec3f pos; + Vec3f velAccel; + + velAccel = D_80B37AD0; + this->timer--; + for (i = ((s32)this->skelAnime.animLength - this->timer) >> 1; i >= 0; i--) { + pos.x = this->actor.world.pos.x + Rand_CenteredFloat(60.0f); + pos.z = this->actor.world.pos.z + Rand_CenteredFloat(60.0f); + pos.y = this->actor.world.pos.y + 20.0f + Rand_CenteredFloat(50.0f); + EffectSsDeadDb_Spawn(play, &pos, &velAccel, &velAccel, 100, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); } } } -void func_80B36F40(EnWf* this, PlayState* play) { - if ((this->unk_2D4 == 6) && (this->unk_2E2 != 0)) { - this->unk_4D6 = Math_SinS(this->unk_2E2 * 0x1068) * 8920.0f; - } else if (this->unk_2D4 != 0xF) { - if (this->unk_2D4 != 8) { - Math_SmoothStepToS(&this->unk_4D6, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 1, 0x5DC, 0); - this->unk_4D6 = CLAMP(this->unk_4D6, -0x3127, 0x3127); +void EnWf_UpdateHeadRot(EnWf* this, PlayState* play) { + if ((this->action == ENWF_ACTION_IDLE) && (this->idleTimer != 0)) { + this->headRot = Math_SinS(this->idleTimer * 0x1068) * 8920.0f; + } else if (this->action != ENWF_ACTION_STUNNED) { + if (this->action != ENWF_ACTION_ATTACK) { + Math_SmoothStepToS(&this->headRot, this->actor.yawTowardsPlayer - this->actor.shape.rot.y, 1, 0x5DC, 0); + this->headRot = CLAMP(this->headRot, -0x3127, 0x3127); } else { - this->unk_4D6 = 0; + this->headRot = 0; } } } -void func_80B37038(EnWf* this, PlayState* play) { - s16 temp_v1; - - if (this->unk_304.base.acFlags & AC_BOUNCED) { - this->unk_304.base.acFlags &= ~(AC_HIT | AC_BOUNCED); - this->unk_424.base.acFlags &= ~AC_HIT; - this->unk_470.base.acFlags &= ~AC_HIT; - } else if (((this->unk_424.base.acFlags & AC_HIT) || (this->unk_470.base.acFlags & AC_HIT)) && - (this->unk_2D4 >= 6)) { - temp_v1 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (!((this->unk_424.base.acFlags & AC_HIT) || !(this->unk_470.base.acFlags & AC_HIT)) || - (ABS(temp_v1) > 0x4A38)) { +void EnWf_CheckCollide(EnWf* this, PlayState* play) { + s16 relYawTowardsPlayer; + + if (this->attackAndBlockCollider.base.acFlags & AC_BOUNCED) { + this->attackAndBlockCollider.base.acFlags &= ~(AC_HIT | AC_BOUNCED); + this->bodyCollider.base.acFlags &= ~AC_HIT; + this->tailCollider.base.acFlags &= ~AC_HIT; + } else if (((this->bodyCollider.base.acFlags & AC_HIT) || (this->tailCollider.base.acFlags & AC_HIT)) && + (this->action >= ENWF_ACTION_IDLE)) { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (!((this->bodyCollider.base.acFlags & AC_HIT) || !(this->tailCollider.base.acFlags & AC_HIT)) || + (ABS(relYawTowardsPlayer) > 0x4A38)) { this->actor.colChkInfo.damage *= 4; } - this->unk_424.base.acFlags &= ~AC_HIT; - this->unk_470.base.acFlags &= ~AC_HIT; - if (this->actor.colChkInfo.damageReaction != 6) { - this->unk_2E6 = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->unk_424.elem, true); + this->bodyCollider.base.acFlags &= ~AC_HIT; + this->tailCollider.base.acFlags &= ~AC_HIT; + if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_6) { + this->lastDamageReaction = this->actor.colChkInfo.damageReaction; + Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); #if OOT_VERSION >= PAL_1_0 - this->unk_2F8 = 0; + this->attackState = 0; #endif - if ((this->actor.colChkInfo.damageReaction == 1) || (this->actor.colChkInfo.damageReaction == 0xF)) { - if (this->unk_2D4 != 0xF) { + if ((this->actor.colChkInfo.damageReaction == ENWF_DMG_REACT_STUN) || + (this->actor.colChkInfo.damageReaction == ENWF_DMG_REACT_F)) { + if (this->action != ENWF_ACTION_STUNNED) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); Actor_ApplyDamage(&this->actor); - func_80B35D18(this); + EnWf_SetupStunned(this); } } else { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - if (this->unk_2E6 == 0xE) { - this->unk_2E4 = 0x28; + if (this->lastDamageReaction == ENWF_DMG_REACT_FIRE) { + this->onFireTimer = 40; } if (Actor_ApplyDamage(&this->actor) == 0) { - func_80B36C8C(this); + EnWf_SetupDie(this); Enemy_StartFinishingBlow(play, &this->actor); } else { - func_80B35E4C(this); + EnWf_SetupDamaged(this); } } } @@ -1256,14 +1306,14 @@ void EnWf_Update(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; s32 pad; - func_80B37038(this, play); - if (this->actor.colChkInfo.damageReaction != 6) { + EnWf_CheckCollide(this, play); + if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_6) { Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->unk_2DC(this, play); - func_80B36F40(this, play); + this->actionFunc(this, play); + EnWf_UpdateHeadRot(this, play); } if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { func_800359B8(&this->actor, this->actor.shape.rot.y, &this->actor.shape.rot); @@ -1271,94 +1321,96 @@ void EnWf_Update(Actor* thisx, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x3E8, 0); Math_SmoothStepToS(&this->actor.shape.rot.z, 0, 1, 0x3E8, 0); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk_304.base); - if ((this->unk_2D4 >= 6) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - Collider_UpdateCylinder(&this->actor, &this->unk_424); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_470.base); - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_424.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->attackAndBlockCollider.base); + if ((this->action >= ENWF_ACTION_IDLE) && + ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->tailCollider.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } - if (this->unk_2D4 == 7) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk_304.base); + if (this->action == ENWF_ACTION_BLOCK) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->attackAndBlockCollider.base); } - if (this->unk_2F8 > 0) { - if (!(this->unk_304.base.atFlags & AT_BOUNCED)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk_304.base); + if (this->attackState > 0) { + if (!(this->attackAndBlockCollider.base.atFlags & AT_BOUNCED)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->attackAndBlockCollider.base); } else { - func_80B3590C(this); + EnWf_SetupAttackBouncedOff(this); } } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 25.0f; - if (this->unk_302 == 0) { + if (this->eyeIndex == 0) { if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { - this->unk_302 += 1; + this->eyeIndex += 1; } } else { - this->unk_302 = (this->unk_302 + 1) & 3; + this->eyeIndex = (this->eyeIndex + 1) & 3; } } -s32 func_80B37454(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { +s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnWf* this = thisx; - if ((arg1 == 0x11) || (arg1 == 0x12)) { - arg4->y -= this->unk_4D6; + if ((limbIndex == WOLFOS_LIMB_HEAD) || (limbIndex == WOLFOS_LIMB_EYES)) { + rot->y -= this->headRot; } return 0; } -void func_80B37494(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { +void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnWf* this = thisx; - s32 var_v1_sp30; - Vec3f sp24; - Vec3f sp18; - - var_v1_sp30 = -1; - Collider_UpdateSpheres(arg1, &this->unk_304); - if (arg1 == 6) { - Matrix_MultVec3f(&D_80B37ADC, &sp24); - this->unk_470.dim.pos.x = sp24.x; - this->unk_470.dim.pos.y = sp24.y; - this->unk_470.dim.pos.z = sp24.z; + s32 bodyPartIndex; + Vec3f tailColliderPos; + Vec3f bodyPartPos; + + bodyPartIndex = -1; + Collider_UpdateSpheres(limbIndex, &this->attackAndBlockCollider); + if (limbIndex == WOLFOS_LIMB_TAIL) { + Matrix_MultVec3f(&D_80B37ADC, &tailColliderPos); + this->tailCollider.dim.pos.x = tailColliderPos.x; + this->tailCollider.dim.pos.y = tailColliderPos.y; + this->tailCollider.dim.pos.z = tailColliderPos.z; } - if ((this->unk_2E4 != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { - switch (arg1) { - case 18: - var_v1_sp30 = 0; + if ((this->onFireTimer != 0) || ((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { + switch (limbIndex) { + case WOLFOS_LIMB_EYES: + bodyPartIndex = 0; break; - case 14: - var_v1_sp30 = 1; + case WOLFOS_LIMB_RIGHT_FOREARM: + bodyPartIndex = 1; break; - case 20: - var_v1_sp30 = 2; + case WOLFOS_LIMB_LEFT_FOREARM: + bodyPartIndex = 2; break; - case 12: - var_v1_sp30 = 3; + case WOLFOS_LIMB_TORSO: + bodyPartIndex = 3; break; - case 7: - var_v1_sp30 = 4; + case WOLFOS_LIMB_WAIST: + bodyPartIndex = 4; break; - case 6: - var_v1_sp30 = 5; + case WOLFOS_LIMB_TAIL: + bodyPartIndex = 5; break; - case 9: - var_v1_sp30 = 6; + case WOLFOS_LIMB_RIGHT_SHIN: + bodyPartIndex = 6; break; case 37: - var_v1_sp30 = 7; + //! @bug 37 is not a valid limb index + bodyPartIndex = 7; break; - case 10: - var_v1_sp30 = 8; + case WOLFOS_LIMB_RIGHT_ANKLE: + bodyPartIndex = 8; break; - case 5: - var_v1_sp30 = 9; + case WOLFOS_LIMB_LEFT_FOOT: + bodyPartIndex = 9; break; } - if (var_v1_sp30 >= 0) { - Matrix_MultVec3f(&D_80B37AE8, &sp18); - this->unk_14C[var_v1_sp30].x = sp18.x; - this->unk_14C[var_v1_sp30].y = sp18.y; - this->unk_14C[var_v1_sp30].z = sp18.z; + if (bodyPartIndex >= 0) { + Matrix_MultVec3f(&sZeroVec, &bodyPartPos); + this->bodyPartsPos[bodyPartIndex].x = bodyPartPos.x; + this->bodyPartsPos[bodyPartIndex].y = bodyPartPos.y; + this->bodyPartsPos[bodyPartIndex].z = bodyPartPos.z; } } } @@ -1367,51 +1419,58 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { EnWf* this = (EnWf*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2157); - if ((this->unk_2D4 != 0) || (this->unk_300 == 0)) { + if ((this->action != ENWF_ACTION_WAIT_APPEAR) || !this->unk_300) { Gfx_SetupDL_25Opa(play->state.gfxCtx); if (this->actor.params == 0) { - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37AF4[this->unk_302])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sWolfosGrayEyeTextures[this->eyeIndex])); } else { - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80B37B04[this->unk_302])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sWolfosWhiteEyeTextures[this->eyeIndex])); } SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80B37454, func_80B37494, this); - if (this->unk_2E4 != 0) { + EnWf_OverrideLimbDraw, EnWf_PostLimbDraw, this); + if (this->onFireTimer != 0) { this->actor.colorFilterTimer++; if (1) {} - this->unk_2E4 -= 1; - if ((this->unk_2E4 & 3) == 0) { - s32 v = this->unk_2E4 >> 2; + this->onFireTimer -= 1; + if ((this->onFireTimer & 3) == 0) { + s32 bodyPartIndex = this->onFireTimer >> 2; - EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->unk_14C[v], 75, 0, 0, v); + EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->bodyPartsPos[bodyPartIndex], 75, 0, 0, + bodyPartIndex); } } } CLOSE_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2190); } -s32 func_80B37830(PlayState* play, EnWf* this) { - Actor* temp_v0_sp24_real; - s16 temp_a2_sp22; - f32 temp_fv1; - - temp_v0_sp24_real = Actor_GetProjectileActor(play, &this->actor, 600.0f); - if (temp_v0_sp24_real != NULL) { - temp_a2_sp22 = Actor_WorldYawTowardActor(&this->actor, temp_v0_sp24_real) - this->actor.shape.rot.y; +/** + * React to projectiles by picking an adequate action. + * @return true if an action was picked + */ +s32 EnWf_ReactToProjectile(PlayState* play, EnWf* this) { + Actor* projectile; + s16 relYawTowardsProjectile; + f32 projectileDist; + + projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); + if (projectile != NULL) { + relYawTowardsProjectile = Actor_WorldYawTowardActor(&this->actor, projectile) - this->actor.shape.rot.y; this->actor.world.rot.y = (u16)(s16)(this->actor.shape.rot.y + 0); - temp_fv1 = Actor_WorldDistXYZToPoint(&this->actor, &temp_v0_sp24_real->world.pos); + projectileDist = Actor_WorldDistXYZToPoint(&this->actor, &projectile->world.pos); //! @bug Using sqrt on a non-squared distance - if ((ABS(temp_a2_sp22) < 0x2EE0) && (sqrt((f64)temp_fv1) < 400.0)) { - func_80B36288(this); + if ((ABS(relYawTowardsProjectile) < 0x2EE0) && (sqrt((f64)projectileDist) < 400.0)) { + EnWf_SetupBlock(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - if ((ABS(temp_a2_sp22) < 0x2000) || (ABS(temp_a2_sp22) >= 0x6000)) { - func_80B365A8(this, play); + if ((ABS(relYawTowardsProjectile) < 0x2000) || (ABS(relYawTowardsProjectile) >= 0x6000)) { + EnWf_SetupShortCirclePlayer(this, play); this->actor.speed *= 2.0f; - } else if (ABS(temp_a2_sp22) < 0x5FFF) { - func_80B35B94(this); + } else if (ABS(relYawTowardsProjectile) < 0x5FFF) { + EnWf_SetupBackflipBackward(this); } } + //! @bug If ABS(relYawTowardsProjectile) == 0x5FFF the function returns true + //! even though no action has been chosen return true; } return false; 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 3b361b35834..010f2025c35 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -4,41 +4,43 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_wf/object_wf.h" + struct EnWf; typedef struct EnWf { /* 0x000 */ Actor actor; - /* 0x14C */ Vec3s unk_14C[10]; + /* 0x14C */ Vec3s bodyPartsPos[10]; /* 0x188 */ SkelAnime skelAnime; - /* 0x1CC */ Vec3s jointTable[22]; - /* 0x250 */ Vec3s morphTable[22]; - /* 0x2D4 */ s32 unk_2D4; + /* 0x1CC */ Vec3s jointTable[WOLFOS_LIMB_MAX]; + /* 0x250 */ Vec3s morphTable[WOLFOS_LIMB_MAX]; + /* 0x2D4 */ s32 action; /* 0x2D8 */ char pad_2D8[4]; - /* 0x2DC */ void (*unk_2DC)(struct EnWf*, struct PlayState*); + /* 0x2DC */ void (*actionFunc)(struct EnWf*, struct PlayState*); /* 0x2E0 */ s16 unk_2E0; - /* 0x2E2 */ s16 unk_2E2; - /* 0x2E4 */ s16 unk_2E4; - /* 0x2E6 */ u8 unk_2E6; + /* 0x2E2 */ s16 idleTimer; + /* 0x2E4 */ s16 onFireTimer; + /* 0x2E6 */ u8 lastDamageReaction; /* 0x2E7 */ char pad_2E7[1]; - /* 0x2E8 */ s32 unk_2E8; - /* 0x2EC */ f32 unk_2EC; + /* 0x2E8 */ s32 timer; + /* 0x2EC */ f32 circlePlayerExtraSpeed; /* 0x2F0 */ char pad_2F0[4]; /* 0x2F4 */ f32 unk_2F4; - /* 0x2F8 */ s16 unk_2F8; + /* 0x2F8 */ s16 attackState; /* 0x2FA */ s16 unk_2FA; - /* 0x2FC */ s16 unk_2FC; - /* 0x2FE */ s16 unk_2FE; + /* 0x2FC */ s16 switchFlag; + /* 0x2FE */ s16 circlePlayerDirection; /* 0x300 */ s16 unk_300; - /* 0x302 */ u8 unk_302; + /* 0x302 */ u8 eyeIndex; /* 0x303 */ char pad_303[1]; - /* 0x304 */ ColliderJntSph unk_304; - /* 0x324 */ ColliderJntSphElement unk_324[4]; - /* 0x424 */ ColliderCylinder unk_424; - /* 0x470 */ ColliderCylinder unk_470; + /* 0x304 */ ColliderJntSph attackAndBlockCollider; + /* 0x324 */ ColliderJntSphElement attackAndBlockColliderElements[4]; + /* 0x424 */ ColliderCylinder bodyCollider; + /* 0x470 */ ColliderCylinder tailCollider; /* 0x4BC */ Vec3f unk_4BC; /* 0x4C8 */ Vec3f unk_4C8; /* 0x4D4 */ char pad_4D4[2]; - /* 0x4D6 */ s16 unk_4D6; + /* 0x4D6 */ s16 headRot; /* 0x4D8 */ char pad_4D8[4]; } EnWf; // size = 0x4DC From 57eb3093e1d1eb8b4822731670aa4fc835c2788c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 08:45:24 +0200 Subject: [PATCH 052/150] fixup --- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 1703df22b1c..fd4839d0791 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -545,7 +545,7 @@ void EnTp_Head_SinkIntoGroundAndReappear(EnTp* this, PlayState* play) { } } -void EnTp_CheckCollide_(EnTp* this, PlayState* play) { +void EnTp_CheckCollide(EnTp* this, PlayState* play) { EnTp* parent; EnTp* child; s32 isHeadInstance; @@ -641,7 +641,7 @@ void EnTp_Update(Actor* thisx, PlayState* play) { this->unk_158 = ENTP_DMG_REACT_NO_EFFECT; } if (this->actor.colChkInfo.health != 0) { - EnTp_CheckCollide_(this, play); + EnTp_CheckCollide(this, play); } this->actionFunc(this, play); if (this->actor.params < 0) { // ENTP_TYPE_HEAD From 39c5ab1f801cab402388d38712071450da9d39a3 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 11:03:02 +0200 Subject: [PATCH 053/150] further libleo cleanup --- include/ultra64.h | 1 - include/ultra64/leo_internal.h | 6 ++- src/libultra/io/devmgr.c | 5 ++- src/n64dd/libleo/cacreateleomanager.c | 10 ++--- src/n64dd/libleo/cjcreateleomanager.c | 12 ++--- src/n64dd/libleo/clearqueue.c | 4 +- src/n64dd/libleo/leocmdex.c | 14 +++--- src/n64dd/libleo/leodiskinit.c | 7 +-- src/n64dd/libleo/leofunc.c | 12 ++--- src/n64dd/libleo/leoinquiry.c | 7 +-- src/n64dd/libleo/leoint.c | 46 ++++++++++--------- src/n64dd/libleo/leointerrupt.c | 64 ++++++++++++++------------- src/n64dd/libleo/leomecha.c | 47 ++++++++++---------- src/n64dd/libleo/leomseq_tbl.c | 15 ++++--- src/n64dd/libleo/leoram.c | 4 +- src/n64dd/libleo/leord_capa.c | 2 +- src/n64dd/libleo/leoreset.c | 2 +- src/n64dd/libleo/leotimer.c | 7 +-- src/n64dd/libleo/leotranslat.c | 4 +- src/n64dd/libleo/readdiskid.c | 2 +- src/n64dd/libleo/readwrite.c | 2 +- src/n64dd/libleo/spdlmotor.c | 2 +- src/n64dd/libleo/testunitready.c | 4 +- src/n64dd/n64dd_7.c | 2 +- 24 files changed, 148 insertions(+), 133 deletions(-) diff --git a/include/ultra64.h b/include/ultra64.h index 8309b5290a5..be735d3a4ea 100644 --- a/include/ultra64.h +++ b/include/ultra64.h @@ -3,7 +3,6 @@ #define BADCASTP (void*) #define BADCASTI (u32) -#define STATIC #include "assert.h" #include "math.h" diff --git a/include/ultra64/leo_internal.h b/include/ultra64/leo_internal.h index 5f7f132e4cf..eae087776e1 100644 --- a/include/ultra64/leo_internal.h +++ b/include/ultra64/leo_internal.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "stack.h" +#define STATIC + extern OSPiHandle* LEOPiInfo; void leointerrupt(void*); void leomain(void*); @@ -119,8 +121,8 @@ extern OSMesg LEOdma_que_buf[2]; extern OSMesg LEOblock_que_buf; extern u8* LEOwrite_pointer; extern LEOCmd* LEOcur_command; -extern s32 LEOasic_bm_ctl_shadow; -extern s32 LEOasic_seq_ctl_shadow; +extern u32 LEOasic_bm_ctl_shadow; +extern u32 LEOasic_seq_ctl_shadow; extern u8 LEOdrive_flag; extern vu8 LEOclr_que_flag; // extern u16 LEOrw_flags; diff --git a/src/libultra/io/devmgr.c b/src/libultra/io/devmgr.c index 7eb3197f81c..d271da1e239 100644 --- a/src/libultra/io/devmgr.c +++ b/src/libultra/io/devmgr.c @@ -62,14 +62,15 @@ void __osDevMgrMain(void* arg) { if (stat & LEO_STATUS_MECHANIC_INTR) { __osEPiRawWriteIo(ioMesg->piHandle, ASIC_BM_CTL, info->bmCtlShadow | LEO_BM_CLR_MECHANIC_INTR); } - blockInfo->errStatus = 4; + blockInfo->errStatus = LEO_SENSE_DATA_PHASE_ERROR; IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); __osSetGlobalIntMask(OS_IM_CART | OS_IM_PI); } osSendMesg(ioMesg->hdr.retQueue, (OSMesg)ioMesg, OS_MESG_NOBLOCK); - if (messageSend == 1 && ioMesg->piHandle->transferInfo.block[0].errStatus == 0) { + if (messageSend == 1 && + ioMesg->piHandle->transferInfo.block[0].errStatus == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { // Run the above once more messageSend = 0; goto readblock1; diff --git a/src/n64dd/libleo/cacreateleomanager.c b/src/n64dd/libleo/cacreateleomanager.c index 02cbac78a74..04f8fd3f59c 100644 --- a/src/n64dd/libleo/cacreateleomanager.c +++ b/src/n64dd/libleo/cacreateleomanager.c @@ -10,15 +10,15 @@ s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) u32 stat; u32 data; - if (__leoActive != 0) { - return 0; + if (__leoActive) { + return LEO_ERROR_GOOD; } if (LeoDriveExist() == 0) { - return 0x29; + return LEO_ERROR_DEVICE_COMMUNICATION_FAILURE; } osLeoDiskInit(); driveRomHandle = osDriveRomInit(); - __leoActive = 1; + __leoActive = true; __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - 0x10); leoInitialize(comPri, intPri, cmdBuf, (u32)cmdMsgCnt); if (osResetType == 1) { @@ -60,5 +60,5 @@ s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) } else { while (true) {} } - return 0; + return LEO_ERROR_GOOD; } diff --git a/src/n64dd/libleo/cjcreateleomanager.c b/src/n64dd/libleo/cjcreateleomanager.c index f20671ba362..ab502e14030 100644 --- a/src/n64dd/libleo/cjcreateleomanager.c +++ b/src/n64dd/libleo/cjcreateleomanager.c @@ -10,15 +10,15 @@ s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) u32 stat; u32 data; - if (__leoActive != 0) { - return 0; + if (__leoActive) { + return LEO_ERROR_GOOD; } if (LeoDriveExist() == 0) { - return 0x29; + return LEO_ERROR_DEVICE_COMMUNICATION_FAILURE; } osLeoDiskInit(); driveRomHandle = osDriveRomInit(); - __leoActive = 1; + __leoActive = true; __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - 0x10); leoInitialize(comPri, intPri, cmdBuf, (u32)cmdMsgCnt); if (osResetType == 1) { @@ -38,7 +38,7 @@ s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) } while (cmdBlockInq.header.status == LEO_STATUS_BUSY) {} if (cmdBlockInq.header.status != 0) { - return (s32)cmdBlockInq.header.sense; + return cmdBlockInq.header.sense; } __leoVersion.drive = cmdBlockInq.version; __leoVersion.driver = 6; @@ -61,5 +61,5 @@ s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) } else { while (true) {} } - return 0; + return LEO_ERROR_GOOD; } diff --git a/src/n64dd/libleo/clearqueue.c b/src/n64dd/libleo/clearqueue.c index c9556942460..e665b54491a 100644 --- a/src/n64dd/libleo/clearqueue.c +++ b/src/n64dd/libleo/clearqueue.c @@ -4,7 +4,7 @@ s32 LeoClearQueue(void) { LEOCmdClearQue cmdBlock; - if (__leoActive == 0) { + if (!__leoActive) { return -1; } cmdBlock.header.command = LEO_COMMAND_CLEAR_QUE; @@ -12,5 +12,5 @@ s32 LeoClearQueue(void) { cmdBlock.header.control = 0; cmdBlock.header.reserve3 = 0; leoCommand(&cmdBlock); - return 0; + return LEO_ERROR_GOOD; } diff --git a/src/n64dd/libleo/leocmdex.c b/src/n64dd/libleo/leocmdex.c index c02699a0f38..16bfb7561f9 100644 --- a/src/n64dd/libleo/leocmdex.c +++ b/src/n64dd/libleo/leocmdex.c @@ -1,5 +1,6 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" #include "attributes.h" extern u16 LEOrw_flags; @@ -35,7 +36,7 @@ void leomain(void* arg0) { LEOPiInfo = osLeoDiskInit(); LEOPiDmaParam.hdr.pri = 1; LEOPiDmaParam.hdr.retQueue = &LEOdma_que; - osEPiReadIo(LEOPiInfo, 0x05000508, &cur_status); + osEPiReadIo(LEOPiInfo, ASIC_STATUS, &cur_status); if (!(cur_status & 0x400000)) { if ((cur_status & 0x06800000) != 0) { leoDrive_reset(); @@ -56,7 +57,7 @@ void leomain(void* arg0) { do { if (cur_status == 0) { - if (sense_code == 0) { + if (sense_code == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { continue; } } else { @@ -136,7 +137,7 @@ void leomain(void* arg0) { break; default: if (LEO_country_code == 0) { - osEPiReadIo(LEOPiInfo, 0x05000540, &cur_status); + osEPiReadIo(LEOPiInfo, ASIC_ID_REG, &cur_status); if ((cur_status & 0x70000) != 0x40000) { while (true) {} } @@ -148,7 +149,8 @@ void leomain(void* arg0) { } if ((LEOcur_command->header.sense = - leoSend_asic_cmd_w(0xB0001, LEO_sys_data.param.disk_type << 16)) != 0) { + leoSend_asic_cmd_w(0xB0001, LEO_sys_data.param.disk_type << 16)) != + LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { LEOcur_command->header.status = LEO_STATUS_CHECK_CONDITION; goto post_exe; } @@ -157,7 +159,7 @@ void leomain(void* arg0) { goto invalid_disktype; } - LEOdisk_type = (LEO_sys_data.param.disk_type & 0xF); + LEOdisk_type = LEO_sys_data.param.disk_type & 0xF; if (LEOdisk_type >= 7) { invalid_disktype: LEOcur_command->header.sense = 11; @@ -173,7 +175,7 @@ void leomain(void* arg0) { post_exe: if (LEOcur_command->header.control & LEO_CONTROL_POST) { - osSendMesg(LEOcur_command->header.post, (void*)(s32)LEOcur_command->header.sense, OS_MESG_BLOCK); + osSendMesg(LEOcur_command->header.post, (OSMesg)(s32)LEOcur_command->header.sense, OS_MESG_BLOCK); } if (LEOclr_que_flag != 0) { leoClr_queue(); diff --git a/src/n64dd/libleo/leodiskinit.c b/src/n64dd/libleo/leodiskinit.c index ffc4089fc57..733857a6e94 100644 --- a/src/n64dd/libleo/leodiskinit.c +++ b/src/n64dd/libleo/leodiskinit.c @@ -1,5 +1,6 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" OSPiHandle __LeoDiskHandle; OSPiHandle* __osDiskHandle; @@ -7,13 +8,13 @@ OSPiHandle* __osDiskHandle; OSPiHandle* osLeoDiskInit(void) { u32 saveMask; - __LeoDiskHandle.type = 2; - __LeoDiskHandle.baseAddress = 0xA5000000; + __LeoDiskHandle.type = DEVICE_TYPE_64DD; + __LeoDiskHandle.baseAddress = PHYS_TO_K1(ASIC_BASE); __LeoDiskHandle.latency = 3; __LeoDiskHandle.pulse = 6; __LeoDiskHandle.pageSize = 6; __LeoDiskHandle.relDuration = 2; - __LeoDiskHandle.domain = 1; + __LeoDiskHandle.domain = PI_DOMAIN2; __LeoDiskHandle.speed = 0; bzero(&__LeoDiskHandle.transferInfo, sizeof(__LeoDiskHandle.transferInfo)); saveMask = __osDisableInt(); diff --git a/src/n64dd/libleo/leofunc.c b/src/n64dd/libleo/leofunc.c index a015c9c694a..a01ba5326c7 100644 --- a/src/n64dd/libleo/leofunc.c +++ b/src/n64dd/libleo/leofunc.c @@ -1,6 +1,8 @@ #include "ultra64.h" +#include "ultra64/leo.h" #include "ultra64/leo_internal.h" #include "array_count.h" +#include "ultra64/message.h" s32 __leoResetCalled = 0; s32 __leoQueuesCreated = 0; @@ -8,7 +10,7 @@ s32 __leoQueuesCreated = 0; OSMesgQueue LEOpost_que; OSMesg LEOpost_que_buf; -void leoInitialize(OSPri compri, OSPri intpri, void** command_que_buf, u32 cmd_buff_size) { +void leoInitialize(OSPri compri, OSPri intpri, OSMesg* command_que_buf, u32 cmd_buff_size) { u32 savedMask; OSPri oldPri; OSPri myPri; @@ -27,7 +29,7 @@ void leoInitialize(OSPri compri, OSPri intpri, void** command_que_buf, u32 cmd_b } savedMask = __osDisableInt(); __leoQueuesCreated = 1; - osCreateMesgQueue(&LEOcommand_que, command_que_buf, (s32)cmd_buff_size); + osCreateMesgQueue(&LEOcommand_que, command_que_buf, cmd_buff_size); osCreateMesgQueue(&LEOcontrol_que, &LEOcontrol_que_buf, 1); osCreateMesgQueue(&LEOevent_que, &LEOevent_que_buf, 1); osCreateMesgQueue(&LEOdma_que, LEOdma_que_buf, ARRAY_COUNT(LEOdma_que_buf)); @@ -52,7 +54,7 @@ void leoCommand(void* cmd_blk_addr) { header->status = LEO_STATUS_CHECK_CONDITION; header->sense = LEO_SENSE_WAITING_NMI; if (header->control & LEO_CONTROL_POST) { - osSendMesg(header->post, (OSMesg)0x25, OS_MESG_BLOCK); + osSendMesg(header->post, (OSMesg)LEO_ERROR_WAITING_NMI, OS_MESG_BLOCK); } } else { osRecvMesg(&LEOblock_que, NULL, OS_MESG_BLOCK); @@ -65,7 +67,7 @@ void leoCommand(void* cmd_blk_addr) { LEOclr_que_flag = 0; header->status = LEO_STATUS_GOOD; if (header->control & LEO_CONTROL_POST) { - osSendMesg(header->post, NULL, OS_MESG_BLOCK); + osSendMesg(header->post, (OSMesg)LEO_ERROR_GOOD, OS_MESG_BLOCK); } break; case LEO_COMMAND_READ: @@ -120,7 +122,7 @@ s32 LeoResetClear(void) { } osRecvMesg(&LEOpost_que, NULL, OS_MESG_BLOCK); if (resetclear.status == LEO_STATUS_GOOD) { - return 0; + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } else { return resetclear.sense; } diff --git a/src/n64dd/libleo/leoinquiry.c b/src/n64dd/libleo/leoinquiry.c index c241f9a9d66..8dac7892115 100644 --- a/src/n64dd/libleo/leoinquiry.c +++ b/src/n64dd/libleo/leoinquiry.c @@ -1,13 +1,14 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" void leoInquiry(void) { u32 asic_id; u32 asic_data; - osEPiReadIo(LEOPiInfo, 0x05000540, &asic_id); - if (leoSend_asic_cmd_w(0x1B0000, 0) == 0) { - osEPiReadIo(LEOPiInfo, 0x05000500, &asic_data); + osEPiReadIo(LEOPiInfo, ASIC_ID_REG, &asic_id); + if (leoSend_asic_cmd_w(0x1B0000, 0) == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { + osEPiReadIo(LEOPiInfo, ASIC_DATA, &asic_data); if (asic_data & 0x10000) { asic_id |= 0x100000; } diff --git a/src/n64dd/libleo/leoint.c b/src/n64dd/libleo/leoint.c index 02ec19897e9..5922d10e630 100644 --- a/src/n64dd/libleo/leoint.c +++ b/src/n64dd/libleo/leoint.c @@ -1,5 +1,7 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" +#include "ultra64/pi.h" extern vu16 LEOrw_flags; @@ -29,7 +31,7 @@ void leointerrupt(void* arg) { } else { result = leoSeek_i(0); } - if (result != 0) { + if (result != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { goto complete; } if (LEOrw_flags & 0x2000) { @@ -40,7 +42,7 @@ void leointerrupt(void* arg) { LEOtgt_param.lba += LEOtgt_param.rdwr_blocks; tg_blocks -= LEOtgt_param.rdwr_blocks; result = read_write_track(); - if (result != 0) { + if (result != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { goto complete; } LEOcur_command->data.readwrite.rw_bytes = @@ -87,7 +89,7 @@ u32 read_write_track(void) { LEOPiInfo->transferInfo.block[1] = LEOPiInfo->transferInfo.block[0]; LEOPiInfo->transferInfo.block[1].C2Addr = &LEOC2_Syndrome[1]; LEOPiInfo->transferInfo.block[1].dramAddr = - ((u8*)LEOPiInfo->transferInfo.block[1].dramAddr + block_param.blkbytes); + (u8*)LEOPiInfo->transferInfo.block[1].dramAddr + block_param.blkbytes; } message = leoChk_mecha_int(); if (message == 0) { @@ -106,13 +108,13 @@ u32 read_write_track(void) { LEOPiInfo->transferInfo.cmdType = 1; osWritebackDCache(block_param.pntr, block_param.blkbytes * LEOtgt_param.rdwr_blocks); - osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, 1); + osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, OS_WRITE); osRecvMesg(&LEOdma_que, NULL, OS_MESG_BLOCK); LEOasic_bm_ctl_shadow = LEOPiInfo->transferInfo.bmCtlShadow; LEOasic_seq_ctl_shadow = LEOPiInfo->transferInfo.seqCtlShadow; bnum = LEOPiInfo->transferInfo.blockNum; message = LEOPiInfo->transferInfo.block[bnum].errStatus; - if (message == 0) { + if (message == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { return message; } goto track_end; @@ -123,7 +125,7 @@ u32 read_write_track(void) { } LEOPiInfo->transferInfo.cmdType = 0; osInvalDCache(block_param.pntr, block_param.blkbytes * LEOtgt_param.rdwr_blocks); - osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, 0); + osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, OS_READ); block = 0; while (LEOtgt_param.rdwr_blocks != 0) { osRecvMesg(&LEOdma_que, NULL, OS_MESG_BLOCK); @@ -142,7 +144,7 @@ u32 read_write_track(void) { u32 c2datasize; if (LEOtgt_param.rdwr_blocks == 1) { - osEPiReadIo(LEOPiInfo, 0x05000514, &message); + osEPiReadIo(LEOPiInfo, ASIC_ERR_SECTOR, &message); if (message & 0x10000000) { message = LEO_SENSE_DATA_PHASE_ERROR; goto track_end; @@ -194,14 +196,14 @@ u32 read_write_track(void) { } if ((retry_cntr & 7) == 0) { message = leoSend_asic_cmd_w(0x30001, 0); - if (message != 0) { + if (message != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { goto do_retry; } } if ((message == LEO_SENSE_NO_REFERENCE_POSITION_FOUND) || ((message == LEO_SENSE_UNRECOVERED_READ_ERROR) && (retry_cntr == 32))) { message = leoDetect_index_w(); - if (message != 0) { + if (message != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { goto do_retry; } } @@ -210,7 +212,7 @@ u32 read_write_track(void) { } else { message = leoSeek_i(0); } - if (message != 0) { + if (message != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { goto do_retry; } } @@ -222,8 +224,8 @@ u32 leoChk_mecha_int(void) { u32 index_stat; stat = leoWait_mecha_cmd_done(0x10001); - if (stat == 0) { - osEPiReadIo(LEOPiInfo, 0x0500050C, &index_stat); + if (stat == LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { + osEPiReadIo(LEOPiInfo, ASIC_CUR_TK, &index_stat); if ((index_stat & 0x60000000) != 0x60000000) { stat = LEO_SENSE_NO_REFERENCE_POSITION_FOUND; } @@ -232,29 +234,29 @@ u32 leoChk_mecha_int(void) { } void leosetup_BM(void) { - osEPiWriteIo(LEOPiInfo, 0x05000510, LEOasic_bm_ctl_shadow | 0x10000000); - osEPiWriteIo(LEOPiInfo, 0x05000510, (u32)LEOasic_bm_ctl_shadow); + osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow | LEO_BM_RESET); + osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, (u32)LEOasic_bm_ctl_shadow); if (LEOtgt_param.start_block != 0) { - LEOasic_bm_ctl_shadow = 0x5A0000; + LEOasic_bm_ctl_shadow = 0x005A0000; } else { LEOasic_bm_ctl_shadow = 0; } if (!(LEOrw_flags & 0x8000)) { - LEOasic_bm_ctl_shadow |= 0x40000000; + LEOasic_bm_ctl_shadow |= LEO_BM_MODE; } if (LEOtgt_param.rdwr_blocks == 2) { - LEOasic_bm_ctl_shadow |= 0x02000000; + LEOasic_bm_ctl_shadow |= LEO_BM_XFER_BLOCK; } - osEPiWriteIo(LEOPiInfo, 0x05000510, (u32)LEOasic_bm_ctl_shadow); + osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, (u32)LEOasic_bm_ctl_shadow); } u32 leochk_err_reg(void) { u32 sense; u32 index_status; - osEPiReadIo(LEOPiInfo, 0x05000514, &sense); - osEPiWriteIo(LEOPiInfo, 0x05000510, LEOasic_bm_ctl_shadow | 0x10000000); - osEPiWriteIo(LEOPiInfo, 0x05000510, (u32)LEOasic_bm_ctl_shadow); + osEPiReadIo(LEOPiInfo, ASIC_ERR_SECTOR, &sense); + osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, LEOasic_bm_ctl_shadow | LEO_BM_RESET); + osEPiWriteIo(LEOPiInfo, ASIC_BM_CTL, (u32)LEOasic_bm_ctl_shadow); if (sense & 0x04000000) { return LEO_SENSE_EJECTED_ILLEGALLY_RESUME; } @@ -270,7 +272,7 @@ u32 leochk_err_reg(void) { if (sense & 0x80000000) { return LEO_SENSE_NO_REFERENCE_POSITION_FOUND; } - osEPiReadIo(LEOPiInfo, 0x0500050C, &index_status); + osEPiReadIo(LEOPiInfo, ASIC_CUR_TK, &index_status); if ((index_status & 0x60000000) == 0x60000000) { return LEO_SENSE_TRACK_FOLLOWING_ERROR; } diff --git a/src/n64dd/libleo/leointerrupt.c b/src/n64dd/libleo/leointerrupt.c index 48d0ab99e43..74c1a6ae61a 100644 --- a/src/n64dd/libleo/leointerrupt.c +++ b/src/n64dd/libleo/leointerrupt.c @@ -1,6 +1,8 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" #include "ultra64/internal.h" +#include "ultra64/pi.h" void __osLeoAbnormalResume(void); void __osLeoResume(void); @@ -19,7 +21,7 @@ s32 __osLeoInterrupt(void) { pi_stat = IO_READ(PI_STATUS_REG); if (pi_stat & PI_STATUS_DMA_BUSY) { __OSGlobalIntMask &= ~(OS_IM_CART & ~OS_IM_RCP); - blockInfo->errStatus = 0x1D; + blockInfo->errStatus = 29; __osLeoResume(); return 1; } @@ -27,14 +29,14 @@ s32 __osLeoInterrupt(void) { while ((pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) { pi_stat = IO_READ(PI_STATUS_REG); } - stat = IO_READ(0xA5000508); - if (stat & 0x02000000) { + stat = IO_READ(ASIC_STATUS); + if (stat & LEO_STATUS_MECHANIC_INTR) { pi_stat = IO_READ(PI_STATUS_REG); while ((pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) { pi_stat = IO_READ(PI_STATUS_REG); } - IO_WRITE(0xA5000510, info->bmCtlShadow | 0x01000000); - blockInfo->errStatus = 0; + IO_WRITE(ASIC_BM_CTL, info->bmCtlShadow | LEO_BM_CLR_MECHANIC_INTR); + blockInfo->errStatus = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; return 0; } if (info->cmdType == 2) { @@ -45,8 +47,8 @@ s32 __osLeoInterrupt(void) { while ((pi_stat & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) { pi_stat = IO_READ(PI_STATUS_REG); } - IO_READ(0xA5000508); - blockInfo->errStatus = 0x16; + IO_READ(ASIC_STATUS); + blockInfo->errStatus = LEO_SENSE_WRITE_FAULT; __osLeoResume(); IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); __OSGlobalIntMask |= OS_IM_PI; @@ -55,41 +57,41 @@ s32 __osLeoInterrupt(void) { if (info->cmdType == 1) { if (!(stat & 0x40000000)) { if ((info->sectorNum + 1) != (info->transferMode * 0x55)) { - blockInfo->errStatus = 0x18; + blockInfo->errStatus = LEO_SENSE_NO_REFERENCE_POSITION_FOUND; __osLeoAbnormalResume(); } else { IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); __OSGlobalIntMask |= OS_IM_PI; - blockInfo->errStatus = 0; + blockInfo->errStatus = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; __osLeoResume(); } } else { - blockInfo->dramAddr = BADCASTP((u32)blockInfo->dramAddr + blockInfo->sectorSize); + blockInfo->dramAddr = (u8*)blockInfo->dramAddr + blockInfo->sectorSize; info->sectorNum += 1; - __osEPiRawStartDma(__osDiskHandle, 1, 0x05000400, blockInfo->dramAddr, blockInfo->sectorSize); + __osEPiRawStartDma(__osDiskHandle, OS_WRITE, ASIC_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); } return 1; } if (info->cmdType == 0) { if (info->transferMode == 3) { if ((s32)(blockInfo->C1ErrNum + 0x11) < info->sectorNum) { - blockInfo->errStatus = 0; + blockInfo->errStatus = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; __osLeoAbnormalResume(); return 1; } if (!(stat & 0x40000000)) { - blockInfo->errStatus = 0x17; + blockInfo->errStatus = LEO_SENSE_UNRECOVERED_READ_ERROR; __osLeoAbnormalResume(); return 1; } } else { - blockInfo->dramAddr = BADCASTP((u32)blockInfo->dramAddr + blockInfo->sectorSize); + blockInfo->dramAddr = (u8*)blockInfo->dramAddr + blockInfo->sectorSize; } - bm_stat = IO_READ(0xA5000510); - if (((bm_stat & 0x200000) && (bm_stat & 0x400000)) || (bm_stat & 0x02000000)) { + bm_stat = IO_READ(ASIC_BM_STATUS); + if (((bm_stat & 0x00200000) && (bm_stat & 0x00400000)) || (bm_stat & 0x02000000)) { if (blockInfo->C1ErrNum >= 4) { if ((info->transferMode != 3) || (info->sectorNum >= 0x53)) { - blockInfo->errStatus = 0x17; + blockInfo->errStatus = LEO_SENSE_UNRECOVERED_READ_ERROR; __osLeoAbnormalResume(); return 1; } @@ -103,21 +105,21 @@ s32 __osLeoInterrupt(void) { } if (stat & 0x10000000) { if (info->sectorNum != 0x57) { - blockInfo->errStatus = 0x18; + blockInfo->errStatus = LEO_SENSE_NO_REFERENCE_POSITION_FOUND; __osLeoAbnormalResume(); } else { if ((info->transferMode == 2) && (info->blockNum == 0)) { info->blockNum = 1; info->sectorNum = -1; - info->block[1].dramAddr = BADCASTP((u32)info->block[1].dramAddr - info->block[1].sectorSize); - blockInfo->errStatus = 0x16; + info->block[1].dramAddr = (u8*)info->block[1].dramAddr - info->block[1].sectorSize; + blockInfo->errStatus = LEO_SENSE_WRITE_FAULT; } else { IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); __OSGlobalIntMask |= OS_IM_PI; info->cmdType = 2; - blockInfo->errStatus = 0; + blockInfo->errStatus = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } - __osEPiRawStartDma(__osDiskHandle, 0, 0x05000000, blockInfo->C2Addr, blockInfo->sectorSize * 4); + __osEPiRawStartDma(__osDiskHandle, OS_READ, ASIC_C2_BUFF, blockInfo->C2Addr, blockInfo->sectorSize * 4); } return 1; } @@ -127,33 +129,33 @@ s32 __osLeoInterrupt(void) { if (info->block[0].C1ErrNum == 0) { if ((((u32*)bptr->C2Addr)[0] | ((u32*)bptr->C2Addr)[1] | ((u32*)bptr->C2Addr)[2] | ((u32*)bptr->C2Addr)[3]) != 0) { - bptr->errStatus = 0x17; + bptr->errStatus = LEO_SENSE_UNRECOVERED_READ_ERROR; __osLeoAbnormalResume(); return 1; } } - info->block[0].errStatus = 0; + info->block[0].errStatus = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; __osLeoResume(); } info->sectorNum += 1; if (stat & 0x40000000) { if (info->sectorNum >= 0x55) { - blockInfo->errStatus = 0x18; + blockInfo->errStatus = LEO_SENSE_NO_REFERENCE_POSITION_FOUND; __osLeoAbnormalResume(); return 1; } - __osEPiRawStartDma(__osDiskHandle, 0, 0x05000400, blockInfo->dramAddr, blockInfo->sectorSize); - blockInfo->errStatus = 0; + __osEPiRawStartDma(__osDiskHandle, OS_READ, ASIC_SECTOR_BUFF, blockInfo->dramAddr, blockInfo->sectorSize); + blockInfo->errStatus = LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; return 1; } if (info->sectorNum < 0x55) { - blockInfo->errStatus = 0x18; + blockInfo->errStatus = LEO_SENSE_NO_REFERENCE_POSITION_FOUND; __osLeoAbnormalResume(); return 1; } return 1; } - blockInfo->errStatus = 4; + blockInfo->errStatus = LEO_SENSE_DATA_PHASE_ERROR; __osLeoAbnormalResume(); return 1; } @@ -164,9 +166,9 @@ void __osLeoAbnormalResume(void) { info = &__osDiskHandle->transferInfo; while (((pi_stat = IO_READ(PI_STATUS_REG)) & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) {} - IO_WRITE(0xA5000510, info->bmCtlShadow | 0x10000000); + IO_WRITE(ASIC_BM_CTL, info->bmCtlShadow | LEO_BM_RESET); while (((pi_stat = IO_READ(PI_STATUS_REG)) & (PI_STATUS_DMA_BUSY | PI_STATUS_IO_BUSY)) != 0) {} - IO_WRITE(0xA5000510, info->bmCtlShadow); + IO_WRITE(ASIC_BM_CTL, info->bmCtlShadow); __osLeoResume(); IO_WRITE(PI_STATUS_REG, PI_STATUS_CLR_INTR); __OSGlobalIntMask |= OS_IM_PI; diff --git a/src/n64dd/libleo/leomecha.c b/src/n64dd/libleo/leomecha.c index 6cd5caef423..5b436c1812b 100644 --- a/src/n64dd/libleo/leomecha.c +++ b/src/n64dd/libleo/leomecha.c @@ -1,5 +1,6 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" #include "attributes.h" u8 leoRecv_event_mesg(s32 control); @@ -10,30 +11,30 @@ u32 unit_atten; u8 leoAnalize_asic_status(void) { u32 curr_stat; - osEPiReadIo(LEOPiInfo, 0x05000508, &asic_cur_status); + osEPiReadIo(LEOPiInfo, ASIC_STATUS, &asic_cur_status); curr_stat = asic_cur_status ^ 0x01000000; - if (curr_stat & 0x01C3FFFF) { - if (curr_stat & 0x01C1FFFF) { + if ((curr_stat & 0x01C3FFFF) != 0) { + if ((curr_stat & 0x01C1FFFF) != 0) { LEOdrive_flag = 0; } if (curr_stat & 0xFFFF) { return LEO_SENSE_DEVICE_COMMUNICATION_FAILURE; } - if ((curr_stat & 0xC00000) == 0x800000) { + if ((curr_stat & 0x00C00000) == 0x00800000) { return LEO_SENSE_COMMAND_PHASE_ERROR; } - if (curr_stat & 0x400000) { + if (curr_stat & 0x00400000) { unit_atten |= 2; return LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED; } if (curr_stat & 0x01000000) { return LEO_SENSE_EJECTED_ILLEGALLY_RESUME; } - if (curr_stat & 0x10000) { + if (curr_stat & 0x00010000) { unit_atten |= 1; return LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED; } - if (curr_stat & 0x20000) { + if (curr_stat & 0x00020000) { return LEO_SENSE_NO_SEEK_COMPLETE; } } @@ -58,7 +59,7 @@ u8 leoChk_asic_ready(u32 asic_cmd) { if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } - osEPiWriteIo(LEOPiInfo, 0x05000508, 0x90000); + osEPiWriteIo(LEOPiInfo, ASIC_CMD, 0x90000); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } @@ -85,11 +86,11 @@ u8 leoChk_done_status(u32 asic_cmd) { switch (code) { case LEO_SENSE_POWERONRESET_DEVICERESET_OCCURED: case LEO_SENSE_MEDIUM_MAY_HAVE_CHANGED: - if (!(asic_cur_status & 0x800000)) { + if (!(asic_cur_status & 0x00800000)) { if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } - osEPiWriteIo(LEOPiInfo, 0x05000508, 0x90000); + osEPiWriteIo(LEOPiInfo, ASIC_CMD, 0x00090000); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } @@ -103,17 +104,17 @@ u8 leoChk_done_status(u32 asic_cmd) { } break; case LEO_SENSE_NO_SEEK_COMPLETE: - osEPiWriteIo(LEOPiInfo, 0x05000500, 0); + osEPiWriteIo(LEOPiInfo, ASIC_DATA, 0); if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } - osEPiWriteIo(LEOPiInfo, 0x05000508, 0xC0000); + osEPiWriteIo(LEOPiInfo, ASIC_CMD, 0x000C0000); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } - osEPiReadIo(LEOPiInfo, 0x05000500, &asic_data); - code = leoChk_asic_ready(0xC0000); - if (code != 0) { + osEPiReadIo(LEOPiInfo, ASIC_DATA, &asic_data); + code = leoChk_asic_ready(0x000C0000); + if (code != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { return code; } if (asic_data & 0x10000) { @@ -140,17 +141,17 @@ u8 leoSend_asic_cmd_i(u32 asic_cmd, u32 asic_data) { u8 status; status = leoChk_asic_ready(asic_cmd); - if (status != 0) { + if (status != LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION) { LEOcur_command->header.sense = status; return LEOcur_command->header.sense; } - osEPiWriteIo(LEOPiInfo, 0x05000500, asic_data); + osEPiWriteIo(LEOPiInfo, ASIC_DATA, asic_data); if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { LEOcur_command->header.sense = LEO_SENSE_WAITING_NMI; return LEOcur_command->header.sense; } - osEPiWriteIo(LEOPiInfo, 0x05000508, asic_cmd); - return 0; + osEPiWriteIo(LEOPiInfo, ASIC_CMD, asic_cmd); + return LEO_SENSE_NO_ADDITIONAL_SENSE_INFOMATION; } u8 leoWait_mecha_cmd_done(u32 asic_cmd) { @@ -185,12 +186,12 @@ u8 leoSend_asic_cmd_w_nochkDiskChange(u32 asic_cmd, u32 asic_data) { LEOcur_command->header.sense = status; return LEOcur_command->header.sense; } - osEPiWriteIo(LEOPiInfo, 0x05000500, asic_data); + osEPiWriteIo(LEOPiInfo, ASIC_DATA, asic_data); if (leoRecv_event_mesg(OS_MESG_NOBLOCK) != 0) { LEOcur_command->header.sense = LEO_SENSE_WAITING_NMI; return LEOcur_command->header.sense; } - osEPiWriteIo(LEOPiInfo, 0x05000508, asic_cmd); + osEPiWriteIo(LEOPiInfo, ASIC_CMD, asic_cmd); if (leoRecv_event_mesg(OS_MESG_BLOCK) != 0) { return LEO_SENSE_WAITING_NMI; } @@ -300,11 +301,11 @@ u8 leoChk_cur_drvmode(void) { } void leoDrive_reset(void) { - osEPiWriteIo(LEOPiInfo, 0x05000520, 0xAAAA0000); + osEPiWriteIo(LEOPiInfo, ASIC_HARD_RESET, 0xAAAA0000); } u32 leoChkUnit_atten(void) { - return (u32)unit_atten; + return unit_atten; } u32 leoRetUnit_atten(void) { diff --git a/src/n64dd/libleo/leomseq_tbl.c b/src/n64dd/libleo/leomseq_tbl.c index 6be4e7560ba..1bf0a391d47 100644 --- a/src/n64dd/libleo/leomseq_tbl.c +++ b/src/n64dd/libleo/leomseq_tbl.c @@ -1,5 +1,6 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" extern vu16 LEOrw_flags; @@ -20,8 +21,8 @@ void leoSet_mseq(u16 rwmode) { u32 sct_byte_u; u8 i; - LEOasic_seq_ctl_shadow &= 0xBFFFFFFF; - osEPiWriteIo(LEOPiInfo, 0x05000518, LEOasic_seq_ctl_shadow); + LEOasic_seq_ctl_shadow &= ~0x40000000; + osEPiWriteIo(LEOPiInfo, ASIC_SEQ_CTL, LEOasic_seq_ctl_shadow); if (rwmode == 1) { tbl = wt_mseq_code; } else { @@ -36,16 +37,16 @@ void leoSet_mseq(u16 rwmode) { mseq_tbl[4] |= sct_byte_x; osWritebackDCache(mseq_tbl, 0x40); LEOPiDmaParam.dramAddr = mseq_tbl; - LEOPiDmaParam.devAddr = 0x05000580; + LEOPiDmaParam.devAddr = MSEQ_RAM_ADDR; LEOPiDmaParam.size = 0x40; LEOPiInfo->transferInfo.cmdType = 2; - osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, 1); + osEPiStartDma(LEOPiInfo, &LEOPiDmaParam, OS_WRITE); osRecvMesg(&LEOdma_que, NULL, OS_MESG_BLOCK); - osEPiWriteIo(LEOPiInfo, 0x05000530, (sct_byte_u | 0x5900) << 16); + osEPiWriteIo(LEOPiInfo, ASIC_SEC_BYTE, (sct_byte_u | 0x5900) << 16); if (LEOrw_flags & 0x800) { sct_byte_x += 0x100; } - osEPiWriteIo(LEOPiInfo, 0x05000528, sct_byte_x << 8); + osEPiWriteIo(LEOPiInfo, ASIC_HOST_SECBYTE, sct_byte_x << 8); LEOasic_seq_ctl_shadow |= 0x40000000; - osEPiWriteIo(LEOPiInfo, 0x05000518, LEOasic_seq_ctl_shadow); + osEPiWriteIo(LEOPiInfo, ASIC_SEQ_CTL, LEOasic_seq_ctl_shadow); } diff --git a/src/n64dd/libleo/leoram.c b/src/n64dd/libleo/leoram.c index 9998f012bfa..e295d472a57 100644 --- a/src/n64dd/libleo/leoram.c +++ b/src/n64dd/libleo/leoram.c @@ -19,8 +19,8 @@ OSMesg LEOdma_que_buf[2]; OSMesg LEOblock_que_buf; u8* LEOwrite_pointer; LEOCmd* LEOcur_command; -s32 LEOasic_bm_ctl_shadow; -s32 LEOasic_seq_ctl_shadow; +u32 LEOasic_bm_ctl_shadow; +u32 LEOasic_seq_ctl_shadow; u8 LEOdrive_flag; vu8 LEOclr_que_flag; u16 LEOrw_flags; diff --git a/src/n64dd/libleo/leord_capa.c b/src/n64dd/libleo/leord_capa.c index 0d0a00d2003..7dc0c3ddb47 100644 --- a/src/n64dd/libleo/leord_capa.c +++ b/src/n64dd/libleo/leord_capa.c @@ -5,7 +5,7 @@ void leoRd_capacity(void) { if (LEOcur_command->header.control & 1) { LEOcur_command->data.readwrite.lba = LEORAM_START_LBA[LEOdisk_type] - 0x18; LEOcur_command->data.readwrite.xfer_blks = 0x10C3; - LEOcur_command->data.readwrite.buff_ptr = BADCASTP LEORAM_BYTE[LEOdisk_type]; + LEOcur_command->data.readwrite.buff_ptr = (void*)LEORAM_BYTE[LEOdisk_type]; } else { LEOcur_command->data.readwrite.lba = 0; LEOcur_command->data.readwrite.xfer_blks = 0x10C3; diff --git a/src/n64dd/libleo/leoreset.c b/src/n64dd/libleo/leoreset.c index 56a808c645e..db3a427aacc 100644 --- a/src/n64dd/libleo/leoreset.c +++ b/src/n64dd/libleo/leoreset.c @@ -8,7 +8,7 @@ void leoClr_queue(void) { ((LEOCmdHeader*)clr_cmd)->sense = LEO_SENSE_COMMAND_TERMINATED; ((LEOCmdHeader*)clr_cmd)->status = LEO_STATUS_CHECK_CONDITION; if (((LEOCmdHeader*)clr_cmd)->control & LEO_CONTROL_POST) { - osSendMesg(((LEOCmdHeader*)clr_cmd)->post, (OSMesg)0x22, OS_MESG_BLOCK); + osSendMesg(((LEOCmdHeader*)clr_cmd)->post, (OSMesg)LEO_ERROR_COMMAND_TERMINATED, OS_MESG_BLOCK); } } } diff --git a/src/n64dd/libleo/leotimer.c b/src/n64dd/libleo/leotimer.c index 6ebf8b5fe48..d1995a44a85 100644 --- a/src/n64dd/libleo/leotimer.c +++ b/src/n64dd/libleo/leotimer.c @@ -1,5 +1,6 @@ #include "ultra64.h" #include "ultra64/leo_internal.h" +#include "ultra64/leodrive.h" #include "attributes.h" typedef struct { @@ -144,7 +145,7 @@ STATIC u8 __locReadTimer(__LOCTime* time) { if (sense_code != 0) { return sense_code; } - osEPiReadIo(LEOPiInfo, 0x05000500, &data); + osEPiReadIo(LEOPiInfo, ASIC_DATA, &data); time->minute = (u8)((u32)(data & 0xFF000000) >> 24); time->second = (s8)((u32)(data & 0xFF0000) >> 16); sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x130000, 0); @@ -152,7 +153,7 @@ STATIC u8 __locReadTimer(__LOCTime* time) { time->minute &= ~0x80; return sense_code; } - osEPiReadIo(LEOPiInfo, 0x05000500, &data); + osEPiReadIo(LEOPiInfo, ASIC_DATA, &data); time->day = (s8)((u32)(data & 0xFF000000) >> 24); time->hour = (s8)((u32)(data & 0xFF0000) >> 16); sense_code = leoSend_asic_cmd_w_nochkDiskChange(0x120000, 0); @@ -160,7 +161,7 @@ STATIC u8 __locReadTimer(__LOCTime* time) { time->minute &= ~0x80; return sense_code; } - osEPiReadIo(LEOPiInfo, 0x05000500, &data); + osEPiReadIo(LEOPiInfo, ASIC_DATA, &data); time->year = (s8)((u32)(data & 0xFF000000) >> 24); time->month = (s8)((u32)(data & 0xFF0000) >> 16); if (time->minute & 0x80) { diff --git a/src/n64dd/libleo/leotranslat.c b/src/n64dd/libleo/leotranslat.c index f29b1b94535..e779b83c7f0 100644 --- a/src/n64dd/libleo/leotranslat.c +++ b/src/n64dd/libleo/leotranslat.c @@ -44,7 +44,7 @@ void leoTranslate(void) { } flag = 0; } - LEOcur_command->data.readwrite.buff_ptr = BADCASTP calc_blks; + LEOcur_command->data.readwrite.buff_ptr = (void*)calc_blks; } else { calc_blks = LEOcur_command->data.readwrite.xfer_blks; while (calc_blks != 0) { @@ -66,7 +66,7 @@ void leoTranslate(void) { } flag = 0; } - LEOcur_command->data.readwrite.buff_ptr = BADCASTP calc_bytes; + LEOcur_command->data.readwrite.buff_ptr = (void*)calc_bytes; } LEOcur_command->header.status = LEO_STATUS_GOOD; } diff --git a/src/n64dd/libleo/readdiskid.c b/src/n64dd/libleo/readdiskid.c index 78a9883faef..d5ee056036d 100644 --- a/src/n64dd/libleo/readdiskid.c +++ b/src/n64dd/libleo/readdiskid.c @@ -2,7 +2,7 @@ #include "ultra64/leo_internal.h" s32 LeoReadDiskID(LEOCmd* cmdBlock, LEODiskID* vaddr, OSMesgQueue* mq) { - if (__leoActive == 0) { + if (!__leoActive) { return -1; } cmdBlock->header.command = LEO_COMMAND_READ_DISK_ID; diff --git a/src/n64dd/libleo/readwrite.c b/src/n64dd/libleo/readwrite.c index df6bb3e6d43..467d5497f64 100644 --- a/src/n64dd/libleo/readwrite.c +++ b/src/n64dd/libleo/readwrite.c @@ -2,7 +2,7 @@ #include "ultra64/leo_internal.h" s32 LeoReadWrite(LEOCmd* cmdBlock, s32 direction, u32 LBA, void* vAddr, u32 nLBAs, OSMesgQueue* mq) { - if (__leoActive == 0) { + if (!__leoActive) { return -1; } if (direction == 0) { diff --git a/src/n64dd/libleo/spdlmotor.c b/src/n64dd/libleo/spdlmotor.c index 1507c5512d5..94f487f3899 100644 --- a/src/n64dd/libleo/spdlmotor.c +++ b/src/n64dd/libleo/spdlmotor.c @@ -2,7 +2,7 @@ #include "ultra64/leo_internal.h" s32 LeoSpdlMotor(LEOCmd* cmdBlock, u8 mode, OSMesgQueue* mq) { - if (__leoActive == 0) { + if (!__leoActive) { return -1; } cmdBlock->header.command = LEO_COMMAND_START_STOP; diff --git a/src/n64dd/libleo/testunitready.c b/src/n64dd/libleo/testunitready.c index 1fd190fdc5a..7ac5512ec3c 100644 --- a/src/n64dd/libleo/testunitready.c +++ b/src/n64dd/libleo/testunitready.c @@ -4,7 +4,7 @@ s32 LeoTestUnitReady(LEOStatus* status) { volatile LEOCmdTestUnitReady cmdBlock; - if (__leoActive == 0) { + if (!__leoActive) { return -1; } if (IO_READ(PI_STATUS_REG) & PI_STATUS_DMA_BUSY) { @@ -17,5 +17,5 @@ s32 LeoTestUnitReady(LEOStatus* status) { leoCommand((void*)&cmdBlock); while (cmdBlock.header.status == LEO_STATUS_BUSY) {} *status = cmdBlock.test; - return (s32)cmdBlock.header.sense; + return cmdBlock.header.sense; } diff --git a/src/n64dd/n64dd_7.c b/src/n64dd/n64dd_7.c index f6c162189b2..4cfc4dd1ace 100644 --- a/src/n64dd/n64dd_7.c +++ b/src/n64dd/n64dd_7.c @@ -68,7 +68,7 @@ s32 func_801CA920(s32 arg0, u8* arg1, int* arg2, int* arg3, int* arg4) { sp24.hdr.retQueue = &sp40; sp24.devAddr = var_s0 + 0xA0000; sp24.dramAddr = (void*)arg1; sp24.hdr.pri = 0; sp24.size = 0x80; // clang-format on sp58->transferInfo.cmdType = 2; - osEPiStartDma(sp58, &sp24, 0); + osEPiStartDma(sp58, &sp24, OS_READ); osRecvMesg(&sp40, NULL, OS_MESG_BLOCK); return 0; } From 57702c2411fa3b5a5f2638d1675388012d262637 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 12:23:57 +0200 Subject: [PATCH 054/150] further n64dd/libleo cleanup --- assets/xml/misc/n64dd.xml | 4 +-- include/n64dd_internal.h | 3 ++ include/ultra64.h | 3 -- src/n64dd/libleo/readwrite.c | 2 +- src/n64dd/libleo/testunitready.c | 2 +- src/n64dd/n64dd_0.c | 25 +++++++-------- src/n64dd/n64dd_2.c | 27 ++++++++-------- src/n64dd/n64dd_3.c | 54 +++++++++++++++----------------- src/n64dd/n64dd_6.c | 18 ++++++----- 9 files changed, 68 insertions(+), 70 deletions(-) diff --git a/assets/xml/misc/n64dd.xml b/assets/xml/misc/n64dd.xml index 838b346b146..a1dd4f98a26 100644 --- a/assets/xml/misc/n64dd.xml +++ b/assets/xml/misc/n64dd.xml @@ -2,7 +2,7 @@ - - + + diff --git a/include/n64dd_internal.h b/include/n64dd_internal.h index c7b1c8cab89..78ae5c36c5b 100644 --- a/include/n64dd_internal.h +++ b/include/n64dd_internal.h @@ -1,6 +1,9 @@ #ifndef N64DD_INTERNAL_H #define N64DD_INTERNAL_H +#define BADCASTP (void*) +#define BADCASTI (u32) + #include "ultra64.h" #include "n64dd.h" #include "stack.h" diff --git a/include/ultra64.h b/include/ultra64.h index be735d3a4ea..9058adeaef6 100644 --- a/include/ultra64.h +++ b/include/ultra64.h @@ -1,9 +1,6 @@ #ifndef ULTRA64_H #define ULTRA64_H -#define BADCASTP (void*) -#define BADCASTI (u32) - #include "assert.h" #include "math.h" #include "stdarg.h" diff --git a/src/n64dd/libleo/readwrite.c b/src/n64dd/libleo/readwrite.c index 467d5497f64..c92839e3151 100644 --- a/src/n64dd/libleo/readwrite.c +++ b/src/n64dd/libleo/readwrite.c @@ -5,7 +5,7 @@ s32 LeoReadWrite(LEOCmd* cmdBlock, s32 direction, u32 LBA, void* vAddr, u32 nLBA if (!__leoActive) { return -1; } - if (direction == 0) { + if (direction == OS_READ) { cmdBlock->header.command = LEO_COMMAND_READ; } else { cmdBlock->header.command = LEO_COMMAND_WRITE; diff --git a/src/n64dd/libleo/testunitready.c b/src/n64dd/libleo/testunitready.c index 7ac5512ec3c..e7f6b4519b0 100644 --- a/src/n64dd/libleo/testunitready.c +++ b/src/n64dd/libleo/testunitready.c @@ -8,7 +8,7 @@ s32 LeoTestUnitReady(LEOStatus* status) { return -1; } if (IO_READ(PI_STATUS_REG) & PI_STATUS_DMA_BUSY) { - return 8; + return LEO_ERROR_BUSY; } cmdBlock.header.command = LEO_COMMAND_TEST_UNIT_READY; cmdBlock.header.reserve1 = 0; diff --git a/src/n64dd/n64dd_0.c b/src/n64dd/n64dd_0.c index 371b6e2e46d..d1e41766c90 100644 --- a/src/n64dd/n64dd_0.c +++ b/src/n64dd/n64dd_0.c @@ -310,7 +310,7 @@ s32 func_801C7658(void) { D_801DA5D0.unk0 = 2; D_801DA5D0.unk10 = 6; D_801DA5D0.unk14 = DmaMgr_DmaFromDriveRom; - D_801DA5D0.unkC = &func_801C7E34; + D_801DA5D0.unkC = func_801C7E34; (&func_801C8860)(&D_801DA5D0); D_801DA5D0.unk0 = 0xD; (&func_801C8860)(&D_801DA5D0); @@ -427,7 +427,7 @@ s32 func_801C843C(s32 arg0, s32* arg1, s32* arg2) { s32 v; v = LeoByteToLBA(1, arg0 + 1, &sp2C); - if (v != 0) { + if (v != LEO_ERROR_GOOD) { return v; } sp24 = sp2C - 1; @@ -435,22 +435,23 @@ s32 func_801C843C(s32 arg0, s32* arg1, s32* arg2) { sp20 = 0; } else { v = LeoLBAToByte(1, sp24, &sp20); - if (v != 0) { + if (v != LEO_ERROR_GOOD) { return v; } } *arg1 = sp24 + 1; *arg2 = arg0 - sp20; - return 0; + return LEO_ERROR_GOOD; } s32 func_801C84E0(s32 arg0) { s32 sp1C; - if (LeoLBAToByte(arg0, 1, &sp1C) == 0) { + if (LeoLBAToByte(arg0, 1, &sp1C) == LEO_ERROR_GOOD) { return sp1C; + } else { + return 0; } - return 0; } void func_801C7C1C(void* arg0, s32 arg1, s32 arg2) { @@ -472,19 +473,17 @@ void func_801C7C1C(void* arg0, s32 arg1, s32 arg2) { sp34 = D_801D36D0; if (sp44 == sp40) { func_801C8214(sp44, sp34, func_801C84E0(sp44)); - bcopy((char*)sp34 + sp3C, arg0, arg2); + bcopy((u8*)sp34 + sp3C, arg0, arg2); } else { var_s1 = 0; func_801C8214(sp44, sp34, func_801C84E0(sp44)); - bcopy((char*)sp34 + sp3C, arg0, func_801C84E0(sp44) - sp3C); + bcopy((u8*)sp34 + sp3C, arg0, func_801C84E0(sp44) - sp3C); temp_v0 = sp44 + 1; if (temp_v0 < sp40) { var_s0 = temp_v0; - if (temp_v0 < sp40) { - do { - var_s1 += func_801C84E0(var_s0); - var_s0 += 1; - } while (var_s0 < sp40); + while (var_s0 < sp40) { + var_s1 += func_801C84E0(var_s0); + var_s0 += 1; } func_801C8214(sp44 + 1, (void*)((func_801C84E0(sp44) + (s32)arg0) - sp3C), var_s1); } diff --git a/src/n64dd/n64dd_2.c b/src/n64dd/n64dd_2.c index d4e2c19c5e9..8e8085d082c 100644 --- a/src/n64dd/n64dd_2.c +++ b/src/n64dd/n64dd_2.c @@ -1,6 +1,8 @@ #include "ultra64.h" #include "n64dd.h" #include "n64dd_internal.h" +#include "array_count.h" +#include "region.h" #include "z_locale.h" #pragma increment_block_number "" @@ -116,16 +118,13 @@ s32 func_801C8A34(void) { } void func_801C8A4C(struct_801E1598* arg0) { - s32 temp_v0; - osCreateMesgQueue(&arg0->unk1C, &D_801E1608, 1); - if (gCurrentRegion == 1) { - arg0->unk68 = LeoCJCreateLeoManager(0x95, 0x96, D_801E1610, 8); + if (gCurrentRegion == REGION_JP) { + arg0->unk68 = LeoCJCreateLeoManager(149, 150, D_801E1610, ARRAY_COUNT(D_801E1610)); } else { - arg0->unk68 = LeoCACreateLeoManager(0x95, 0x96, D_801E1610, 8); + arg0->unk68 = LeoCACreateLeoManager(149, 150, D_801E1610, ARRAY_COUNT(D_801E1610)); } - temp_v0 = arg0->unk68; - if ((temp_v0 == 0x29) || (temp_v0 == 0)) { + if ((arg0->unk68 == LEO_ERROR_DEVICE_COMMUNICATION_FAILURE) || (arg0->unk68 == LEO_ERROR_GOOD)) { D_801D36E4 = 1; } } @@ -152,8 +151,8 @@ void func_801C8B8C(struct_801E1598* arg0) { sp30 = arg0->unk5C; if (LeoByteToLBA(sp30, (u32)arg0->unk60, &sp34) == 0) { sp28 = &arg0->unk1C; - LeoReadWrite(&arg0->unk0, 0, (u32)sp30, arg0->unk58, (u32)sp34, sp28); - osRecvMesg(sp28, BADCASTP & arg0->unk68, OS_MESG_BLOCK); + LeoReadWrite(&arg0->unk0, OS_READ, (u32)sp30, arg0->unk58, (u32)sp34, sp28); + osRecvMesg(sp28, (OSMesg*)&arg0->unk68, OS_MESG_BLOCK); } } @@ -163,10 +162,10 @@ void func_801C8C00(struct_801E1598* arg0) { OSMesgQueue* sp28; sp30 = arg0->unk58; - if (LeoByteToLBA((s32)sp30, (u32)arg0->unk60, &sp34) == 0) { + if (LeoByteToLBA((s32)sp30, (u32)arg0->unk60, &sp34) == LEO_ERROR_GOOD) { sp28 = &arg0->unk1C; - LeoReadWrite(&arg0->unk0, 1, (u32)sp30, (void*)arg0->unk5C, (u32)sp34, sp28); - osRecvMesg(sp28, (void**)&arg0->unk68, OS_MESG_BLOCK); + LeoReadWrite(&arg0->unk0, OS_WRITE, (u32)sp30, (void*)arg0->unk5C, (u32)sp34, sp28); + osRecvMesg(sp28, (OSMesg*)&arg0->unk68, OS_MESG_BLOCK); } } @@ -264,7 +263,7 @@ s8 func_801C8FD0(void) { s32 temp_v0; temp_v0 = func_801C8F9C(&D_801E1598); - if (D_801E1598.unk68 == 8) { + if (D_801E1598.unk68 == LEO_ERROR_BUSY) { return 0; } if (temp_v0 == 0) { @@ -274,7 +273,7 @@ s8 func_801C8FD0(void) { } s32 func_801C9020(void) { - if ((func_801C90A4() == 0) && (D_801E1598.unk68 != 0)) { + if ((func_801C90A4() == 0) && (D_801E1598.unk68 != LEO_ERROR_GOOD)) { return D_801E1598.unk68; } return -1; diff --git a/src/n64dd/n64dd_3.c b/src/n64dd/n64dd_3.c index 543d362114b..c64ad25147a 100644 --- a/src/n64dd/n64dd_3.c +++ b/src/n64dd/n64dd_3.c @@ -86,11 +86,9 @@ void func_801C9400(void) { } s32 func_801C9430(struct_801E1598* arg0) { - s32 temp_a1; - - temp_a1 = arg0->unk68; - if (((temp_a1 < 0x25) || (temp_a1 >= 0x29)) && (temp_a1 != 0x1F) && (temp_a1 != 0x20)) { - func_801C91B0(temp_a1); + if (((arg0->unk68 <= LEO_ERROR_ILLEGAL_TIMER_VALUE) || (arg0->unk68 >= LEO_ERROR_DEVICE_COMMUNICATION_FAILURE)) && + (arg0->unk68 != LEO_ERROR_INVALID_COMMAND_OPERATION_CODE) && (arg0->unk68 != LEO_ERROR_LBA_OUT_OF_RANGE)) { + func_801C91B0(arg0->unk68); func_801C9228(3); } LeoClearQueue(); @@ -105,17 +103,17 @@ s32 func_801C948C(struct_801E1598* arg0) { Sleep_Msec(60); func_801C8B40(arg0); switch (arg0->unk68) { - case 0x2A: + case LEO_ERROR_MEDIUM_NOT_PRESENT: func_801C92D4(); return 0; - case 0x22: + case LEO_ERROR_COMMAND_TERMINATED: func_801C92D4(); LeoClearQueue(); return 3; - case 0: + case LEO_ERROR_GOOD: func_801C92A0(6); FALLTHROUGH; - case 0x23: + case LEO_ERROR_QUEUE_FULL: var_s0 = 1; FALLTHROUGH; default: @@ -131,18 +129,18 @@ s32 func_801C948C(struct_801E1598* arg0) { s32 func_801C955C(struct_801E1598* arg0) { switch (arg0->unk68) { - case 34: + case LEO_ERROR_COMMAND_TERMINATED: func_801C9400(); LeoClearQueue(); return 3; - case 2: + case LEO_ERROR_DIAGNOSTIC_FAILURE: func_801C91B0(arg0->unk68); func_801C92A0(5); return 9; - case 0: + case LEO_ERROR_GOOD: func_801C9400(); return 0; - case 43: + case LEO_ERROR_POWERONRESET_DEVICERESET_OCCURED: if ((u8)arg0->unk65 == 0) { func_801C9400(); arg0->unk65 = 2; @@ -152,7 +150,7 @@ s32 func_801C955C(struct_801E1598* arg0) { default: func_801C9400(); return func_801C9430(arg0); - case 35: + case LEO_ERROR_QUEUE_FULL: return 9; } } @@ -163,11 +161,11 @@ s32 func_801C9630(struct_801E1598* arg0) { while (true) { func_801C8AF8(arg0); switch (arg0->unk68) { - case 0x31: + case LEO_ERROR_EJECTED_ILLEGALLY_RESUME: func_801C91B0(arg0->unk68); func_801C9228(2); return 5; - case 0x2A: + case LEO_ERROR_MEDIUM_NOT_PRESENT: func_801C9400(); return 5; default: @@ -188,13 +186,13 @@ s32 func_801C96E0(struct_801E1598* arg0) { Sleep_Msec(60); func_801C8AF8(arg0); switch (arg0->unk68) { - case 0x23: + case LEO_ERROR_QUEUE_FULL: continue; - case 0x31: + case LEO_ERROR_EJECTED_ILLEGALLY_RESUME: func_801C91B0(arg0->unk68); func_801C9228(2); FALLTHROUGH; - case 0x2A: + case LEO_ERROR_MEDIUM_NOT_PRESENT: func_801C92A0(4); continue; } @@ -306,7 +304,7 @@ s32 func_801C999C(struct_801E1598* arg0) { } s32 func_801C9A50(struct_801E1598* arg0) { - if (arg0->unk68 == 0x29) { + if (arg0->unk68 == LEO_ERROR_DEVICE_COMMUNICATION_FAILURE) { return func_801C9430(arg0); } if (osMemSize < 0x800000) { @@ -323,7 +321,7 @@ s32 func_801C9AD0(struct_801E1598* arg0) { s32 temp_v0; switch (arg0->unk68) { - case 23: + case LEO_ERROR_UNRECOVERED_READ_ERROR: func_801C8F9C(arg0); temp_v0 = func_801C948C(arg0); if (temp_v0 != 0) { @@ -331,20 +329,20 @@ s32 func_801C9AD0(struct_801E1598* arg0) { } func_801C9400(); return 2; - case 2: + case LEO_ERROR_DIAGNOSTIC_FAILURE: return func_801C97C8(arg0); - case 34: + case LEO_ERROR_COMMAND_TERMINATED: LeoClearQueue(); return 3; - case 49: + case LEO_ERROR_EJECTED_ILLEGALLY_RESUME: return func_801C9934(arg0); - case 47: + case LEO_ERROR_MEDIUM_MAY_HAVE_CHANGED: return func_801C9870(arg0); - case 42: + case LEO_ERROR_MEDIUM_NOT_PRESENT: return func_801C996C(arg0); - case 0: + case LEO_ERROR_GOOD: return 0; - case 35: + case LEO_ERROR_QUEUE_FULL: return 2; default: return func_801C9430(arg0); diff --git a/src/n64dd/n64dd_6.c b/src/n64dd/n64dd_6.c index 81bfe190b11..19a9bb2852f 100644 --- a/src/n64dd/n64dd_6.c +++ b/src/n64dd/n64dd_6.c @@ -1,6 +1,7 @@ #include "ultra64.h" #include "n64dd.h" #include "n64dd_internal.h" +#include "region.h" #include "z_locale.h" #pragma increment_block_number "" @@ -107,7 +108,7 @@ const char* D_801D3760[2][8][4] = { }, }, }; -UNK_TYPE1 D_801D3860[2][0x600] = { +u8 D_801D3860[2][0x600] = { { #include "assets/misc/n64dd/D_801D3860_0.bin.inc.c" }, @@ -115,12 +116,12 @@ UNK_TYPE1 D_801D3860[2][0x600] = { #include "assets/misc/n64dd/D_801D3860_1.bin.inc.c" }, }; -s8 D_801D4460[2][0x2800] = { +u8 D_801D4460[2][0x2800] = { { -#include "assets/misc/n64dd/D_801D3860_2.bin.inc.c" +#include "assets/misc/n64dd/D_801D4460_0.bin.inc.c" }, { -#include "assets/misc/n64dd/D_801D3860_3.bin.inc.c" +#include "assets/misc/n64dd/D_801D4460_1.bin.inc.c" }, }; @@ -161,7 +162,7 @@ s32 func_801CA3E0(s32 arg0) { } s32 func_801CA4B8(void) { - return gCurrentRegion == 1 ? 0 : 1; + return gCurrentRegion == REGION_JP ? 0 : 1; } void func_801CA4E4(u8* arg0, u8 arg1, s32 arg2) { @@ -206,7 +207,7 @@ void func_801CA628(void* arg0, s32 arg1) { const char* temp_v0; temp_v0 = func_801CA514(); - if (gCurrentRegion == 1) { + if (gCurrentRegion == REGION_JP) { func_801CA544((char*)(temp_v0 + 0xC), arg1); } else { func_801CA5C4((char*)(temp_v0 + 0xD), arg1); @@ -216,10 +217,11 @@ void func_801CA628(void* arg0, s32 arg1) { void* func_801CA698(s32 arg0) { func_801CA730(); - if (arg0 == 0x29) { + if (arg0 == LEO_ERROR_DEVICE_COMMUNICATION_FAILURE) { return D_801D3860[func_801CA4B8()]; } - if (((arg0 >= 0x25) && (arg0 < 0x29)) || (arg0 == 0x1F) || (arg0 == 0x20)) { + if (((arg0 >= LEO_ERROR_WAITING_NMI) && (arg0 < LEO_ERROR_DEVICE_COMMUNICATION_FAILURE)) || + (arg0 == LEO_ERROR_INVALID_COMMAND_OPERATION_CODE) || (arg0 == LEO_ERROR_LBA_OUT_OF_RANGE)) { return D_801E1800; } else { func_801CA628(D_801E1800, arg0); From fb746bcfe5cf67d619f17fa2b0fbf7ac48b99aa8 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 21:11:33 +0200 Subject: [PATCH 055/150] MemCopy: The memory regions must not overlap. --- src/code/z_memory_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/code/z_memory_utils.c b/src/code/z_memory_utils.c index 1941122b0d1..dd184d94a1e 100644 --- a/src/code/z_memory_utils.c +++ b/src/code/z_memory_utils.c @@ -3,6 +3,7 @@ /** * Copy `size` bytes from `src` to `dest`. + * The memory regions must not overlap. */ void* MemCopy(void* dest, void* src, s32 size) { u8* destu = (u8*)dest; From 1fe6576fff42460780f6c1ddd67652ec9ebb9aef Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 22:24:31 +0200 Subject: [PATCH 056/150] further vis docs --- include/vis.h | 6 ++++++ src/code/z_viscvg.c | 2 +- src/code/z_viszbuffer.c | 31 ++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/vis.h b/include/vis.h index 2fdd3a1ef38..3aa3691eca5 100644 --- a/include/vis.h +++ b/include/vis.h @@ -4,6 +4,12 @@ #include "ultra64.h" #include "color.h" +/** + * Meaning of color1 and color2: + * - VisCvg: see VisCvgType for color1. color2 unused + * - VisMono: LERP endpoints. See z_vismono.c file comment + * - VisZBuffer: LERP endpoints. See z_viszbuffer.c file comment + */ typedef struct VisParams { /* 0x00 */ u32 type; /* 0x04 */ u32 setScissor; diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index 34529a05d42..f86417c90b2 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -75,7 +75,7 @@ void VisCvg_Draw(VisCvg* this, Gfx** gfxp) { Gfx* gfx = *gfxp; gDPPipeSync(gfx++); - // Primitive depth and G_ZS_PRIM are set but this is useless since neither Z_CMD nor Z_UPD are set. + // Set full dz, see comment in PreRender_FetchFbufCoverage for details. gDPSetPrimDepth(gfx++, 0xFFFF, 0xFFFF); if (this->params.setScissor == true) { diff --git a/src/code/z_viszbuffer.c b/src/code/z_viszbuffer.c index 03f8f45eb56..e19f44f3845 100644 --- a/src/code/z_viszbuffer.c +++ b/src/code/z_viszbuffer.c @@ -1,11 +1,40 @@ /** * This file implements a framebuffer effect relying on the depth buffer (Z buffer). * It merely allows LERPing between two colors (from color2 to color1), using the Z buffer bytes (interpreted as either - * ia16 or rgba16) as the factor. + * ia16 or rgba16 depending on the type being 0 or not) as the factor. * * Z buffer values are two bytes each. They are floating point, which makes the effect not that interesting for an * actual application as that doesn't map well to be interpreted as ia16 or rgba16, though some discontinuous gradients * can be seen. + * + * The bit layout of Z buffer values is: + * 0bEEEM_MMMM_MMMM_MMDD + * Where E is the 3 exponent bits, M is the 11 mantissa bits, + * and D is 2 of the 4 dz value bits (the remaining two are stored in the "hidden" 9th bit of each byte). + * In 3D space, Z values increase from front (near plane) to back (far plane). + * + * Interpreted as ia16: + * 0bIIII_IIII_AAAA_AAAA + * The intensity channel takes its value from the exponent bits and the high mantissa bits, so it continuously increases + * from front to back. + * The alpha channel mostly takes its value from the lowest mantissa bits, so it increases from front to back but also + * rolls over frequently. + * This can be observed in-game by setting color1 to white and color2 to black. + * From front to back, the intensity gradient is a continuous increase. + * The alpha is ignored due to the render mode VisZBuffer uses. + * + * Interpreted as rgba16: + * 0bRRRR_RGGG_GGBB_BBBA + * The red channel mostly takes its value from the exponent bits, so it continuously increases from front to back. + * The green channel takes its value from the middle mantissa bits, so it increases from front to back but also rolls + * over frequently. + * The blue channel mostly takes its value from the lowest mantissa bits, so it increases from front to back and also + * rolls over even more frequently. + * This can be observed in-game by setting color1 to white and color2 to black. + * From front to back, the gradients for each color channel are then: + * - red: continuous increase + * - green: discontinuous succession of continuous increases + * - blue: like green but even higher frequency */ #include "ultra64.h" From 267311f2c39ffda7435d659aedcf7b944b42ab19 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 22:27:53 +0200 Subject: [PATCH 057/150] compress n64dd segment --- spec/spec | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/spec b/spec/spec index 028ef286041..26bbae7c18d 100644 --- a/spec/spec +++ b/spec/spec @@ -863,6 +863,7 @@ endseg #if PLATFORM_N64 beginseg name "n64dd" + compress align 0x40 include "$(BUILD_DIR)/src/n64dd/n64dd_0.o" include "$(BUILD_DIR)/src/n64dd/n64dd_1.o" From e8812e9238c1ef43822d7f97d968baf4e622541f Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 22:37:45 +0200 Subject: [PATCH 058/150] reorganize libleo files --- Makefile | 6 +- spec/spec | 80 +++++++++---------- src/{n64dd/libleo => libleo/api}/bytetolba.c | 0 .../api}/cacreateleomanager.c | 0 .../api}/cjcreateleomanager.c | 0 src/{n64dd/libleo => libleo/api}/clearqueue.c | 0 src/{n64dd/libleo => libleo/api}/driveexist.c | 0 src/{n64dd/libleo => libleo/api}/lbatobyte.c | 0 .../libleo => libleo/api}/leodiskinit.c | 0 src/{n64dd/libleo => libleo/api}/leoglobals.c | 0 .../libleo => libleo/api}/leointerrupt.c | 0 src/{n64dd/libleo => libleo/api}/readdiskid.c | 0 src/{n64dd/libleo => libleo/api}/readwrite.c | 0 src/{n64dd/libleo => libleo/api}/rezero.c | 0 src/{n64dd/libleo => libleo/api}/spdlmotor.c | 0 .../libleo => libleo/api}/testunitready.c | 0 src/{n64dd/libleo => libleo/leo}/getaadr.s | 0 src/{n64dd/libleo => libleo/leo}/getaadr2.s | 0 src/{n64dd/libleo => libleo/leo}/getkadr.s | 0 src/{n64dd/libleo => libleo/leo}/leo_tbl.c | 0 .../libleo => libleo/leo}/leoc2_syndrome.c | 0 src/{n64dd/libleo => libleo/leo}/leoc2ecc.c | 0 src/{n64dd/libleo => libleo/leo}/leocmdex.c | 0 src/{n64dd/libleo => libleo/leo}/leofunc.c | 0 src/{n64dd/libleo => libleo/leo}/leoinquiry.c | 0 src/{n64dd/libleo => libleo/leo}/leoint.c | 0 src/{n64dd/libleo => libleo/leo}/leomecha.c | 0 .../libleo => libleo/leo}/leomode_sel.c | 0 src/{n64dd/libleo => libleo/leo}/leomotor.c | 0 .../libleo => libleo/leo}/leomseq_tbl.c | 0 src/{n64dd/libleo => libleo/leo}/leoram.c | 0 src/{n64dd/libleo => libleo/leo}/leord_capa.c | 0 .../libleo => libleo/leo}/leord_diskid.c | 0 src/{n64dd/libleo => libleo/leo}/leoread.c | 0 src/{n64dd/libleo => libleo/leo}/leoreset.c | 0 src/{n64dd/libleo => libleo/leo}/leoseek.c | 0 .../libleo => libleo/leo}/leotempbuffer.c | 0 .../libleo => libleo/leo}/leotestunit.c | 0 src/{n64dd/libleo => libleo/leo}/leotimer.c | 0 .../libleo => libleo/leo}/leotranslat.c | 0 src/{n64dd/libleo => libleo/leo}/leoutil.c | 0 src/{n64dd/libleo => libleo/leo}/leowrite.c | 0 42 files changed, 43 insertions(+), 43 deletions(-) rename src/{n64dd/libleo => libleo/api}/bytetolba.c (100%) rename src/{n64dd/libleo => libleo/api}/cacreateleomanager.c (100%) rename src/{n64dd/libleo => libleo/api}/cjcreateleomanager.c (100%) rename src/{n64dd/libleo => libleo/api}/clearqueue.c (100%) rename src/{n64dd/libleo => libleo/api}/driveexist.c (100%) rename src/{n64dd/libleo => libleo/api}/lbatobyte.c (100%) rename src/{n64dd/libleo => libleo/api}/leodiskinit.c (100%) rename src/{n64dd/libleo => libleo/api}/leoglobals.c (100%) rename src/{n64dd/libleo => libleo/api}/leointerrupt.c (100%) rename src/{n64dd/libleo => libleo/api}/readdiskid.c (100%) rename src/{n64dd/libleo => libleo/api}/readwrite.c (100%) rename src/{n64dd/libleo => libleo/api}/rezero.c (100%) rename src/{n64dd/libleo => libleo/api}/spdlmotor.c (100%) rename src/{n64dd/libleo => libleo/api}/testunitready.c (100%) rename src/{n64dd/libleo => libleo/leo}/getaadr.s (100%) rename src/{n64dd/libleo => libleo/leo}/getaadr2.s (100%) rename src/{n64dd/libleo => libleo/leo}/getkadr.s (100%) rename src/{n64dd/libleo => libleo/leo}/leo_tbl.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoc2_syndrome.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoc2ecc.c (100%) rename src/{n64dd/libleo => libleo/leo}/leocmdex.c (100%) rename src/{n64dd/libleo => libleo/leo}/leofunc.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoinquiry.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoint.c (100%) rename src/{n64dd/libleo => libleo/leo}/leomecha.c (100%) rename src/{n64dd/libleo => libleo/leo}/leomode_sel.c (100%) rename src/{n64dd/libleo => libleo/leo}/leomotor.c (100%) rename src/{n64dd/libleo => libleo/leo}/leomseq_tbl.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoram.c (100%) rename src/{n64dd/libleo => libleo/leo}/leord_capa.c (100%) rename src/{n64dd/libleo => libleo/leo}/leord_diskid.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoread.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoreset.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoseek.c (100%) rename src/{n64dd/libleo => libleo/leo}/leotempbuffer.c (100%) rename src/{n64dd/libleo => libleo/leo}/leotestunit.c (100%) rename src/{n64dd/libleo => libleo/leo}/leotimer.c (100%) rename src/{n64dd/libleo => libleo/leo}/leotranslat.c (100%) rename src/{n64dd/libleo => libleo/leo}/leoutil.c (100%) rename src/{n64dd/libleo => libleo/leo}/leowrite.c (100%) diff --git a/Makefile b/Makefile index b3c0ab1e95c..fd9f24553a1 100644 --- a/Makefile +++ b/Makefile @@ -740,7 +740,7 @@ $(BUILD_DIR)/src/libultra/os/exceptasm.o: POSTPROCESS_OBJ := $(PYTHON) tools/set endif $(BUILD_DIR)/src/code/%.o: ASOPTFLAGS := -O2 -$(BUILD_DIR)/src/n64dd/libleo/%.o: ASOPTFLAGS := -O2 +$(BUILD_DIR)/src/libleo/%.o: ASOPTFLAGS := -O2 $(BUILD_DIR)/src/libultra/libc/%.o: ASOPTFLAGS := -O2 $(BUILD_DIR)/src/libultra/mgu/%.o: ASOPTFLAGS := -O2 @@ -790,8 +790,8 @@ $(BUILD_DIR)/src/libultra/os/%.o: OPTFLAGS := -O1 endif endif -$(BUILD_DIR)/src/n64dd/libleo/%.o: CC := $(CC_OLD) -$(BUILD_DIR)/src/n64dd/libleo/%.o: OPTFLAGS := -O2 +$(BUILD_DIR)/src/libleo/%.o: CC := $(CC_OLD) +$(BUILD_DIR)/src/libleo/%.o: OPTFLAGS := -O2 ifeq ($(PLATFORM),IQUE) $(BUILD_DIR)/src/libgcc/%.o: CC := $(EGCS_CC) diff --git a/spec/spec b/spec/spec index 26bbae7c18d..53b8a86e075 100644 --- a/spec/spec +++ b/spec/spec @@ -873,46 +873,46 @@ beginseg include "$(BUILD_DIR)/src/n64dd/n64dd_5.o" include "$(BUILD_DIR)/src/n64dd/n64dd_6.o" include "$(BUILD_DIR)/src/n64dd/n64dd_7.o" - include "$(BUILD_DIR)/src/n64dd/libleo/readwrite.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leofunc.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoram.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoint.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leocmdex.o" - include "$(BUILD_DIR)/src/n64dd/libleo/getaadr2.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoread.o" - include "$(BUILD_DIR)/src/n64dd/libleo/lbatobyte.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoinquiry.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leodiskinit.o" - include "$(BUILD_DIR)/src/n64dd/libleo/readdiskid.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leord_diskid.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leomecha.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leotempbuffer.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoc2_syndrome.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leo_tbl.o" - include "$(BUILD_DIR)/src/n64dd/libleo/spdlmotor.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoc2ecc.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leomseq_tbl.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoglobals.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leomotor.o" - include "$(BUILD_DIR)/src/n64dd/libleo/driveexist.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leomode_sel.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leord_capa.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoutil.o" - include "$(BUILD_DIR)/src/n64dd/libleo/rezero.o" - include "$(BUILD_DIR)/src/n64dd/libleo/clearqueue.o" - include "$(BUILD_DIR)/src/n64dd/libleo/bytetolba.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoreset.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leotranslat.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leotimer.o" - include "$(BUILD_DIR)/src/n64dd/libleo/getkadr.o" - include "$(BUILD_DIR)/src/n64dd/libleo/getaadr.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leowrite.o" - include "$(BUILD_DIR)/src/n64dd/libleo/cjcreateleomanager.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leointerrupt.o" - include "$(BUILD_DIR)/src/n64dd/libleo/cacreateleomanager.o" - include "$(BUILD_DIR)/src/n64dd/libleo/testunitready.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leotestunit.o" - include "$(BUILD_DIR)/src/n64dd/libleo/leoseek.o" + include "$(BUILD_DIR)/src/libleo/api/readwrite.o" + include "$(BUILD_DIR)/src/libleo/leo/leofunc.o" + include "$(BUILD_DIR)/src/libleo/leo/leoram.o" + include "$(BUILD_DIR)/src/libleo/leo/leoint.o" + include "$(BUILD_DIR)/src/libleo/leo/leocmdex.o" + include "$(BUILD_DIR)/src/libleo/leo/getaadr2.o" + include "$(BUILD_DIR)/src/libleo/leo/leoread.o" + include "$(BUILD_DIR)/src/libleo/api/lbatobyte.o" + include "$(BUILD_DIR)/src/libleo/leo/leoinquiry.o" + include "$(BUILD_DIR)/src/libleo/api/leodiskinit.o" + include "$(BUILD_DIR)/src/libleo/api/readdiskid.o" + include "$(BUILD_DIR)/src/libleo/leo/leord_diskid.o" + include "$(BUILD_DIR)/src/libleo/leo/leomecha.o" + include "$(BUILD_DIR)/src/libleo/leo/leotempbuffer.o" + include "$(BUILD_DIR)/src/libleo/leo/leoc2_syndrome.o" + include "$(BUILD_DIR)/src/libleo/leo/leo_tbl.o" + include "$(BUILD_DIR)/src/libleo/api/spdlmotor.o" + include "$(BUILD_DIR)/src/libleo/leo/leoc2ecc.o" + include "$(BUILD_DIR)/src/libleo/leo/leomseq_tbl.o" + include "$(BUILD_DIR)/src/libleo/api/leoglobals.o" + include "$(BUILD_DIR)/src/libleo/leo/leomotor.o" + include "$(BUILD_DIR)/src/libleo/api/driveexist.o" + include "$(BUILD_DIR)/src/libleo/leo/leomode_sel.o" + include "$(BUILD_DIR)/src/libleo/leo/leord_capa.o" + include "$(BUILD_DIR)/src/libleo/leo/leoutil.o" + include "$(BUILD_DIR)/src/libleo/api/rezero.o" + include "$(BUILD_DIR)/src/libleo/api/clearqueue.o" + include "$(BUILD_DIR)/src/libleo/api/bytetolba.o" + include "$(BUILD_DIR)/src/libleo/leo/leoreset.o" + include "$(BUILD_DIR)/src/libleo/leo/leotranslat.o" + include "$(BUILD_DIR)/src/libleo/leo/leotimer.o" + include "$(BUILD_DIR)/src/libleo/leo/getkadr.o" + include "$(BUILD_DIR)/src/libleo/leo/getaadr.o" + include "$(BUILD_DIR)/src/libleo/leo/leowrite.o" + include "$(BUILD_DIR)/src/libleo/api/cjcreateleomanager.o" + include "$(BUILD_DIR)/src/libleo/api/leointerrupt.o" + include "$(BUILD_DIR)/src/libleo/api/cacreateleomanager.o" + include "$(BUILD_DIR)/src/libleo/api/testunitready.o" + include "$(BUILD_DIR)/src/libleo/leo/leotestunit.o" + include "$(BUILD_DIR)/src/libleo/leo/leoseek.o" endseg #endif diff --git a/src/n64dd/libleo/bytetolba.c b/src/libleo/api/bytetolba.c similarity index 100% rename from src/n64dd/libleo/bytetolba.c rename to src/libleo/api/bytetolba.c diff --git a/src/n64dd/libleo/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c similarity index 100% rename from src/n64dd/libleo/cacreateleomanager.c rename to src/libleo/api/cacreateleomanager.c diff --git a/src/n64dd/libleo/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c similarity index 100% rename from src/n64dd/libleo/cjcreateleomanager.c rename to src/libleo/api/cjcreateleomanager.c diff --git a/src/n64dd/libleo/clearqueue.c b/src/libleo/api/clearqueue.c similarity index 100% rename from src/n64dd/libleo/clearqueue.c rename to src/libleo/api/clearqueue.c diff --git a/src/n64dd/libleo/driveexist.c b/src/libleo/api/driveexist.c similarity index 100% rename from src/n64dd/libleo/driveexist.c rename to src/libleo/api/driveexist.c diff --git a/src/n64dd/libleo/lbatobyte.c b/src/libleo/api/lbatobyte.c similarity index 100% rename from src/n64dd/libleo/lbatobyte.c rename to src/libleo/api/lbatobyte.c diff --git a/src/n64dd/libleo/leodiskinit.c b/src/libleo/api/leodiskinit.c similarity index 100% rename from src/n64dd/libleo/leodiskinit.c rename to src/libleo/api/leodiskinit.c diff --git a/src/n64dd/libleo/leoglobals.c b/src/libleo/api/leoglobals.c similarity index 100% rename from src/n64dd/libleo/leoglobals.c rename to src/libleo/api/leoglobals.c diff --git a/src/n64dd/libleo/leointerrupt.c b/src/libleo/api/leointerrupt.c similarity index 100% rename from src/n64dd/libleo/leointerrupt.c rename to src/libleo/api/leointerrupt.c diff --git a/src/n64dd/libleo/readdiskid.c b/src/libleo/api/readdiskid.c similarity index 100% rename from src/n64dd/libleo/readdiskid.c rename to src/libleo/api/readdiskid.c diff --git a/src/n64dd/libleo/readwrite.c b/src/libleo/api/readwrite.c similarity index 100% rename from src/n64dd/libleo/readwrite.c rename to src/libleo/api/readwrite.c diff --git a/src/n64dd/libleo/rezero.c b/src/libleo/api/rezero.c similarity index 100% rename from src/n64dd/libleo/rezero.c rename to src/libleo/api/rezero.c diff --git a/src/n64dd/libleo/spdlmotor.c b/src/libleo/api/spdlmotor.c similarity index 100% rename from src/n64dd/libleo/spdlmotor.c rename to src/libleo/api/spdlmotor.c diff --git a/src/n64dd/libleo/testunitready.c b/src/libleo/api/testunitready.c similarity index 100% rename from src/n64dd/libleo/testunitready.c rename to src/libleo/api/testunitready.c diff --git a/src/n64dd/libleo/getaadr.s b/src/libleo/leo/getaadr.s similarity index 100% rename from src/n64dd/libleo/getaadr.s rename to src/libleo/leo/getaadr.s diff --git a/src/n64dd/libleo/getaadr2.s b/src/libleo/leo/getaadr2.s similarity index 100% rename from src/n64dd/libleo/getaadr2.s rename to src/libleo/leo/getaadr2.s diff --git a/src/n64dd/libleo/getkadr.s b/src/libleo/leo/getkadr.s similarity index 100% rename from src/n64dd/libleo/getkadr.s rename to src/libleo/leo/getkadr.s diff --git a/src/n64dd/libleo/leo_tbl.c b/src/libleo/leo/leo_tbl.c similarity index 100% rename from src/n64dd/libleo/leo_tbl.c rename to src/libleo/leo/leo_tbl.c diff --git a/src/n64dd/libleo/leoc2_syndrome.c b/src/libleo/leo/leoc2_syndrome.c similarity index 100% rename from src/n64dd/libleo/leoc2_syndrome.c rename to src/libleo/leo/leoc2_syndrome.c diff --git a/src/n64dd/libleo/leoc2ecc.c b/src/libleo/leo/leoc2ecc.c similarity index 100% rename from src/n64dd/libleo/leoc2ecc.c rename to src/libleo/leo/leoc2ecc.c diff --git a/src/n64dd/libleo/leocmdex.c b/src/libleo/leo/leocmdex.c similarity index 100% rename from src/n64dd/libleo/leocmdex.c rename to src/libleo/leo/leocmdex.c diff --git a/src/n64dd/libleo/leofunc.c b/src/libleo/leo/leofunc.c similarity index 100% rename from src/n64dd/libleo/leofunc.c rename to src/libleo/leo/leofunc.c diff --git a/src/n64dd/libleo/leoinquiry.c b/src/libleo/leo/leoinquiry.c similarity index 100% rename from src/n64dd/libleo/leoinquiry.c rename to src/libleo/leo/leoinquiry.c diff --git a/src/n64dd/libleo/leoint.c b/src/libleo/leo/leoint.c similarity index 100% rename from src/n64dd/libleo/leoint.c rename to src/libleo/leo/leoint.c diff --git a/src/n64dd/libleo/leomecha.c b/src/libleo/leo/leomecha.c similarity index 100% rename from src/n64dd/libleo/leomecha.c rename to src/libleo/leo/leomecha.c diff --git a/src/n64dd/libleo/leomode_sel.c b/src/libleo/leo/leomode_sel.c similarity index 100% rename from src/n64dd/libleo/leomode_sel.c rename to src/libleo/leo/leomode_sel.c diff --git a/src/n64dd/libleo/leomotor.c b/src/libleo/leo/leomotor.c similarity index 100% rename from src/n64dd/libleo/leomotor.c rename to src/libleo/leo/leomotor.c diff --git a/src/n64dd/libleo/leomseq_tbl.c b/src/libleo/leo/leomseq_tbl.c similarity index 100% rename from src/n64dd/libleo/leomseq_tbl.c rename to src/libleo/leo/leomseq_tbl.c diff --git a/src/n64dd/libleo/leoram.c b/src/libleo/leo/leoram.c similarity index 100% rename from src/n64dd/libleo/leoram.c rename to src/libleo/leo/leoram.c diff --git a/src/n64dd/libleo/leord_capa.c b/src/libleo/leo/leord_capa.c similarity index 100% rename from src/n64dd/libleo/leord_capa.c rename to src/libleo/leo/leord_capa.c diff --git a/src/n64dd/libleo/leord_diskid.c b/src/libleo/leo/leord_diskid.c similarity index 100% rename from src/n64dd/libleo/leord_diskid.c rename to src/libleo/leo/leord_diskid.c diff --git a/src/n64dd/libleo/leoread.c b/src/libleo/leo/leoread.c similarity index 100% rename from src/n64dd/libleo/leoread.c rename to src/libleo/leo/leoread.c diff --git a/src/n64dd/libleo/leoreset.c b/src/libleo/leo/leoreset.c similarity index 100% rename from src/n64dd/libleo/leoreset.c rename to src/libleo/leo/leoreset.c diff --git a/src/n64dd/libleo/leoseek.c b/src/libleo/leo/leoseek.c similarity index 100% rename from src/n64dd/libleo/leoseek.c rename to src/libleo/leo/leoseek.c diff --git a/src/n64dd/libleo/leotempbuffer.c b/src/libleo/leo/leotempbuffer.c similarity index 100% rename from src/n64dd/libleo/leotempbuffer.c rename to src/libleo/leo/leotempbuffer.c diff --git a/src/n64dd/libleo/leotestunit.c b/src/libleo/leo/leotestunit.c similarity index 100% rename from src/n64dd/libleo/leotestunit.c rename to src/libleo/leo/leotestunit.c diff --git a/src/n64dd/libleo/leotimer.c b/src/libleo/leo/leotimer.c similarity index 100% rename from src/n64dd/libleo/leotimer.c rename to src/libleo/leo/leotimer.c diff --git a/src/n64dd/libleo/leotranslat.c b/src/libleo/leo/leotranslat.c similarity index 100% rename from src/n64dd/libleo/leotranslat.c rename to src/libleo/leo/leotranslat.c diff --git a/src/n64dd/libleo/leoutil.c b/src/libleo/leo/leoutil.c similarity index 100% rename from src/n64dd/libleo/leoutil.c rename to src/libleo/leo/leoutil.c diff --git a/src/n64dd/libleo/leowrite.c b/src/libleo/leo/leowrite.c similarity index 100% rename from src/n64dd/libleo/leowrite.c rename to src/libleo/leo/leowrite.c From d8d47a233820c3a7cd9e6330783c30d0c2b7e29c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 22:47:18 +0200 Subject: [PATCH 059/150] cleanup version checks --- src/n64dd/n64dd_0.c | 14 +++++++------- src/n64dd/n64dd_2.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/n64dd/n64dd_0.c b/src/n64dd/n64dd_0.c index d1e41766c90..164a41305db 100644 --- a/src/n64dd/n64dd_0.c +++ b/src/n64dd/n64dd_0.c @@ -115,7 +115,7 @@ s32 func_801C7958(void) { s32 sp1C; s32 (*p)(struct_801DA5D0*); -#if OOT_VERSION <= NTSC_1_1 +#if OOT_VERSION < PAL_1_0 if (1) {} #endif @@ -174,7 +174,7 @@ void func_801C79DC(void* arg) { LEODiskID D_801DC850; s32 D_801DC870; -#if OOT_VERSION > NTSC_1_0 +#if OOT_VERSION >= NTSC_1_1 void func_801C7B28(void) { s32 temp_v1_2; @@ -257,7 +257,7 @@ void func_801C7CEC(s32 arg0, s32 arg1, s32 arg2) { if (arg2 != 0) { func_801CAA60(BADCASTP arg2, 0, 0xB0, 0x140, 0x20, 0xB, BADCASTP sp2C, 0x140); } -#if OOT_VERSION <= NTSC_1_1 +#if OOT_VERSION < PAL_1_0 osViBlack(0); #endif } @@ -290,7 +290,7 @@ s32 func_801C7658(void) { if (D_80121212 != 0) { return 0; } -#if OOT_VERSION <= NTSC_1_1 +#if OOT_VERSION < PAL_1_0 StackCheck_Init(&D_801DB808, D_801DA808, STACK_TOP(D_801DA808), 0, 0x100, "ddmsg"); osCreateThread(&D_801DA658, 9, func_801C79DC, &D_801DA410, STACK_TOP(D_801DA808), 0xD); osStartThread(&D_801DA658); @@ -314,7 +314,7 @@ s32 func_801C7658(void) { (&func_801C8860)(&D_801DA5D0); D_801DA5D0.unk0 = 0xD; (&func_801C8860)(&D_801DA5D0); -#if OOT_VERSION > NTSC_1_1 +#if OOT_VERSION >= PAL_1_0 StackCheck_Init(&D_801DB808, D_801DA808, STACK_TOP(D_801DA808), 0, 0x100, "ddmsg"); osCreateThread(&D_801DA658, 9, func_801C79DC, &D_801DA410, STACK_TOP(D_801DA808), 0xD); osStartThread(&D_801DA658); @@ -325,7 +325,7 @@ s32 func_801C7658(void) { s32 func_801C7818(void) { s32 (*p)(struct_801DA5D0*) = func_801C8860; -#if OOT_VERSION > NTSC_1_0 +#if OOT_VERSION >= NTSC_1_1 D_801DA638 = 1; D_801DA640 = 0; #endif @@ -334,7 +334,7 @@ s32 func_801C7818(void) { while (func_801C8A24() == 0) { Sleep_Usec(1000000 / 60); } -#if OOT_VERSION > NTSC_1_0 +#if OOT_VERSION >= NTSC_1_1 if ((D_801D3728 == 1) || (D_801E17E0 == 1) || (D_801E17E4 == 1)) { D_801DA640 = osGetTime(); } diff --git a/src/n64dd/n64dd_2.c b/src/n64dd/n64dd_2.c index 8e8085d082c..823cc3d050a 100644 --- a/src/n64dd/n64dd_2.c +++ b/src/n64dd/n64dd_2.c @@ -296,7 +296,7 @@ s32 func_801C90A4(void) { s32 func_801C90BC(void) { D_801E1598.unk64 = 3; func_801C8E50(&D_801E1598, 1); -#if OOT_VERSION > NTSC_1_0 +#if OOT_VERSION >= NTSC_1_1 D_801D3710 = 0; #endif if ((D_801E1598.unk6C == 3) || (D_801E1598.unk6C == 4)) { @@ -309,7 +309,7 @@ s32 func_801C90BC(void) { s32 func_801C9114(void) { D_801E1598.unk64 = 4; func_801C8E50(&D_801E1598, 1); -#if OOT_VERSION > NTSC_1_0 +#if OOT_VERSION >= NTSC_1_1 D_801D3710 = 0; #endif if ((D_801E1598.unk6C == 3) || (D_801E1598.unk6C == 4)) { From 8900fd2e447cd20d9a319c0b866213f139890a5c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 23:01:52 +0200 Subject: [PATCH 060/150] n64dd cleanup --- include/n64dd.h | 2 +- include/n64dd_internal.h | 2 + src/n64dd/n64dd_0.c | 14 +++---- src/n64dd/n64dd_3.c | 3 -- src/n64dd/n64dd_7.c | 87 +++++++++++++++++++--------------------- 5 files changed, 52 insertions(+), 56 deletions(-) diff --git a/include/n64dd.h b/include/n64dd.h index 181366013d3..8b699694d1e 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -81,7 +81,7 @@ s32 func_801C70FC(void); void func_801C7268(void); s32 func_801C7658(void); s32 func_801C7818(void); -void func_801C7C1C(void* arg0, s32 arg1, s32 arg2); +void func_801C7C1C(void* dest, s32 offset, s32 size); void func_801C7E78(void); void n64dd_SetDiskVersion(s32 arg0); diff --git a/include/n64dd_internal.h b/include/n64dd_internal.h index 78ae5c36c5b..015c46085b8 100644 --- a/include/n64dd_internal.h +++ b/include/n64dd_internal.h @@ -99,4 +99,6 @@ void func_801C9D68(char*, u16); extern u8 gN64DDDiskReadTemporaryBuffer[]; +extern struct_801E1590 D_801E1590; + #endif diff --git a/src/n64dd/n64dd_0.c b/src/n64dd/n64dd_0.c index 164a41305db..750bc86db1f 100644 --- a/src/n64dd/n64dd_0.c +++ b/src/n64dd/n64dd_0.c @@ -454,7 +454,7 @@ s32 func_801C84E0(s32 arg0) { } } -void func_801C7C1C(void* arg0, s32 arg1, s32 arg2) { +void func_801C7C1C(void* dest, s32 offset, s32 size) { s32 sp44; s32 sp40; s32 sp3C; @@ -468,16 +468,16 @@ void func_801C7C1C(void* arg0, s32 arg1, s32 arg2) { func_801C77F0(); D_801DA638 = 1; D_801DA640 = 0; - func_801C843C(arg1, &sp44, &sp3C); - func_801C843C(arg1 + arg2, &sp40, &sp38); + func_801C843C(offset, &sp44, &sp3C); + func_801C843C(offset + size, &sp40, &sp38); sp34 = D_801D36D0; if (sp44 == sp40) { func_801C8214(sp44, sp34, func_801C84E0(sp44)); - bcopy((u8*)sp34 + sp3C, arg0, arg2); + bcopy((u8*)sp34 + sp3C, dest, size); } else { var_s1 = 0; func_801C8214(sp44, sp34, func_801C84E0(sp44)); - bcopy((u8*)sp34 + sp3C, arg0, func_801C84E0(sp44) - sp3C); + bcopy((u8*)sp34 + sp3C, dest, func_801C84E0(sp44) - sp3C); temp_v0 = sp44 + 1; if (temp_v0 < sp40) { var_s0 = temp_v0; @@ -485,11 +485,11 @@ void func_801C7C1C(void* arg0, s32 arg1, s32 arg2) { var_s1 += func_801C84E0(var_s0); var_s0 += 1; } - func_801C8214(sp44 + 1, (void*)((func_801C84E0(sp44) + (s32)arg0) - sp3C), var_s1); + func_801C8214(sp44 + 1, (void*)((func_801C84E0(sp44) + (s32)dest) - sp3C), var_s1); } if (sp38 > 0) { func_801C8214(sp40, sp34, func_801C84E0(sp40)); - bcopy(sp34, (void*)(((func_801C84E0(sp44) + (s32)arg0) - sp3C) + var_s1), sp38); + bcopy(sp34, (void*)(((func_801C84E0(sp44) + (s32)dest) - sp3C) + var_s1), sp38); } } #if OOT_VERSION == NTSC_1_0 diff --git a/src/n64dd/n64dd_3.c b/src/n64dd/n64dd_3.c index c64ad25147a..11d90ae39c5 100644 --- a/src/n64dd/n64dd_3.c +++ b/src/n64dd/n64dd_3.c @@ -4,9 +4,6 @@ #include "libc64/sleep.h" #include "attributes.h" -// TODO move to a header once we can easily fix bss orderings -extern struct_801E1590 D_801E1590; - s32 D_801D3720 = 0; void* D_801D3724 = NULL; s32 D_801D3728 = 0; diff --git a/src/n64dd/n64dd_7.c b/src/n64dd/n64dd_7.c index 4cfc4dd1ace..1b3eb94783f 100644 --- a/src/n64dd/n64dd_7.c +++ b/src/n64dd/n64dd_7.c @@ -1,27 +1,24 @@ +/** + * Some sort of GfxPrint like utility? + */ + #include "ultra64.h" #include "n64dd.h" #include "n64dd_internal.h" #include "libc64/aprintf.h" #include "attributes.h" +#include "color.h" typedef struct struct_801CAF10 { - /* 0x00 */ struct struct_801CAF10* (*unk0)(struct struct_801CAF10*, u8*, s32); + /* 0x00 */ PrintCallback callback; /* 0x04 */ u8* unk4; /* 0x08 */ u16 unk8; - /* 0x0A */ u16 unkA; - /* 0x0C */ u16 unkC; + /* 0x0A */ u16 posX; + /* 0x0C */ u16 posY; /* 0x0E */ char padE[2]; - /* 0x10 */ union { - s32 unk10w; - struct { - s8 unk10; - s8 unk11; - s8 unk12; - s8 unk13; - }; - }; - /* 0x14 */ u16 unk14; - /* 0x16 */ u16 unk16; + /* 0x10 */ Color_RGBA8_u32 color; + /* 0x14 */ u16 baseX; + /* 0x16 */ u16 baseY; /* 0x18 */ u16 unk18; /* 0x1A */ u16 unk1A; /* 0x1C */ u8 unk1C; @@ -29,7 +26,7 @@ typedef struct struct_801CAF10 { /* 0x20 */ s16* unk20; /* 0x24 */ u16 unk24; /* 0x26 */ u16 unk26; -} struct_801CAF10; /* size >= 0x28 */ +} struct_801CAF10; /* size = 0x28 */ u32 D_801D9460[0x5F] = { 0x9D14, 0x232A14, 0x296314, 0x2F8A14, 0x457E18, 0x63CA14, 0x84AA14, 0xA03314, 0xA45E14, @@ -104,20 +101,20 @@ void func_801CAA60(u8* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s } void func_801CAB68(struct_801CAF10* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { - arg0->unk10 = arg1; - arg0->unk11 = arg2; - arg0->unk12 = arg3; - arg0->unk13 = arg4; + arg0->color.r = arg1; + arg0->color.g = arg2; + arg0->color.b = arg3; + arg0->color.a = arg4; } void func_801CAB84(struct_801CAF10* arg0, s32 arg1, s32 arg2) { - arg0->unkA = (s16)(arg0->unk14 + arg1); - arg0->unkC = (s16)(arg0->unk16 + arg2); + arg0->posX = (s16)(arg0->baseX + arg1); + arg0->posY = (s16)(arg0->baseY + arg2); } void func_801CABA4(struct_801CAF10* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { - arg0->unk14 = (u16)arg1; - arg0->unk16 = (u16)arg2; + arg0->baseX = (u16)arg1; + arg0->baseY = (u16)arg2; arg0->unk18 = (u16)arg3; arg0->unk1A = (u16)arg4; } @@ -152,21 +149,21 @@ void func_801CAC3C(struct_801CAF10* arg0, u8 arg1) { } arg0->unk1C = 0; if (func_801CA920(var_a0, arg0->unk4, &sp48, &sp44, &sp40) == 0) { - if ((s32)arg0->unk18 < (arg0->unkA + sp48)) { - arg0->unkA = arg0->unk14; - if ((s32)arg0->unk1A < arg0->unkC + 0x10) { - arg0->unkC = arg0->unk16; + if ((s32)arg0->unk18 < (arg0->posX + sp48)) { + arg0->posX = arg0->baseX; + if ((s32)arg0->unk1A < arg0->posY + 0x10) { + arg0->posY = arg0->baseY; } else { - arg0->unkC = arg0->unkC + 0x10; + arg0->posY = arg0->posY + 0x10; } } - func_801CAA60(arg0->unk4, arg0->unkA, arg0->unkC, sp48, sp44, sp40, arg0->unk20, (s32)arg0->unk24); + func_801CAA60(arg0->unk4, arg0->posX, arg0->posY, sp48, sp44, sp40, arg0->unk20, (s32)arg0->unk24); if (sp48 == 0x10) { var_v0 = sp48; } else { var_v0 = sp48 + 2; } - arg0->unkA += var_v0; + arg0->posX += var_v0; } } @@ -178,22 +175,22 @@ void func_801CAD64(struct_801CAF10* arg0, u8 arg1) { case 0: break; case 0xA: - arg0->unkC += 0x20; + arg0->posY += 0x20; FALLTHROUGH; case 0xD: - arg0->unkA = arg0->unk14; + arg0->posX = arg0->baseX; break; case 9: do { func_801CAC3C(arg0, 0x20); - } while ((arg0->unkA - arg0->unk14) % 256); + } while ((arg0->posX - arg0->baseX) % 256); break; } } } -void func_801CAE2C(struct_801CAF10* arg0, u8* arg1, s32 arg2, s32 arg3) { - u8* var_s0; +void func_801CAE2C(struct_801CAF10* arg0, const char* arg1, s32 arg2, size_t arg3) { + const char* var_s0; s32 var_s1; var_s0 = arg1; @@ -208,20 +205,20 @@ void func_801CAE88(struct_801CAF10* arg0, u8* arg1) { } } -struct_801CAF10* func_801CAEE0(struct_801CAF10* arg0, u8* arg1, s32 arg2) { +void* func_801CAEE0(void* arg0, const char* arg1, size_t arg2) { func_801CAE2C(arg0, arg1, 1, arg2); return arg0; } void func_801CAF10(struct_801CAF10* arg0) { - arg0->unk0 = func_801CAEE0; - arg0->unkA = 0; - arg0->unkC = 0; - arg0->unk14 = 0; - arg0->unk16 = 0; + arg0->callback = func_801CAEE0; + arg0->posX = 0; + arg0->posY = 0; + arg0->baseX = 0; + arg0->baseY = 0; arg0->unk18 = 0; arg0->unk1A = 0; - arg0->unk10w = 0; + arg0->color.rgba = 0; arg0->unk1C = 0; arg0->unk4 = 0; } @@ -229,11 +226,11 @@ void func_801CAF10(struct_801CAF10* arg0) { void func_801CAF48(struct_801CAF10* arg0) { } -void func_801CAF54(PrintCallback* arg0, const char* arg1, va_list arg2) { - PrintUtils_VPrintf(arg0, arg1, arg2); +void func_801CAF54(struct_801CAF10* arg0, const char* arg1, va_list arg2) { + PrintUtils_VPrintf(&arg0->callback, arg1, arg2); } -void func_801CAF74(PrintCallback* arg0, const char* arg1, ...) { +void func_801CAF74(struct_801CAF10* arg0, const char* arg1, ...) { va_list varargs; va_start(varargs, arg1); From fcf68f8cbffb8065b38fb926a5343d44ccb1f315 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 1 Aug 2026 23:11:43 +0200 Subject: [PATCH 061/150] n64dd_error_textures.xml --- assets/xml/misc/n64dd.xml | 8 -------- assets/xml/misc/n64dd_error_textures.xml | 8 ++++++++ baseroms/ntsc-1.0/config.yml | 4 ++-- baseroms/ntsc-1.1/config.yml | 4 ++-- baseroms/ntsc-1.2/config.yml | 4 ++-- baseroms/pal-1.0/config.yml | 4 ++-- baseroms/pal-1.1/config.yml | 4 ++-- src/n64dd/n64dd_6.c | 13 +++++++------ 8 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 assets/xml/misc/n64dd.xml create mode 100644 assets/xml/misc/n64dd_error_textures.xml diff --git a/assets/xml/misc/n64dd.xml b/assets/xml/misc/n64dd.xml deleted file mode 100644 index a1dd4f98a26..00000000000 --- a/assets/xml/misc/n64dd.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/assets/xml/misc/n64dd_error_textures.xml b/assets/xml/misc/n64dd_error_textures.xml new file mode 100644 index 00000000000..82b997cb26a --- /dev/null +++ b/assets/xml/misc/n64dd_error_textures.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/baseroms/ntsc-1.0/config.yml b/baseroms/ntsc-1.0/config.yml index 1056ad38a2e..f55ef8b46d4 100644 --- a/baseroms/ntsc-1.0/config.yml +++ b/baseroms/ntsc-1.0/config.yml @@ -67,8 +67,8 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB600 end_offset: 0xEC088 -- name: misc/n64dd - xml_path: assets/xml/misc/n64dd.xml +- name: misc/n64dd_error_textures + xml_path: assets/xml/misc/n64dd_error_textures.xml start_offset: 0xC160 end_offset: 0x11D60 - name: misc/link_animetion diff --git a/baseroms/ntsc-1.1/config.yml b/baseroms/ntsc-1.1/config.yml index 41d8ff909e1..e18ac07d3ed 100644 --- a/baseroms/ntsc-1.1/config.yml +++ b/baseroms/ntsc-1.1/config.yml @@ -67,8 +67,8 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB7C0 end_offset: 0xEC248 -- name: misc/n64dd - xml_path: assets/xml/misc/n64dd.xml +- name: misc/n64dd_error_textures + xml_path: assets/xml/misc/n64dd_error_textures.xml start_offset: 0xC140 end_offset: 0x11D40 - name: misc/link_animetion diff --git a/baseroms/ntsc-1.2/config.yml b/baseroms/ntsc-1.2/config.yml index e54d92cfaec..7db790b9f93 100644 --- a/baseroms/ntsc-1.2/config.yml +++ b/baseroms/ntsc-1.2/config.yml @@ -67,8 +67,8 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xEB610 end_offset: 0xEC098 -- name: misc/n64dd - xml_path: assets/xml/misc/n64dd.xml +- name: misc/n64dd_error_textures + xml_path: assets/xml/misc/n64dd_error_textures.xml start_offset: 0xC120 end_offset: 0x11D20 - name: misc/link_animetion diff --git a/baseroms/pal-1.0/config.yml b/baseroms/pal-1.0/config.yml index 6f222188038..c7522d5c742 100644 --- a/baseroms/pal-1.0/config.yml +++ b/baseroms/pal-1.0/config.yml @@ -73,8 +73,8 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F20 end_offset: 0xE99A8 -- name: misc/n64dd - xml_path: assets/xml/misc/n64dd.xml +- name: misc/n64dd_error_textures + xml_path: assets/xml/misc/n64dd_error_textures.xml start_offset: 0xC0E0 end_offset: 0x11CE0 - name: misc/link_animetion diff --git a/baseroms/pal-1.1/config.yml b/baseroms/pal-1.1/config.yml index d432dc8bd55..9c368020da5 100644 --- a/baseroms/pal-1.1/config.yml +++ b/baseroms/pal-1.1/config.yml @@ -73,8 +73,8 @@ assets: xml_path: assets/xml/code/fbdemo_wipe1.xml start_offset: 0xE8F60 end_offset: 0xE99E8 -- name: misc/n64dd - xml_path: assets/xml/misc/n64dd.xml +- name: misc/n64dd_error_textures + xml_path: assets/xml/misc/n64dd_error_textures.xml start_offset: 0xC0E0 end_offset: 0x11CE0 - name: misc/link_animetion diff --git a/src/n64dd/n64dd_6.c b/src/n64dd/n64dd_6.c index 19a9bb2852f..9d373efd6ad 100644 --- a/src/n64dd/n64dd_6.c +++ b/src/n64dd/n64dd_6.c @@ -2,6 +2,7 @@ #include "n64dd.h" #include "n64dd_internal.h" #include "region.h" +#include "tex_len.h" #include "z_locale.h" #pragma increment_block_number "" @@ -108,20 +109,20 @@ const char* D_801D3760[2][8][4] = { }, }, }; -u8 D_801D3860[2][0x600] = { +u64 D_801D3860[2][TEX_LEN(u64, 192, 16, 4)] = { { -#include "assets/misc/n64dd/D_801D3860_0.bin.inc.c" +#include "assets/misc/n64dd_error_textures/gN64DDError41JPNTex.i4.inc.c" }, { -#include "assets/misc/n64dd/D_801D3860_1.bin.inc.c" +#include "assets/misc/n64dd_error_textures/gN64DDError41ENGTex.i4.inc.c" }, }; -u8 D_801D4460[2][0x2800] = { +u64 D_801D4460[2][TEX_LEN(u64, 320, 64, 4)] = { { -#include "assets/misc/n64dd/D_801D4460_0.bin.inc.c" +#include "assets/misc/n64dd_error_textures/gN64DDPleaseReadManualJPNTex.i4.inc.c" }, { -#include "assets/misc/n64dd/D_801D4460_1.bin.inc.c" +#include "assets/misc/n64dd_error_textures/gN64DDPleaseReadManualENGTex.i4.inc.c" }, }; From f97d56a20d794106f1205f21a2c8ab09b1284d19 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 2 Aug 2026 06:04:34 +0200 Subject: [PATCH 062/150] libleo/n64dd fixes/cleanup --- spec/spec | 8 ++++---- src/libleo/api/cacreateleomanager.c | 3 ++- src/libleo/api/cjcreateleomanager.c | 3 ++- src/libleo/{leo => api}/getaadr.s | 0 src/libleo/{leo => api}/getaadr2.s | 0 src/libleo/{leo => api}/getkadr.s | 0 src/libleo/api/readdiskid.c | 2 +- src/libleo/leo/leo_tbl.c | 11 ++++------- src/libleo/{api/rezero.c => leo/leorezero.c} | 0 src/n64dd/n64dd_7.c | 11 +++++------ 10 files changed, 18 insertions(+), 20 deletions(-) rename src/libleo/{leo => api}/getaadr.s (100%) rename src/libleo/{leo => api}/getaadr2.s (100%) rename src/libleo/{leo => api}/getkadr.s (100%) rename src/libleo/{api/rezero.c => leo/leorezero.c} (100%) diff --git a/spec/spec b/spec/spec index 53b8a86e075..46a9654955d 100644 --- a/spec/spec +++ b/spec/spec @@ -878,7 +878,7 @@ beginseg include "$(BUILD_DIR)/src/libleo/leo/leoram.o" include "$(BUILD_DIR)/src/libleo/leo/leoint.o" include "$(BUILD_DIR)/src/libleo/leo/leocmdex.o" - include "$(BUILD_DIR)/src/libleo/leo/getaadr2.o" + include "$(BUILD_DIR)/src/libleo/api/getaadr2.o" include "$(BUILD_DIR)/src/libleo/leo/leoread.o" include "$(BUILD_DIR)/src/libleo/api/lbatobyte.o" include "$(BUILD_DIR)/src/libleo/leo/leoinquiry.o" @@ -898,14 +898,14 @@ beginseg include "$(BUILD_DIR)/src/libleo/leo/leomode_sel.o" include "$(BUILD_DIR)/src/libleo/leo/leord_capa.o" include "$(BUILD_DIR)/src/libleo/leo/leoutil.o" - include "$(BUILD_DIR)/src/libleo/api/rezero.o" + include "$(BUILD_DIR)/src/libleo/leo/leorezero.o" include "$(BUILD_DIR)/src/libleo/api/clearqueue.o" include "$(BUILD_DIR)/src/libleo/api/bytetolba.o" include "$(BUILD_DIR)/src/libleo/leo/leoreset.o" include "$(BUILD_DIR)/src/libleo/leo/leotranslat.o" include "$(BUILD_DIR)/src/libleo/leo/leotimer.o" - include "$(BUILD_DIR)/src/libleo/leo/getkadr.o" - include "$(BUILD_DIR)/src/libleo/leo/getaadr.o" + include "$(BUILD_DIR)/src/libleo/api/getkadr.o" + include "$(BUILD_DIR)/src/libleo/api/getaadr.o" include "$(BUILD_DIR)/src/libleo/leo/leowrite.o" include "$(BUILD_DIR)/src/libleo/api/cjcreateleomanager.o" include "$(BUILD_DIR)/src/libleo/api/leointerrupt.o" diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c index 04f8fd3f59c..c296a159a12 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -1,4 +1,5 @@ #include "ultra64.h" +#include "ultra64/asm.h" #include "ultra64/leo_internal.h" s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) { @@ -19,7 +20,7 @@ s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) osLeoDiskInit(); driveRomHandle = osDriveRomInit(); __leoActive = true; - __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - 0x10); + __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - FRAMESZ(SZREG * NARGSAVE)); leoInitialize(comPri, intPri, cmdBuf, (u32)cmdMsgCnt); if (osResetType == 1) { __leoSetReset(); diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c index ab502e14030..1a9e9f57906 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -1,4 +1,5 @@ #include "ultra64.h" +#include "ultra64/asm.h" #include "ultra64/leo_internal.h" s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) { @@ -19,7 +20,7 @@ s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) osLeoDiskInit(); driveRomHandle = osDriveRomInit(); __leoActive = true; - __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - 0x10); + __osSetHWIntrRoutine(OS_INTR_CART, __osLeoInterrupt, STACK_TOP(leoDiskStack) - FRAMESZ(SZREG * NARGSAVE)); leoInitialize(comPri, intPri, cmdBuf, (u32)cmdMsgCnt); if (osResetType == 1) { __leoSetReset(); diff --git a/src/libleo/leo/getaadr.s b/src/libleo/api/getaadr.s similarity index 100% rename from src/libleo/leo/getaadr.s rename to src/libleo/api/getaadr.s diff --git a/src/libleo/leo/getaadr2.s b/src/libleo/api/getaadr2.s similarity index 100% rename from src/libleo/leo/getaadr2.s rename to src/libleo/api/getaadr2.s diff --git a/src/libleo/leo/getkadr.s b/src/libleo/api/getkadr.s similarity index 100% rename from src/libleo/leo/getkadr.s rename to src/libleo/api/getkadr.s diff --git a/src/libleo/api/readdiskid.c b/src/libleo/api/readdiskid.c index d5ee056036d..1200c5f6aa4 100644 --- a/src/libleo/api/readdiskid.c +++ b/src/libleo/api/readdiskid.c @@ -9,7 +9,7 @@ s32 LeoReadDiskID(LEOCmd* cmdBlock, LEODiskID* vaddr, OSMesgQueue* mq) { cmdBlock->header.reserve1 = 0; cmdBlock->header.control = 0; cmdBlock->header.reserve3 = 0; - cmdBlock->data.readwrite.lba = (u32)vaddr; + cmdBlock->data.readdiskid.buffer_pointer = vaddr; if (mq != NULL) { cmdBlock->header.control |= LEO_CONTROL_POST; cmdBlock->header.post = mq; diff --git a/src/libleo/leo/leo_tbl.c b/src/libleo/leo/leo_tbl.c index 30bebe8f8cc..280dbfaa144 100644 --- a/src/libleo/leo/leo_tbl.c +++ b/src/libleo/leo/leo_tbl.c @@ -19,13 +19,10 @@ const u16 LEOZONE_SCYL_TBL[0x10] = { 0, 0x9E, 0x13C, 0x1D1, 0x266, 0x2FB, 0x390, 0x425, 0x91, 0x12F, 0x1C4, 0x259, 0x2EE, 0x383, 0x418, 0x48A, }; const u8 LEOVZONE_PZONEHD_TBL[][0x10] = { - { 0, 1, 2, 9, 8, 3, 4, 5, 6, 7, 0xF, 0xE, 0xD, 0xC, 0xB, 0xA }, - { 0, 1, 2, 3, 0xA, 9, 8, 4, 5, 6, 7, 0xF, 0xE, 0xD, 0xC, 0xB }, - { 0, 1, 2, 3, 4, 0xB, 0xA, 9, 8, 5, 6, 7, 0xF, 0xE, 0xD, 0xC }, - { 0, 1, 2, 3, 4, 5, 0xC, 0xB, 0xA, 9, 8, 6, 7, 0xF, 0xE, 0xD }, - { 0, 1, 2, 3, 4, 5, 6, 0xD, 0xC, 0xB, 0xA, 9, 8, 7, 0xF, 0xE }, - { 0, 1, 2, 3, 4, 5, 6, 7, 0xE, 0xD, 0xC, 0xB, 0xA, 9, 8, 0xF }, - { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08 }, + { 0, 1, 2, 9, 8, 3, 4, 5, 6, 7, 15, 14, 13, 12, 11, 10 }, { 0, 1, 2, 3, 10, 9, 8, 4, 5, 6, 7, 15, 14, 13, 12, 11 }, + { 0, 1, 2, 3, 4, 11, 10, 9, 8, 5, 6, 7, 15, 14, 13, 12 }, { 0, 1, 2, 3, 4, 5, 12, 11, 10, 9, 8, 6, 7, 15, 14, 13 }, + { 0, 1, 2, 3, 4, 5, 6, 13, 12, 11, 10, 9, 8, 7, 15, 14 }, { 0, 1, 2, 3, 4, 5, 6, 7, 14, 13, 12, 11, 10, 9, 8, 15 }, + { 0, 1, 2, 3, 4, 5, 6, 7, 15, 14, 13, 12, 11, 10, 9, 8 }, }; const u16 LEOZONE_OUTERCYL_TBL[8] = { 0, 0x9E, 0x13C, 0x1D1, 0x266, 0x2FB, 0x390, 0x425 }; const u16 LEORAM_START_LBA[8] = { 0x5A2, 0x7C6, 0x9EA, 0xC0E, 0xE32, 0x1010, 0x10DC, 0 }; diff --git a/src/libleo/api/rezero.c b/src/libleo/leo/leorezero.c similarity index 100% rename from src/libleo/api/rezero.c rename to src/libleo/leo/leorezero.c diff --git a/src/n64dd/n64dd_7.c b/src/n64dd/n64dd_7.c index 1b3eb94783f..6c4244d6ee0 100644 --- a/src/n64dd/n64dd_7.c +++ b/src/n64dd/n64dd_7.c @@ -70,7 +70,11 @@ s32 func_801CA920(s32 arg0, u8* arg1, int* arg2, int* arg3, int* arg4) { return 0; } -extern const u16 D_801D9C10[]; +const u16 D_801D9C10[0x10] = { + 0x0001, 0x1085, 0x2109, 0x318D, 0x4211, 0x5295, 0x6319, 0x739D, + 0x8C63, 0x9CE7, 0xAD6B, 0xBDEF, 0xCE73, 0xDEF7, 0xEF7B, 0xFFFF, +}; + u16 func_801CAA44(s32 arg0) { return D_801D9C10[arg0 & 0xF]; } @@ -237,8 +241,3 @@ void func_801CAF74(struct_801CAF10* arg0, const char* arg1, ...) { func_801CAF54(arg0, arg1, varargs); va_end(varargs); } - -const u16 D_801D9C10[0x10] = { - 1, 0x1085, 0x2109, 0x318D, 0x4211, 0x5295, 0x6319, 0x739D, - 0x8C63, 0x9CE7, 0xAD6B, 0xBDEF, 0xCE73, 0xDEF7, 0xEF7B, 0xFFFF, -}; From 09c810757a68a9cb3c6c5edffb23720b632c2c38 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 2 Aug 2026 16:15:05 +0200 Subject: [PATCH 063/150] document object_zf --- assets/xml/objects/object_zf.xml | 432 ++++++++++++------------ src/overlays/actors/ovl_En_Zf/z_en_zf.c | 72 ++-- 2 files changed, 252 insertions(+), 252 deletions(-) diff --git a/assets/xml/objects/object_zf.xml b/assets/xml/objects/object_zf.xml index d6d17075b1d..39ab2f42a23 100644 --- a/assets/xml/objects/object_zf.xml +++ b/assets/xml/objects/object_zf.xml @@ -1,306 +1,306 @@ - - - - - - - - - - - + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 3a9495281b2..1f5b1aa8538 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -173,9 +173,9 @@ static InitChainEntry sInitChain[3] = { ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP), }; static AnimationHeader* D_80B4A280[] = { - &object_zf_Anim_01081C, - &object_zf_Anim_010CAC, - &object_zf_Anim_011070, + &gZfJumpAnim___, + &gZfAirborneAnim___, + &gZfLandFromJumpAnim__, }; static Vec3f D_80B4A28C = { 1100.0f, -700.0f, 0.0f }; static Vec3f D_80B4A298 = { 300.0f, 0.0f, 0.0f }; @@ -295,13 +295,13 @@ void EnZf_Init(Actor* thisx, PlayState* play) { if (this->actor.params == -2) { this->actor.colChkInfo.health = 12; this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; - SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_006690, &object_zf_Anim_00B10C, this->jointTable, - this->morphTable, 0x31); + SkelAnime_Init(play, &this->skelAnime, &gDinolfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, + 0x31); } else { this->actor.colChkInfo.health = 6; this->actor.naviEnemyId = NAVI_ENEMY_LIZALFOS; - SkelAnime_Init(play, &this->skelAnime, &object_zf_Skel_0104B8, &object_zf_Anim_00B10C, this->jointTable, - this->morphTable, 0x31); + SkelAnime_Init(play, &this->skelAnime, &gLizalfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, + 0x31); } if (this->actor.params < 0) { this->unk3FE = -1; @@ -597,8 +597,8 @@ s32 func_80B44E8C(PlayState* play, EnZf* this) { } void func_80B450AC(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_009530, 0.0f, 9.0f, - Animation_GetLastFrame(&object_zf_Anim_009530), ANIMMODE_LOOP, 0.0f); + Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 0.0f, 9.0f, Animation_GetLastFrame(&gZfTauntAnim_____), + ANIMMODE_LOOP, 0.0f); this->actor.world.pos.y = this->actor.floorHeight + 300.0f; this->unk404 = this->actor.shape.shadowAlpha = 0; this->unk3F0 = 0xA; @@ -634,7 +634,7 @@ void func_80B45174(EnZf* this, PlayState* play) { } if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->unk3E4 != 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ONGND); - Animation_Change(&this->skelAnime, &object_zf_Anim_008C6C, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); this->unk3E4 = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; @@ -654,8 +654,8 @@ void func_80B45174(EnZf* this, PlayState* play) { } void func_80B45384(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_00B10C, 1.0f, 0.0f, - Animation_GetLastFrame(&object_zf_Anim_00B10C), ANIMMODE_LOOP_INTERP, -4.0f); + Animation_Change(&this->skelAnime, &gZfTaunt2Anim_____, 1.0f, 0.0f, Animation_GetLastFrame(&gZfTaunt2Anim_____), + ANIMMODE_LOOP_INTERP, -4.0f); this->unk3DC = 3; this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; @@ -720,7 +720,7 @@ void func_80B4543C(EnZf* this, PlayState* play) { } void func_80B456B4(EnZf* this, PlayState* play) { - Animation_MorphToLoop(&this->skelAnime, &object_zf_Anim_008138, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); this->unk3DC = 5; if (this->actor.params >= 0) { this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); @@ -861,7 +861,7 @@ void func_80B45748(EnZf* this, PlayState* play) { } void func_80B45E30(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0; this->unk3E4 = 1; this->actor.velocity.y = 15.0f; @@ -886,7 +886,7 @@ void func_80B45EF0(EnZf* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { if (this->unk3F0 == 0) { - Animation_Change(&this->skelAnime, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0xA; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else { @@ -908,7 +908,7 @@ void func_80B45EF0(EnZf* this, PlayState* play) { } void func_80B4604C(EnZf* this) { - Animation_MorphToLoop(&this->skelAnime, &object_zf_Anim_008138, -4.0f); + Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); this->unk3DC = 6; func_80B44050(this, func_80B46098); } @@ -967,7 +967,7 @@ void func_80B462E4(EnZf* this, PlayState* play) { if ((this->actor.params < 0) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { - Animation_PlayLoop(&this->skelAnime, &object_zf_Anim_016388); + Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); this->actor.speed = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 20.0f; @@ -1083,8 +1083,8 @@ void func_80B463E4(EnZf* this, PlayState* play) { } void func_80B46A24(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_00A3D4, 1.25f, 0.0f, - Animation_GetLastFrame(&object_zf_Anim_00A3D4), ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &gZfSlashAnim, 1.25f, 0.0f, Animation_GetLastFrame(&gZfSlashAnim), ANIMMODE_ONCE, + -4.0f); if (this->actor.params == -2) { this->skelAnime.playSpeed = 1.75f; } @@ -1148,7 +1148,7 @@ void func_80B46AE0(EnZf* this, PlayState* play) { void func_80B46D64(EnZf* this) { f32 f = this->skelAnime.curFrame - 3.0f; - Animation_Change(&this->skelAnime, &object_zf_Anim_00A3D4, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gZfSlashAnim, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); this->unk3DC = 8; func_80B44050(this, func_80B46DD4); } @@ -1166,7 +1166,7 @@ void func_80B46DD4(EnZf* this, PlayState* play) { } void func_80B46E8C(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_009530, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &gZfTauntAnim_____, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0; this->unk3E4 = 1; this->unk3DC = 0xB; @@ -1187,7 +1187,7 @@ void func_80B46F2C(EnZf* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { if (this->unk3F0 == 0) { - Animation_Change(&this->skelAnime, &object_zf_Anim_008C6C, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); this->unk3F0 = 0xA; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else if ((play->gameplayFrames % 2) != 0) { @@ -1212,7 +1212,7 @@ void func_80B47050(EnZf* this) { if (this->unk410 == 0xF) { this->unk3F6 = 0x24; } else { - Animation_PlayOnceSetSpeed(&this->skelAnime, &object_zf_Anim_0157F8, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &gZfDamagedAnim___, 0.0f); } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->unk3DC = 0xE; @@ -1264,11 +1264,11 @@ void func_80B47360(EnZf* this, PlayState* play) { f32 temp_fv1; var_fv0 = 0.0f; - temp_fv1 = Animation_GetLastFrame(&object_zf_Anim_0119F4); + temp_fv1 = Animation_GetLastFrame(&gZfTurnAroundAnim__); if (this->unk3DC < 0x11) { var_fv0 = -4.0f; } - Animation_Change(&this->skelAnime, &object_zf_Anim_0119F4, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); + Animation_Change(&this->skelAnime, &gZfTurnAroundAnim__, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); this->unk3DC = 0x12; this->actor.speed = 0.0f; this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); @@ -1470,7 +1470,7 @@ void func_80B4781C(EnZf* this, PlayState* play) { } void func_80B47C64(EnZf* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &object_zf_Anim_01366C); + Animation_PlayOnce(&this->skelAnime, &gZfGetBackUpAndTurnAroundAnim_____); this->actor.world.rot.y += 0x8000; this->unk3DC = 0x15; this->actor.speed = 0.0f; @@ -1498,8 +1498,8 @@ void func_80B47CF8(EnZf* this, PlayState* play) { } void func_80B47DA8(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_0157F8, 1.5f, 0.0f, - Animation_GetLastFrame(&object_zf_Anim_0157F8), ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &gZfDamagedAnim___, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDamagedAnim___), + ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = -4.0f; @@ -1574,7 +1574,7 @@ void func_80B47EB4(EnZf* this, PlayState* play) { } void func_80B48210(EnZf* this) { - Animation_Change(&this->skelAnime, &object_zf_Anim_009530, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); this->unk3F0 = 0; this->unk3E4 = 1; this->unk3DC = 0x16; @@ -1593,7 +1593,7 @@ void func_80B482B8(EnZf* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { if (this->unk3F0 == 0) { - Animation_Change(&this->skelAnime, &object_zf_Anim_00A3D4, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &gZfSlashAnim, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); this->unk3F0 = 0xA; } else if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; @@ -1615,7 +1615,7 @@ void func_80B483E4(EnZf* this, PlayState* play) { if ((this->actor.params < 0) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { - Animation_PlayLoop(&this->skelAnime, &object_zf_Anim_016388); + Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); temp_v1_sp2E = player->actor.shape.rot.y; @@ -1775,8 +1775,8 @@ typedef struct UnkActor { void func_80B48CEC(EnZf* this) { Actor* temp_v0; - Animation_Change(&this->skelAnime, &object_zf_Anim_014E60, 1.5f, 0.0f, - Animation_GetLastFrame(&object_zf_Anim_014E60), ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &gZfDieAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDieAnim), ANIMMODE_ONCE, + -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; @@ -1984,13 +1984,13 @@ s32 func_80B495FC(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg case 15: if (this->unk3FA != 0) { - *arg2 = object_zf_DL_00E198; + *arg2 = gLizalfosRightHandDL; } break; case 33: if (this->unk3FA != 0) { - *arg2 = object_zf_DL_010060; + *arg2 = gLizalfosSheathedSwordDL; } break; } @@ -2102,7 +2102,7 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { } void func_80B49B60(EnZf* this, f32 arg1) { - Animation_MorphToLoop(&this->skelAnime, &object_zf_Anim_016388, -1.0f); + Animation_MorphToLoop(&this->skelAnime, &gZfCautiousWalkAnim___, -1.0f); this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 8.0f; if (this->actor.params == -2) { this->actor.speed = 2.0f * arg1; From 3162690c7edbe69db20cc080c20899a36f142286 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 3 Aug 2026 17:14:07 +0200 Subject: [PATCH 064/150] wip EnZf docs --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 1509 ++++++++++++----------- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 43 +- 2 files changed, 815 insertions(+), 737 deletions(-) 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 1f5b1aa8538..15d5572e4be 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -32,41 +32,62 @@ void EnZf_Destroy(Actor* thisx, PlayState* play); void EnZf_Update(Actor* thisx, PlayState* play); void EnZf_Draw(Actor* thisx, PlayState* play); -s16 func_80B446A8(Vec3f* arg0, s16 arg1); -void func_80B450AC(EnZf* this); -void func_80B45174(EnZf* this, PlayState* play); -void func_80B45384(EnZf* this); -void func_80B4543C(EnZf* this, PlayState* play); -void func_80B456B4(EnZf* this, PlayState* play); -void func_80B45748(EnZf* this, PlayState* play); -void func_80B45E30(EnZf* this); -void func_80B45EF0(EnZf* this, PlayState* play); -void func_80B4604C(EnZf* this); -void func_80B46098(EnZf* this, PlayState* play); -void func_80B462E4(EnZf* this, PlayState* play); -void func_80B463E4(EnZf* this, PlayState* play); -void func_80B46A24(EnZf* this); -void func_80B46AE0(EnZf* this, PlayState* play); -void func_80B46DD4(EnZf* this, PlayState* play); -void func_80B46E8C(EnZf* this); -void func_80B46F2C(EnZf* this, PlayState* play); -void func_80B47120(EnZf* this, PlayState* play); -void func_80B47360(EnZf* this, PlayState* play); -void func_80B4743C(EnZf* this, PlayState* play); -void func_80B47544(EnZf* this, PlayState* play); -void func_80B4779C(EnZf* this, PlayState* play); -void func_80B4781C(EnZf* this, PlayState* play); -void func_80B47CF8(EnZf* this, PlayState* play); -void func_80B47EB4(EnZf* this, PlayState* play); -void func_80B48210(EnZf* this); -void func_80B482B8(EnZf* this, PlayState* play); -void func_80B483E4(EnZf* this, PlayState* play); -void func_80B48578(EnZf* this, PlayState* play); -void func_80B48CEC(EnZf* this); -void func_80B48E50(EnZf* this, PlayState* play); -void func_80B49B60(EnZf* this, f32 arg1); -s32 func_80B49C2C(PlayState* play, EnZf* this); -s32 func_80B49E4C(PlayState* play, EnZf* this); +s16 EnZf_FindPlatform1__(Vec3f* arg0, s16 arg1); +void EnZf_SetupWaitAppear_(EnZf* this); +void EnZf_WaitAppear_(EnZf* this, PlayState* play); +void EnZf_SetupIdle_(EnZf* this); +void EnZf_Idle_(EnZf* this, PlayState* play); +void EnZf_Setup5_(EnZf* this, PlayState* play); +void EnZf_5_(EnZf* this, PlayState* play); +void EnZf_Setup13_(EnZf* this); +void EnZf_13_(EnZf* this, PlayState* play); +void EnZf_Setup6_(EnZf* this); +void EnZf_6_(EnZf* this, PlayState* play); +void EnZf_Setup7or5___(EnZf* this, PlayState* play); +void EnZf_7_(EnZf* this, PlayState* play); +void EnZf_Setup9_(EnZf* this); +void EnZf_9_(EnZf* this, PlayState* play); +void EnZf_8_(EnZf* this, PlayState* play); +void EnZf_Setup11_(EnZf* this); +void EnZf_11_(EnZf* this, PlayState* play); +void EnZf_14_(EnZf* this, PlayState* play); +void EnZf_Setup18_(EnZf* this, PlayState* play); +void EnZf_18_(EnZf* this, PlayState* play); +void EnZf_Jump20__(EnZf* this, PlayState* play); +void EnZf_SetupJump19__(EnZf* this, PlayState* play); +void EnZf_Jump19__(EnZf* this, PlayState* play); +void EnZf_21_(EnZf* this, PlayState* play); +void EnZf_16_(EnZf* this, PlayState* play); +void EnZf_Setup22_(EnZf* this); +void EnZf_22_(EnZf* this, PlayState* play); +void EnZf_Setup12or5___(EnZf* this, PlayState* play); +void EnZf_CirclePlayer___(EnZf* this, PlayState* play); +void EnZf_SetupDie_(EnZf* this); +void EnZf_Die_(EnZf* this, PlayState* play); +void EnZf_SetupCirclePlayer___(EnZf* this, f32 arg1); +s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this); +s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this); + +typedef enum EnZfAction { + ENZF_ACTION_WAIT_APPEAR_, + ENZF_ACTION_IDLE_ = 3, + ENZF_ACTION_5 = 5, + ENZF_ACTION_6, + ENZF_ACTION_7, + ENZF_ACTION_8, + ENZF_ACTION_9, + ENZF_ACTION_11 = 11, + ENZF_ACTION_CIRCLE_PLAYER___, + ENZF_ACTION_13, + ENZF_ACTION_14, + ENZF_ACTION_DIE_, + ENZF_ACTION_16, + ENZF_ACTION_18 = 18, + ENZF_ACTION_JUMP_19__, + ENZF_ACTION_JUMP_20__, + ENZF_ACTION_21, + ENZF_ACTION_22 +} EnZfAction; static Vec3f D_80B4A090[0x18] = { { 3560.0f, 100.0f, -1517.0f }, { 3170.0f, 100.0f, -1767.0f }, { 3165.0f, 100.0f, -2217.0f }, @@ -79,7 +100,7 @@ static Vec3f D_80B4A090[0x18] = { { 3930.0f, 531.0f, -1705.0f }, { 3780.0f, 531.0f, -1835.0f }, { 3560.0f, 531.0f, -1985.0f }, }; static s16 D_80B4A1B0 = 0; -static s16 D_80B4A1B4 = 1; +static s16 D_80B4A1B4 = ENZF_TYPE_1; ActorProfile En_Zf_Profile = { /**/ ACTOR_EN_ZF, @@ -93,7 +114,7 @@ ActorProfile En_Zf_Profile = { /**/ EnZf_Draw, }; -static ColliderCylinderInit sCylinderInit = { +static ColliderCylinderInit sBodyCylinderInit = { { COL_MATERIAL_HIT0, AT_NONE, @@ -113,7 +134,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 70, 0, { 0, 0, 0 } }, }; -static ColliderQuadInit sColliderQuadInit = { +static ColliderQuadInit sSwordColliderQuadInit = { { COL_MATERIAL_NONE, AT_ON | AT_TYPE_ENEMY, @@ -133,39 +154,47 @@ static ColliderQuadInit sColliderQuadInit = { { { { 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 EnZfDamageReaction { + ENZF_DMG_REACT_0, + ENZF_DMG_REACT_1, + ENZF_DMG_REACT_6 = 6, + ENZF_DMG_REACT_D = 13, + ENZF_DMG_REACT_F = 15 +} EnZfDamageReaction; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0xD), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(0, 0x1), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0x1), - /* Kokiri sword */ DMG_ENTRY(1, 0x0), - /* Master sword */ DMG_ENTRY(2, 0x0), - /* Giant's Knife */ DMG_ENTRY(4, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0xD), - /* Ice arrow */ DMG_ENTRY(4, 0xF), - /* Light arrow */ DMG_ENTRY(2, 0xD), - /* Unk arrow 1 */ DMG_ENTRY(2, 0xD), - /* Unk arrow 2 */ DMG_ENTRY(2, 0xD), - /* Unk arrow 3 */ DMG_ENTRY(2, 0xD), - /* Fire magic */ DMG_ENTRY(0, 0x6), - /* Ice magic */ DMG_ENTRY(3, 0xF), - /* Light magic */ DMG_ENTRY(0, 0x6), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0x0), - /* Giant spin */ DMG_ENTRY(4, 0x0), - /* Master spin */ DMG_ENTRY(2, 0x0), - /* Kokiri jump */ DMG_ENTRY(2, 0x0), - /* Giant jump */ DMG_ENTRY(8, 0x0), - /* Master jump */ DMG_ENTRY(4, 0x0), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, ENZF_DMG_REACT_1), + /* Deku stick */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Slingshot */ DMG_ENTRY(1, ENZF_DMG_REACT_D), + /* Explosive */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Boomerang */ DMG_ENTRY(0, ENZF_DMG_REACT_1), + /* Normal arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Hammer swing */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Hookshot */ DMG_ENTRY(0, ENZF_DMG_REACT_1), + /* Kokiri sword */ DMG_ENTRY(1, ENZF_DMG_REACT_0), + /* Master sword */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Giant's Knife */ DMG_ENTRY(4, ENZF_DMG_REACT_0), + /* Fire arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_D), + /* Ice arrow */ DMG_ENTRY(4, ENZF_DMG_REACT_F), + /* Light arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_D), + /* Unk arrow 1 */ DMG_ENTRY(2, ENZF_DMG_REACT_D), + /* Unk arrow 2 */ DMG_ENTRY(2, ENZF_DMG_REACT_D), + /* Unk arrow 3 */ DMG_ENTRY(2, ENZF_DMG_REACT_D), + /* Fire magic */ DMG_ENTRY(0, ENZF_DMG_REACT_6), + /* Ice magic */ DMG_ENTRY(3, ENZF_DMG_REACT_F), + /* Light magic */ DMG_ENTRY(0, ENZF_DMG_REACT_6), + /* Shield */ DMG_ENTRY(0, ENZF_DMG_REACT_0), + /* Mirror Ray */ DMG_ENTRY(0, ENZF_DMG_REACT_0), + /* Kokiri spin */ DMG_ENTRY(1, ENZF_DMG_REACT_0), + /* Giant spin */ DMG_ENTRY(4, ENZF_DMG_REACT_0), + /* Master spin */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Kokiri jump */ DMG_ENTRY(2, ENZF_DMG_REACT_0), + /* Giant jump */ DMG_ENTRY(8, ENZF_DMG_REACT_0), + /* Master jump */ DMG_ENTRY(4, ENZF_DMG_REACT_0), + /* Unknown 1 */ DMG_ENTRY(0, ENZF_DMG_REACT_0), + /* Unblockable */ DMG_ENTRY(0, ENZF_DMG_REACT_0), + /* Hammer jump */ DMG_ENTRY(4, ENZF_DMG_REACT_0), + /* Unknown 2 */ DMG_ENTRY(0, ENZF_DMG_REACT_0), }; static InitChainEntry sInitChain[3] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), @@ -192,79 +221,103 @@ static Gfx D_80B4A2F8[] = { }; static s32 D_80B4AB30; -void func_80B44050(EnZf* this, void (*arg1)(EnZf*, PlayState*)) { - this->unk3E8 = arg1; +void EnZf_SetupAction(EnZf* this, void (*actionFunc)(EnZf*, PlayState*)) { + this->actionFunc = actionFunc; } -s32 func_80B44058(EnZf* this, PlayState* play, f32 arg2) { - s16 temp_v1; - s16 sp44; - f32 sp40; - f32 temp_ft2; - Vec3f sp30; - - if (arg2 == 0.0f) { +/** + * Checks if the actor will not be standing on the ground after moving by `distance`. + * If `distance` is 0, it is determined from the actor's speed direction and type. + * + * Returns true if the actor will not be standing on ground. + * + * Note: uses world.rot.y + */ +s32 EnZf_TestNoFloorAhead_(EnZf* this, PlayState* play, f32 distance) { + s16 ret; + s16 prevBgCheckFlags; + f32 dx; + f32 dz; + Vec3f prevPos; + + if (distance == 0.0f) { if (this->actor.speed >= 0.0f) { - arg2 = 1.0f; + distance = 1.0f; } else { - arg2 = -1.0f; + distance = -1.0f; } - if (this->actor.params >= 0) { - arg2 = arg2 * 45.0f; + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + distance = distance * 45.0f; } else { - arg2 = arg2 * 30.0f; + distance = distance * 30.0f; } } - sp30 = this->actor.world.pos; - sp44 = this->actor.bgCheckFlags; - sp40 = Math_SinS(this->actor.world.rot.y) * arg2; - temp_ft2 = Math_CosS(this->actor.world.rot.y) * arg2; - this->actor.world.pos.x += sp40; - this->actor.world.pos.z += temp_ft2; + + prevPos = this->actor.world.pos; + prevBgCheckFlags = this->actor.bgCheckFlags; + + dx = Math_SinS(this->actor.world.rot.y) * distance; + dz = Math_CosS(this->actor.world.rot.y) * distance; + this->actor.world.pos.x += dx; + this->actor.world.pos.z += dz; + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->actor.world.pos = sp30; - temp_v1 = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - this->actor.bgCheckFlags = sp44; - return temp_v1; -} -s16 func_80B441C4(EnZf* this, PlayState* play, f32 arg2) { - s16 temp_v0; - s16 sp44; - f32 sp40; - f32 temp_fv0_2; - Vec3f sp30; + this->actor.world.pos = prevPos; + + ret = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + this->actor.bgCheckFlags = prevBgCheckFlags; + + return ret; +} - if ((this->actor.speed != 0.0f) && func_80B44058(this, play, this->actor.speed)) { +/** + * Note: uses shape.rot.y + */ +s16 EnZf_TestNoFloorAhead2_(EnZf* this, PlayState* play, f32 distance) { + s16 ret; + s16 prevBgCheckFlags; + f32 dx; + f32 dz; + Vec3f prevPos; + + if ((this->actor.speed != 0.0f) && EnZf_TestNoFloorAhead_(this, play, this->actor.speed)) { return true; } - sp30 = this->actor.world.pos; - sp44 = this->actor.bgCheckFlags; - sp40 = Math_SinS(this->actor.shape.rot.y) * arg2; - temp_fv0_2 = Math_CosS(this->actor.shape.rot.y) * arg2; - this->actor.world.pos.x += sp40; - this->actor.world.pos.z += temp_fv0_2; + + prevPos = this->actor.world.pos; + prevBgCheckFlags = this->actor.bgCheckFlags; + + dx = Math_SinS(this->actor.shape.rot.y) * distance; + dz = Math_CosS(this->actor.shape.rot.y) * distance; + this->actor.world.pos.x += dx; + this->actor.world.pos.z += dz; + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->actor.world.pos = sp30; - temp_v0 = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); - this->actor.bgCheckFlags = sp44; - return temp_v0; + + this->actor.world.pos = prevPos; + + ret = !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND); + this->actor.bgCheckFlags = prevBgCheckFlags; + + return ret; } void EnZf_Init(Actor* thisx, PlayState* play) { - f32 temp_fv0; + f32 yDiff; s32 pad; Player* player; - EffectBlureInit1 sp4C; + EffectBlureInit1 swordBlure; EnZf* this = (EnZf*)thisx; player = GET_PLAYER(play); Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.attentionRangeType = ATTENTION_RANGE_3; - this->unk3FC = PARAMS_GET_S(thisx->params, 8, 8); - this->actor.params &= 0xFF; + this->switchFlag = PARAMS_GET_S(thisx->params, 8, 8); + this->actor.params = PARAMS_GET_U(this->actor.params, 0, 8); + // Sign-extend the params low byte if (this->actor.params & 0x80) { this->actor.params |= 0xFF00; } @@ -272,53 +325,53 @@ void EnZf_Init(Actor* thisx, PlayState* play) { this->unk3E0 = 0; this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.damageTable = &sDamageTable; - sp4C.p1StartColor[0] = sp4C.p1StartColor[1] = sp4C.p1StartColor[2] = sp4C.p1StartColor[3] = sp4C.p2StartColor[0] = - sp4C.p2StartColor[1] = sp4C.p2StartColor[2] = sp4C.p1EndColor[0] = sp4C.p1EndColor[1] = sp4C.p1EndColor[2] = - sp4C.p2EndColor[0] = sp4C.p2EndColor[1] = sp4C.p2EndColor[2] = 255; - sp4C.p2StartColor[3] = 64; - sp4C.p1EndColor[3] = 0; - sp4C.p2EndColor[3] = 0; - sp4C.elemDuration = 8; - sp4C.unkFlag = 0; - sp4C.calcMode = 2; - Effect_Add(play, &this->unk414, EFFECT_BLURE1, 0U, 0U, &sp4C); + swordBlure.p1StartColor[0] = swordBlure.p1StartColor[1] = swordBlure.p1StartColor[2] = swordBlure.p1StartColor[3] = + swordBlure.p2StartColor[0] = swordBlure.p2StartColor[1] = swordBlure.p2StartColor[2] = + swordBlure.p1EndColor[0] = swordBlure.p1EndColor[1] = swordBlure.p1EndColor[2] = swordBlure.p2EndColor[0] = + swordBlure.p2EndColor[1] = swordBlure.p2EndColor[2] = 255; + swordBlure.p2StartColor[3] = 64; + swordBlure.p1EndColor[3] = 0; + swordBlure.p2EndColor[3] = 0; + swordBlure.elemDuration = 8; + swordBlure.unkFlag = 0; + swordBlure.calcMode = 2; + Effect_Add(play, &this->swordBlureEffectIndex, EFFECT_BLURE1, 0, 0, &swordBlure); Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 45.0f, 45.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->unk404 = 0xFF; + this->alpha_ = 255; this->actor.colChkInfo.cylRadius = 40; this->actor.colChkInfo.cylHeight = 100; - Collider_InitCylinder(play, &this->unk418); - Collider_SetCylinder(play, &this->unk418, &this->actor, &sCylinderInit); - Collider_InitQuad(play, &this->unk464); - Collider_SetQuad(play, &this->unk464, &this->actor, &sColliderQuadInit); - if (this->actor.params == -2) { + Collider_InitCylinder(play, &this->bodyCollider); + Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyCylinderInit); + Collider_InitQuad(play, &this->swordCollider); + Collider_SetQuad(play, &this->swordCollider, &this->actor, &sSwordColliderQuadInit); + if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->actor.colChkInfo.health = 12; this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; SkelAnime_Init(play, &this->skelAnime, &gDinolfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, - 0x31); + ZF_LIMB_MAX); } else { this->actor.colChkInfo.health = 6; this->actor.naviEnemyId = NAVI_ENEMY_LIZALFOS; SkelAnime_Init(play, &this->skelAnime, &gLizalfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, - 0x31); - } - if (this->actor.params < 0) { - this->unk3FE = -1; - this->unk400 = this->unk3FE; - D_80B4A1B4 = -1; - this->unk3E4 = 1; - if (this->actor.params == (-1)) { - func_80B450AC(this); - } else { - func_80B45384(this); + ZF_LIMB_MAX); + } + if (this->actor.params < 0) { // ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 + this->unk400 = this->unk3FE = -1; + D_80B4A1B4 = ENZF_TYPE_NEG1; + this->actionState_ = 1; + if (this->actor.params == ENZF_TYPE_NEG1) { + EnZf_SetupWaitAppear_(this); + } else { // ENZF_TYPE_DINOLFOS + EnZf_SetupIdle_(this); } } else { - temp_fv0 = player->actor.world.pos.y - this->actor.world.pos.y; - if ((ABS(temp_fv0) <= 100.0f) && !Flags_GetSwitch(play, this->unk3FC)) { - this->unk400 = this->unk3FE = func_80B446A8(&this->actor.world.pos, 0); - func_80B450AC(this); - D_80B4A1B4 = 1; + yDiff = player->actor.world.pos.y - this->actor.world.pos.y; + if ((ABS(yDiff) <= 100.0f) && !Flags_GetSwitch(play, this->switchFlag)) { + this->unk400 = this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, 0); + EnZf_SetupWaitAppear_(this); + D_80B4A1B4 = ENZF_TYPE_1; } else { Actor_Kill(&this->actor); } @@ -328,45 +381,44 @@ void EnZf_Init(Actor* thisx, PlayState* play) { void EnZf_Destroy(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; - if ((this->actor.params >= 0) && + if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (Actor_FindNearby(play, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { func_800F5B58(); } - Effect_Delete(play, this->unk414); - Collider_DestroyCylinder(play, &this->unk418); - Collider_DestroyQuad(play, &this->unk464); + Effect_Delete(play, this->swordBlureEffectIndex); + Collider_DestroyCylinder(play, &this->bodyCollider); + Collider_DestroyQuad(play, &this->swordCollider); } -s16 func_80B446A8(Vec3f* arg0, s16 arg1) { - Vec3f* temp_v0; - Vec3f* temp_v0_2; - f32 var_fv0_real; - s16 var_v1; +s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred) { + Vec3f* platformPos; + f32 range; + s16 i; - var_fv0_real = 210.0f; - if (arg0->y >= 420.0f) { - var_fv0_real = 110.0f; + range = 210.0f; + if (pos->y >= 420.0f) { + range = 110.0f; } - if (arg1 != -1) { - temp_v0 = &D_80B4A090[arg1]; - if (((temp_v0->y - 150.0f) <= arg0->y) && (arg0->y <= (temp_v0->y + 150.0f)) && - ((temp_v0->x - var_fv0_real) <= arg0->x) && (arg0->x <= (temp_v0->x + var_fv0_real)) && - ((temp_v0->z - var_fv0_real) <= arg0->z) && (arg0->z <= (temp_v0->z + var_fv0_real))) { - return arg1; + if (preferred != -1) { + platformPos = &D_80B4A090[preferred]; + if (((platformPos->y - 150.0f) <= pos->y) && (pos->y <= (platformPos->y + 150.0f)) && + ((platformPos->x - range) <= pos->x) && (pos->x <= (platformPos->x + range)) && + ((platformPos->z - range) <= pos->z) && (pos->z <= (platformPos->z + range))) { + return preferred; } } - for (var_v1 = 0x17; var_v1 >= 0; var_v1--) { - temp_v0_2 = &D_80B4A090[var_v1]; - if (((temp_v0_2->y - 150.0f) <= arg0->y) && (arg0->y <= (temp_v0_2->y + 150.0f)) && - ((temp_v0_2->x - var_fv0_real) <= arg0->x) && (arg0->x <= (temp_v0_2->x + var_fv0_real)) && - ((temp_v0_2->z - var_fv0_real) <= arg0->z) && (arg0->z <= (temp_v0_2->z + var_fv0_real))) { + for (i = ARRAY_COUNT(D_80B4A090) - 1; i >= 0; i--) { + platformPos = &D_80B4A090[i]; + if (((platformPos->y - 150.0f) <= pos->y) && (pos->y <= (platformPos->y + 150.0f)) && + ((platformPos->x - range) <= pos->x) && (pos->x <= (platformPos->x + range)) && + ((platformPos->z - range) <= pos->z) && (pos->z <= (platformPos->z + range))) { break; } } - return var_v1; + return i; } -s16 func_80B44870(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { +s16 EnZf_FindPlatform2__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { Vec3f* temp_s0; f32 temp_fv0; f32 var_fs0; @@ -389,7 +441,7 @@ s16 func_80B44870(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { var_s7 = 0; var_fs1 = 99999.0f; var_s4 = var_s5 = -1; - temp_s3 = func_80B446A8(&player->actor.world.pos, arg1); + temp_s3 = EnZf_FindPlatform1__(&player->actor.world.pos, arg1); if (arg0->y > 420.0f) { var_fs3 = 50.0f; var_s7 = 8; @@ -411,7 +463,7 @@ s16 func_80B44870(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { if (var_s0 == temp_s3) { continue; } - if (((temp_s3 == (-1)) && ((Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s0]) < var_fs3)))) { + if (((temp_s3 == -1) && ((Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s0]) < var_fs3)))) { continue; } temp_fv0 = Math_Vec3f_DistXYZ(arg0, &D_80B4A090[var_s0]); @@ -453,7 +505,7 @@ s16 func_80B44870(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { return var_s5; } -s32 func_80B44B14(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { +s32 EnZf_FindPlatform3__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { Vec3f* temp_s0; f32 temp_fv0; f32 var_fs0; @@ -469,7 +521,7 @@ s32 func_80B44B14(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { var_s1 = 7; var_s4 = 0; - var_fp = func_80B446A8(&player->actor.world.pos, -1); + var_fp = EnZf_FindPlatform1__(&player->actor.world.pos, -1); var_fs2 = 500.0f; var_fs0 = 99998.0f; var_fs1 = 99999.0f; @@ -515,7 +567,7 @@ s32 func_80B44CF0(PlayState* play, EnZf* this) { Actor* playerFocusActor; player = GET_PLAYER(play); - if (this->actor.params >= 0) { + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 if (player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { return false; } else { @@ -525,7 +577,7 @@ s32 func_80B44CF0(PlayState* play, EnZf* this) { if (!Actor_OtherIsLockedOn(play, &this->actor)) { return true; } - if (this->actor.params == -2) { + if (this->actor.params == ENZF_TYPE_DINOLFOS) { playerFocusActor = player->focusActor; if (playerFocusActor == NULL) { return false; @@ -544,98 +596,97 @@ s32 func_80B44CF0(PlayState* play, EnZf* this) { } void func_80B44DC4(EnZf* this, PlayState* play) { - s16 var_v0; + s16 relYawTowardsPlayer; - var_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - var_v0 = ABS(var_v0); - if (var_v0 >= 0x1B58) { - func_80B483E4(this, play); + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + relYawTowardsPlayer = ABS(relYawTowardsPlayer); + if (relYawTowardsPlayer >= 0x1B58) { + EnZf_Setup12or5___(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { - func_80B45384(this); + EnZf_SetupIdle_(this); } } -s32 func_80B44E8C(PlayState* play, EnZf* this) { - s16 var_t0_sp2E; - Actor* temp_v0_2_sp28; +s32 EnZf_PickAction_(PlayState* play, EnZf* this) { + s16 absRelWallYaw; + Actor* explosive; - var_t0_sp2E = this->actor.wallYaw - this->actor.shape.rot.y; - var_t0_sp2E = ABS(var_t0_sp2E); + absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; + absRelWallYaw = ABS(absRelWallYaw); if (func_800354B4(play, &this->actor, 100.0f, 0x5DC0, 0x2AA8, this->actor.shape.rot.y) != 0) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_t0_sp2E) < 0x2EE0) && + if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { - func_80B48210(this); + EnZf_Setup22_(this); } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { - func_80B48210(this); + EnZf_Setup22_(this); } else { - func_80B46E8C(this); + EnZf_Setup11_(this); } return true; } - temp_v0_2_sp28 = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); - if (temp_v0_2_sp28 != NULL) { + explosive = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_EXPLOSIVE, 80.0f); + if (explosive != NULL) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_t0_sp2E < 0x2EE0)) || - (temp_v0_2_sp28->id == ACTOR_EN_BOM_CHU)) { - if ((temp_v0_2_sp28->id == ACTOR_EN_BOM_CHU) && - (Actor_WorldDistXYZToActor(&this->actor, temp_v0_2_sp28) < 80.0f) && - ((s16)(this->actor.shape.rot.y - temp_v0_2_sp28->world.rot.y + 0x8000) < 0x3E80)) { - func_80B48210(this); + if (((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (absRelWallYaw < 0x2EE0)) || + (explosive->id == ACTOR_EN_BOM_CHU)) { + if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && + ((s16)(this->actor.shape.rot.y - explosive->world.rot.y + 0x8000) < 0x3E80)) { + EnZf_Setup22_(this); } else { - func_80B49B60(this, 4.0f); + EnZf_SetupCirclePlayer___(this, 4.0f); } } else { - func_80B46E8C(this); + EnZf_Setup11_(this); } return true; } return false; } -void func_80B450AC(EnZf* this) { +void EnZf_SetupWaitAppear_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 0.0f, 9.0f, Animation_GetLastFrame(&gZfTauntAnim_____), ANIMMODE_LOOP, 0.0f); this->actor.world.pos.y = this->actor.floorHeight + 300.0f; - this->unk404 = this->actor.shape.shadowAlpha = 0; - this->unk3F0 = 0xA; - this->unk3E4 = 1; - this->unk3DC = 0; + this->alpha_ = this->actor.shape.shadowAlpha = 0; + this->timer_ = 10; + this->actionState_ = 1; + this->action = ENZF_ACTION_WAIT_APPEAR_; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B44050(this, func_80B45174); + EnZf_SetupAction(this, EnZf_WaitAppear_); } -void func_80B45174(EnZf* this, PlayState* play) { - if (this->unk3F0 == 1) { +void EnZf_WaitAppear_(EnZf* this, PlayState* play) { + if (this->timer_ == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - if (this->actor.params == 0) { + if (this->actor.params == ENZF_TYPE_0) { func_800F5ACC(NA_BGM_MINI_BOSS); } } - if (this->unk3F0 != 0) { - if (this->actor.params != -1) { - this->unk3F0 -= 1; + if (this->timer_ != 0) { + if (this->actor.params != ENZF_TYPE_NEG1) { + this->timer_--; } else if (this->actor.xzDistToPlayer <= 160.0f) { - this->unk3F0 = 0; + this->timer_ = 0; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } this->actor.world.pos.y = this->actor.floorHeight + 300.0f; } else { - if (this->unk404 < 0xFF) { - this->unk404 += 0x33; + if (this->alpha_ < 255) { + this->alpha_ += 51; } } - if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->unk3E4 != 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->actionState_ != 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ONGND); Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); - this->unk3E4 = 0; + this->actionState_ = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; @@ -643,74 +694,75 @@ void func_80B45174(EnZf* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { - this->unk404 = 0xFF; - if (this->actor.params > 0) { - func_80B47360(this, play); + this->alpha_ = 255; + if (this->actor.params > 0) { // ENZF_TYPE_1 + EnZf_Setup18_(this, play); } else { - func_80B45384(this); + EnZf_SetupIdle_(this); } } - this->actor.shape.shadowAlpha = this->unk404; + this->actor.shape.shadowAlpha = this->alpha_; } -void func_80B45384(EnZf* this) { +void EnZf_SetupIdle_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTaunt2Anim_____, 1.0f, 0.0f, Animation_GetLastFrame(&gZfTaunt2Anim_____), ANIMMODE_LOOP_INTERP, -4.0f); - this->unk3DC = 3; - this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->action = ENZF_ACTION_IDLE_; + this->timer_ = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B44050(this, func_80B4543C); + EnZf_SetupAction(this, EnZf_Idle_); } -void func_80B4543C(EnZf* this, PlayState* play) { +void EnZf_Idle_(EnZf* this, PlayState* play) { Player* player; s32 pad; - s16 var_v1_sp26; - s16 var_v1_2; + s16 absYawTowardsPlayerRelToHead; + s16 absYawDiffWithPlayer; player = GET_PLAYER(play); - var_v1_sp26 = (this->actor.yawTowardsPlayer - this->unk3EC) - this->actor.shape.rot.y; - var_v1_sp26 = ABS(var_v1_sp26); + absYawTowardsPlayerRelToHead = this->actor.yawTowardsPlayer - this->headRot - this->actor.shape.rot.y; + absYawTowardsPlayerRelToHead = ABS(absYawTowardsPlayerRelToHead); SkelAnime_Update(&this->skelAnime); - if (!func_80B49C2C(play, this)) { - if (this->actor.params == -2) { - if (this->unk3F4 != 0) { - this->unk3F4 -= 1; - if (var_v1_sp26 < 0x1FFE) { - this->unk3F4 = 0; + if (!EnZf_ReactToProjectile_(play, this)) { + if (this->actor.params == ENZF_TYPE_DINOLFOS) { + if (this->timer2_ != 0) { + this->timer2_--; + if (absYawTowardsPlayerRelToHead < 0x1FFE) { + this->timer2_ = 0; } else { return; } - } else if (func_80B44E8C(play, this)) { + } else if (EnZf_PickAction_(play, this)) { return; } } - var_v1_2 = player->actor.shape.rot.y - this->actor.shape.rot.y; - var_v1_2 = ABS(var_v1_2); - if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != 0) && (var_v1_2 >= 0x1F40)) { + absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; + absYawDiffWithPlayer = ABS(absYawDiffWithPlayer); + if ((this->actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != 0) && + (absYawDiffWithPlayer >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - if (var_v1_2) {} - func_80B483E4(this, play); - } else if (this->unk3F0 != 0) { - this->unk3F0 -= 1; + if (absYawDiffWithPlayer) {} + EnZf_Setup12or5___(this, play); + } else if (this->timer_ != 0) { + this->timer_--; } else { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 100.0f) && (Rand_ZeroOne() < 0.3f)) { - if (this->actor.params == -2) { + if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - func_80B45E30(this); + EnZf_Setup13_(this); } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } } else if (Rand_ZeroOne() > 0.3f) { - func_80B456B4(this, play); + EnZf_Setup5_(this, play); } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } } else { - func_80B4604C(this); + EnZf_Setup6_(this); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -719,19 +771,19 @@ void func_80B4543C(EnZf* this, PlayState* play) { } } -void func_80B456B4(EnZf* this, PlayState* play) { +void EnZf_Setup5_(EnZf* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); - this->unk3DC = 5; - if (this->actor.params >= 0) { - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - this->unk402 = func_80B44B14(&this->actor.world.pos, this->unk3FE, this->unk400, play); - this->unk3E4 = 0; + this->action = ENZF_ACTION_5; + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + this->unk402 = EnZf_FindPlatform3__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->actionState_ = 0; } this->actor.speed = 0.0f; - func_80B44050(this, func_80B45748); + EnZf_SetupAction(this, EnZf_5_); } -void func_80B45748(EnZf* this, PlayState* play) { +void EnZf_5_(EnZf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad1; @@ -746,16 +798,16 @@ void func_80B45748(EnZf* this, PlayState* play) { sp44 = 350.0f; sp40 = 0.0f; player = GET_PLAYER(play); - if (this->actor.params >= 0) { - sp48 = func_80B446A8(&player->actor.world.pos, -1); - this->unk3FE = func_80B446A8(&this->actor.world.pos, sp48); + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + sp48 = EnZf_FindPlatform1__(&player->actor.world.pos, -1); + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, sp48); if (this->actor.world.pos.y >= 420.0f) { sp44 = 270.0f; } } - if (!func_80B49C2C(play, this)) { + if (!EnZf_ReactToProjectile_(play, this)) { if (sp48 != this->unk3FE) { - this->unk402 = func_80B44B14(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unk402 = EnZf_FindPlatform3__(&this->actor.world.pos, this->unk3FE, this->unk400, play); if ((sp48 < 0) && (this->unk402 == this->unk3FE)) { sp48 = this->unk3FE; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -769,8 +821,8 @@ void func_80B45748(EnZf* this, PlayState* play) { if ((this->unk3F8 && (this->actor.speed > 0.0f)) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_v1 >= 0x5C19))) { if ((Actor_WorldDistXZToPoint(&this->actor, &D_80B4A090[this->unk402]) < sp44) && - !func_80B44058(this, play, 191.9956f)) { - func_80B45E30(this); + !EnZf_TestNoFloorAhead_(this, play, 191.9956f)) { + EnZf_Setup13_(this); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 20.0f; } @@ -784,7 +836,7 @@ void func_80B45748(EnZf* this, PlayState* play) { } } } - if (Actor_OtherIsLockedOn(play, &this->actor) != 0) { + if (Actor_OtherIsLockedOn(play, &this->actor)) { sp40 = 100.0f; } if (this->actor.xzDistToPlayer <= (70.0f + sp40)) { @@ -801,7 +853,7 @@ void func_80B45748(EnZf* this, PlayState* play) { (var_v1 >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); return; } } @@ -812,36 +864,36 @@ void func_80B45748(EnZf* this, PlayState* play) { if (sp48 == this->unk3FE) { if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { if (Rand_ZeroOne() > 0.5f) { - func_80B462E4(this, play); + EnZf_Setup7or5___(this, play); } else { - func_80B45384(this); + EnZf_SetupIdle_(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { if ((Rand_ZeroOne() > 0.05f) && func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else if (Rand_ZeroOne() > 0.5f) { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } else { - func_80B45384(this); + EnZf_SetupIdle_(this); } } else if (this->unk3F8) { - func_80B462E4(this, play); + EnZf_Setup7or5___(this, play); } else if (Rand_ZeroOne() < 0.1f) { - func_80B45384(this); + EnZf_SetupIdle_(this); } } - if (this->actor.params == -2) { - if (!func_80B44E8C(play, this)) { + if (this->actor.params == ENZF_TYPE_DINOLFOS) { + if (!EnZf_PickAction_(play, this)) { if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { if (Actor_IsLockedOn(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - func_80B45E30(this); + EnZf_Setup13_(this); return; } } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); return; } } @@ -860,60 +912,61 @@ void func_80B45748(EnZf* this, PlayState* play) { } } -void func_80B45E30(EnZf* this) { +void EnZf_Setup13_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); - this->unk3F0 = 0; - this->unk3E4 = 1; + this->timer_ = 0; + this->actionState_ = 1; this->actor.velocity.y = 15.0f; - if (this->actor.params >= 0) { + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 this->actor.speed = 16.0f; } else { this->actor.speed = 10.0f; } - this->unk3DC = 0xD; + this->action = ENZF_ACTION_13; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - func_80B44050(this, func_80B45EF0); + EnZf_SetupAction(this, EnZf_13_); } -void func_80B45EF0(EnZf* this, PlayState* play) { - if (this->unk3F0 != 0) { +void EnZf_13_(EnZf* this, PlayState* play) { + if (this->timer_ != 0) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; - this->unk3E4 = 0; + this->actionState_ = 0; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; } } if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk3F0 == 0) { + if (this->timer_ == 0) { Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); - this->unk3F0 = 0xA; + this->timer_ = 10; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else { this->actor.speed = 0.0f; - this->unk3E4 = 0; - func_80B456B4(this, play); + this->actionState_ = 0; + EnZf_Setup5_(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - if ((this->actor.params == -2) && (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && + ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) != 0)) { if (func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } } } -void func_80B4604C(EnZf* this) { +void EnZf_Setup6_(EnZf* this) { Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); - this->unk3DC = 6; - func_80B44050(this, func_80B46098); + this->action = ENZF_ACTION_6; + EnZf_SetupAction(this, EnZf_6_); } -void func_80B46098(EnZf* this, PlayState* play) { +void EnZf_6_(EnZf* this, PlayState* play) { s32 pad; s16 temp_v0; s16 var_v1; @@ -921,7 +974,8 @@ void func_80B46098(EnZf* this, PlayState* play) { f32 var_fv1; player = GET_PLAYER(play); - if (!func_80B49C2C(play, this) && ((this->actor.params != -2) || !func_80B44E8C(play, this))) { + if (!EnZf_ReactToProjectile_(play, this) && + ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this))) { temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp_v0 > 0) { var_v1 = (temp_v0 * 0.25f) + 2000.0f; @@ -943,18 +997,18 @@ void func_80B46098(EnZf* this, PlayState* play) { } this->skelAnime.playSpeed = -var_fv1; SkelAnime_Update(&this->skelAnime); - if (this->actor.params >= 0) { - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - if (func_80B446A8(&player->actor.world.pos, -1) != this->unk3FE) { - func_80B456B4(this, play); + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unk3FE) { + EnZf_Setup5_(this, play); return; } } if (Actor_IsFacingPlayer(&this->actor, 0x1555) != 0) { if (Rand_ZeroOne() > 0.8f) { - func_80B462E4(this, play); + EnZf_Setup7or5___(this, play); } else { - func_80B456B4(this, play); + EnZf_Setup5_(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { @@ -963,24 +1017,24 @@ void func_80B46098(EnZf* this, PlayState* play) { } } -void func_80B462E4(EnZf* this, PlayState* play) { - if ((this->actor.params < 0) || +void EnZf_Setup7or5___(EnZf* this, PlayState* play) { + if ((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); this->actor.speed = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; - this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 20.0f; - this->unk3E4 = 0; - this->unk3DC = 7; - this->unk408 = 0.0f; - func_80B44050(this, func_80B463E4); + this->timer_ = (Rand_ZeroOne() * 10.0f) + 20.0f; + this->actionState_ = 0; + this->action = ENZF_ACTION_7; + this->dodgeSpeed___ = 0.0f; + EnZf_SetupAction(this, EnZf_7_); } else { - func_80B456B4(this, play); + EnZf_Setup5_(this, play); } } -void func_80B463E4(EnZf* this, PlayState* play) { +void EnZf_7_(EnZf* this, PlayState* play) { s16 sp56; s32 beforeCurFrame; s32 prevFrame; @@ -993,7 +1047,8 @@ void func_80B463E4(EnZf* this, PlayState* play) { player = GET_PLAYER(play); sp3C = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - if (!func_80B49C2C(play, this) && ((this->actor.params != -2) || !func_80B44E8C(play, this))) { + if (!EnZf_ReactToProjectile_(play, this) && + ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; sp56 = player->actor.shape.rot.y + 0x8000; if (Math_SinS(sp56 - this->actor.shape.rot.y) >= 0.0f) { @@ -1007,7 +1062,7 @@ void func_80B463E4(EnZf* this, PlayState* play) { this->actor.speed = 8.0f; } } - if (this->actor.params >= 0) { + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 if (this->unk3F8) { this->actor.speed = -this->actor.speed; } @@ -1039,22 +1094,22 @@ void func_80B463E4(EnZf* this, PlayState* play) { sp3C = 100.0f; } if (this->actor.xzDistToPlayer <= (70.0f + sp3C)) { - Math_SmoothStepToF(&this->unk408, -4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed___, -4.0f, 1.0f, 1.5f, 0.0f); } else if ((90.0f + sp3C) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->unk408, 4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed___, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk408, 0.0f, 1.0f, 5.65f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed___, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->unk408 != 0.0f) && !func_80B441C4(this, play, this->unk408)) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk408; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk408; + if ((this->dodgeSpeed___ != 0.0f) && !EnZf_TestNoFloorAhead2_(this, play, this->dodgeSpeed___)) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->dodgeSpeed___; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->dodgeSpeed___; } - if (ABS(this->actor.speed) >= ABS(this->unk408)) { + if (ABS(this->actor.speed) >= ABS(this->dodgeSpeed___)) { this->skelAnime.playSpeed = this->actor.speed * 0.75f; } else if (this->skelAnime.playSpeed < 0.0f) { - this->skelAnime.playSpeed = this->unk408 * -0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed___ * -0.75f; } else { - this->skelAnime.playSpeed = this->unk408 * 0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed___ * 0.75f; } prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -1068,34 +1123,34 @@ void func_80B463E4(EnZf* this, PlayState* play) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - if ((Math_CosS(sp56 - this->actor.shape.rot.y) < -0.85f) || (this->unk3F0 == 0)) { + if ((Math_CosS(sp56 - this->actor.shape.rot.y) < -0.85f) || (this->timer_ == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { - func_80B45384(this); + EnZf_SetupIdle_(this); } - } else if (this->unk3F0 != 0) { - this->unk3F0 -= 1; + } else if (this->timer_ != 0) { + this->timer_--; } } } -void func_80B46A24(EnZf* this) { +void EnZf_Setup9_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfSlashAnim, 1.25f, 0.0f, Animation_GetLastFrame(&gZfSlashAnim), ANIMMODE_ONCE, -4.0f); - if (this->actor.params == -2) { + if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->skelAnime.playSpeed = 1.75f; } - this->unk464.base.atFlags &= ~AT_BOUNCED; - this->unk3DC = 9; + this->swordCollider.base.atFlags &= ~AT_BOUNCED; + this->action = ENZF_ACTION_9; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.speed = 0.0f; - func_80B44050(this, func_80B46AE0); + EnZf_SetupAction(this, EnZf_9_); } -void func_80B46AE0(EnZf* this, PlayState* play) { +void EnZf_9_(EnZf* this, PlayState* play) { Player* player; s16 var_v0; s16 var_v0_2; @@ -1106,18 +1161,18 @@ void func_80B46AE0(EnZf* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); } if (SkelAnime_Update(&this->skelAnime)) { - EffectBlure_AddSpace(Effect_GetByIndex(this->unk414)); - if ((this->actor.params == -2) && !Actor_IsFacingPlayer(&this->actor, 0x1554)) { - func_80B45384(this); - this->unk3F0 = (Rand_ZeroOne() * 5.0f) + 5.0f; - this->unk3F4 = (Rand_ZeroOne() * 20.0f) + 100.0f; + EffectBlure_AddSpace(Effect_GetByIndex(this->swordBlureEffectIndex)); + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && !Actor_IsFacingPlayer(&this->actor, 0x1554)) { + EnZf_SetupIdle_(this); + this->timer_ = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->timer2_ = (Rand_ZeroOne() * 20.0f) + 100.0f; } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { - func_80B45384(this); - this->unk3F0 = (Rand_ZeroOne() * 5.0f) + 5.0f; + EnZf_SetupIdle_(this); + this->timer_ = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } else { var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; var_v0 = ABS(var_v0); @@ -1126,74 +1181,74 @@ void func_80B46AE0(EnZf* this, PlayState* play) { var_v0_2 = ABS(var_v0_2); if (var_v0_2 > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_HOSTILE_LOCK_ON | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (this->actor.isLockedOn != 0) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } } else { - func_80B46A24(this); + EnZf_Setup9_(this); } } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } } } } } -void func_80B46D64(EnZf* this) { +void EnZf_Setup8_(EnZf* this) { f32 f = this->skelAnime.curFrame - 3.0f; Animation_Change(&this->skelAnime, &gZfSlashAnim, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); - this->unk3DC = 8; - func_80B44050(this, func_80B46DD4); + this->action = ENZF_ACTION_8; + EnZf_SetupAction(this, EnZf_8_); } -void func_80B46DD4(EnZf* this, PlayState* play) { +void EnZf_8_(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { - func_80B45384(this); + EnZf_SetupIdle_(this); } else if ((Rand_ZeroOne() > 0.2f) && func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } } } -void func_80B46E8C(EnZf* this) { +void EnZf_Setup11_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); - this->unk3F0 = 0; - this->unk3E4 = 1; - this->unk3DC = 0xB; + this->timer_ = 0; + this->actionState_ = 1; + this->action = ENZF_ACTION_11; this->actor.velocity.y = 15.0f; this->actor.speed = -15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - func_80B44050(this, func_80B46F2C); + EnZf_SetupAction(this, EnZf_11_); } -void func_80B46F2C(EnZf* this, PlayState* play) { - if (this->unk3F0 != 0) { +void EnZf_11_(EnZf* this, PlayState* play) { + if (this->timer_ != 0) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; - this->unk3E4 = 0; + this->actionState_ = 0; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; } } if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk3F0 == 0) { + if (this->timer_ == 0) { Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); - this->unk3F0 = 0xA; + this->timer_ = 10; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else if ((play->gameplayFrames % 2) != 0) { - func_80B483E4(this, play); + EnZf_Setup12or5___(this, play); } else { - func_80B45384(this); + EnZf_SetupIdle_(this); } } if ((play->state.frames & 0x5F) == 0) { @@ -1201,25 +1256,25 @@ void func_80B46F2C(EnZf* this, PlayState* play) { } } -void func_80B47050(EnZf* this) { +void EnZf_Setup14_(EnZf* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; - this->unk3E4 = 0; + this->actionState_ = 0; } else { - this->unk3E4 = 1; + this->actionState_ = 1; } - if (this->unk410 == 0xF) { - this->unk3F6 = 0x24; + if (this->lastDamageReaction == ENZF_DMG_REACT_F) { + this->unk3F6 = 36; } else { Animation_PlayOnceSetSpeed(&this->skelAnime, &gZfDamagedAnim___, 0.0f); } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->unk3DC = 0xE; - func_80B44050(this, func_80B47120); + this->action = ENZF_ACTION_14; + EnZf_SetupAction(this, EnZf_14_); } -void func_80B47120(EnZf* this, PlayState* play) { +void EnZf_14_(EnZf* this, PlayState* play) { s16 var_v0; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1229,27 +1284,27 @@ void func_80B47120(EnZf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->unk3E4 = 0; + this->actionState_ = 0; } if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - func_80B48CEC(this); - } else if ((this->actor.params != -2) || !func_80B44E8C(play, this)) { - if (D_80B4A1B4 != -1) { + EnZf_SetupDie_(this); + } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this)) { + if (D_80B4A1B4 != ENZF_TYPE_NEG1) { func_80B44DC4(this, play); } else { var_v0 = this->actor.wallYaw - this->actor.shape.rot.y; var_v0 = ABS(var_v0); - if ((this->actor.params == -2) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_v0) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B48210(this); - } else if (!func_80B49C2C(play, this)) { - if (this->actor.params != -2) { + EnZf_Setup22_(this); + } else if (!EnZf_ReactToProjectile_(play, this)) { + if (this->actor.params != ENZF_TYPE_DINOLFOS) { func_80B44DC4(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { func_80B44DC4(this, play); } @@ -1259,25 +1314,25 @@ void func_80B47120(EnZf* this, PlayState* play) { } } -void func_80B47360(EnZf* this, PlayState* play) { +void EnZf_Setup18_(EnZf* this, PlayState* play) { f32 var_fv0; f32 temp_fv1; var_fv0 = 0.0f; temp_fv1 = Animation_GetLastFrame(&gZfTurnAroundAnim__); - if (this->unk3DC < 0x11) { + if (this->action <= ENZF_ACTION_16) { var_fv0 = -4.0f; } Animation_Change(&this->skelAnime, &gZfTurnAroundAnim__, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); - this->unk3DC = 0x12; + this->action = ENZF_ACTION_18; this->actor.speed = 0.0f; - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B44050(this, func_80B4743C); + EnZf_SetupAction(this, EnZf_18_); } -void func_80B4743C(EnZf* this, PlayState* play) { +void EnZf_18_(EnZf* this, PlayState* play) { s16 temp_v1; temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]) + 0x8000; @@ -1285,22 +1340,22 @@ void func_80B4743C(EnZf* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = temp_v1 - 0x8000; - func_80B4779C(this, play); + EnZf_SetupJump19__(this, play); this->unk3FA = 1; } } -void func_80B474E4(EnZf* this) { - this->unk3E4 = 0; +void EnZf_SetupJump20__(EnZf* this) { + this->actionState_ = 0; Animation_MorphToPlayOnce(&this->skelAnime, D_80B4A280[0], -4.0f); - this->unk3DC = 0x14; + this->action = ENZF_ACTION_JUMP_20__; this->actor.speed = 0.0f; this->unk40C = 0.0f; - this->unk408 = 0.0f; - func_80B44050(this, func_80B47544); + this->dodgeSpeed___ = 0.0f; + EnZf_SetupAction(this, EnZf_Jump20__); } -void func_80B47544(EnZf* this, PlayState* play) { +void EnZf_Jump20__(EnZf* this, PlayState* play) { f32 var_fv0; f32 sp40; @@ -1310,23 +1365,23 @@ void func_80B47544(EnZf* this, PlayState* play) { if (this->actor.world.pos.y >= 420.0f) { sp40 = 250.0f; } - if ((this->actor.xzDistToPlayer < sp40) && (this->unk3E4 != 1)) { + if ((this->actor.xzDistToPlayer < sp40) && (this->actionState_ != 1)) { this->actor.shape.rot.y = this->actor.world.rot.y; - func_80B47360(this, play); + EnZf_Setup18_(this, play); } else { - if (this->unk3E4 != 1) { - func_80B49E4C(play, this); + if (this->actionState_ != 1) { + EnZf_ReactToProjectile2_____(play, this); } if (SkelAnime_Update(&this->skelAnime)) { - this->unk3E4 += 1; - if (this->unk3E4 >= 3) { - this->unk3E4 = 0; + this->actionState_ += 1; + if (this->actionState_ >= 3) { + this->actionState_ = 0; } - if ((this->unk408 != 0.0f) || (this->unk40C != 0.0f)) { - this->unk3E4 = 1; + if ((this->dodgeSpeed___ != 0.0f) || (this->unk40C != 0.0f)) { + this->actionState_ = 1; } - var_fv0 = Animation_GetLastFrame(D_80B4A280[this->unk3E4]); - switch (this->unk3E4) { + var_fv0 = Animation_GetLastFrame(D_80B4A280[this->actionState_]); + switch (this->actionState_) { case 0: this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; @@ -1334,8 +1389,8 @@ void func_80B47544(EnZf* this, PlayState* play) { case 1: this->actor.velocity.y = this->unk40C + 10.0f; - this->actor.speed = this->unk408; - this->unk408 = 0.0f; + this->actor.speed = this->dodgeSpeed___; + this->dodgeSpeed___ = 0.0f; this->unk40C = 0.0f; break; @@ -1344,7 +1399,8 @@ void func_80B47544(EnZf* this, PlayState* play) { this->actor.world.pos.y = this->actor.floorHeight; break; } - Animation_Change(&this->skelAnime, D_80B4A280[this->unk3E4], 1.5f, 0.0f, var_fv0, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, D_80B4A280[this->actionState_], 1.5f, 0.0f, var_fv0, ANIMMODE_ONCE, + 0.0f); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1352,16 +1408,16 @@ void func_80B47544(EnZf* this, PlayState* play) { } } -void func_80B4779C(EnZf* this, PlayState* play) { - this->unk3E4 = 0; +void EnZf_SetupJump19__(EnZf* this, PlayState* play) { + this->actionState_ = 0; Animation_PlayOnce(&this->skelAnime, D_80B4A280[0]); - this->unk3DC = 0x13; - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); - func_80B44050(this, func_80B4781C); + this->action = ENZF_ACTION_JUMP_19__; + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + EnZf_SetupAction(this, EnZf_Jump19__); } -void func_80B4781C(EnZf* this, PlayState* play) { +void EnZf_Jump19__(EnZf* this, PlayState* play) { f32 sp74; f32 sp70; f32 var_fs0; @@ -1370,14 +1426,14 @@ void func_80B4781C(EnZf* this, PlayState* play) { f32 var_fv0_sp60; s32 pad2; s16 sp5A; - s32 sp54; - s32 temp_v1_sp50; + s32 prevActionState_; + s32 floorAheadFlags; s32 var_v1_real_sp4C; sp70 = 1.0f; var_fs0 = 550.0f; sp74 = Actor_WorldDistXZToPoint(&this->actor, &D_80B4A090[this->unk402]); - sp54 = this->unk3E4; + prevActionState_ = this->actionState_; if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } @@ -1385,17 +1441,17 @@ void func_80B4781C(EnZf* this, PlayState* play) { var_fs0 = 280.0f; } sp5A = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]); - switch (this->unk3E4) { + switch (this->actionState_) { case 0: this->actor.world.rot.y = sp5A; this->actor.shape.rot.y = sp5A + 0x8000; D_80B4AB30 = 0; this->unk400 = this->unk3FE; - temp_v1_sp50 = 0; - temp_v1_sp50 |= !func_80B44058(this, play, 107.0f) << 0; - temp_v1_sp50 |= !func_80B44058(this, play, 220.0f) << 1; - this->unk3E4 += 1; - switch (temp_v1_sp50) { + floorAheadFlags = 0; + floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 107.0f) << 0; + floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 220.0f) << 1; + this->actionState_ += 1; + switch (floorAheadFlags) { case 1: case 3: this->actor.velocity.y = 12.0f; @@ -1418,14 +1474,14 @@ void func_80B4781C(EnZf* this, PlayState* play) { var_fv0_sp60 += 1.2f; for (var_v1_real_sp4C = 0x14; var_v1_real_sp4C >= 0; var_v1_real_sp4C -= 1, var_fs0_2 += 10.0f, var_fv0_sp60 += 1.2f) { - if (!func_80B44058(this, play, var_fs0_2)) { + if (!EnZf_TestNoFloorAhead_(this, play, var_fs0_2)) { this->actor.speed = var_fv0_sp60; this->actor.velocity.y = 12.0f; break; } } if (this->actor.speed == 0.0f) { - func_80B474E4(this); + EnZf_SetupJump20__(this); } break; } @@ -1441,14 +1497,14 @@ void func_80B4781C(EnZf* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4F0, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); if (var_fs0 <= this->actor.xzDistToPlayer) { - func_80B474E4(this); + EnZf_SetupJump20__(this); } else { if (sp74 < 80.0f) { - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); } } - this->unk3E4 = 0; + this->actionState_ = 0; sp70 = 2.0f; } else { Math_SmoothStepToS(&this->actor.world.rot.y, sp5A, 1, 0xFA0, 0); @@ -1459,27 +1515,27 @@ void func_80B4781C(EnZf* this, PlayState* play) { case 2: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - this->unk3E4 = 0; + this->actionState_ = 0; } break; } - if (sp54 != this->unk3E4) { - Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->unk3E4], sp70); + if (prevActionState_ != this->actionState_) { + Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->actionState_], sp70); } SkelAnime_Update(&this->skelAnime); } -void func_80B47C64(EnZf* this, PlayState* play) { +void EnZf_Setup21_(EnZf* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gZfGetBackUpAndTurnAroundAnim_____); this->actor.world.rot.y += 0x8000; - this->unk3DC = 0x15; + this->action = ENZF_ACTION_21; this->actor.speed = 0.0f; - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - this->unk402 = func_80B44870(&this->actor.world.pos, this->unk3FE, this->unk400, play); - func_80B44050(this, func_80B47CF8); + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + EnZf_SetupAction(this, EnZf_21_); } -void func_80B47CF8(EnZf* this, PlayState* play) { +void EnZf_21_(EnZf* this, PlayState* play) { s16 sp2E; sp2E = this->actor.yawTowardsPlayer; @@ -1489,36 +1545,36 @@ void func_80B47CF8(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.world.rot.y = sp2E; - this->unk3E4 = -1; - func_80B45384(this); + this->actionState_ = -1; + EnZf_SetupIdle_(this); } if (this->skelAnime.curFrame == 22.0f) { this->unk3FA = 0; } } -void func_80B47DA8(EnZf* this) { +void EnZf_Setup16_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfDamagedAnim___, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDamagedAnim___), ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = -4.0f; - this->unk3E4 = 0; + this->actionState_ = 0; } else { - this->unk3E4 = 1; + this->actionState_ = 1; } - if (this->actor.params == -2) { + if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->skelAnime.playSpeed = 4.5f; } - if (this->actor.params < 0) { + if (this->actor.params < 0) { // ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 this->actor.world.rot.y = this->actor.yawTowardsPlayer; } Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DAMAGE); - this->unk3DC = 0x10; - func_80B44050(this, func_80B47EB4); + this->action = ENZF_ACTION_16; + EnZf_SetupAction(this, EnZf_16_); } -void func_80B47EB4(EnZf* this, PlayState* play) { +void EnZf_16_(EnZf* this, PlayState* play) { s16 var_v0; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1528,20 +1584,20 @@ void func_80B47EB4(EnZf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->unk3E4 = 0; + this->actionState_ = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (((this->actor.params != -2) || !func_80B44E8C(play, this)) && SkelAnime_Update(&this->skelAnime) && - (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (D_80B4A1B4 != -1) { - if (this->unk410 == 0xD) { + if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this)) && + SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (D_80B4A1B4 != ENZF_TYPE_NEG1) { + if (this->lastDamageReaction == ENZF_DMG_REACT_D) { D_80B4A1B0 += 1; } else { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!func_80B44058(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - func_80B48210(this); + if (!EnZf_TestNoFloorAhead_(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + EnZf_Setup22_(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { func_80B44DC4(this, play); } @@ -1549,22 +1605,22 @@ void func_80B47EB4(EnZf* this, PlayState* play) { } else { var_v0 = this->actor.wallYaw - this->actor.shape.rot.y; var_v0 = ABS(var_v0); - if ((this->actor.params == -2) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(var_v0) < 0x2EE0) && - (this->actor.xzDistToPlayer < 90.0f)) { - func_80B48210(this); - } else if (!func_80B49C2C(play, this)) { - if (this->actor.params != -2) { + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && + (ABS(var_v0) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { + EnZf_Setup22_(this); + } else if (!EnZf_ReactToProjectile_(play, this)) { + if (this->actor.params != ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!func_80B44058(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - func_80B48210(this); + if (!EnZf_TestNoFloorAhead_(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + EnZf_Setup22_(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { func_80B44DC4(this, play); } } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && func_80B44CF0(play, this)) { - func_80B46A24(this); + EnZf_Setup9_(this); } else { func_80B44DC4(this, play); } @@ -1573,46 +1629,46 @@ void func_80B47EB4(EnZf* this, PlayState* play) { } } -void func_80B48210(EnZf* this) { +void EnZf_Setup22_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); - this->unk3F0 = 0; - this->unk3E4 = 1; - this->unk3DC = 0x16; + this->timer_ = 0; + this->actionState_ = 1; + this->action = ENZF_ACTION_22; this->actor.velocity.y = 22.0f; this->actor.speed = 7.5f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; - func_80B44050(this, func_80B482B8); + EnZf_SetupAction(this, EnZf_22_); } -void func_80B482B8(EnZf* this, PlayState* play) { +void EnZf_22_(EnZf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { func_800355B8(play, &this->unk4F0); func_800355B8(play, &this->unk4E4); } if (SkelAnime_Update(&this->skelAnime)) { - if (this->unk3F0 == 0) { + if (this->timer_ == 0) { Animation_Change(&this->skelAnime, &gZfSlashAnim, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); - this->unk3F0 = 0xA; + this->timer_ = 10; } else if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - func_80B46A24(this); + EnZf_Setup9_(this); Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); this->skelAnime.curFrame = 13.0f; } } } -void func_80B483E4(EnZf* this, PlayState* play) { +void EnZf_Setup12or5___(EnZf* this, PlayState* play) { s16 temp_v1_sp2E; Player* player; f32 temp_ft3; - if ((this->actor.params < 0) || + if ((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); @@ -1624,32 +1680,32 @@ void func_80B483E4(EnZf* this, PlayState* play) { } else if (Math_SinS(temp_v1_sp2E - this->actor.shape.rot.y) < 0.0f) { this->actor.speed = 6.0f; } - this->unk408 = 0.0f; - this->unk3E4 = 0; + this->dodgeSpeed___ = 0.0f; + this->actionState_ = 0; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->unk3DC = 0xC; - func_80B44050(this, func_80B48578); + this->timer_ = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->action = ENZF_ACTION_CIRCLE_PLAYER___; + EnZf_SetupAction(this, EnZf_CirclePlayer___); } else { - func_80B456B4(this, play); + EnZf_Setup5_(this, play); } } -void func_80B48578(EnZf* this, PlayState* play) { +void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { s16 temp_t0_sp56; s16 var_v0; Player* player; s32 prevFrame; s32 beforeCurFrame; s32 pad; - f32 sp40; + f32 extraRadius; f32 absPlaySpeed; player = GET_PLAYER(play); - sp40 = 0.0f; + extraRadius = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); temp_t0_sp56 = player->actor.shape.rot.y; - if (this->actor.params >= 0) { + if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 if (this->unk3F8) { this->actor.speed = -this->actor.speed; } @@ -1686,73 +1742,75 @@ void func_80B48578(EnZf* this, PlayState* play) { this->actor.speed -= 0.125f; } this->actor.world.rot.y = this->actor.shape.rot.y + 0x4000; - if (Actor_OtherIsLockedOn(play, &this->actor) != 0) { - sp40 = 100.0f; + if (Actor_OtherIsLockedOn(play, &this->actor)) { + extraRadius = 100.0f; } - if (this->actor.xzDistToPlayer <= (70.0f + sp40)) { - Math_SmoothStepToF(&this->unk408, -4.0f, 1.0f, 1.5f, 0.0f); - } else if ((90.0f + sp40) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->unk408, 4.0f, 1.0f, 1.5f, 0.0f); + if (this->actor.xzDistToPlayer <= (70.0f + extraRadius)) { + Math_SmoothStepToF(&this->dodgeSpeed___, -4.0f, 1.0f, 1.5f, 0.0f); + } else if ((90.0f + extraRadius) < this->actor.xzDistToPlayer) { + Math_SmoothStepToF(&this->dodgeSpeed___, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->unk408, 0.0f, 1.0f, 5.65f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed___, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->unk408 != 0.0f) && !func_80B441C4(this, play, this->unk408)) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->unk408; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->unk408; + if ((this->dodgeSpeed___ != 0.0f) && !EnZf_TestNoFloorAhead2_(this, play, this->dodgeSpeed___)) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->dodgeSpeed___; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->dodgeSpeed___; } - if (ABS(this->actor.speed) >= ABS(this->unk408)) { + if (ABS(this->actor.speed) >= ABS(this->dodgeSpeed___)) { this->skelAnime.playSpeed = -this->actor.speed * 0.75f; } else { if (this->skelAnime.playSpeed < 0.0f) { - this->skelAnime.playSpeed = this->unk408 * -0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed___ * -0.75f; } else { - this->skelAnime.playSpeed = this->unk408 * 0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed___ * 0.75f; } } prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - this->unk3FE = func_80B446A8(&this->actor.world.pos, this->unk3FE); - if (func_80B446A8(&player->actor.world.pos, -1) != this->unk3FE) { + this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); + if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unk3FE) { this->actor.speed = 0.0f; - if ((this->actor.params >= 0) && (D_80B4A1B4 == this->actor.params)) { - func_80B474E4(this); + if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == this->actor.params)) { + EnZf_SetupJump20__(this); } else { - func_80B456B4(this, play); + EnZf_Setup5_(this, play); } - } else if ((this->actor.params != -2) || !func_80B44E8C(play, this)) { - if (this->unk3F0 == 0) { + } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this)) { + if (this->timer_ == 0) { var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; if (var_v0 < 0) { var_v0 *= -1; } if (var_v0 >= 0x3A98) { - if ((this->actor.params >= 0) && (D_80B4A1B4 == this->actor.params)) { - func_80B474E4(this); + if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == this->actor.params)) { + EnZf_SetupJump20__(this); } else { - func_80B45384(this); - this->unk3F0 = (Rand_ZeroOne() * 5.0f) + 1.0f; + EnZf_SetupIdle_(this); + this->timer_ = (Rand_ZeroOne() * 5.0f) + 1.0f; } - } else if ((this->actor.params >= 0) && (D_80B4A1B4 == this->actor.params)) { - func_80B474E4(this); } else { - this->actor.world.rot.y = this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - (func_80B44CF0(play, this) != 0)) { - func_80B46A24(this); + if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == this->actor.params)) { + EnZf_SetupJump20__(this); } else { - if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && - !func_80B44058(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { - func_80B45E30(this); + this->actor.world.rot.y = this->actor.shape.rot.y; + if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && + (func_80B44CF0(play, this) != 0)) { + EnZf_Setup9_(this); } else { - func_80B456B4(this, play); + if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && + !EnZf_TestNoFloorAhead_(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { + EnZf_Setup13_(this); + } else { + EnZf_Setup5_(this, play); + } } } } y:; //! FAKE } else { - this->unk3F0 -= 1; + this->timer_--; } if ((prevFrame != (s32)this->skelAnime.curFrame) && (((beforeCurFrame < 0xE) && (((s32)absPlaySpeed + prevFrame) >= 0x10)) || @@ -1772,7 +1830,7 @@ typedef struct UnkActor { UNK_TYPE2 unk3F4; } UnkActor; -void func_80B48CEC(EnZf* this) { +void EnZf_SetupDie_(EnZf* this) { Actor* temp_v0; Animation_Change(&this->skelAnime, &gZfDieAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDieAnim), ANIMMODE_ONCE, @@ -1780,13 +1838,13 @@ void func_80B48CEC(EnZf* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; - this->unk3E4 = 0; + this->actionState_ = 0; } else { - this->unk3E4 = 1; + this->actionState_ = 1; } - this->unk3DC = 0xF; + this->action = ENZF_ACTION_DIE_; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (D_80B4A1B4 != -1) { + if (D_80B4A1B4 != ENZF_TYPE_NEG1) { temp_v0 = this->actor.prev; if (temp_v0 != NULL) { ((UnkActor*)temp_v0)->unk3F4 = 0x5A; @@ -1804,10 +1862,10 @@ void func_80B48CEC(EnZf* this) { } D_80B4A1B0 = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); - func_80B44050(this, func_80B48E50); + EnZf_SetupAction(this, EnZf_Die_); } -void func_80B48E50(EnZf* this, PlayState* play) { +void EnZf_Die_(EnZf* this, PlayState* play) { s32 temp_ft1; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1815,21 +1873,21 @@ void func_80B48E50(EnZf* this, PlayState* play) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.15f, 0.0f); - this->unk3E4 = 0; + this->actionState_ = 0; } if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.category != ACTORCAT_PROP) { - if ((this->actor.params >= 0) && (D_80B4A1B4 == -1)) { - Flags_SetSwitch(play, this->unk3FC); + if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == -1)) { + Flags_SetSwitch(play, this->switchFlag); func_800F5B58(); } else { - D_80B4A1B4 = -1; + D_80B4A1B4 = ENZF_TYPE_NEG1; } Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } - if (this->unk404 != 0) { - this->unk404 -= 5; - this->actor.shape.shadowAlpha = this->unk404; + if (this->alpha_ != 0) { + this->alpha_ -= 5; + this->actor.shape.shadowAlpha = this->alpha_; } else { Actor_Kill(&this->actor); } @@ -1841,55 +1899,56 @@ void func_80B48E50(EnZf* this, PlayState* play) { } } -void func_80B48F90(EnZf* this, PlayState* play) { - s16 temp_v0_2; +void EnZf_UpdateHeadRot(EnZf* this, PlayState* play) { + s16 yawTowardsPlayerRelToHead; - if ((this->actor.params == -2) && (this->unk3DC == 3) && (this->unk3F4 != 0)) { - this->unk3EC = Math_SinS(this->unk3F4 * 0x578) * 10920.0f; + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->action == ENZF_ACTION_IDLE_) && (this->timer2_ != 0)) { + this->headRot = Math_SinS(this->timer2_ * 0x578) * 10920.0f; } else { - temp_v0_2 = this->actor.yawTowardsPlayer; - temp_v0_2 -= (s16)(this->unk3EC + this->actor.shape.rot.y); - this->unk3EE = CLAMP(temp_v0_2, -0x7D0, 0x7D0); - this->unk3EC += this->unk3EE; - this->unk3EC = CLAMP(this->unk3EC, -0x1CD7, 0x1CD7); + yawTowardsPlayerRelToHead = this->actor.yawTowardsPlayer; + yawTowardsPlayerRelToHead -= (s16)(this->headRot + this->actor.shape.rot.y); + this->headRotStep = CLAMP(yawTowardsPlayerRelToHead, -0x7D0, 0x7D0); + this->headRot += this->headRotStep; + this->headRot = CLAMP(this->headRot, -0x1CD7, 0x1CD7); } } void func_80B490B4(EnZf* this, PlayState* play) { s32 pad; - s16 var_a3; - - if ((this->unk418.base.acFlags & AC_HIT) && (this->unk3DC < 0xF)) { - this->unk418.base.acFlags &= ~AC_HIT; - if ((((this->actor.params < 0)) || (D_80B4A1B4 != this->actor.params)) && - ((this->actor.colChkInfo.damageReaction != 6))) { - this->unk410 = this->actor.colChkInfo.damageReaction; - Actor_SetDropFlag(&this->actor, &this->unk418.elem, false); - if ((this->actor.colChkInfo.damageReaction == 1) || (this->actor.colChkInfo.damageReaction == 0xF)) { - if (this->unk3DC != 0xE) { + s16 dropParams; + + if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action <= ENZF_ACTION_14)) { + this->bodyCollider.base.acFlags &= ~AC_HIT; + if (((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || (D_80B4A1B4 != this->actor.params)) && + ((this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6))) { + this->lastDamageReaction = this->actor.colChkInfo.damageReaction; + Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, false); + if ((this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_1) || + (this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_F)) { + if (this->action != ENZF_ACTION_14) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); Actor_ApplyDamage(&this->actor); - func_80B47050(this); + EnZf_Setup14_(this); } } else { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (Actor_ApplyDamage(&this->actor) == 0) { - var_a3 = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_4, false); - func_80B48CEC(this); - if (this->actor.params == -2) { - var_a3 = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false); + dropParams = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_4, false); + EnZf_SetupDie_(this); + if (this->actor.params == ENZF_TYPE_DINOLFOS) { + dropParams = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false); } - Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, var_a3); + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, dropParams); Enemy_StartFinishingBlow(play, &this->actor); } else { - if (D_80B4A1B4 != -1) { + if (D_80B4A1B4 != ENZF_TYPE_NEG1) { if (((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && (this->actor.colChkInfo.health < 4)) { - this->unk410 = 0xD; + this->lastDamageReaction = ENZF_DMG_REACT_D; } } - func_80B47DA8(this); + EnZf_Setup16_(this); } } } @@ -1901,14 +1960,14 @@ void EnZf_Update(Actor* thisx, PlayState* play) { s32 pad[2]; func_80B490B4(this, play); - if (this->actor.colChkInfo.damageReaction != 6) { + if (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6) { this->unk3F8 = false; - if ((this->unk3E4 != 1) && (this->unk3DC != 0x13)) { + if ((this->actionState_ != 1) && (this->action != ENZF_ACTION_JUMP_19__)) { if (this->actor.speed != 0.0f) { - this->unk3F8 = func_80B44058(this, play, this->actor.speed * 1.5f); + this->unk3F8 = EnZf_TestNoFloorAhead_(this, play, this->actor.speed * 1.5f); } if (!this->unk3F8) { - this->unk3F8 = func_80B44058(this, play, 0.0f); + this->unk3F8 = EnZf_TestNoFloorAhead_(this, play, 0.0f); } } if (!this->unk3F8) { @@ -1918,16 +1977,16 @@ void EnZf_Update(Actor* thisx, PlayState* play) { UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->unk3E4 = 1; + this->actionState_ = 1; } - this->unk3E8(this, play); + this->actionFunc(this, play); } if (this->actor.colChkInfo.health > 0) { - if ((this->unk3DC != 9) && (this->unk3DC != 0xE)) { - func_80B48F90(this, play); + if ((this->action != ENZF_ACTION_9) && (this->action != ENZF_ACTION_14)) { + EnZf_UpdateHeadRot(this, play); } if ((D_80B4A1B0 != 0) && (D_80B4A1B4 != this->actor.params)) { - func_80B47360(this, play); + EnZf_Setup18_(this, play); D_80B4A1B4 = this->actor.params; D_80B4A1B0 = 0; if (this->actor.prev != NULL) { @@ -1937,261 +1996,271 @@ void EnZf_Update(Actor* thisx, PlayState* play) { } } } - if (this->unk3DC >= 0xF) { - Math_SmoothStepToS(&this->unk3EC, 0, 1, 0x7D0, 0); - if ((this->unk3DC < 0x15) && (this->unk3F4 == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (this->action >= ENZF_ACTION_DIE_) { + Math_SmoothStepToS(&this->headRot, 0, 1, 0x7D0, 0); + if ((this->action <= ENZF_ACTION_JUMP_20__) && (this->timer2_ == 1) && + (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health > 0) { - func_80B47C64(this, play); + EnZf_Setup21_(this, play); } - this->unk3F4 -= 1; + this->timer2_--; } - if (this->unk3F4 >= 2) { - this->unk3F4 -= 1; + if (this->timer2_ >= 2) { + this->timer2_--; } } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 40.0f; if (this->actor.colChkInfo.health > 0) { - if (this->unk404 == 0xFF) { - Collider_UpdateCylinder(&this->actor, &this->unk418); - if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->unk3DC < 0x11)) { - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk418.base); + if (this->alpha_ == 255) { + Collider_UpdateCylinder(&this->actor, &this->bodyCollider); + if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_16)) { + CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } - if (((this->actor.params < 0) || (D_80B4A1B4 != this->actor.params)) && + if (((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || + (D_80B4A1B4 != this->actor.params)) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk418.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } } } - if ((this->unk3DC == 9) && ((this->skelAnime.curFrame >= 14.0f)) && (this->skelAnime.curFrame <= 20.0f)) { - if (!(this->unk464.base.atFlags & AT_BOUNCED) && !(this->unk464.base.acFlags & AC_HIT)) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk464.base); + if ((this->action == ENZF_ACTION_9) && ((this->skelAnime.curFrame >= 14.0f)) && + (this->skelAnime.curFrame <= 20.0f)) { + if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && !(this->swordCollider.base.acFlags & AC_HIT)) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } else { - this->unk464.base.atFlags &= ~AT_BOUNCED; - this->unk464.base.acFlags &= ~AC_HIT; - func_80B46D64(this); + this->swordCollider.base.atFlags &= ~AT_BOUNCED; + this->swordCollider.base.acFlags &= ~AC_HIT; + EnZf_Setup8_(this); } } } -s32 func_80B495FC(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx) { +s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnZf* this = thisx; - switch (arg1) { - case 5: - arg4->y -= this->unk3EC; + switch (limbIndex) { + case ZF_LIMB_HEAD_ROOT: + rot->y -= this->headRot; break; - case 15: + case ZF_LIMB_RIGHT_HAND_AND_SWORD: if (this->unk3FA != 0) { - *arg2 = gLizalfosRightHandDL; + *dList = gLizalfosRightHandDL; } break; - case 33: + case ZF_LIMB_SHEATH: if (this->unk3FA != 0) { - *arg2 = gLizalfosSheathedSwordDL; + *dList = gLizalfosSheathedSwordDL; } break; } return 0; } -void func_80B49688(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx, Gfx** gfx) { +void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Vec3f sp54; Vec3f sp48; - s32 var_s1; + s32 bodyPartIndex; EnZf* this = thisx; - var_s1 = -1; - if (arg1 == 0xF) { - Matrix_MultVec3f(&D_80B4A2BC, &this->unk464.dim.quad[1]); - Matrix_MultVec3f(&D_80B4A2C8, &this->unk464.dim.quad[0]); - Matrix_MultVec3f(&D_80B4A2D4, &this->unk464.dim.quad[3]); - Matrix_MultVec3f(&D_80B4A2E0, &this->unk464.dim.quad[2]); - Collider_SetQuadVertices(&this->unk464, &this->unk464.dim.quad[0], &this->unk464.dim.quad[1], - &this->unk464.dim.quad[2], &this->unk464.dim.quad[3]); + bodyPartIndex = -1; + if (limbIndex == ZF_LIMB_RIGHT_HAND_AND_SWORD) { + Matrix_MultVec3f(&D_80B4A2BC, &this->swordCollider.dim.quad[1]); + Matrix_MultVec3f(&D_80B4A2C8, &this->swordCollider.dim.quad[0]); + Matrix_MultVec3f(&D_80B4A2D4, &this->swordCollider.dim.quad[3]); + Matrix_MultVec3f(&D_80B4A2E0, &this->swordCollider.dim.quad[2]); + Collider_SetQuadVertices(&this->swordCollider, &this->swordCollider.dim.quad[0], + &this->swordCollider.dim.quad[1], &this->swordCollider.dim.quad[2], + &this->swordCollider.dim.quad[3]); Matrix_MultVec3f(&D_80B4A2A4, &sp54); Matrix_MultVec3f(&D_80B4A2B0, &sp48); - if (this->unk3DC == 9) { + if (this->action == ENZF_ACTION_9) { if (this->skelAnime.curFrame < 14.0f) { - EffectBlure_AddSpace(Effect_GetByIndex(this->unk414)); + EffectBlure_AddSpace(Effect_GetByIndex(this->swordBlureEffectIndex)); } else if (this->skelAnime.curFrame < 20.0f) { - EffectBlure_AddVertex(Effect_GetByIndex(this->unk414), &sp54, &sp48); + EffectBlure_AddVertex(Effect_GetByIndex(this->swordBlureEffectIndex), &sp54, &sp48); } } } else { - Actor_SetFeetPos(&this->actor, arg1, 0x2D, &D_80B4A298, 0x26, &D_80B4A298); + Actor_SetFeetPos(&this->actor, limbIndex, ZF_LIMB_LEFT_FOOT_CLAWS, &D_80B4A298, ZF_LIMB_RIGHT_FOOT_CLAWS, + &D_80B4A298); } - switch (arg1) { - case 0x2D: + switch (limbIndex) { + case ZF_LIMB_LEFT_FOOT_CLAWS: Matrix_MultVec3f(&D_80B4A298, &this->unk4F0); break; - case 0x26: + case ZF_LIMB_RIGHT_FOOT_CLAWS: Matrix_MultVec3f(&D_80B4A298, &this->unk4E4); break; } if (this->unk3F6 != 0) { - switch (arg1) { - case 9: - var_s1 = 0; + switch (limbIndex) { + case ZF_LIMB_HEAD: + bodyPartIndex = 0; break; - case 10: - var_s1 = 1; + case ZF_LIMB_NECK: + bodyPartIndex = 1; break; - case 25: - var_s1 = 2; + case ZF_LIMB_ARMOR: + bodyPartIndex = 2; break; - case 16: - var_s1 = 3; + case ZF_LIMB_FOREARM: + bodyPartIndex = 3; break; - case 23: - var_s1 = 4; + case ZF_LIMB_LEFT_FOREARM: + bodyPartIndex = 4; break; - case 48: - var_s1 = 5; + case ZF_LIMB_BODY: + bodyPartIndex = 5; break; - case 14: - var_s1 = 6; + case ZF_LIMB_RIGHT_HAND_AND_SWORD_ROOT: + bodyPartIndex = 6; break; - case 39: - var_s1 = 7; + case ZF_LIMB_RIGHT_SHIN: + bodyPartIndex = 7; break; - case 43: - var_s1 = 8; + case ZF_LIMB_LEFT_SHIN_ROOT: + bodyPartIndex = 8; break; } - if (var_s1 >= 0) { - Matrix_MultVec3f(&D_80B4A2EC, &this->unk4FC[var_s1]); + if (bodyPartIndex >= 0) { + Matrix_MultVec3f(&D_80B4A2EC, &this->bodyPartsPos[bodyPartIndex]); } } } void EnZf_Draw(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; - s32 v; + s32 bodyPartIndex; OPEN_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3533); func_8002EBCC(&this->actor, play, 1); - gSPTexture(D_80B4A2F8, gRegEditor->data[0x360], gRegEditor->data[0x361], 0, G_TX_RENDERTILE, G_ON); + gSPTexture(D_80B4A2F8, IREG(0), IREG(1), 0, G_TX_RENDERTILE, G_ON); gSPSegment(POLY_OPA_DISP++, 8, D_80B4A2F8); - if (this->unk404 == 255) { + if (this->alpha_ == 255) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->unk404); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha_); gSPSegment(POLY_OPA_DISP++, 9, &D_80116280[2]); - POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80B495FC, - func_80B49688, this, POLY_OPA_DISP); + POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_OPA_DISP); if (this->unk3F6 != 0) { thisx->colorFilterTimer += 1; - this->unk3F6 -= 1; - if (!(this->unk3F6 & 3)) { - v = this->unk3F6 >> 2; - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &this->unk4FC[v], 150, 150, 150, 250, 235, 245, 255, - 1.4f); + this->unk3F6--; + if ((this->unk3F6 & 3) == 0) { + bodyPartIndex = this->unk3F6 >> 2; + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &this->bodyPartsPos[bodyPartIndex], 150, 150, 150, + 250, 235, 245, 255, 1.4f); } } } else { Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->unk404); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha_); gSPSegment(POLY_XLU_DISP++, 9, D_80116280); - POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80B495FC, - func_80B49688, this, POLY_XLU_DISP); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, + EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_XLU_DISP); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3601); } -void func_80B49B60(EnZf* this, f32 arg1) { +void EnZf_SetupCirclePlayer___(EnZf* this, f32 speed) { Animation_MorphToLoop(&this->skelAnime, &gZfCautiousWalkAnim___, -1.0f); - this->unk3F0 = (Rand_ZeroOne() * 10.0f) + 8.0f; - if (this->actor.params == -2) { - this->actor.speed = 2.0f * arg1; - this->unk3F0 /= 2; + this->timer_ = (Rand_ZeroOne() * 10.0f) + 8.0f; + if (this->actor.params == ENZF_TYPE_DINOLFOS) { + this->actor.speed = 2.0f * speed; + this->timer_ /= 2; } else { - this->actor.speed = arg1; + this->actor.speed = speed; } - this->unk3E4 = 0; + this->actionState_ = 0; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - this->unk3DC = 0xC; - func_80B44050(this, func_80B48578); + this->action = ENZF_ACTION_CIRCLE_PLAYER___; + EnZf_SetupAction(this, EnZf_CirclePlayer___); } -s32 func_80B49C2C(PlayState* play, EnZf* this) { - Actor* temp_v0_sp1C; - s16 sp1A; - s16 var_t0_sp18; - s16 var_v1; +s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this) { + Actor* projectile; + s16 relYawTowardsProjectile; + s16 noFloorAheadFlags_; + s16 directionFlags_; - temp_v0_sp1C = Actor_GetProjectileActor(play, &this->actor, 600.0f); - if (temp_v0_sp1C != NULL) { - sp1A = Actor_WorldYawTowardActor(&this->actor, temp_v0_sp1C) - (s16)(this->actor.shape.rot.y + 0); + projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); + if (projectile != NULL) { + relYawTowardsProjectile = + Actor_WorldYawTowardActor(&this->actor, projectile) - (s16)(this->actor.shape.rot.y + 0); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - var_t0_sp18 = 0; - if (func_80B44058(this, play, -8.0f)) { - var_t0_sp18 |= 1; + noFloorAheadFlags_ = 0; + if (EnZf_TestNoFloorAhead_(this, play, -8.0f)) { + noFloorAheadFlags_ |= 1; } - if (func_80B44058(this, play, 8.0f)) { - var_t0_sp18 |= 2; + if (EnZf_TestNoFloorAhead_(this, play, 8.0f)) { + noFloorAheadFlags_ |= 2; } this->actor.world.rot.y = this->actor.shape.rot.y; - if ((((this->actor.xzDistToPlayer < 90.0f) || (var_t0_sp18 == 3)) && !func_80B44058(this, play, 135.0f)) || - (temp_v0_sp1C->id == ACTOR_ARMS_HOOK)) { - func_80B48210(this); + if ((((this->actor.xzDistToPlayer < 90.0f) || (noFloorAheadFlags_ == 3)) && + !EnZf_TestNoFloorAhead_(this, play, 135.0f)) || + (projectile->id == ACTOR_ARMS_HOOK)) { + EnZf_Setup22_(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - if (var_t0_sp18 == 0) { - var_v1 = play->gameplayFrames & 1; + if (noFloorAheadFlags_ == 0) { + directionFlags_ = play->gameplayFrames & 1; } else { - var_v1 = var_t0_sp18; + directionFlags_ = noFloorAheadFlags_; } - if ((ABS(sp1A) < 0x2000) || (ABS(sp1A) >= 0x6000)) { - if (var_v1 & 1) { - func_80B49B60(this, 8.0f); + if ((ABS(relYawTowardsProjectile) < 0x2000) || (ABS(relYawTowardsProjectile) >= 0x6000)) { + if (directionFlags_ & 1) { + EnZf_SetupCirclePlayer___(this, 8.0f); } else { - func_80B49B60(this, -8.0f); + EnZf_SetupCirclePlayer___(this, -8.0f); } - } else if (ABS(sp1A) < 0x5FFF) { - if (var_v1 & 1) { - func_80B49B60(this, 4.0f); + } else if (ABS(relYawTowardsProjectile) < 0x5FFF) { + if (directionFlags_ & 1) { + EnZf_SetupCirclePlayer___(this, 4.0f); } else { - func_80B49B60(this, -4.0f); + EnZf_SetupCirclePlayer___(this, -4.0f); } } + //! @bug If ABS(relYawTowardsProjectile) == 0x5FFF the function returns true + //! even though no action has been chosen } return true; } return false; } -s32 func_80B49E4C(PlayState* play, EnZf* this) { - Actor* temp_v0; - s16 sp22; - s16 sp20; +s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this) { + Actor* projectile; + s16 relYawTowardsProjectile; + s16 noFloorAheadFlags_; s16 sp1E; s16 sp1C; sp1C = 0; - temp_v0 = Actor_GetProjectileActor(play, &this->actor, 600.0f); - if (temp_v0 != NULL) { - sp22 = Actor_WorldYawTowardActor(&this->actor, temp_v0) - (s16)(this->actor.shape.rot.y + 0); + projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); + if (projectile != NULL) { + relYawTowardsProjectile = + Actor_WorldYawTowardActor(&this->actor, projectile) - (s16)(this->actor.shape.rot.y + 0); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - sp20 = 0; - if (func_80B44058(this, play, -70.0f)) { - sp20 |= 1; + noFloorAheadFlags_ = 0; + if (EnZf_TestNoFloorAhead_(this, play, -70.0f)) { + noFloorAheadFlags_ |= 1; } - if (func_80B44058(this, play, 70.0f)) { - sp20 |= 2; + if (EnZf_TestNoFloorAhead_(this, play, 70.0f)) { + noFloorAheadFlags_ |= 2; } this->actor.speed = 0.0f; - if ((ABS(sp22) < 0x2000 || ABS(sp22) > 0x5FFF)) { - if (sp20 == 0) { + if ((ABS(relYawTowardsProjectile) < 0x2000 || ABS(relYawTowardsProjectile) > 0x5FFF)) { + if (noFloorAheadFlags_ == 0) { if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; } } else { - switch (sp20) { + switch (noFloorAheadFlags_) { case 1: sp1E = 6; break; @@ -2206,15 +2275,15 @@ s32 func_80B49E4C(PlayState* play, EnZf* this) { break; } } - } else if (ABS(sp22) < 0x5FFF) { - if (sp20 == 0) { + } else if (ABS(relYawTowardsProjectile) < 0x5FFF) { + if (noFloorAheadFlags_ == 0) { if ((play->gameplayFrames % 2) != 0) { sp1E = 6; } else { sp1E = -6; } } else { - switch (sp20) { + switch (noFloorAheadFlags_) { case 1: sp1E = 6; break; @@ -2231,7 +2300,7 @@ s32 func_80B49E4C(PlayState* play, EnZf* this) { } } //! @bug if sp22 is exactly 0x5FFF, sp1E is used uninitialized - this->unk408 = sp1E; + this->dodgeSpeed___ = sp1E; this->unk40C = sp1C; return 1; } 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 5c8c22edf57..8d746134fe2 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -4,40 +4,49 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_zf/object_zf.h" + +typedef enum EnZfType { + ENZF_TYPE_DINOLFOS = -2, + ENZF_TYPE_NEG1, // Lizalfos + ENZF_TYPE_0, // Lizalfos + ENZF_TYPE_1 // Lizalfos +} EnZfType; + struct EnZf; typedef struct EnZf { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ Vec3s jointTable[49]; - /* 0x2B6 */ Vec3s morphTable[49]; - /* 0x3DC */ s32 unk3DC; + /* 0x190 */ Vec3s jointTable[ZF_LIMB_MAX]; + /* 0x2B6 */ Vec3s morphTable[ZF_LIMB_MAX]; + /* 0x3DC */ s32 action; /* 0x3E0 */ s32 unk3E0; - /* 0x3E4 */ s32 unk3E4; - /* 0x3E8 */ void (*unk3E8)(struct EnZf*, struct PlayState*); - /* 0x3EC */ s16 unk3EC; - /* 0x3EE */ s16 unk3EE; - /* 0x3F0 */ s32 unk3F0; - /* 0x3F4 */ s16 unk3F4; + /* 0x3E4 */ s32 actionState_; + /* 0x3E8 */ void (*actionFunc)(struct EnZf*, struct PlayState*); + /* 0x3EC */ s16 headRot; + /* 0x3EE */ s16 headRotStep; + /* 0x3F0 */ s32 timer_; + /* 0x3F4 */ s16 timer2_; /* 0x3F6 */ s16 unk3F6; /* 0x3F8 */ s16 unk3F8; /* 0x3FA */ s16 unk3FA; - /* 0x3FC */ s16 unk3FC; + /* 0x3FC */ s16 switchFlag; /* 0x3FE */ s16 unk3FE; /* 0x400 */ s16 unk400; /* 0x402 */ s16 unk402; - /* 0x404 */ u8 unk404; + /* 0x404 */ u8 alpha_; /* 0x405 */ char pad405[3]; - /* 0x408 */ f32 unk408; + /* 0x408 */ f32 dodgeSpeed___; /* 0x40C */ f32 unk40C; - /* 0x410 */ u8 unk410; + /* 0x410 */ u8 lastDamageReaction; /* 0x411 */ char pad411[3]; - /* 0x414 */ s32 unk414; - /* 0x418 */ ColliderCylinder unk418; - /* 0x464 */ ColliderQuad unk464; + /* 0x414 */ s32 swordBlureEffectIndex; + /* 0x418 */ ColliderCylinder bodyCollider; + /* 0x464 */ ColliderQuad swordCollider; /* 0x4E4 */ Vec3f unk4E4; /* 0x4F0 */ Vec3f unk4F0; - /* 0x4FC */ Vec3f unk4FC[9]; + /* 0x4FC */ Vec3f bodyPartsPos[9]; } EnZf; // size = 0x568 #endif From f93f9742f81807d2100d90f5eaf505e4fe21c025 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 3 Aug 2026 17:25:32 +0200 Subject: [PATCH 065/150] format z_en_zf.c --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 15d5572e4be..b18759614d4 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -32,7 +32,7 @@ void EnZf_Destroy(Actor* thisx, PlayState* play); void EnZf_Update(Actor* thisx, PlayState* play); void EnZf_Draw(Actor* thisx, PlayState* play); -s16 EnZf_FindPlatform1__(Vec3f* arg0, s16 arg1); +s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred); void EnZf_SetupWaitAppear_(EnZf* this); void EnZf_WaitAppear_(EnZf* this, PlayState* play); void EnZf_SetupIdle_(EnZf* this); @@ -64,7 +64,7 @@ void EnZf_Setup12or5___(EnZf* this, PlayState* play); void EnZf_CirclePlayer___(EnZf* this, PlayState* play); void EnZf_SetupDie_(EnZf* this); void EnZf_Die_(EnZf* this, PlayState* play); -void EnZf_SetupCirclePlayer___(EnZf* this, f32 arg1); +void EnZf_SetupCirclePlayer___(EnZf* this, f32 speed); s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this); s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this); From 05fda04f829c38bf0cf2ac3bfcfa73d53f689f29 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 4 Aug 2026 16:37:54 +0200 Subject: [PATCH 066/150] wip EnZf docs --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 696 +++++++++++++----------- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 18 +- 2 files changed, 378 insertions(+), 336 deletions(-) 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 b18759614d4..551845949cc 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -45,21 +45,21 @@ void EnZf_Setup6_(EnZf* this); void EnZf_6_(EnZf* this, PlayState* play); void EnZf_Setup7or5___(EnZf* this, PlayState* play); void EnZf_7_(EnZf* this, PlayState* play); -void EnZf_Setup9_(EnZf* this); -void EnZf_9_(EnZf* this, PlayState* play); -void EnZf_8_(EnZf* this, PlayState* play); +void EnZf_SetupAttack(EnZf* this); +void EnZf_Attack(EnZf* this, PlayState* play); +void EnZf_AttackBounced(EnZf* this, PlayState* play); void EnZf_Setup11_(EnZf* this); void EnZf_11_(EnZf* this, PlayState* play); -void EnZf_14_(EnZf* this, PlayState* play); +void EnZf_Stunned_(EnZf* this, PlayState* play); void EnZf_Setup18_(EnZf* this, PlayState* play); void EnZf_18_(EnZf* this, PlayState* play); void EnZf_Jump20__(EnZf* this, PlayState* play); void EnZf_SetupJump19__(EnZf* this, PlayState* play); void EnZf_Jump19__(EnZf* this, PlayState* play); void EnZf_21_(EnZf* this, PlayState* play); -void EnZf_16_(EnZf* this, PlayState* play); -void EnZf_Setup22_(EnZf* this); -void EnZf_22_(EnZf* this, PlayState* play); +void EnZf_Damaged_(EnZf* this, PlayState* play); +void EnZf_SetupJumpAttack__(EnZf* this); +void EnZf_JumpAttack__(EnZf* this, PlayState* play); void EnZf_Setup12or5___(EnZf* this, PlayState* play); void EnZf_CirclePlayer___(EnZf* this, PlayState* play); void EnZf_SetupDie_(EnZf* this); @@ -74,33 +74,67 @@ typedef enum EnZfAction { ENZF_ACTION_5 = 5, ENZF_ACTION_6, ENZF_ACTION_7, - ENZF_ACTION_8, - ENZF_ACTION_9, + ENZF_ACTION_ATTACK_BOUNCED, + ENZF_ACTION_ATTACK, ENZF_ACTION_11 = 11, ENZF_ACTION_CIRCLE_PLAYER___, ENZF_ACTION_13, - ENZF_ACTION_14, + ENZF_ACTION_STUNNED_, ENZF_ACTION_DIE_, - ENZF_ACTION_16, + ENZF_ACTION_DAMAGED_, ENZF_ACTION_18 = 18, ENZF_ACTION_JUMP_19__, ENZF_ACTION_JUMP_20__, ENZF_ACTION_21, - ENZF_ACTION_22 + ENZF_ACTION_JUMP_ATTACK__ } EnZfAction; -static Vec3f D_80B4A090[0x18] = { - { 3560.0f, 100.0f, -1517.0f }, { 3170.0f, 100.0f, -1767.0f }, { 3165.0f, 100.0f, -2217.0f }, - { 3563.0f, 100.0f, -2437.0f }, { 3946.0f, 100.0f, -2217.0f }, { 3942.0f, 100.0f, -1765.0f }, - { 2861.0f, 100.0f, -2394.0f }, { 2776.0f, 100.0f, -1987.0f }, { 4527.0f, 531.0f, -1146.0f }, - { 4442.0f, 531.0f, -1405.0f }, { 4170.0f, 531.0f, -1395.0f }, { 4030.0f, 531.0f, -1162.0f }, - { 4010.0f, 531.0f, -883.0f }, { 4270.0f, 531.0f, -810.0f }, { 4520.0f, 531.0f, -880.0f }, - { 4260.0f, 531.0f, -1035.0f }, { 4757.0f, 531.0f, -1146.0f }, { 3850.0f, 531.0f, -883.0f }, - { 4380.0f, 531.0f, -690.0f }, { 4197.0f, 531.0f, -646.0f }, { 4070.0f, 531.0f, -1575.0f }, - { 3930.0f, 531.0f, -1705.0f }, { 3780.0f, 531.0f, -1835.0f }, { 3560.0f, 531.0f, -1985.0f }, +/** + * Positions of the platforms in Dodongo's Cavern in the lizalfos fights room (room 3). + */ +static Vec3f sDCPlatformPositions_[] = { + // Lower floor + { 3560.0f, 100.0f, -1517.0f }, + { 3170.0f, 100.0f, -1767.0f }, + { 3165.0f, 100.0f, -2217.0f }, + { 3563.0f, 100.0f, -2437.0f }, + { 3946.0f, 100.0f, -2217.0f }, + { 3942.0f, 100.0f, -1765.0f }, + { 2861.0f, 100.0f, -2394.0f }, + { 2776.0f, 100.0f, -1987.0f }, + + // Higher floor + { 4527.0f, 531.0f, -1146.0f }, + { 4442.0f, 531.0f, -1405.0f }, + { 4170.0f, 531.0f, -1395.0f }, + { 4030.0f, 531.0f, -1162.0f }, + { 4010.0f, 531.0f, -883.0f }, + { 4270.0f, 531.0f, -810.0f }, + { 4520.0f, 531.0f, -880.0f }, + // Higher floor extras + // center platform + { 4260.0f, 531.0f, -1035.0f }, + // room sides + { 4757.0f, 531.0f, -1146.0f }, + { 3850.0f, 531.0f, -883.0f }, + { 4380.0f, 531.0f, -690.0f }, + { 4197.0f, 531.0f, -646.0f }, + // "path" to atop of the column + { 4070.0f, 531.0f, -1575.0f }, + { 3930.0f, 531.0f, -1705.0f }, + { 3780.0f, 531.0f, -1835.0f }, + { 3560.0f, 531.0f, -1985.0f }, }; -static s16 D_80B4A1B0 = 0; -static s16 D_80B4A1B4 = ENZF_TYPE_1; +/** + * Incremented when a pair is spawned and the active / foreground / fighting one should retreat. + */ +static s16 sPairedActiveFleeFlag_ = 0; +/** + * When a pair is spawned, this tracks the type of the inactive / background / not fighting one + * (ENZF_TYPE_LIZALFOS_PAIRED_A_ or ENZF_TYPE_LIZALFOS_PAIRED_B_). + * When no pair, or once one of the pair is defeated, this is ENZF_TYPE_LIZALFOS_SINGLE_. + */ +static s16 sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_PAIRED_B_; ActorProfile En_Zf_Profile = { /**/ ACTOR_EN_ZF, @@ -155,46 +189,46 @@ static ColliderQuadInit sSwordColliderQuadInit = { }; typedef enum EnZfDamageReaction { - ENZF_DMG_REACT_0, - ENZF_DMG_REACT_1, + ENZF_DMG_REACT_NONE, + ENZF_DMG_REACT_STUN, ENZF_DMG_REACT_6 = 6, - ENZF_DMG_REACT_D = 13, - ENZF_DMG_REACT_F = 15 + ENZF_DMG_REACT_FLEE = 13, + ENZF_DMG_REACT_ICE = 15 } EnZfDamageReaction; static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, ENZF_DMG_REACT_1), - /* Deku stick */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Slingshot */ DMG_ENTRY(1, ENZF_DMG_REACT_D), - /* Explosive */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Boomerang */ DMG_ENTRY(0, ENZF_DMG_REACT_1), - /* Normal arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Hammer swing */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Hookshot */ DMG_ENTRY(0, ENZF_DMG_REACT_1), - /* Kokiri sword */ DMG_ENTRY(1, ENZF_DMG_REACT_0), - /* Master sword */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Giant's Knife */ DMG_ENTRY(4, ENZF_DMG_REACT_0), - /* Fire arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_D), - /* Ice arrow */ DMG_ENTRY(4, ENZF_DMG_REACT_F), - /* Light arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_D), - /* Unk arrow 1 */ DMG_ENTRY(2, ENZF_DMG_REACT_D), - /* Unk arrow 2 */ DMG_ENTRY(2, ENZF_DMG_REACT_D), - /* Unk arrow 3 */ DMG_ENTRY(2, ENZF_DMG_REACT_D), + /* Deku nut */ DMG_ENTRY(0, ENZF_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(1, ENZF_DMG_REACT_FLEE), + /* Explosive */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(0, ENZF_DMG_REACT_STUN), + /* Normal arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(0, ENZF_DMG_REACT_STUN), + /* Kokiri sword */ DMG_ENTRY(1, ENZF_DMG_REACT_NONE), + /* Master sword */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Giant's Knife */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), + /* Fire arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_FLEE), + /* Ice arrow */ DMG_ENTRY(4, ENZF_DMG_REACT_ICE), + /* Light arrow */ DMG_ENTRY(2, ENZF_DMG_REACT_FLEE), + /* Unk arrow 1 */ DMG_ENTRY(2, ENZF_DMG_REACT_FLEE), + /* Unk arrow 2 */ DMG_ENTRY(2, ENZF_DMG_REACT_FLEE), + /* Unk arrow 3 */ DMG_ENTRY(2, ENZF_DMG_REACT_FLEE), /* Fire magic */ DMG_ENTRY(0, ENZF_DMG_REACT_6), - /* Ice magic */ DMG_ENTRY(3, ENZF_DMG_REACT_F), + /* Ice magic */ DMG_ENTRY(3, ENZF_DMG_REACT_ICE), /* Light magic */ DMG_ENTRY(0, ENZF_DMG_REACT_6), - /* Shield */ DMG_ENTRY(0, ENZF_DMG_REACT_0), - /* Mirror Ray */ DMG_ENTRY(0, ENZF_DMG_REACT_0), - /* Kokiri spin */ DMG_ENTRY(1, ENZF_DMG_REACT_0), - /* Giant spin */ DMG_ENTRY(4, ENZF_DMG_REACT_0), - /* Master spin */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Kokiri jump */ DMG_ENTRY(2, ENZF_DMG_REACT_0), - /* Giant jump */ DMG_ENTRY(8, ENZF_DMG_REACT_0), - /* Master jump */ DMG_ENTRY(4, ENZF_DMG_REACT_0), - /* Unknown 1 */ DMG_ENTRY(0, ENZF_DMG_REACT_0), - /* Unblockable */ DMG_ENTRY(0, ENZF_DMG_REACT_0), - /* Hammer jump */ DMG_ENTRY(4, ENZF_DMG_REACT_0), - /* Unknown 2 */ DMG_ENTRY(0, ENZF_DMG_REACT_0), + /* Shield */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, ENZF_DMG_REACT_NONE), + /* Giant spin */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), + /* Master spin */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Kokiri jump */ DMG_ENTRY(2, ENZF_DMG_REACT_NONE), + /* Giant jump */ DMG_ENTRY(8, ENZF_DMG_REACT_NONE), + /* Master jump */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), + /* Unknown 1 */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), }; static InitChainEntry sInitChain[3] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), @@ -246,7 +280,7 @@ s32 EnZf_TestNoFloorAhead_(EnZf* this, PlayState* play, f32 distance) { } else { distance = -1.0f; } - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { distance = distance * 45.0f; } else { distance = distance * 30.0f; @@ -357,11 +391,11 @@ void EnZf_Init(Actor* thisx, PlayState* play) { SkelAnime_Init(play, &this->skelAnime, &gLizalfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, ZF_LIMB_MAX); } - if (this->actor.params < 0) { // ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 - this->unk400 = this->unk3FE = -1; - D_80B4A1B4 = ENZF_TYPE_NEG1; + if (!ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + this->unkPlatform400 = this->unkPlatform3FE = -1; + sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_SINGLE_; this->actionState_ = 1; - if (this->actor.params == ENZF_TYPE_NEG1) { + if (this->actor.params == ENZF_TYPE_LIZALFOS_SINGLE_) { EnZf_SetupWaitAppear_(this); } else { // ENZF_TYPE_DINOLFOS EnZf_SetupIdle_(this); @@ -369,9 +403,9 @@ void EnZf_Init(Actor* thisx, PlayState* play) { } else { yDiff = player->actor.world.pos.y - this->actor.world.pos.y; if ((ABS(yDiff) <= 100.0f) && !Flags_GetSwitch(play, this->switchFlag)) { - this->unk400 = this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, 0); + this->unkPlatform400 = this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, 0); EnZf_SetupWaitAppear_(this); - D_80B4A1B4 = ENZF_TYPE_1; + sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_PAIRED_B_; } else { Actor_Kill(&this->actor); } @@ -381,7 +415,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { void EnZf_Destroy(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; - if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && + if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (Actor_FindNearby(play, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { func_800F5B58(); } @@ -400,15 +434,15 @@ s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred) { range = 110.0f; } if (preferred != -1) { - platformPos = &D_80B4A090[preferred]; + platformPos = &sDCPlatformPositions_[preferred]; if (((platformPos->y - 150.0f) <= pos->y) && (pos->y <= (platformPos->y + 150.0f)) && ((platformPos->x - range) <= pos->x) && (pos->x <= (platformPos->x + range)) && ((platformPos->z - range) <= pos->z) && (pos->z <= (platformPos->z + range))) { return preferred; } } - for (i = ARRAY_COUNT(D_80B4A090) - 1; i >= 0; i--) { - platformPos = &D_80B4A090[i]; + for (i = ARRAY_COUNT(sDCPlatformPositions_) - 1; i >= 0; i--) { + platformPos = &sDCPlatformPositions_[i]; if (((platformPos->y - 150.0f) <= pos->y) && (pos->y <= (platformPos->y + 150.0f)) && ((platformPos->x - range) <= pos->x) && (pos->x <= (platformPos->x + range)) && ((platformPos->z - range) <= pos->z) && (pos->z <= (platformPos->z + range))) { @@ -418,7 +452,7 @@ s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred) { return i; } -s16 EnZf_FindPlatform2__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { +s16 EnZf_FindPlatform2__(Vec3f* thisPos, s16 platform_arg1, s16 platform_arg2, PlayState* play) { Vec3f* temp_s0; f32 temp_fv0; f32 var_fs0; @@ -428,45 +462,46 @@ s16 EnZf_FindPlatform2__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { s16 temp_s0_2; s16 temp_s3; s16 temp_v1; - s16 var_s0; + s16 i; s16 var_s4; s16 var_s5; - s32 var_s7; // s6 in gc-eu-mq + s32 iMin; Player* player = GET_PLAYER(play); var_fs2 = 585.0f; var_fs3 = 400.0f; var_fs0 = 99998.0f; - var_s0 = 5; - var_s7 = 0; + i = 5; + iMin = 0; var_fs1 = 99999.0f; var_s4 = var_s5 = -1; - temp_s3 = EnZf_FindPlatform1__(&player->actor.world.pos, arg1); - if (arg0->y > 420.0f) { + temp_s3 = EnZf_FindPlatform1__(&player->actor.world.pos, platform_arg1); + if (thisPos->y > 420.0f) { var_fs3 = 50.0f; - var_s7 = 8; - if (arg1 >= 0xF) { + iMin = 8; + if (platform_arg1 >= 15) { var_fs2 = 400.0f; - var_s0 = 0x17; + i = 23; } else { var_fs2 = 380.0f; - var_s0 = 0xE; + i = 14; } } - for (; var_s0 >= var_s7; var_s0--) { + for (; i >= iMin; i--) { #if !DEBUG_FEATURES if (0) {} #endif - if (var_s0 == arg1) { + if (i == platform_arg1) { continue; } - if (var_s0 == temp_s3) { + if (i == temp_s3) { continue; } - if (((temp_s3 == -1) && ((Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s0]) < var_fs3)))) { + if (((temp_s3 == -1) && + ((Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]) < var_fs3)))) { continue; } - temp_fv0 = Math_Vec3f_DistXYZ(arg0, &D_80B4A090[var_s0]); + temp_fv0 = Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions_[i]); if ((var_fs2 < temp_fv0)) { continue; } @@ -474,14 +509,14 @@ s16 EnZf_FindPlatform2__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { var_fs1 = var_fs0; var_s4 = var_s5; var_fs0 = temp_fv0; - var_s5 = var_s0; + var_s5 = i; } else if (temp_fv0 < var_fs1) { var_fs1 = temp_fv0; - var_s4 = var_s0; + var_s4 = i; } } - temp_s0 = &D_80B4A090[var_s5]; + temp_s0 = &sDCPlatformPositions_[var_s5]; //! @bug `var_s4` can be -1 in certain conditions and cause an out of bounds access. //! Under normal conditions, this doesn't cause problems because the data before `D_80B4A090` @@ -489,85 +524,87 @@ s16 EnZf_FindPlatform2__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { // These two function calls do nothing. Their return values aren't used and they have no side effects. #ifndef AVOID_UB Math_Vec3f_DistXYZ(&player->actor.world.pos, temp_s0); - Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s4]); + Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[var_s4]); #endif if (var_s4 > 0) { - temp_s0_2 = Math_Vec3f_Yaw(arg0, temp_s0); - temp_v1 = temp_s0_2 - Math_Vec3f_Yaw(arg0, &player->actor.world.pos); + temp_s0_2 = Math_Vec3f_Yaw(thisPos, temp_s0); + temp_v1 = temp_s0_2 - Math_Vec3f_Yaw(thisPos, &player->actor.world.pos); if (ABS(temp_v1) < 0x36B0) { var_s5 = var_s4; } } if (var_s5 < 0) { - var_s5 = arg2; + var_s5 = platform_arg2; } return var_s5; } -s32 EnZf_FindPlatform3__(Vec3f* arg0, s16 arg1, s16 arg2, PlayState* play) { +s32 EnZf_FindPlatform3__(Vec3f* thisPos_, s16 platform_arg1, s16 platform_arg2, PlayState* play) { Vec3f* temp_s0; - f32 temp_fv0; - f32 var_fs0; - f32 var_fs1; - f32 var_fs2; + f32 platformDistToPlayer; + f32 closestPlatformToPlayerDist_; + f32 secondClosestPlatformToPlayerDist_; + f32 maxPlatformDist_; s16 temp_fp; - s16 var_s1; - s16 var_s2; - s16 var_s3; - s16 var_fp; - s32 var_s4; + s16 i; + s16 closestPlatformToPlayer_; + s16 secondClosestPlatformToPlayer_; + s16 playerPlatform_; + s32 iMin; Player* player = GET_PLAYER(play); - var_s1 = 7; - var_s4 = 0; - var_fp = EnZf_FindPlatform1__(&player->actor.world.pos, -1); - var_fs2 = 500.0f; - var_fs0 = 99998.0f; - var_fs1 = 99999.0f; - var_s2 = arg1; - var_s3 = arg2; - if (arg0->y > 200.0f) { - var_fs2 = 290.0f; - var_s1 = 0x17; - var_s4 = 8; - } - for (; var_s1 >= var_s4; var_s1--) { - if (var_fs2 < Math_Vec3f_DistXYZ(arg0, &D_80B4A090[var_s1])) { + i = 7; + iMin = 0; + playerPlatform_ = EnZf_FindPlatform1__(&player->actor.world.pos, -1); + maxPlatformDist_ = 500.0f; + closestPlatformToPlayerDist_ = 99998.0f; + secondClosestPlatformToPlayerDist_ = 99999.0f; + closestPlatformToPlayer_ = platform_arg1; + secondClosestPlatformToPlayer_ = platform_arg2; + if (thisPos_->y > 200.0f) { + maxPlatformDist_ = 290.0f; + i = 23; + iMin = 8; + } + for (; i >= iMin; i--) { + if (Math_Vec3f_DistXYZ(thisPos_, &sDCPlatformPositions_[i]) > maxPlatformDist_) { continue; } - if (var_s1 != var_fp) { - temp_fv0 = Math_Vec3f_DistXYZ(&player->actor.world.pos, &D_80B4A090[var_s1]); - if (temp_fv0 < var_fs0) { - var_fs1 = var_fs0; - var_s3 = var_s2; - var_fs0 = temp_fv0; - var_s2 = var_s1; - } else if (temp_fv0 < var_fs1) { - var_fs1 = temp_fv0; - var_s3 = var_s1; + if (i != playerPlatform_) { + platformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]); + if (platformDistToPlayer < closestPlatformToPlayerDist_) { + secondClosestPlatformToPlayerDist_ = closestPlatformToPlayerDist_; + secondClosestPlatformToPlayer_ = closestPlatformToPlayer_; + closestPlatformToPlayerDist_ = platformDistToPlayer; + closestPlatformToPlayer_ = i; + } else if (platformDistToPlayer < secondClosestPlatformToPlayerDist_) { + secondClosestPlatformToPlayerDist_ = platformDistToPlayer; + secondClosestPlatformToPlayer_ = i; } } else { - var_s2 = var_fp; + closestPlatformToPlayer_ = playerPlatform_; + // TODO: This break is weird, it makes the function result heavily depend on the order of + // the platform positions array break; } } - if (var_s3 != var_fp) { - var_fp = var_s2; + if (secondClosestPlatformToPlayer_ != playerPlatform_) { + playerPlatform_ = closestPlatformToPlayer_; } else { - var_fp = var_s3; + playerPlatform_ = secondClosestPlatformToPlayer_; } - return var_fp; + return playerPlatform_; } -s32 func_80B44CF0(PlayState* play, EnZf* this) { +s32 EnZf_ShouldAttack_(PlayState* play, EnZf* this) { s32 pad; Player* player; Actor* playerFocusActor; player = GET_PLAYER(play); - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { if (player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { return false; } else { @@ -595,7 +632,7 @@ s32 func_80B44CF0(PlayState* play, EnZf* this) { return false; } -void func_80B44DC4(EnZf* this, PlayState* play) { +void EnZf_PickAction_(EnZf* this, PlayState* play) { s16 relYawTowardsPlayer; relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -603,14 +640,17 @@ void func_80B44DC4(EnZf* this, PlayState* play) { if (relYawTowardsPlayer >= 0x1B58) { EnZf_Setup12or5___(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && - func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { EnZf_SetupIdle_(this); } } -s32 EnZf_PickAction_(PlayState* play, EnZf* this) { +/** + * @return true if an action was picked + */ +s32 EnZf_DinolfosPickAction_(PlayState* play, EnZf* this) { s16 absRelWallYaw; Actor* explosive; @@ -620,9 +660,9 @@ s32 EnZf_PickAction_(PlayState* play, EnZf* this) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else { EnZf_Setup11_(this); } @@ -635,7 +675,7 @@ s32 EnZf_PickAction_(PlayState* play, EnZf* this) { (explosive->id == ACTOR_EN_BOM_CHU)) { if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && ((s16)(this->actor.shape.rot.y - explosive->world.rot.y + 0x8000) < 0x3E80)) { - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else { EnZf_SetupCirclePlayer___(this, 4.0f); } @@ -665,12 +705,12 @@ void EnZf_WaitAppear_(EnZf* this, PlayState* play) { if (this->timer_ == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - if (this->actor.params == ENZF_TYPE_0) { + if (this->actor.params == ENZF_TYPE_LIZALFOS_PAIRED_A_) { func_800F5ACC(NA_BGM_MINI_BOSS); } } if (this->timer_ != 0) { - if (this->actor.params != ENZF_TYPE_NEG1) { + if (this->actor.params != ENZF_TYPE_LIZALFOS_SINGLE_) { this->timer_--; } else if (this->actor.xzDistToPlayer <= 160.0f) { this->timer_ = 0; @@ -695,7 +735,7 @@ void EnZf_WaitAppear_(EnZf* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { this->alpha_ = 255; - if (this->actor.params > 0) { // ENZF_TYPE_1 + if (this->actor.params >= ENZF_TYPE_LIZALFOS_PAIRED_B_) { EnZf_Setup18_(this, play); } else { EnZf_SetupIdle_(this); @@ -733,7 +773,7 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { } else { return; } - } else if (EnZf_PickAction_(play, this)) { + } else if (EnZf_DinolfosPickAction_(play, this)) { return; } } @@ -774,9 +814,10 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { void EnZf_Setup5_(EnZf* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); this->action = ENZF_ACTION_5; - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - this->unk402 = EnZf_FindPlatform3__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + this->unkPlatform402 = + EnZf_FindPlatform3__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); this->actionState_ = 0; } this->actor.speed = 0.0f; @@ -787,7 +828,7 @@ void EnZf_5_(EnZf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad1; - s16 var_v1; + s16 absYawDiff; s16 sp48; f32 sp44; f32 sp40; @@ -798,29 +839,30 @@ void EnZf_5_(EnZf* this, PlayState* play) { sp44 = 350.0f; sp40 = 0.0f; player = GET_PLAYER(play); - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { sp48 = EnZf_FindPlatform1__(&player->actor.world.pos, -1); - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, sp48); + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, sp48); if (this->actor.world.pos.y >= 420.0f) { sp44 = 270.0f; } } if (!EnZf_ReactToProjectile_(play, this)) { - if (sp48 != this->unk3FE) { - this->unk402 = EnZf_FindPlatform3__(&this->actor.world.pos, this->unk3FE, this->unk400, play); - if ((sp48 < 0) && (this->unk402 == this->unk3FE)) { - sp48 = this->unk3FE; + if (sp48 != this->unkPlatform3FE) { // May only pass if type is paired + this->unkPlatform402 = + EnZf_FindPlatform3__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); + if ((sp48 < 0) && (this->unkPlatform402 == this->unkPlatform3FE)) { + sp48 = this->unkPlatform3FE; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer = this->actor.shape.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]); - var_v1 = this->actor.wallYaw - this->actor.shape.rot.y; - if (var_v1 < 0) { - var_v1 *= -1; + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]); + absYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; + if (absYawDiff < 0) { + absYawDiff *= -1; } if ((this->unk3F8 && (this->actor.speed > 0.0f)) || - ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (var_v1 >= 0x5C19))) { - if ((Actor_WorldDistXZToPoint(&this->actor, &D_80B4A090[this->unk402]) < sp44) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (absYawDiff >= 0x5C19))) { + if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]) < sp44) && !EnZf_TestNoFloorAhead_(this, play, 191.9956f)) { EnZf_Setup13_(this); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -828,7 +870,8 @@ void EnZf_5_(EnZf* this, PlayState* play) { } return; } else { - this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk3FE]); + this->actor.world.rot.y = + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform3FE]); } } else { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -845,12 +888,12 @@ void EnZf_5_(EnZf* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speed, 8.0f, 1.0f, 0.5f, 0.0f); } this->skelAnime.playSpeed = this->actor.speed * 1.2f; - var_v1 = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (var_v1 < 0) { - var_v1 *= -1; + absYawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (absYawDiff < 0) { + absYawDiff *= -1; } - if ((sp48 == this->unk3FE) && (this->actor.xzDistToPlayer < 150.0f) && (player->meleeWeaponState != 0) && - (var_v1 >= 0x1F40)) { + if ((sp48 == this->unkPlatform3FE) && (this->actor.xzDistToPlayer < 150.0f) && + (player->meleeWeaponState != 0) && (absYawDiff >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { EnZf_Setup12or5___(this, play); @@ -861,7 +904,7 @@ void EnZf_5_(EnZf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - if (sp48 == this->unk3FE) { + if (sp48 == this->unkPlatform3FE) { if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { if (Rand_ZeroOne() > 0.5f) { EnZf_Setup7or5___(this, play); @@ -869,8 +912,8 @@ void EnZf_5_(EnZf* this, PlayState* play) { EnZf_SetupIdle_(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { - if ((Rand_ZeroOne() > 0.05f) && func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + if ((Rand_ZeroOne() > 0.05f) && EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else if (Rand_ZeroOne() > 0.5f) { EnZf_Setup12or5___(this, play); } else { @@ -883,7 +926,7 @@ void EnZf_5_(EnZf* this, PlayState* play) { } } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (!EnZf_PickAction_(play, this)) { + if (!EnZf_DinolfosPickAction_(play, this)) { if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { if (Actor_IsLockedOn(play, &this->actor)) { @@ -906,7 +949,7 @@ void EnZf_5_(EnZf* this, PlayState* play) { } if ((prevFrame != (s32)this->skelAnime.curFrame) && (((beforeCurFrame < 2) && (((s32)absPlaySpeed + prevFrame) >= 4)) || - ((beforeCurFrame < 0x20) && (((s32)absPlaySpeed + prevFrame) >= 0x22)))) { + ((beforeCurFrame < 32) && (((s32)absPlaySpeed + prevFrame) >= 34)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } } @@ -917,7 +960,7 @@ void EnZf_Setup13_(EnZf* this) { this->timer_ = 0; this->actionState_ = 1; this->actor.velocity.y = 15.0f; - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { this->actor.speed = 16.0f; } else { this->actor.speed = 10.0f; @@ -952,8 +995,8 @@ void EnZf_13_(EnZf* this, PlayState* play) { } if ((this->actor.params == ENZF_TYPE_DINOLFOS) && ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) != 0)) { - if (func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + if (EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { EnZf_Setup12or5___(this, play); } @@ -975,7 +1018,7 @@ void EnZf_6_(EnZf* this, PlayState* play) { player = GET_PLAYER(play); if (!EnZf_ReactToProjectile_(play, this) && - ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this))) { + !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (temp_v0 > 0) { var_v1 = (temp_v0 * 0.25f) + 2000.0f; @@ -997,14 +1040,14 @@ void EnZf_6_(EnZf* this, PlayState* play) { } this->skelAnime.playSpeed = -var_fv1; SkelAnime_Update(&this->skelAnime); - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unk3FE) { + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE) { EnZf_Setup5_(this, play); return; } } - if (Actor_IsFacingPlayer(&this->actor, 0x1555) != 0) { + if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.8f) { EnZf_Setup7or5___(this, play); } else { @@ -1018,7 +1061,7 @@ void EnZf_6_(EnZf* this, PlayState* play) { } void EnZf_Setup7or5___(EnZf* this, PlayState* play) { - if ((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || + if (!ENZF_IS_TYPE_PAIRED_(this->actor.params) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); @@ -1048,7 +1091,7 @@ void EnZf_7_(EnZf* this, PlayState* play) { sp3C = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (!EnZf_ReactToProjectile_(play, this) && - ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this))) { + !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; sp56 = player->actor.shape.rot.y + 0x8000; if (Math_SinS(sp56 - this->actor.shape.rot.y) >= 0.0f) { @@ -1062,7 +1105,7 @@ void EnZf_7_(EnZf* this, PlayState* play) { this->actor.speed = 8.0f; } } - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { if (this->unk3F8) { this->actor.speed = -this->actor.speed; } @@ -1090,7 +1133,7 @@ void EnZf_7_(EnZf* this, PlayState* play) { } } } - if (Actor_OtherIsLockedOn(play, &this->actor) != 0) { + if (Actor_OtherIsLockedOn(play, &this->actor)) { sp3C = 100.0f; } if (this->actor.xzDistToPlayer <= (70.0f + sp3C)) { @@ -1126,8 +1169,8 @@ void EnZf_7_(EnZf* this, PlayState* play) { if ((Math_CosS(sp56 - this->actor.shape.rot.y) < -0.85f) || (this->timer_ == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { EnZf_SetupIdle_(this); } @@ -1137,23 +1180,23 @@ void EnZf_7_(EnZf* this, PlayState* play) { } } -void EnZf_Setup9_(EnZf* this) { +void EnZf_SetupAttack(EnZf* this) { Animation_Change(&this->skelAnime, &gZfSlashAnim, 1.25f, 0.0f, Animation_GetLastFrame(&gZfSlashAnim), ANIMMODE_ONCE, -4.0f); if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->skelAnime.playSpeed = 1.75f; } this->swordCollider.base.atFlags &= ~AT_BOUNCED; - this->action = ENZF_ACTION_9; + this->action = ENZF_ACTION_ATTACK; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.speed = 0.0f; - EnZf_SetupAction(this, EnZf_9_); + EnZf_SetupAction(this, EnZf_Attack); } -void EnZf_9_(EnZf* this, PlayState* play) { +void EnZf_Attack(EnZf* this, PlayState* play) { Player* player; - s16 var_v0; - s16 var_v0_2; + s16 absYawDiffWithPlayer; + s16 absRelYawTowardsPlayer; player = GET_PLAYER(play); this->actor.speed = 0.0f; @@ -1174,23 +1217,23 @@ void EnZf_9_(EnZf* this, PlayState* play) { if (Rand_ZeroOne() > 0.7f) { EnZf_Setup12or5___(this, play); } else { - var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; - var_v0 = ABS(var_v0); - if (var_v0 <= 0x2710) { - var_v0_2 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - var_v0_2 = ABS(var_v0_2); - if (var_v0_2 > 0x3E80) { + absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; + absYawDiffWithPlayer = ABS(absYawDiffWithPlayer); + if (absYawDiffWithPlayer <= 0x2710) { + absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); + if (absRelYawTowardsPlayer > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnZf_Setup12or5___(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_HOSTILE_LOCK_ON | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { - if (this->actor.isLockedOn != 0) { - EnZf_Setup9_(this); + if (this->actor.isLockedOn) { + EnZf_SetupAttack(this); } else { EnZf_Setup12or5___(this, play); } } else { - EnZf_Setup9_(this); + EnZf_SetupAttack(this); } } else { EnZf_Setup12or5___(this, play); @@ -1200,20 +1243,20 @@ void EnZf_9_(EnZf* this, PlayState* play) { } } -void EnZf_Setup8_(EnZf* this) { +void EnZf_SetupAttackBounced(EnZf* this) { f32 f = this->skelAnime.curFrame - 3.0f; Animation_Change(&this->skelAnime, &gZfSlashAnim, -1.0f, f, 0.0f, ANIMMODE_ONCE, 0.0f); - this->action = ENZF_ACTION_8; - EnZf_SetupAction(this, EnZf_8_); + this->action = ENZF_ACTION_ATTACK_BOUNCED; + EnZf_SetupAction(this, EnZf_AttackBounced); } -void EnZf_8_(EnZf* this, PlayState* play) { +void EnZf_AttackBounced(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { EnZf_SetupIdle_(this); - } else if ((Rand_ZeroOne() > 0.2f) && func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + } else if ((Rand_ZeroOne() > 0.2f) && EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { EnZf_Setup12or5___(this, play); } @@ -1256,7 +1299,7 @@ void EnZf_11_(EnZf* this, PlayState* play) { } } -void EnZf_Setup14_(EnZf* this) { +void EnZf_SetupStunned_(EnZf* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; @@ -1264,18 +1307,18 @@ void EnZf_Setup14_(EnZf* this) { } else { this->actionState_ = 1; } - if (this->lastDamageReaction == ENZF_DMG_REACT_F) { - this->unk3F6 = 36; + if (this->lastDamageReaction == ENZF_DMG_REACT_ICE) { + this->frozenTimer = 36; } else { Animation_PlayOnceSetSpeed(&this->skelAnime, &gZfDamagedAnim___, 0.0f); } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->action = ENZF_ACTION_14; - EnZf_SetupAction(this, EnZf_14_); + this->action = ENZF_ACTION_STUNNED_; + EnZf_SetupAction(this, EnZf_Stunned_); } -void EnZf_14_(EnZf* this, PlayState* play) { - s16 var_v0; +void EnZf_Stunned_(EnZf* this, PlayState* play) { + s16 absRelWallYaw; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; @@ -1289,24 +1332,24 @@ void EnZf_14_(EnZf* this, PlayState* play) { if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { EnZf_SetupDie_(this); - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this)) { - if (D_80B4A1B4 != ENZF_TYPE_NEG1) { - func_80B44DC4(this, play); + } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { + if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { + EnZf_PickAction_(this, play); } else { - var_v0 = this->actor.wallYaw - this->actor.shape.rot.y; - var_v0 = ABS(var_v0); + absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; + absRelWallYaw = ABS(absRelWallYaw); if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && - (ABS(var_v0) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { + (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else if (!EnZf_ReactToProjectile_(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { - func_80B44DC4(this, play); + EnZf_PickAction_(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && - func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { - func_80B44DC4(this, play); + EnZf_PickAction_(this, play); } } } @@ -1320,14 +1363,15 @@ void EnZf_Setup18_(EnZf* this, PlayState* play) { var_fv0 = 0.0f; temp_fv1 = Animation_GetLastFrame(&gZfTurnAroundAnim__); - if (this->action <= ENZF_ACTION_16) { + if (this->action <= ENZF_ACTION_DAMAGED_) { var_fv0 = -4.0f; } Animation_Change(&this->skelAnime, &gZfTurnAroundAnim__, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); this->action = ENZF_ACTION_18; this->actor.speed = 0.0f; - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + this->unkPlatform402 = + EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); this->actor.world.rot.y = this->actor.shape.rot.y; EnZf_SetupAction(this, EnZf_18_); } @@ -1335,7 +1379,7 @@ void EnZf_Setup18_(EnZf* this, PlayState* play) { void EnZf_18_(EnZf* this, PlayState* play) { s16 temp_v1; - temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]) + 0x8000; + temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, temp_v1, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -1412,8 +1456,9 @@ void EnZf_SetupJump19__(EnZf* this, PlayState* play) { this->actionState_ = 0; Animation_PlayOnce(&this->skelAnime, D_80B4A280[0]); this->action = ENZF_ACTION_JUMP_19__; - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + this->unkPlatform402 = + EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); EnZf_SetupAction(this, EnZf_Jump19__); } @@ -1432,7 +1477,7 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { sp70 = 1.0f; var_fs0 = 550.0f; - sp74 = Actor_WorldDistXZToPoint(&this->actor, &D_80B4A090[this->unk402]); + sp74 = Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]); prevActionState_ = this->actionState_; if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1440,13 +1485,13 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { if (this->actor.world.pos.y >= 420.0f) { var_fs0 = 280.0f; } - sp5A = Actor_WorldYawTowardPoint(&this->actor, &D_80B4A090[this->unk402]); + sp5A = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]); switch (this->actionState_) { case 0: this->actor.world.rot.y = sp5A; this->actor.shape.rot.y = sp5A + 0x8000; D_80B4AB30 = 0; - this->unk400 = this->unk3FE; + this->unkPlatform400 = this->unkPlatform3FE; floorAheadFlags = 0; floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 107.0f) << 0; floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 220.0f) << 1; @@ -1500,8 +1545,9 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { EnZf_SetupJump20__(this); } else { if (sp74 < 80.0f) { - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + this->unkPlatform402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, + this->unkPlatform400, play); } } this->actionState_ = 0; @@ -1530,8 +1576,9 @@ void EnZf_Setup21_(EnZf* this, PlayState* play) { this->actor.world.rot.y += 0x8000; this->action = ENZF_ACTION_21; this->actor.speed = 0.0f; - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - this->unk402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unk3FE, this->unk400, play); + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + this->unkPlatform402 = + EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); EnZf_SetupAction(this, EnZf_21_); } @@ -1553,11 +1600,11 @@ void EnZf_21_(EnZf* this, PlayState* play) { } } -void EnZf_Setup16_(EnZf* this) { +void EnZf_SetupDamaged_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfDamagedAnim___, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDamagedAnim___), ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && - (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { + ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = -4.0f; this->actionState_ = 0; } else { @@ -1566,16 +1613,16 @@ void EnZf_Setup16_(EnZf* this) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->skelAnime.playSpeed = 4.5f; } - if (this->actor.params < 0) { // ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 + if (!ENZF_IS_TYPE_PAIRED_(this->actor.params)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; } Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DAMAGE); - this->action = ENZF_ACTION_16; - EnZf_SetupAction(this, EnZf_16_); + this->action = ENZF_ACTION_DAMAGED_; + EnZf_SetupAction(this, EnZf_Damaged_); } -void EnZf_16_(EnZf* this, PlayState* play) { - s16 var_v0; +void EnZf_Damaged_(EnZf* this, PlayState* play) { + s16 absRelWallYaw; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { this->actor.speed = 0.0f; @@ -1587,61 +1634,61 @@ void EnZf_16_(EnZf* this, PlayState* play) { this->actionState_ = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this)) && + if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this)) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (D_80B4A1B4 != ENZF_TYPE_NEG1) { - if (this->lastDamageReaction == ENZF_DMG_REACT_D) { - D_80B4A1B0 += 1; + if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { + if (this->lastDamageReaction == ENZF_DMG_REACT_FLEE) { + sPairedActiveFleeFlag_ += 1; } else { this->actor.world.rot.y = this->actor.shape.rot.y; if (!EnZf_TestNoFloorAhead_(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { - EnZf_Setup9_(this); + EnZf_SetupAttack(this); } else { - func_80B44DC4(this, play); + EnZf_PickAction_(this, play); } } } else { - var_v0 = this->actor.wallYaw - this->actor.shape.rot.y; - var_v0 = ABS(var_v0); + absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; + absRelWallYaw = ABS(absRelWallYaw); if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && - (ABS(var_v0) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_Setup22_(this); + (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { + EnZf_SetupJumpAttack__(this); } else if (!EnZf_ReactToProjectile_(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y; if (!EnZf_TestNoFloorAhead_(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { - EnZf_Setup9_(this); + EnZf_SetupAttack(this); } else { - func_80B44DC4(this, play); + EnZf_PickAction_(this, play); } } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - func_80B44CF0(play, this)) { - EnZf_Setup9_(this); + EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { - func_80B44DC4(this, play); + EnZf_PickAction_(this, play); } } } } } -void EnZf_Setup22_(EnZf* this) { +void EnZf_SetupJumpAttack__(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); this->timer_ = 0; this->actionState_ = 1; - this->action = ENZF_ACTION_22; + this->action = ENZF_ACTION_JUMP_ATTACK__; this->actor.velocity.y = 22.0f; this->actor.speed = 7.5f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_22_); + EnZf_SetupAction(this, EnZf_JumpAttack__); } -void EnZf_22_(EnZf* this, PlayState* play) { +void EnZf_JumpAttack__(EnZf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { func_800355B8(play, &this->unk4F0); @@ -1656,7 +1703,7 @@ void EnZf_22_(EnZf* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; - EnZf_Setup9_(this); + EnZf_SetupAttack(this); Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); this->skelAnime.curFrame = 13.0f; } @@ -1668,7 +1715,7 @@ void EnZf_Setup12or5___(EnZf* this, PlayState* play) { Player* player; f32 temp_ft3; - if ((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || + if (!ENZF_IS_TYPE_PAIRED_(this->actor.params) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); @@ -1705,7 +1752,7 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { extraRadius = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); temp_t0_sp56 = player->actor.shape.rot.y; - if (this->actor.params >= 0) { // ENZF_TYPE_0, ENZF_TYPE_1 + if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { if (this->unk3F8) { this->actor.speed = -this->actor.speed; } @@ -1769,35 +1816,35 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - this->unk3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unk3FE); - if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unk3FE) { + this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); + if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE) { this->actor.speed = 0.0f; - if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == this->actor.params)) { + if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { EnZf_SetupJump20__(this); } else { EnZf_Setup5_(this, play); } - } else if ((this->actor.params != ENZF_TYPE_DINOLFOS) || !EnZf_PickAction_(play, this)) { + } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { if (this->timer_ == 0) { var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; if (var_v0 < 0) { var_v0 *= -1; } if (var_v0 >= 0x3A98) { - if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == this->actor.params)) { + if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { EnZf_SetupJump20__(this); } else { EnZf_SetupIdle_(this); this->timer_ = (Rand_ZeroOne() * 5.0f) + 1.0f; } } else { - if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == this->actor.params)) { + if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { EnZf_SetupJump20__(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - (func_80B44CF0(play, this) != 0)) { - EnZf_Setup9_(this); + EnZf_ShouldAttack_(play, this)) { + EnZf_SetupAttack(this); } else { if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && !EnZf_TestNoFloorAhead_(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { @@ -1823,15 +1870,8 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { } } -// this is probably just EnZf? -typedef struct UnkActor { - Actor actor; - char pad14C[0x3F4 - 0x14C]; - UNK_TYPE2 unk3F4; -} UnkActor; - void EnZf_SetupDie_(EnZf* this) { - Actor* temp_v0; + Actor* otherEnZf; Animation_Change(&this->skelAnime, &gZfDieAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDieAnim), ANIMMODE_ONCE, -4.0f); @@ -1844,23 +1884,23 @@ void EnZf_SetupDie_(EnZf* this) { } this->action = ENZF_ACTION_DIE_; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (D_80B4A1B4 != ENZF_TYPE_NEG1) { - temp_v0 = this->actor.prev; - if (temp_v0 != NULL) { - ((UnkActor*)temp_v0)->unk3F4 = 0x5A; - temp_v0 = this->actor.prev; - if (temp_v0->colChkInfo.health < 3) { - temp_v0->colChkInfo.health = 3; + if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { + otherEnZf = this->actor.prev; + if (otherEnZf != NULL) { + ((EnZf*)otherEnZf)->timer2_ = 90; + otherEnZf = this->actor.prev; + if (otherEnZf->colChkInfo.health < 3) { + otherEnZf->colChkInfo.health = 3; } } else { - ((UnkActor*)this->actor.next)->unk3F4 = 0x5A; - temp_v0 = this->actor.next; - if (temp_v0->colChkInfo.health < 3) { - temp_v0->colChkInfo.health = 3; + ((EnZf*)this->actor.next)->timer2_ = 90; + otherEnZf = this->actor.next; + if (otherEnZf->colChkInfo.health < 3) { + otherEnZf->colChkInfo.health = 3; } } } - D_80B4A1B0 = 0; + sPairedActiveFleeFlag_ = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); EnZf_SetupAction(this, EnZf_Die_); } @@ -1877,11 +1917,11 @@ void EnZf_Die_(EnZf* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.category != ACTORCAT_PROP) { - if ((this->actor.params >= 0) /* ENZF_TYPE_0, ENZF_TYPE_1 */ && (D_80B4A1B4 == -1)) { + if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == ENZF_TYPE_LIZALFOS_SINGLE_)) { Flags_SetSwitch(play, this->switchFlag); func_800F5B58(); } else { - D_80B4A1B4 = ENZF_TYPE_NEG1; + sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_SINGLE_; } Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } @@ -1913,22 +1953,22 @@ void EnZf_UpdateHeadRot(EnZf* this, PlayState* play) { } } -void func_80B490B4(EnZf* this, PlayState* play) { +void EnZf_CheckCollide(EnZf* this, PlayState* play) { s32 pad; s16 dropParams; - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action <= ENZF_ACTION_14)) { + if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action <= ENZF_ACTION_STUNNED_)) { this->bodyCollider.base.acFlags &= ~AC_HIT; - if (((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || (D_80B4A1B4 != this->actor.params)) && - ((this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6))) { + if (!(ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) && + (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6)) { this->lastDamageReaction = this->actor.colChkInfo.damageReaction; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, false); - if ((this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_1) || - (this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_F)) { - if (this->action != ENZF_ACTION_14) { + if ((this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_STUN) || + (this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_ICE)) { + if (this->action != ENZF_ACTION_STUNNED_) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); Actor_ApplyDamage(&this->actor); - EnZf_Setup14_(this); + EnZf_SetupStunned_(this); } } else { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1942,13 +1982,13 @@ void func_80B490B4(EnZf* this, PlayState* play) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, dropParams); Enemy_StartFinishingBlow(play, &this->actor); } else { - if (D_80B4A1B4 != ENZF_TYPE_NEG1) { + if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { if (((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && (this->actor.colChkInfo.health < 4)) { - this->lastDamageReaction = ENZF_DMG_REACT_D; + this->lastDamageReaction = ENZF_DMG_REACT_FLEE; } } - EnZf_Setup16_(this); + EnZf_SetupDamaged_(this); } } } @@ -1959,7 +1999,7 @@ void EnZf_Update(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; s32 pad[2]; - func_80B490B4(this, play); + EnZf_CheckCollide(this, play); if (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6) { this->unk3F8 = false; if ((this->actionState_ != 1) && (this->action != ENZF_ACTION_JUMP_19__)) { @@ -1982,17 +2022,17 @@ void EnZf_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); } if (this->actor.colChkInfo.health > 0) { - if ((this->action != ENZF_ACTION_9) && (this->action != ENZF_ACTION_14)) { + if ((this->action != ENZF_ACTION_ATTACK) && (this->action != ENZF_ACTION_STUNNED_)) { EnZf_UpdateHeadRot(this, play); } - if ((D_80B4A1B0 != 0) && (D_80B4A1B4 != this->actor.params)) { + if ((sPairedActiveFleeFlag_ != 0) && (sPairedInactiveType__ != this->actor.params)) { EnZf_Setup18_(this, play); - D_80B4A1B4 = this->actor.params; - D_80B4A1B0 = 0; + sPairedInactiveType__ = this->actor.params; + sPairedActiveFleeFlag_ = 0; if (this->actor.prev != NULL) { - ((UnkActor*)this->actor.prev)->unk3F4 = 0x5A; + ((EnZf*)this->actor.prev)->timer2_ = 90; } else { - ((UnkActor*)this->actor.next)->unk3F4 = 0x5A; + ((EnZf*)this->actor.next)->timer2_ = 90; } } } @@ -2014,24 +2054,24 @@ void EnZf_Update(Actor* thisx, PlayState* play) { if (this->actor.colChkInfo.health > 0) { if (this->alpha_ == 255) { Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_16)) { + if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_DAMAGED_)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } - if (((this->actor.params < 0) /* ENZF_TYPE_DINOLFOS, ENZF_TYPE_NEG1 */ || - (D_80B4A1B4 != this->actor.params)) && + if (!(ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) && ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } } } - if ((this->action == ENZF_ACTION_9) && ((this->skelAnime.curFrame >= 14.0f)) && + if ((this->action == ENZF_ACTION_ATTACK) && ((this->skelAnime.curFrame >= 14.0f)) && (this->skelAnime.curFrame <= 20.0f)) { + // Note: AC_HIT will never be set as CollisionCheck_SetAC is never called on the swordCollider if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && !(this->swordCollider.base.acFlags & AC_HIT)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->swordCollider.base); } else { this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->swordCollider.base.acFlags &= ~AC_HIT; - EnZf_Setup8_(this); + EnZf_SetupAttackBounced(this); } } } @@ -2076,7 +2116,7 @@ void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, &this->swordCollider.dim.quad[3]); Matrix_MultVec3f(&D_80B4A2A4, &sp54); Matrix_MultVec3f(&D_80B4A2B0, &sp48); - if (this->action == ENZF_ACTION_9) { + if (this->action == ENZF_ACTION_ATTACK) { if (this->skelAnime.curFrame < 14.0f) { EffectBlure_AddSpace(Effect_GetByIndex(this->swordBlureEffectIndex)); } else if (this->skelAnime.curFrame < 20.0f) { @@ -2095,7 +2135,7 @@ void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, Matrix_MultVec3f(&D_80B4A298, &this->unk4E4); break; } - if (this->unk3F6 != 0) { + if (this->frozenTimer != 0) { switch (limbIndex) { case ZF_LIMB_HEAD: bodyPartIndex = 0; @@ -2145,11 +2185,11 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { gSPSegment(POLY_OPA_DISP++, 9, &D_80116280[2]); POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_OPA_DISP); - if (this->unk3F6 != 0) { + if (this->frozenTimer != 0) { thisx->colorFilterTimer += 1; - this->unk3F6--; - if ((this->unk3F6 & 3) == 0) { - bodyPartIndex = this->unk3F6 >> 2; + this->frozenTimer--; + if ((this->frozenTimer & 3) == 0) { + bodyPartIndex = this->frozenTimer >> 2; EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &this->bodyPartsPos[bodyPartIndex], 150, 150, 150, 250, 235, 245, 255, 1.4f); } @@ -2202,7 +2242,7 @@ s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this) { if ((((this->actor.xzDistToPlayer < 90.0f) || (noFloorAheadFlags_ == 3)) && !EnZf_TestNoFloorAhead_(this, play, 135.0f)) || (projectile->id == ACTOR_ARMS_HOOK)) { - EnZf_Setup22_(this); + EnZf_SetupJumpAttack__(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; if (noFloorAheadFlags_ == 0) { 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 8d746134fe2..d5b69b648b3 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -7,12 +7,14 @@ #include "assets/objects/object_zf/object_zf.h" typedef enum EnZfType { - ENZF_TYPE_DINOLFOS = -2, - ENZF_TYPE_NEG1, // Lizalfos - ENZF_TYPE_0, // Lizalfos - ENZF_TYPE_1 // Lizalfos + /* -2 */ ENZF_TYPE_DINOLFOS = -2,// Ganon's Tower room 0 x2, GTG room 7 x2 + /* -1 */ ENZF_TYPE_LIZALFOS_SINGLE_, // Spirit room 4 x2, Spirit room 26 x2 + /* 0 */ ENZF_TYPE_LIZALFOS_PAIRED_A_, // DC room 3 x2 + /* 1 */ ENZF_TYPE_LIZALFOS_PAIRED_B_ // DC room 3 x2 } EnZfType; +#define ENZF_IS_TYPE_PAIRED_(type) ((type) >= ENZF_TYPE_LIZALFOS_PAIRED_A_) + struct EnZf; typedef struct EnZf { @@ -28,13 +30,13 @@ typedef struct EnZf { /* 0x3EE */ s16 headRotStep; /* 0x3F0 */ s32 timer_; /* 0x3F4 */ s16 timer2_; - /* 0x3F6 */ s16 unk3F6; + /* 0x3F6 */ s16 frozenTimer; /* 0x3F8 */ s16 unk3F8; /* 0x3FA */ s16 unk3FA; /* 0x3FC */ s16 switchFlag; - /* 0x3FE */ s16 unk3FE; - /* 0x400 */ s16 unk400; - /* 0x402 */ s16 unk402; + /* 0x3FE */ s16 unkPlatform3FE; + /* 0x400 */ s16 unkPlatform400; + /* 0x402 */ s16 unkPlatform402; /* 0x404 */ u8 alpha_; /* 0x405 */ char pad405[3]; /* 0x408 */ f32 dodgeSpeed___; From 9ca412467c85f1fae4bf91b56073768e6d62295a Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 4 Aug 2026 22:06:35 +0200 Subject: [PATCH 067/150] wip EnZf docs --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 682 ++++++++++++------------ src/overlays/actors/ovl_En_Zf/z_en_zf.h | 16 +- 2 files changed, 351 insertions(+), 347 deletions(-) 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 551845949cc..e34e203c37c 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -37,30 +37,30 @@ void EnZf_SetupWaitAppear_(EnZf* this); void EnZf_WaitAppear_(EnZf* this, PlayState* play); void EnZf_SetupIdle_(EnZf* this); void EnZf_Idle_(EnZf* this, PlayState* play); -void EnZf_Setup5_(EnZf* this, PlayState* play); -void EnZf_5_(EnZf* this, PlayState* play); -void EnZf_Setup13_(EnZf* this); -void EnZf_13_(EnZf* this, PlayState* play); -void EnZf_Setup6_(EnZf* this); -void EnZf_6_(EnZf* this, PlayState* play); -void EnZf_Setup7or5___(EnZf* this, PlayState* play); -void EnZf_7_(EnZf* this, PlayState* play); +void EnZf_SetupMainWalk_(EnZf* this, PlayState* play); +void EnZf_MainWalk_(EnZf* this, PlayState* play); +void EnZf_SetupJump13___(EnZf* this); +void EnZf_Jump13___(EnZf* this, PlayState* play); +void EnZf_SetupTurnTowardsPlayer_(EnZf* this); +void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play); +void EnZf_SetupSidestepOrMainWalk___(EnZf* this, PlayState* play); +void EnZf_Sidestep__(EnZf* this, PlayState* play); void EnZf_SetupAttack(EnZf* this); void EnZf_Attack(EnZf* this, PlayState* play); void EnZf_AttackBounced(EnZf* this, PlayState* play); -void EnZf_Setup11_(EnZf* this); -void EnZf_11_(EnZf* this, PlayState* play); +void EnZf_SetupJumpBackwards_(EnZf* this); +void EnZf_JumpBackwards_(EnZf* this, PlayState* play); void EnZf_Stunned_(EnZf* this, PlayState* play); -void EnZf_Setup18_(EnZf* this, PlayState* play); -void EnZf_18_(EnZf* this, PlayState* play); -void EnZf_Jump20__(EnZf* this, PlayState* play); -void EnZf_SetupJump19__(EnZf* this, PlayState* play); -void EnZf_Jump19__(EnZf* this, PlayState* play); -void EnZf_21_(EnZf* this, PlayState* play); +void EnZf_SetupJumpSeqStartTurnAround_(EnZf* this, PlayState* play); +void EnZf_JumpSeqStartTurnAround_(EnZf* this, PlayState* play); +void EnZf_JumpSeqJump20__(EnZf* this, PlayState* play); +void EnZf_SetupJumpSeqJump19__(EnZf* this, PlayState* play); +void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play); +void EnZf_JumpSeqFinalLanding_____(EnZf* this, PlayState* play); void EnZf_Damaged_(EnZf* this, PlayState* play); void EnZf_SetupJumpAttack__(EnZf* this); void EnZf_JumpAttack__(EnZf* this, PlayState* play); -void EnZf_Setup12or5___(EnZf* this, PlayState* play); +void EnZf_SetupCirclePlayerOrMainWalk___(EnZf* this, PlayState* play); void EnZf_CirclePlayer___(EnZf* this, PlayState* play); void EnZf_SetupDie_(EnZf* this); void EnZf_Die_(EnZf* this, PlayState* play); @@ -71,21 +71,21 @@ s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this); typedef enum EnZfAction { ENZF_ACTION_WAIT_APPEAR_, ENZF_ACTION_IDLE_ = 3, - ENZF_ACTION_5 = 5, - ENZF_ACTION_6, - ENZF_ACTION_7, + ENZF_ACTION_MAIN_WALK_ = 5, + ENZF_ACTION_TURN_TOWARDS_PLAYER_, + ENZF_ACTION_SIDESTEP__, ENZF_ACTION_ATTACK_BOUNCED, ENZF_ACTION_ATTACK, - ENZF_ACTION_11 = 11, + ENZF_ACTION_JUMP_BACKWARDS_ = 11, ENZF_ACTION_CIRCLE_PLAYER___, - ENZF_ACTION_13, + ENZF_ACTION_13_JUMP___, ENZF_ACTION_STUNNED_, ENZF_ACTION_DIE_, ENZF_ACTION_DAMAGED_, - ENZF_ACTION_18 = 18, - ENZF_ACTION_JUMP_19__, - ENZF_ACTION_JUMP_20__, - ENZF_ACTION_21, + ENZF_ACTION_JUMP_SEQ_START_TURN_AROUND_ = 18, + ENZF_ACTION_JUMP_SEQ_JUMP_19__, + ENZF_ACTION_JUMP_SEQ_JUMP_20__, + ENZF_ACTION_JUMP_SEQ_FINAL_LANDING_____, ENZF_ACTION_JUMP_ATTACK__ } EnZfAction; @@ -392,7 +392,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { ZF_LIMB_MAX); } if (!ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - this->unkPlatform400 = this->unkPlatform3FE = -1; + this->unkPlatform400_home___ = this->unkPlatform3FE_cur = -1; sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_SINGLE_; this->actionState_ = 1; if (this->actor.params == ENZF_TYPE_LIZALFOS_SINGLE_) { @@ -403,7 +403,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { } else { yDiff = player->actor.world.pos.y - this->actor.world.pos.y; if ((ABS(yDiff) <= 100.0f) && !Flags_GetSwitch(play, this->switchFlag)) { - this->unkPlatform400 = this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, 0); + this->unkPlatform400_home___ = this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, 0); EnZf_SetupWaitAppear_(this); sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_PAIRED_B_; } else { @@ -452,38 +452,38 @@ s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred) { return i; } -s16 EnZf_FindPlatform2__(Vec3f* thisPos, s16 platform_arg1, s16 platform_arg2, PlayState* play) { - Vec3f* temp_s0; - f32 temp_fv0; - f32 var_fs0; - f32 var_fs1; - f32 var_fs2; - f32 var_fs3; - s16 temp_s0_2; - s16 temp_s3; - s16 temp_v1; +s16 EnZf_FindPlatformWithoutPlayer__(Vec3f* thisPos, s16 curPlatform, s16 fallbackPlatform, PlayState* play) { + Vec3f* closestPlatformPos; + f32 platformDist; + f32 closestPlatformDist; + f32 secondClosestPlatformDist; + f32 maxPlatformDist_; + f32 minPlatformDistFromPlayer; + s16 yawTowardsClosestPlatform; + s16 playerPlatform; + s16 yawDiff; s16 i; - s16 var_s4; - s16 var_s5; + s16 secondClosestPlatform; + s16 closestPlatform; s32 iMin; Player* player = GET_PLAYER(play); - var_fs2 = 585.0f; - var_fs3 = 400.0f; - var_fs0 = 99998.0f; + maxPlatformDist_ = 585.0f; + minPlatformDistFromPlayer = 400.0f; + closestPlatformDist = 99998.0f; i = 5; iMin = 0; - var_fs1 = 99999.0f; - var_s4 = var_s5 = -1; - temp_s3 = EnZf_FindPlatform1__(&player->actor.world.pos, platform_arg1); + secondClosestPlatformDist = 99999.0f; + secondClosestPlatform = closestPlatform = -1; + playerPlatform = EnZf_FindPlatform1__(&player->actor.world.pos, curPlatform); if (thisPos->y > 420.0f) { - var_fs3 = 50.0f; + minPlatformDistFromPlayer = 50.0f; iMin = 8; - if (platform_arg1 >= 15) { - var_fs2 = 400.0f; + if (curPlatform >= 15) { + maxPlatformDist_ = 400.0f; i = 23; } else { - var_fs2 = 380.0f; + maxPlatformDist_ = 380.0f; i = 14; } } @@ -491,56 +491,57 @@ s16 EnZf_FindPlatform2__(Vec3f* thisPos, s16 platform_arg1, s16 platform_arg2, P #if !DEBUG_FEATURES if (0) {} #endif - if (i == platform_arg1) { + if (i == curPlatform) { continue; } - if (i == temp_s3) { + if (i == playerPlatform) { continue; } - if (((temp_s3 == -1) && - ((Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]) < var_fs3)))) { + if ((playerPlatform == -1) && + (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]) < minPlatformDistFromPlayer)) { continue; } - temp_fv0 = Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions_[i]); - if ((var_fs2 < temp_fv0)) { + platformDist = Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions_[i]); + if (platformDist > maxPlatformDist_) { continue; } - if (temp_fv0 < var_fs0) { - var_fs1 = var_fs0; - var_s4 = var_s5; - var_fs0 = temp_fv0; - var_s5 = i; - } else if (temp_fv0 < var_fs1) { - var_fs1 = temp_fv0; - var_s4 = i; + if (platformDist < closestPlatformDist) { + secondClosestPlatformDist = closestPlatformDist; + secondClosestPlatform = closestPlatform; + closestPlatformDist = platformDist; + closestPlatform = i; + } else if (platformDist < secondClosestPlatformDist) { + secondClosestPlatformDist = platformDist; + secondClosestPlatform = i; } } - temp_s0 = &sDCPlatformPositions_[var_s5]; + closestPlatformPos = &sDCPlatformPositions_[closestPlatform]; - //! @bug `var_s4` can be -1 in certain conditions and cause an out of bounds access. + //! @bug `secondClosestPlatform` can be -1 in certain conditions and cause an out of bounds access. //! Under normal conditions, this doesn't cause problems because the data before `D_80B4A090` //! is section padding between .text and .data, so 0 gets read as a float. // These two function calls do nothing. Their return values aren't used and they have no side effects. #ifndef AVOID_UB - Math_Vec3f_DistXYZ(&player->actor.world.pos, temp_s0); - Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[var_s4]); + Math_Vec3f_DistXYZ(&player->actor.world.pos, closestPlatformPos); + Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[secondClosestPlatform]); #endif - if (var_s4 > 0) { - temp_s0_2 = Math_Vec3f_Yaw(thisPos, temp_s0); - temp_v1 = temp_s0_2 - Math_Vec3f_Yaw(thisPos, &player->actor.world.pos); - if (ABS(temp_v1) < 0x36B0) { - var_s5 = var_s4; + //! @bug The check should be >= 0 + if (secondClosestPlatform > 0) { + yawTowardsClosestPlatform = Math_Vec3f_Yaw(thisPos, closestPlatformPos); + yawDiff = yawTowardsClosestPlatform - Math_Vec3f_Yaw(thisPos, &player->actor.world.pos); + if (ABS(yawDiff) < 0x36B0) { + closestPlatform = secondClosestPlatform; } } - if (var_s5 < 0) { - var_s5 = platform_arg2; + if (closestPlatform < 0) { + closestPlatform = fallbackPlatform; } - return var_s5; + return closestPlatform; } -s32 EnZf_FindPlatform3__(Vec3f* thisPos_, s16 platform_arg1, s16 platform_arg2, PlayState* play) { +s32 EnZf_FindPlatformCloseToPlayer__(Vec3f* thisPos_, s16 curPlatform, s16 platform_arg2, PlayState* play) { Vec3f* temp_s0; f32 platformDistToPlayer; f32 closestPlatformToPlayerDist_; @@ -560,7 +561,7 @@ s32 EnZf_FindPlatform3__(Vec3f* thisPos_, s16 platform_arg1, s16 platform_arg2, maxPlatformDist_ = 500.0f; closestPlatformToPlayerDist_ = 99998.0f; secondClosestPlatformToPlayerDist_ = 99999.0f; - closestPlatformToPlayer_ = platform_arg1; + closestPlatformToPlayer_ = curPlatform; secondClosestPlatformToPlayer_ = platform_arg2; if (thisPos_->y > 200.0f) { maxPlatformDist_ = 290.0f; @@ -598,7 +599,7 @@ s32 EnZf_FindPlatform3__(Vec3f* thisPos_, s16 platform_arg1, s16 platform_arg2, return playerPlatform_; } -s32 EnZf_ShouldAttack_(PlayState* play, EnZf* this) { +s32 EnZf_CanAttack_(PlayState* play, EnZf* this) { s32 pad; Player* player; Actor* playerFocusActor; @@ -638,9 +639,9 @@ void EnZf_PickAction_(EnZf* this, PlayState* play) { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; relYawTowardsPlayer = ABS(relYawTowardsPlayer); if (relYawTowardsPlayer >= 0x1B58) { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && - EnZf_ShouldAttack_(play, this)) { + EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { EnZf_SetupIdle_(this); @@ -664,7 +665,7 @@ s32 EnZf_DinolfosPickAction_(PlayState* play, EnZf* this) { } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { EnZf_SetupJumpAttack__(this); } else { - EnZf_Setup11_(this); + EnZf_SetupJumpBackwards_(this); } return true; } @@ -680,7 +681,7 @@ s32 EnZf_DinolfosPickAction_(PlayState* play, EnZf* this) { EnZf_SetupCirclePlayer___(this, 4.0f); } } else { - EnZf_Setup11_(this); + EnZf_SetupJumpBackwards_(this); } return true; } @@ -730,13 +731,13 @@ void EnZf_WaitAppear_(EnZf* this, PlayState* play) { this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; - Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4F0, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { this->alpha_ = 255; if (this->actor.params >= ENZF_TYPE_LIZALFOS_PAIRED_B_) { - EnZf_Setup18_(this, play); + EnZf_SetupJumpSeqStartTurnAround_(this, play); } else { EnZf_SetupIdle_(this); } @@ -783,7 +784,7 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { (absYawDiffWithPlayer >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (absYawDiffWithPlayer) {} - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } else if (this->timer_ != 0) { this->timer_--; } else { @@ -792,17 +793,17 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { (Rand_ZeroOne() < 0.3f)) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnZf_Setup13_(this); + EnZf_SetupJump13___(this); } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } } else if (Rand_ZeroOne() > 0.3f) { - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } } else { - EnZf_Setup6_(this); + EnZf_SetupTurnTowardsPlayer_(this); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -811,67 +812,68 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { } } -void EnZf_Setup5_(EnZf* this, PlayState* play) { +void EnZf_SetupMainWalk_(EnZf* this, PlayState* play) { Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); - this->action = ENZF_ACTION_5; + this->action = ENZF_ACTION_MAIN_WALK_; if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - this->unkPlatform402 = - EnZf_FindPlatform3__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + this->unkPlatform402_target_ = EnZf_FindPlatformCloseToPlayer__( + &this->actor.world.pos, this->unkPlatform3FE_cur, this->unkPlatform400_home___, play); this->actionState_ = 0; } this->actor.speed = 0.0f; - EnZf_SetupAction(this, EnZf_5_); + EnZf_SetupAction(this, EnZf_MainWalk_); } -void EnZf_5_(EnZf* this, PlayState* play) { +void EnZf_MainWalk_(EnZf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad1; s16 absYawDiff; - s16 sp48; - f32 sp44; - f32 sp40; + s16 playerPlatform; + f32 maxTargetPlatformDistForJump_; + f32 extraDistFromPlayer; Player* player; f32 absPlaySpeed; - sp48 = -1; - sp44 = 350.0f; - sp40 = 0.0f; + playerPlatform = -1; + maxTargetPlatformDistForJump_ = 350.0f; + extraDistFromPlayer = 0.0f; player = GET_PLAYER(play); if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - sp48 = EnZf_FindPlatform1__(&player->actor.world.pos, -1); - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, sp48); + playerPlatform = EnZf_FindPlatform1__(&player->actor.world.pos, -1); + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, playerPlatform); if (this->actor.world.pos.y >= 420.0f) { - sp44 = 270.0f; + maxTargetPlatformDistForJump_ = 270.0f; } } if (!EnZf_ReactToProjectile_(play, this)) { - if (sp48 != this->unkPlatform3FE) { // May only pass if type is paired - this->unkPlatform402 = - EnZf_FindPlatform3__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); - if ((sp48 < 0) && (this->unkPlatform402 == this->unkPlatform3FE)) { - sp48 = this->unkPlatform3FE; + if (playerPlatform != this->unkPlatform3FE_cur) { // May only pass if type is paired + this->unkPlatform402_target_ = EnZf_FindPlatformCloseToPlayer__( + &this->actor.world.pos, this->unkPlatform3FE_cur, this->unkPlatform400_home___, play); + if ((playerPlatform < 0) && (this->unkPlatform402_target_ == this->unkPlatform3FE_cur)) { + playerPlatform = this->unkPlatform3FE_cur; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer = this->actor.shape.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]); + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]); absYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; if (absYawDiff < 0) { absYawDiff *= -1; } - if ((this->unk3F8 && (this->actor.speed > 0.0f)) || + if ((this->noFloorAhead_ && (this->actor.speed > 0.0f)) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (absYawDiff >= 0x5C19))) { - if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]) < sp44) && + if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]) < + maxTargetPlatformDistForJump_) && !EnZf_TestNoFloorAhead_(this, play, 191.9956f)) { - EnZf_Setup13_(this); + EnZf_SetupJump13___(this); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 20.0f; } return; } else { this->actor.world.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform3FE]); + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform3FE_cur]); } } else { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -880,9 +882,9 @@ void EnZf_5_(EnZf* this, PlayState* play) { } } if (Actor_OtherIsLockedOn(play, &this->actor)) { - sp40 = 100.0f; + extraDistFromPlayer = 100.0f; } - if (this->actor.xzDistToPlayer <= (70.0f + sp40)) { + if (this->actor.xzDistToPlayer <= (70.0f + extraDistFromPlayer)) { Math_SmoothStepToF(&this->actor.speed, -8.0f, 1.0f, 0.5f, 0.0f); } else { Math_SmoothStepToF(&this->actor.speed, 8.0f, 1.0f, 0.5f, 0.0f); @@ -892,11 +894,11 @@ void EnZf_5_(EnZf* this, PlayState* play) { if (absYawDiff < 0) { absYawDiff *= -1; } - if ((sp48 == this->unkPlatform3FE) && (this->actor.xzDistToPlayer < 150.0f) && + if ((playerPlatform == this->unkPlatform3FE_cur) && (this->actor.xzDistToPlayer < 150.0f) && (player->meleeWeaponState != 0) && (absYawDiff >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); return; } } @@ -904,23 +906,23 @@ void EnZf_5_(EnZf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - if (sp48 == this->unkPlatform3FE) { - if (Actor_IsFacingPlayer(&this->actor, 0x11C7) == 0) { + if (playerPlatform == this->unkPlatform3FE_cur) { + if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { - EnZf_Setup7or5___(this, play); + EnZf_SetupSidestepOrMainWalk___(this, play); } else { EnZf_SetupIdle_(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { - if ((Rand_ZeroOne() > 0.05f) && EnZf_ShouldAttack_(play, this)) { + if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else if (Rand_ZeroOne() > 0.5f) { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } else { EnZf_SetupIdle_(this); } - } else if (this->unk3F8) { - EnZf_Setup7or5___(this, play); + } else if (this->noFloorAhead_) { + EnZf_SetupSidestepOrMainWalk___(this, play); } else if (Rand_ZeroOne() < 0.1f) { EnZf_SetupIdle_(this); } @@ -932,11 +934,11 @@ void EnZf_5_(EnZf* this, PlayState* play) { if (Actor_IsLockedOn(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnZf_Setup13_(this); + EnZf_SetupJump13___(this); return; } } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); return; } } @@ -955,7 +957,7 @@ void EnZf_5_(EnZf* this, PlayState* play) { } } -void EnZf_Setup13_(EnZf* this) { +void EnZf_SetupJump13___(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); this->timer_ = 0; this->actionState_ = 1; @@ -965,12 +967,12 @@ void EnZf_Setup13_(EnZf* this) { } else { this->actor.speed = 10.0f; } - this->action = ENZF_ACTION_13; + this->action = ENZF_ACTION_13_JUMP___; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - EnZf_SetupAction(this, EnZf_13_); + EnZf_SetupAction(this, EnZf_Jump13___); } -void EnZf_13_(EnZf* this, PlayState* play) { +void EnZf_Jump13___(EnZf* this, PlayState* play) { if (this->timer_ != 0) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; @@ -987,7 +989,7 @@ void EnZf_13_(EnZf* this, PlayState* play) { } else { this->actor.speed = 0.0f; this->actionState_ = 0; - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { @@ -995,63 +997,67 @@ void EnZf_13_(EnZf* this, PlayState* play) { } if ((this->actor.params == ENZF_TYPE_DINOLFOS) && ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) != 0)) { - if (EnZf_ShouldAttack_(play, this)) { + if (EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } } } -void EnZf_Setup6_(EnZf* this) { +/** + * Note: this action does not set the actor's speed. It is always 0 because EnZf_Idle is its only user and + * EnZf_SetupIdle sets the speed to 0. + */ +void EnZf_SetupTurnTowardsPlayer_(EnZf* this) { Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); - this->action = ENZF_ACTION_6; - EnZf_SetupAction(this, EnZf_6_); + this->action = ENZF_ACTION_TURN_TOWARDS_PLAYER_; + EnZf_SetupAction(this, EnZf_TurnTowardsPlayer_); } -void EnZf_6_(EnZf* this, PlayState* play) { +void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play) { s32 pad; - s16 temp_v0; - s16 var_v1; + s16 relYawTowardsPlayer; + s16 yawSpeed; Player* player; - f32 var_fv1; + f32 animPlaySpeed; player = GET_PLAYER(play); if (!EnZf_ReactToProjectile_(play, this) && !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (temp_v0 > 0) { - var_v1 = (temp_v0 * 0.25f) + 2000.0f; + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (relYawTowardsPlayer > 0) { + yawSpeed = (relYawTowardsPlayer * 0.25f) + 2000.0f; } else { - var_v1 = (temp_v0 * 0.25f) - 2000.0f; + yawSpeed = (relYawTowardsPlayer * 0.25f) - 2000.0f; } - this->actor.shape.rot.y += var_v1; + this->actor.shape.rot.y += yawSpeed; this->actor.world.rot.y = this->actor.shape.rot.y; - if (temp_v0 > 0) { - var_fv1 = var_v1 * 1.5f; - if (var_fv1 > 2.0f) { - var_fv1 = 2.0f; + if (relYawTowardsPlayer > 0) { + animPlaySpeed = yawSpeed * 1.5f; + if (animPlaySpeed > 2.0f) { + animPlaySpeed = 2.0f; } } else { - var_fv1 = var_v1 * 1.5f; - if (var_fv1 < -2.0f) { - var_fv1 = -2.0f; + animPlaySpeed = yawSpeed * 1.5f; + if (animPlaySpeed < -2.0f) { + animPlaySpeed = -2.0f; } } - this->skelAnime.playSpeed = -var_fv1; + this->skelAnime.playSpeed = -animPlaySpeed; SkelAnime_Update(&this->skelAnime); if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE) { - EnZf_Setup5_(this, play); + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE_cur) { + EnZf_SetupMainWalk_(this, play); return; } } if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.8f) { - EnZf_Setup7or5___(this, play); + EnZf_SetupSidestepOrMainWalk___(this, play); } else { - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { @@ -1060,7 +1066,7 @@ void EnZf_6_(EnZf* this, PlayState* play) { } } -void EnZf_Setup7or5___(EnZf* this, PlayState* play) { +void EnZf_SetupSidestepOrMainWalk___(EnZf* this, PlayState* play) { if (!ENZF_IS_TYPE_PAIRED_(this->actor.params) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { @@ -1069,16 +1075,16 @@ void EnZf_Setup7or5___(EnZf* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; this->timer_ = (Rand_ZeroOne() * 10.0f) + 20.0f; this->actionState_ = 0; - this->action = ENZF_ACTION_7; + this->action = ENZF_ACTION_SIDESTEP__; this->dodgeSpeed___ = 0.0f; - EnZf_SetupAction(this, EnZf_7_); + EnZf_SetupAction(this, EnZf_Sidestep__); } else { - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } } -void EnZf_7_(EnZf* this, PlayState* play) { - s16 sp56; +void EnZf_Sidestep__(EnZf* this, PlayState* play) { + s16 playerYawOpposite; s32 beforeCurFrame; s32 prevFrame; s32 pad; @@ -1093,20 +1099,20 @@ void EnZf_7_(EnZf* this, PlayState* play) { if (!EnZf_ReactToProjectile_(play, this) && !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; - sp56 = player->actor.shape.rot.y + 0x8000; - if (Math_SinS(sp56 - this->actor.shape.rot.y) >= 0.0f) { + playerYawOpposite = player->actor.shape.rot.y + 0x8000; + if (Math_SinS(playerYawOpposite - this->actor.shape.rot.y) >= 0.0f) { this->actor.speed -= 0.25f; if (this->actor.speed < -8.0f) { this->actor.speed = -8.0f; } - } else if (Math_SinS(sp56 - this->actor.shape.rot.y) < 0.0f) { + } else if (Math_SinS(playerYawOpposite - this->actor.shape.rot.y) < 0.0f) { this->actor.speed += 0.25f; if (this->actor.speed > 8.0f) { this->actor.speed = 8.0f; } } if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - if (this->unk3F8) { + if (this->noFloorAhead_) { this->actor.speed = -this->actor.speed; } } else { @@ -1166,10 +1172,10 @@ void EnZf_7_(EnZf* this, PlayState* play) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - if ((Math_CosS(sp56 - this->actor.shape.rot.y) < -0.85f) || (this->timer_ == 0)) { + if ((Math_CosS(playerYawOpposite - this->actor.shape.rot.y) < -0.85f) || (this->timer_ == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_ShouldAttack_(play, this)) { + EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { EnZf_SetupIdle_(this); @@ -1215,7 +1221,7 @@ void EnZf_Attack(EnZf* this, PlayState* play) { } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } else { absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; absYawDiffWithPlayer = ABS(absYawDiffWithPlayer); @@ -1224,19 +1230,19 @@ void EnZf_Attack(EnZf* this, PlayState* play) { absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); if (absRelYawTowardsPlayer > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_HOSTILE_LOCK_ON | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (this->actor.isLockedOn) { EnZf_SetupAttack(this); } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } } else { EnZf_SetupAttack(this); } } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } } } @@ -1255,26 +1261,26 @@ void EnZf_AttackBounced(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { EnZf_SetupIdle_(this); - } else if ((Rand_ZeroOne() > 0.2f) && EnZf_ShouldAttack_(play, this)) { + } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } } } -void EnZf_Setup11_(EnZf* this) { +void EnZf_SetupJumpBackwards_(EnZf* this) { Animation_Change(&this->skelAnime, &gZfTauntAnim_____, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); this->timer_ = 0; this->actionState_ = 1; - this->action = ENZF_ACTION_11; + this->action = ENZF_ACTION_JUMP_BACKWARDS_; this->actor.velocity.y = 15.0f; this->actor.speed = -15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - EnZf_SetupAction(this, EnZf_11_); + EnZf_SetupAction(this, EnZf_JumpBackwards_); } -void EnZf_11_(EnZf* this, PlayState* play) { +void EnZf_JumpBackwards_(EnZf* this, PlayState* play) { if (this->timer_ != 0) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; @@ -1289,7 +1295,7 @@ void EnZf_11_(EnZf* this, PlayState* play) { this->timer_ = 10; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else if ((play->gameplayFrames % 2) != 0) { - EnZf_Setup12or5___(this, play); + EnZf_SetupCirclePlayerOrMainWalk___(this, play); } else { EnZf_SetupIdle_(this); } @@ -1346,7 +1352,7 @@ void EnZf_Stunned_(EnZf* this, PlayState* play) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { EnZf_PickAction_(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && - EnZf_ShouldAttack_(play, this)) { + EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { EnZf_PickAction_(this, play); @@ -1357,50 +1363,50 @@ void EnZf_Stunned_(EnZf* this, PlayState* play) { } } -void EnZf_Setup18_(EnZf* this, PlayState* play) { - f32 var_fv0; - f32 temp_fv1; +void EnZf_SetupJumpSeqStartTurnAround_(EnZf* this, PlayState* play) { + f32 animMorphFrames; + f32 animEndFrame; - var_fv0 = 0.0f; - temp_fv1 = Animation_GetLastFrame(&gZfTurnAroundAnim__); + animMorphFrames = 0.0f; + animEndFrame = Animation_GetLastFrame(&gZfTurnAroundAnim__); if (this->action <= ENZF_ACTION_DAMAGED_) { - var_fv0 = -4.0f; + animMorphFrames = -4.0f; } - Animation_Change(&this->skelAnime, &gZfTurnAroundAnim__, 2.0f, 0.0f, temp_fv1, ANIMMODE_ONCE, var_fv0); - this->action = ENZF_ACTION_18; + Animation_Change(&this->skelAnime, &gZfTurnAroundAnim__, 2.0f, 0.0f, animEndFrame, ANIMMODE_ONCE, animMorphFrames); + this->action = ENZF_ACTION_JUMP_SEQ_START_TURN_AROUND_; this->actor.speed = 0.0f; - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - this->unkPlatform402 = - EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__(&this->actor.world.pos, this->unkPlatform3FE_cur, + this->unkPlatform400_home___, play); this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_18_); + EnZf_SetupAction(this, EnZf_JumpSeqStartTurnAround_); } -void EnZf_18_(EnZf* this, PlayState* play) { - s16 temp_v1; +void EnZf_JumpSeqStartTurnAround_(EnZf* this, PlayState* play) { + s16 yaw; - temp_v1 = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]) + 0x8000; - Math_SmoothStepToS(&this->actor.world.rot.y, temp_v1, 1, 0x3E8, 0); + yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]) + 0x8000; + Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime)) { - this->actor.world.rot.y = temp_v1 - 0x8000; - EnZf_SetupJump19__(this, play); - this->unk3FA = 1; + this->actor.world.rot.y = yaw - 0x8000; + EnZf_SetupJumpSeqJump19__(this, play); + this->isSwordSheathed = true; } } -void EnZf_SetupJump20__(EnZf* this) { +void EnZf_SetupJumpSeqJump20__(EnZf* this) { this->actionState_ = 0; Animation_MorphToPlayOnce(&this->skelAnime, D_80B4A280[0], -4.0f); - this->action = ENZF_ACTION_JUMP_20__; + this->action = ENZF_ACTION_JUMP_SEQ_JUMP_20__; this->actor.speed = 0.0f; - this->unk40C = 0.0f; + this->dodgeVelocityY___ = 0.0f; this->dodgeSpeed___ = 0.0f; - EnZf_SetupAction(this, EnZf_Jump20__); + EnZf_SetupAction(this, EnZf_JumpSeqJump20__); } -void EnZf_Jump20__(EnZf* this, PlayState* play) { - f32 var_fv0; +void EnZf_JumpSeqJump20__(EnZf* this, PlayState* play) { + f32 animEndFrame; f32 sp40; sp40 = 400.0f; @@ -1411,7 +1417,7 @@ void EnZf_Jump20__(EnZf* this, PlayState* play) { } if ((this->actor.xzDistToPlayer < sp40) && (this->actionState_ != 1)) { this->actor.shape.rot.y = this->actor.world.rot.y; - EnZf_Setup18_(this, play); + EnZf_SetupJumpSeqStartTurnAround_(this, play); } else { if (this->actionState_ != 1) { EnZf_ReactToProjectile2_____(play, this); @@ -1421,10 +1427,10 @@ void EnZf_Jump20__(EnZf* this, PlayState* play) { if (this->actionState_ >= 3) { this->actionState_ = 0; } - if ((this->dodgeSpeed___ != 0.0f) || (this->unk40C != 0.0f)) { + if ((this->dodgeSpeed___ != 0.0f) || (this->dodgeVelocityY___ != 0.0f)) { this->actionState_ = 1; } - var_fv0 = Animation_GetLastFrame(D_80B4A280[this->actionState_]); + animEndFrame = Animation_GetLastFrame(D_80B4A280[this->actionState_]); switch (this->actionState_) { case 0: this->actor.velocity.y = 0.0f; @@ -1432,18 +1438,18 @@ void EnZf_Jump20__(EnZf* this, PlayState* play) { break; case 1: - this->actor.velocity.y = this->unk40C + 10.0f; + this->actor.velocity.y = this->dodgeVelocityY___ + 10.0f; this->actor.speed = this->dodgeSpeed___; this->dodgeSpeed___ = 0.0f; - this->unk40C = 0.0f; + this->dodgeVelocityY___ = 0.0f; break; case 2: - var_fv0 = 3.0f; + animEndFrame = 3.0f; this->actor.world.pos.y = this->actor.floorHeight; break; } - Animation_Change(&this->skelAnime, D_80B4A280[this->actionState_], 1.5f, 0.0f, var_fv0, ANIMMODE_ONCE, + Animation_Change(&this->skelAnime, D_80B4A280[this->actionState_], 1.5f, 0.0f, animEndFrame, ANIMMODE_ONCE, 0.0f); } if ((play->gameplayFrames & 0x5F) == 0) { @@ -1452,32 +1458,33 @@ void EnZf_Jump20__(EnZf* this, PlayState* play) { } } -void EnZf_SetupJump19__(EnZf* this, PlayState* play) { +void EnZf_SetupJumpSeqJump19__(EnZf* this, PlayState* play) { this->actionState_ = 0; Animation_PlayOnce(&this->skelAnime, D_80B4A280[0]); - this->action = ENZF_ACTION_JUMP_19__; - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - this->unkPlatform402 = - EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); - EnZf_SetupAction(this, EnZf_Jump19__); + this->action = ENZF_ACTION_JUMP_SEQ_JUMP_19__; + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__(&this->actor.world.pos, this->unkPlatform3FE_cur, + this->unkPlatform400_home___, play); + EnZf_SetupAction(this, EnZf_JumpSeqJump19__); } -void EnZf_Jump19__(EnZf* this, PlayState* play) { - f32 sp74; - f32 sp70; +void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play) { + f32 distToTargetPlatform_; + f32 animPlaySpeed; f32 var_fs0; - f32 var_fs0_2; + f32 candidateDistance; s32 pad; - f32 var_fv0_sp60; + f32 candidateSpeed; s32 pad2; - s16 sp5A; + s16 yawTowardsTargetPlatform; s32 prevActionState_; s32 floorAheadFlags; - s32 var_v1_real_sp4C; + s32 i; - sp70 = 1.0f; + animPlaySpeed = 1.0f; var_fs0 = 550.0f; - sp74 = Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]); + distToTargetPlatform_ = + Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]); prevActionState_ = this->actionState_; if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1485,13 +1492,14 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { if (this->actor.world.pos.y >= 420.0f) { var_fs0 = 280.0f; } - sp5A = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402]); + yawTowardsTargetPlatform = + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]); switch (this->actionState_) { case 0: - this->actor.world.rot.y = sp5A; - this->actor.shape.rot.y = sp5A + 0x8000; + this->actor.world.rot.y = yawTowardsTargetPlatform; + this->actor.shape.rot.y = yawTowardsTargetPlatform + 0x8000; D_80B4AB30 = 0; - this->unkPlatform400 = this->unkPlatform3FE; + this->unkPlatform400_home___ = this->unkPlatform3FE_cur; floorAheadFlags = 0; floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 107.0f) << 0; floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 220.0f) << 1; @@ -1513,20 +1521,19 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { default: if (play) {} - var_fs0_2 = 107.0f; - var_fs0_2 += 10.0f; - var_fv0_sp60 = 8.0f; - var_fv0_sp60 += 1.2f; - for (var_v1_real_sp4C = 0x14; var_v1_real_sp4C >= 0; - var_v1_real_sp4C -= 1, var_fs0_2 += 10.0f, var_fv0_sp60 += 1.2f) { - if (!EnZf_TestNoFloorAhead_(this, play, var_fs0_2)) { - this->actor.speed = var_fv0_sp60; + candidateDistance = 107.0f; + candidateDistance += 10.0f; + candidateSpeed = 8.0f; + candidateSpeed += 1.2f; + for (i = 20; i >= 0; i--, candidateDistance += 10.0f, candidateSpeed += 1.2f) { + if (!EnZf_TestNoFloorAhead_(this, play, candidateDistance)) { + this->actor.speed = candidateSpeed; this->actor.velocity.y = 12.0f; break; } } if (this->actor.speed == 0.0f) { - EnZf_SetupJump20__(this); + EnZf_SetupJumpSeqJump20__(this); } break; } @@ -1539,21 +1546,19 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; this->actor.speed = 0.0f; - Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4F0, 3.0f, 2, 2.0f, 0, 0, false); - Actor_SpawnFloorDustRing(play, &this->actor, &this->unk4E4, 3.0f, 2, 2.0f, 0, 0, false); - if (var_fs0 <= this->actor.xzDistToPlayer) { - EnZf_SetupJump20__(this); - } else { - if (sp74 < 80.0f) { - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - this->unkPlatform402 = EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, - this->unkPlatform400, play); - } + Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); + Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); + if (this->actor.xzDistToPlayer >= var_fs0) { + EnZf_SetupJumpSeqJump20__(this); + } else if (distToTargetPlatform_ < 80.0f) { + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__( + &this->actor.world.pos, this->unkPlatform3FE_cur, this->unkPlatform400_home___, play); } this->actionState_ = 0; - sp70 = 2.0f; + animPlaySpeed = 2.0f; } else { - Math_SmoothStepToS(&this->actor.world.rot.y, sp5A, 1, 0xFA0, 0); + Math_SmoothStepToS(&this->actor.world.rot.y, yawTowardsTargetPlatform, 1, 0xFA0, 0); this->actor.shape.rot.y = this->actor.world.rot.y + 0x8000; D_80B4AB30 += 1; } @@ -1566,37 +1571,37 @@ void EnZf_Jump19__(EnZf* this, PlayState* play) { break; } if (prevActionState_ != this->actionState_) { - Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->actionState_], sp70); + Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->actionState_], animPlaySpeed); } SkelAnime_Update(&this->skelAnime); } -void EnZf_Setup21_(EnZf* this, PlayState* play) { +void EnZf_SetupJumpSeqFinalLanding_____(EnZf* this, PlayState* play) { Animation_PlayOnce(&this->skelAnime, &gZfGetBackUpAndTurnAroundAnim_____); this->actor.world.rot.y += 0x8000; - this->action = ENZF_ACTION_21; + this->action = ENZF_ACTION_JUMP_SEQ_FINAL_LANDING_____; this->actor.speed = 0.0f; - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - this->unkPlatform402 = - EnZf_FindPlatform2__(&this->actor.world.pos, this->unkPlatform3FE, this->unkPlatform400, play); - EnZf_SetupAction(this, EnZf_21_); + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__(&this->actor.world.pos, this->unkPlatform3FE_cur, + this->unkPlatform400_home___, play); + EnZf_SetupAction(this, EnZf_JumpSeqFinalLanding_____); } -void EnZf_21_(EnZf* this, PlayState* play) { - s16 sp2E; +void EnZf_JumpSeqFinalLanding_____(EnZf* this, PlayState* play) { + s16 yawTowardsPlayer; - sp2E = this->actor.yawTowardsPlayer; + yawTowardsPlayer = this->actor.yawTowardsPlayer; if (this->skelAnime.curFrame >= 26.0f) { - Math_SmoothStepToS(&this->actor.shape.rot.y, sp2E, 1, 0x1770, 0); + Math_SmoothStepToS(&this->actor.shape.rot.y, yawTowardsPlayer, 1, 0x1770, 0); } if (SkelAnime_Update(&this->skelAnime)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); - this->actor.world.rot.y = sp2E; + this->actor.world.rot.y = yawTowardsPlayer; this->actionState_ = -1; EnZf_SetupIdle_(this); } if (this->skelAnime.curFrame == 22.0f) { - this->unk3FA = 0; + this->isSwordSheathed = false; } } @@ -1666,7 +1671,7 @@ void EnZf_Damaged_(EnZf* this, PlayState* play) { EnZf_PickAction_(this, play); } } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_ShouldAttack_(play, this)) { + EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { EnZf_PickAction_(this, play); @@ -1691,8 +1696,8 @@ void EnZf_SetupJumpAttack__(EnZf* this) { void EnZf_JumpAttack__(EnZf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { - func_800355B8(play, &this->unk4F0); - func_800355B8(play, &this->unk4E4); + func_800355B8(play, &this->leftFootPos); + func_800355B8(play, &this->rightFootPos); } if (SkelAnime_Update(&this->skelAnime)) { if (this->timer_ == 0) { @@ -1710,10 +1715,9 @@ void EnZf_JumpAttack__(EnZf* this, PlayState* play) { } } -void EnZf_Setup12or5___(EnZf* this, PlayState* play) { - s16 temp_v1_sp2E; +void EnZf_SetupCirclePlayerOrMainWalk___(EnZf* this, PlayState* play) { + s16 playerYaw; Player* player; - f32 temp_ft3; if (!ENZF_IS_TYPE_PAIRED_(this->actor.params) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || @@ -1721,10 +1725,10 @@ void EnZf_Setup12or5___(EnZf* this, PlayState* play) { Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - temp_v1_sp2E = player->actor.shape.rot.y; - if (Math_SinS(temp_v1_sp2E - this->actor.shape.rot.y) >= 0.0f) { + playerYaw = player->actor.shape.rot.y; + if (Math_SinS(playerYaw - this->actor.shape.rot.y) >= 0.0f) { this->actor.speed = -6.0f; - } else if (Math_SinS(temp_v1_sp2E - this->actor.shape.rot.y) < 0.0f) { + } else if (Math_SinS(playerYaw - this->actor.shape.rot.y) < 0.0f) { this->actor.speed = 6.0f; } this->dodgeSpeed___ = 0.0f; @@ -1734,13 +1738,13 @@ void EnZf_Setup12or5___(EnZf* this, PlayState* play) { this->action = ENZF_ACTION_CIRCLE_PLAYER___; EnZf_SetupAction(this, EnZf_CirclePlayer___); } else { - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } } void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { - s16 temp_t0_sp56; - s16 var_v0; + s16 playerYaw; + s16 yaw; Player* player; s32 prevFrame; s32 beforeCurFrame; @@ -1751,9 +1755,9 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { player = GET_PLAYER(play); extraRadius = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); - temp_t0_sp56 = player->actor.shape.rot.y; + playerYaw = player->actor.shape.rot.y; if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - if (this->unk3F8) { + if (this->noFloorAhead_) { this->actor.speed = -this->actor.speed; } } else { @@ -1761,16 +1765,16 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { !Actor_TestFloorInDirection(&this->actor, play, this->actor.speed, this->actor.shape.rot.y + 0x3FFF)) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->actor.speed >= 0.0f) { - var_v0 = this->actor.shape.rot.y + 0x3FFF; + yaw = this->actor.shape.rot.y + 0x3FFF; } else { - var_v0 = this->actor.shape.rot.y - 0x3FFF; + yaw = this->actor.shape.rot.y - 0x3FFF; } - var_v0 = this->actor.wallYaw - var_v0; + yaw = this->actor.wallYaw - yaw; } else { - var_v0 = 0; + yaw = 0; this->actor.speed *= -0.8f; } - if (ABS(var_v0) > 0x4000) { + if (ABS(yaw) > 0x4000) { this->actor.speed *= -0.8f; if (this->actor.speed < 0.0f) { this->actor.speed -= 0.5f; @@ -1783,7 +1787,7 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { if (1) {} //! FAKE #endif } - if (Math_SinS(temp_t0_sp56 - this->actor.shape.rot.y) >= 0.0f) { + if (Math_SinS(playerYaw - this->actor.shape.rot.y) >= 0.0f) { this->actor.speed += 0.125f; } else { this->actor.speed -= 0.125f; @@ -1816,41 +1820,41 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - this->unkPlatform3FE = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE); - if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE) { + this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); + if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE_cur) { this->actor.speed = 0.0f; if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { - EnZf_SetupJump20__(this); + EnZf_SetupJumpSeqJump20__(this); } else { - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { if (this->timer_ == 0) { - var_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (var_v0 < 0) { - var_v0 *= -1; + yaw = player->actor.shape.rot.y - this->actor.shape.rot.y; + if (yaw < 0) { + yaw *= -1; } - if (var_v0 >= 0x3A98) { + if (yaw >= 0x3A98) { if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { - EnZf_SetupJump20__(this); + EnZf_SetupJumpSeqJump20__(this); } else { EnZf_SetupIdle_(this); this->timer_ = (Rand_ZeroOne() * 5.0f) + 1.0f; } } else { if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { - EnZf_SetupJump20__(this); + EnZf_SetupJumpSeqJump20__(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_ShouldAttack_(play, this)) { + EnZf_CanAttack_(play, this)) { EnZf_SetupAttack(this); } else { if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && !EnZf_TestNoFloorAhead_(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { - EnZf_Setup13_(this); + EnZf_SetupJump13___(this); } else { - EnZf_Setup5_(this, play); + EnZf_SetupMainWalk_(this, play); } } } @@ -1860,8 +1864,8 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { this->timer_--; } if ((prevFrame != (s32)this->skelAnime.curFrame) && - (((beforeCurFrame < 0xE) && (((s32)absPlaySpeed + prevFrame) >= 0x10)) || - ((beforeCurFrame < 0x1B) && (((s32)absPlaySpeed + prevFrame) >= 0x1D)))) { + (((beforeCurFrame < 14) && (((s32)absPlaySpeed + prevFrame) >= 16)) || + ((beforeCurFrame < 27) && (((s32)absPlaySpeed + prevFrame) >= 29)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_WALK); } if ((play->gameplayFrames & 0x5F) == 0) { @@ -2001,16 +2005,16 @@ void EnZf_Update(Actor* thisx, PlayState* play) { EnZf_CheckCollide(this, play); if (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6) { - this->unk3F8 = false; - if ((this->actionState_ != 1) && (this->action != ENZF_ACTION_JUMP_19__)) { + this->noFloorAhead_ = false; + if ((this->actionState_ != 1) && (this->action != ENZF_ACTION_JUMP_SEQ_JUMP_19__)) { if (this->actor.speed != 0.0f) { - this->unk3F8 = EnZf_TestNoFloorAhead_(this, play, this->actor.speed * 1.5f); + this->noFloorAhead_ = EnZf_TestNoFloorAhead_(this, play, this->actor.speed * 1.5f); } - if (!this->unk3F8) { - this->unk3F8 = EnZf_TestNoFloorAhead_(this, play, 0.0f); + if (!this->noFloorAhead_) { + this->noFloorAhead_ = EnZf_TestNoFloorAhead_(this, play, 0.0f); } } - if (!this->unk3F8) { + if (!this->noFloorAhead_) { Actor_MoveXZGravity(&this->actor); } Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, @@ -2026,7 +2030,7 @@ void EnZf_Update(Actor* thisx, PlayState* play) { EnZf_UpdateHeadRot(this, play); } if ((sPairedActiveFleeFlag_ != 0) && (sPairedInactiveType__ != this->actor.params)) { - EnZf_Setup18_(this, play); + EnZf_SetupJumpSeqStartTurnAround_(this, play); sPairedInactiveType__ = this->actor.params; sPairedActiveFleeFlag_ = 0; if (this->actor.prev != NULL) { @@ -2038,10 +2042,10 @@ void EnZf_Update(Actor* thisx, PlayState* play) { } if (this->action >= ENZF_ACTION_DIE_) { Math_SmoothStepToS(&this->headRot, 0, 1, 0x7D0, 0); - if ((this->action <= ENZF_ACTION_JUMP_20__) && (this->timer2_ == 1) && + if ((this->action <= ENZF_ACTION_JUMP_SEQ_JUMP_20__) && (this->timer2_ == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health > 0) { - EnZf_Setup21_(this, play); + EnZf_SetupJumpSeqFinalLanding_____(this, play); } this->timer2_--; } @@ -2085,13 +2089,13 @@ s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po break; case ZF_LIMB_RIGHT_HAND_AND_SWORD: - if (this->unk3FA != 0) { + if (this->isSwordSheathed) { *dList = gLizalfosRightHandDL; } break; case ZF_LIMB_SHEATH: - if (this->unk3FA != 0) { + if (this->isSwordSheathed) { *dList = gLizalfosSheathedSwordDL; } break; @@ -2129,10 +2133,10 @@ void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } switch (limbIndex) { case ZF_LIMB_LEFT_FOOT_CLAWS: - Matrix_MultVec3f(&D_80B4A298, &this->unk4F0); + Matrix_MultVec3f(&D_80B4A298, &this->leftFootPos); break; case ZF_LIMB_RIGHT_FOOT_CLAWS: - Matrix_MultVec3f(&D_80B4A298, &this->unk4E4); + Matrix_MultVec3f(&D_80B4A298, &this->rightFootPos); break; } if (this->frozenTimer != 0) { @@ -2275,10 +2279,10 @@ s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this) { Actor* projectile; s16 relYawTowardsProjectile; s16 noFloorAheadFlags_; - s16 sp1E; - s16 sp1C; + s16 dodgeSpeed_; + s16 dodgeVelocityY_; - sp1C = 0; + dodgeVelocityY_ = 0; projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectile != NULL) { relYawTowardsProjectile = @@ -2295,54 +2299,54 @@ s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this) { if ((ABS(relYawTowardsProjectile) < 0x2000 || ABS(relYawTowardsProjectile) > 0x5FFF)) { if (noFloorAheadFlags_ == 0) { if ((play->gameplayFrames % 2) != 0) { - sp1E = 6; + dodgeSpeed_ = 6; } else { - sp1E = -6; + dodgeSpeed_ = -6; } } else { switch (noFloorAheadFlags_) { case 1: - sp1E = 6; + dodgeSpeed_ = 6; break; case 2: - sp1E = -6; + dodgeSpeed_ = -6; break; case 3: - sp1C = 5; - sp1E = 0; + dodgeVelocityY_ = 5; + dodgeSpeed_ = 0; break; } } } else if (ABS(relYawTowardsProjectile) < 0x5FFF) { if (noFloorAheadFlags_ == 0) { if ((play->gameplayFrames % 2) != 0) { - sp1E = 6; + dodgeSpeed_ = 6; } else { - sp1E = -6; + dodgeSpeed_ = -6; } } else { switch (noFloorAheadFlags_) { case 1: - sp1E = 6; + dodgeSpeed_ = 6; break; case 2: - sp1E = -6; + dodgeSpeed_ = -6; break; case 3: - sp1C = 0xA; - sp1E = 0; + dodgeVelocityY_ = 10; + dodgeSpeed_ = 0; break; } } } //! @bug if sp22 is exactly 0x5FFF, sp1E is used uninitialized - this->dodgeSpeed___ = sp1E; - this->unk40C = sp1C; - return 1; + this->dodgeSpeed___ = dodgeSpeed_; + this->dodgeVelocityY___ = dodgeVelocityY_; + return true; } - return 0; + return false; } 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 d5b69b648b3..f0eb4f564f7 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -31,23 +31,23 @@ typedef struct EnZf { /* 0x3F0 */ s32 timer_; /* 0x3F4 */ s16 timer2_; /* 0x3F6 */ s16 frozenTimer; - /* 0x3F8 */ s16 unk3F8; - /* 0x3FA */ s16 unk3FA; + /* 0x3F8 */ s16 noFloorAhead_; + /* 0x3FA */ s16 isSwordSheathed; /* 0x3FC */ s16 switchFlag; - /* 0x3FE */ s16 unkPlatform3FE; - /* 0x400 */ s16 unkPlatform400; - /* 0x402 */ s16 unkPlatform402; + /* 0x3FE */ s16 unkPlatform3FE_cur; + /* 0x400 */ s16 unkPlatform400_home___; + /* 0x402 */ s16 unkPlatform402_target_; /* 0x404 */ u8 alpha_; /* 0x405 */ char pad405[3]; /* 0x408 */ f32 dodgeSpeed___; - /* 0x40C */ f32 unk40C; + /* 0x40C */ f32 dodgeVelocityY___; /* 0x410 */ u8 lastDamageReaction; /* 0x411 */ char pad411[3]; /* 0x414 */ s32 swordBlureEffectIndex; /* 0x418 */ ColliderCylinder bodyCollider; /* 0x464 */ ColliderQuad swordCollider; - /* 0x4E4 */ Vec3f unk4E4; - /* 0x4F0 */ Vec3f unk4F0; + /* 0x4E4 */ Vec3f rightFootPos; + /* 0x4F0 */ Vec3f leftFootPos; /* 0x4FC */ Vec3f bodyPartsPos[9]; } EnZf; // size = 0x568 From 77e3d18fc01085d5527d0fc7b540ca388393e3e4 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 5 Aug 2026 12:14:32 +0200 Subject: [PATCH 068/150] finish up EnZf docs --- assets/xml/objects/object_zf.xml | 22 +- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 1172 ++++++++++++----------- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 36 +- 3 files changed, 631 insertions(+), 599 deletions(-) diff --git a/assets/xml/objects/object_zf.xml b/assets/xml/objects/object_zf.xml index 39ab2f42a23..ae62fc4dc17 100644 --- a/assets/xml/objects/object_zf.xml +++ b/assets/xml/objects/object_zf.xml @@ -140,11 +140,11 @@ - - - + + + - + @@ -294,13 +294,13 @@ - - - - - + + + + + - - + + 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 e34e203c37c..0cec0b1433f 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -32,61 +32,61 @@ void EnZf_Destroy(Actor* thisx, PlayState* play); void EnZf_Update(Actor* thisx, PlayState* play); void EnZf_Draw(Actor* thisx, PlayState* play); -s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred); -void EnZf_SetupWaitAppear_(EnZf* this); -void EnZf_WaitAppear_(EnZf* this, PlayState* play); -void EnZf_SetupIdle_(EnZf* this); -void EnZf_Idle_(EnZf* this, PlayState* play); -void EnZf_SetupMainWalk_(EnZf* this, PlayState* play); -void EnZf_MainWalk_(EnZf* this, PlayState* play); -void EnZf_SetupJump13___(EnZf* this); -void EnZf_Jump13___(EnZf* this, PlayState* play); -void EnZf_SetupTurnTowardsPlayer_(EnZf* this); -void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play); -void EnZf_SetupSidestepOrMainWalk___(EnZf* this, PlayState* play); -void EnZf_Sidestep__(EnZf* this, PlayState* play); +s16 EnZf_FindPlatform(Vec3f* pos, s16 preferred); +void EnZf_SetupWaitAppear(EnZf* this); +void EnZf_WaitAppear(EnZf* this, PlayState* play); +void EnZf_SetupIdle(EnZf* this); +void EnZf_Idle(EnZf* this, PlayState* play); +void EnZf_SetupMainWalk(EnZf* this, PlayState* play); +void EnZf_MainWalk(EnZf* this, PlayState* play); +void EnZf_SetupJumpForwards(EnZf* this); +void EnZf_JumpForwards(EnZf* this, PlayState* play); +void EnZf_SetupTurnTowardsPlayer(EnZf* this); +void EnZf_TurnTowardsPlayer(EnZf* this, PlayState* play); +void EnZf_SetupSidestepIfFloor(EnZf* this, PlayState* play); +void EnZf_Sidestep(EnZf* this, PlayState* play); void EnZf_SetupAttack(EnZf* this); void EnZf_Attack(EnZf* this, PlayState* play); void EnZf_AttackBounced(EnZf* this, PlayState* play); -void EnZf_SetupJumpBackwards_(EnZf* this); -void EnZf_JumpBackwards_(EnZf* this, PlayState* play); -void EnZf_Stunned_(EnZf* this, PlayState* play); -void EnZf_SetupJumpSeqStartTurnAround_(EnZf* this, PlayState* play); -void EnZf_JumpSeqStartTurnAround_(EnZf* this, PlayState* play); -void EnZf_JumpSeqJump20__(EnZf* this, PlayState* play); -void EnZf_SetupJumpSeqJump19__(EnZf* this, PlayState* play); -void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play); -void EnZf_JumpSeqFinalLanding_____(EnZf* this, PlayState* play); -void EnZf_Damaged_(EnZf* this, PlayState* play); -void EnZf_SetupJumpAttack__(EnZf* this); -void EnZf_JumpAttack__(EnZf* this, PlayState* play); -void EnZf_SetupCirclePlayerOrMainWalk___(EnZf* this, PlayState* play); -void EnZf_CirclePlayer___(EnZf* this, PlayState* play); -void EnZf_SetupDie_(EnZf* this); -void EnZf_Die_(EnZf* this, PlayState* play); -void EnZf_SetupCirclePlayer___(EnZf* this, f32 speed); -s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this); -s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this); +void EnZf_SetupJumpBackwards(EnZf* this); +void EnZf_JumpBackwards(EnZf* this, PlayState* play); +void EnZf_Stunned(EnZf* this, PlayState* play); +void EnZf_Paired_SetupJumpAwayStartTurnAround(EnZf* this, PlayState* play); +void EnZf_Paired_JumpAwayStartTurnAround(EnZf* this, PlayState* play); +void EnZf_Paired_IdleHop(EnZf* this, PlayState* play); +void EnZf_Paired_SetupJumpAway(EnZf* this, PlayState* play); +void EnZf_Paired_JumpAway(EnZf* this, PlayState* play); +void EnZf_Paired_EngageCombat(EnZf* this, PlayState* play); +void EnZf_Damaged(EnZf* this, PlayState* play); +void EnZf_SetupJumpAttack(EnZf* this); +void EnZf_JumpAttack(EnZf* this, PlayState* play); +void EnZf_SetupCirclePlayerIfFloor(EnZf* this, PlayState* play); +void EnZf_CirclePlayer(EnZf* this, PlayState* play); +void EnZf_SetupDie(EnZf* this); +void EnZf_Die(EnZf* this, PlayState* play); +void EnZf_SetupCirclePlayer(EnZf* this, f32 speed); +s32 EnZf_ReactToProjectile(PlayState* play, EnZf* this); +s32 EnZf_ReactToProjectileSetDodgeSpeed(PlayState* play, EnZf* this); typedef enum EnZfAction { - ENZF_ACTION_WAIT_APPEAR_, - ENZF_ACTION_IDLE_ = 3, - ENZF_ACTION_MAIN_WALK_ = 5, - ENZF_ACTION_TURN_TOWARDS_PLAYER_, - ENZF_ACTION_SIDESTEP__, + ENZF_ACTION_WAIT_APPEAR, + ENZF_ACTION_IDLE = 3, + ENZF_ACTION_MAIN_WALK = 5, + ENZF_ACTION_TURN_TOWARDS_PLAYER, + ENZF_ACTION_SIDESTEP, ENZF_ACTION_ATTACK_BOUNCED, ENZF_ACTION_ATTACK, - ENZF_ACTION_JUMP_BACKWARDS_ = 11, - ENZF_ACTION_CIRCLE_PLAYER___, - ENZF_ACTION_13_JUMP___, - ENZF_ACTION_STUNNED_, - ENZF_ACTION_DIE_, - ENZF_ACTION_DAMAGED_, - ENZF_ACTION_JUMP_SEQ_START_TURN_AROUND_ = 18, - ENZF_ACTION_JUMP_SEQ_JUMP_19__, - ENZF_ACTION_JUMP_SEQ_JUMP_20__, - ENZF_ACTION_JUMP_SEQ_FINAL_LANDING_____, - ENZF_ACTION_JUMP_ATTACK__ + ENZF_ACTION_JUMP_BACKWARDS = 11, + ENZF_ACTION_CIRCLE_PLAYER, + ENZF_ACTION_JUMP_FORWARDS, + ENZF_ACTION_STUNNED, + ENZF_ACTION_DIE, + ENZF_ACTION_DAMAGED, + ENZF_ACTION_PAIRED_JUMP_AWAY_START_TURN_AROUND = 18, + ENZF_ACTION_PAIRED_JUMP_AWAY, + ENZF_ACTION_PAIRED_IDLE_HOP, + ENZF_ACTION_PAIRED_ENGAGE_COMBAT, + ENZF_ACTION_JUMP_ATTACK } EnZfAction; /** @@ -128,13 +128,13 @@ static Vec3f sDCPlatformPositions_[] = { /** * Incremented when a pair is spawned and the active / foreground / fighting one should retreat. */ -static s16 sPairedActiveFleeFlag_ = 0; +static s16 sPairedActiveFleeFlag = 0; /** * When a pair is spawned, this tracks the type of the inactive / background / not fighting one - * (ENZF_TYPE_LIZALFOS_PAIRED_A_ or ENZF_TYPE_LIZALFOS_PAIRED_B_). - * When no pair, or once one of the pair is defeated, this is ENZF_TYPE_LIZALFOS_SINGLE_. + * (ENZF_TYPE_LIZALFOS_PAIRED_A or ENZF_TYPE_LIZALFOS_PAIRED_B). + * When no pair, or once one of the pair is defeated, this is ENZF_TYPE_LIZALFOS_SINGLE. */ -static s16 sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_PAIRED_B_; +static s16 sPairedInactiveType = ENZF_TYPE_LIZALFOS_PAIRED_B; ActorProfile En_Zf_Profile = { /**/ ACTOR_EN_ZF, @@ -230,16 +230,19 @@ static DamageTable sDamageTable = { /* Hammer jump */ DMG_ENTRY(4, ENZF_DMG_REACT_NONE), /* Unknown 2 */ DMG_ENTRY(0, ENZF_DMG_REACT_NONE), }; + static InitChainEntry sInitChain[3] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 15, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3500, ICHAIN_STOP), }; + static AnimationHeader* D_80B4A280[] = { - &gZfJumpAnim___, - &gZfAirborneAnim___, - &gZfLandFromJumpAnim__, + &gZfRunAwayJumpAnim, + &gZfRunAwayAirborneAnim, + &gZfRunAwayLandAnim, }; + static Vec3f D_80B4A28C = { 1100.0f, -700.0f, 0.0f }; static Vec3f D_80B4A298 = { 300.0f, 0.0f, 0.0f }; static Vec3f D_80B4A2A4 = { 300.0f, -1700.0f, 0.0f }; @@ -267,7 +270,7 @@ void EnZf_SetupAction(EnZf* this, void (*actionFunc)(EnZf*, PlayState*)) { * * Note: uses world.rot.y */ -s32 EnZf_TestNoFloorAhead_(EnZf* this, PlayState* play, f32 distance) { +s32 EnZf_TestNoFloorAhead(EnZf* this, PlayState* play, f32 distance) { s16 ret; s16 prevBgCheckFlags; f32 dx; @@ -280,7 +283,7 @@ s32 EnZf_TestNoFloorAhead_(EnZf* this, PlayState* play, f32 distance) { } else { distance = -1.0f; } - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { distance = distance * 45.0f; } else { distance = distance * 30.0f; @@ -307,16 +310,20 @@ s32 EnZf_TestNoFloorAhead_(EnZf* this, PlayState* play, f32 distance) { } /** - * Note: uses shape.rot.y + * Checks if the actor will not be standing on the ground after moving by its speed or `distance`. + * + * Returns true if the actor will not be standing on ground. + * + * Note: uses shape.rot.y for the second `distance` check. */ -s16 EnZf_TestNoFloorAhead2_(EnZf* this, PlayState* play, f32 distance) { +s16 EnZf_TestNoFloorAheadShape(EnZf* this, PlayState* play, f32 distance) { s16 ret; s16 prevBgCheckFlags; f32 dx; f32 dz; Vec3f prevPos; - if ((this->actor.speed != 0.0f) && EnZf_TestNoFloorAhead_(this, play, this->actor.speed)) { + if ((this->actor.speed != 0.0f) && EnZf_TestNoFloorAhead(this, play, this->actor.speed)) { return true; } @@ -356,7 +363,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { this->actor.params |= 0xFF00; } ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, 90.0f); - this->unk3E0 = 0; + this->unk_3E0 = 0; this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.damageTable = &sDamageTable; swordBlure.p1StartColor[0] = swordBlure.p1StartColor[1] = swordBlure.p1StartColor[2] = swordBlure.p1StartColor[3] = @@ -373,7 +380,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 45.0f, 45.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->alpha_ = 255; + this->alpha = 255; this->actor.colChkInfo.cylRadius = 40; this->actor.colChkInfo.cylHeight = 100; Collider_InitCylinder(play, &this->bodyCollider); @@ -383,29 +390,29 @@ void EnZf_Init(Actor* thisx, PlayState* play) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->actor.colChkInfo.health = 12; this->actor.naviEnemyId = NAVI_ENEMY_DINOLFOS; - SkelAnime_Init(play, &this->skelAnime, &gDinolfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gDinolfosSkel, &gZfIdleAnim, this->jointTable, this->morphTable, ZF_LIMB_MAX); } else { this->actor.colChkInfo.health = 6; this->actor.naviEnemyId = NAVI_ENEMY_LIZALFOS; - SkelAnime_Init(play, &this->skelAnime, &gLizalfosSkel, &gZfTaunt2Anim_____, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gLizalfosSkel, &gZfIdleAnim, this->jointTable, this->morphTable, ZF_LIMB_MAX); } - if (!ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - this->unkPlatform400_home___ = this->unkPlatform3FE_cur = -1; - sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_SINGLE_; - this->actionState_ = 1; - if (this->actor.params == ENZF_TYPE_LIZALFOS_SINGLE_) { - EnZf_SetupWaitAppear_(this); + if (!ENZF_IS_TYPE_PAIRED(this->actor.params)) { + this->homePlatform = this->curPlatform = -1; + sPairedInactiveType = ENZF_TYPE_LIZALFOS_SINGLE; + this->actionState = 1; + if (this->actor.params == ENZF_TYPE_LIZALFOS_SINGLE) { + EnZf_SetupWaitAppear(this); } else { // ENZF_TYPE_DINOLFOS - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } } else { yDiff = player->actor.world.pos.y - this->actor.world.pos.y; if ((ABS(yDiff) <= 100.0f) && !Flags_GetSwitch(play, this->switchFlag)) { - this->unkPlatform400_home___ = this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, 0); - EnZf_SetupWaitAppear_(this); - sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_PAIRED_B_; + this->homePlatform = this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, 0); + EnZf_SetupWaitAppear(this); + sPairedInactiveType = ENZF_TYPE_LIZALFOS_PAIRED_B; } else { Actor_Kill(&this->actor); } @@ -415,7 +422,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { void EnZf_Destroy(Actor* thisx, PlayState* play) { EnZf* this = (EnZf*)thisx; - if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && + if (ENZF_IS_TYPE_PAIRED(this->actor.params) && (Actor_FindNearby(play, &this->actor, ACTOR_EN_ZF, ACTORCAT_ENEMY, 10000.0f) == NULL)) { func_800F5B58(); } @@ -424,7 +431,7 @@ void EnZf_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyQuad(play, &this->swordCollider); } -s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred) { +s16 EnZf_FindPlatform(Vec3f* pos, s16 preferred) { Vec3f* platformPos; f32 range; s16 i; @@ -452,12 +459,12 @@ s16 EnZf_FindPlatform1__(Vec3f* pos, s16 preferred) { return i; } -s16 EnZf_FindPlatformWithoutPlayer__(Vec3f* thisPos, s16 curPlatform, s16 fallbackPlatform, PlayState* play) { +s16 EnZf_FindPlatformWithoutPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallbackPlatform, PlayState* play) { Vec3f* closestPlatformPos; f32 platformDist; f32 closestPlatformDist; f32 secondClosestPlatformDist; - f32 maxPlatformDist_; + f32 maxPlatformDist; f32 minPlatformDistFromPlayer; s16 yawTowardsClosestPlatform; s16 playerPlatform; @@ -468,22 +475,22 @@ s16 EnZf_FindPlatformWithoutPlayer__(Vec3f* thisPos, s16 curPlatform, s16 fallba s32 iMin; Player* player = GET_PLAYER(play); - maxPlatformDist_ = 585.0f; + maxPlatformDist = 585.0f; minPlatformDistFromPlayer = 400.0f; closestPlatformDist = 99998.0f; i = 5; iMin = 0; secondClosestPlatformDist = 99999.0f; secondClosestPlatform = closestPlatform = -1; - playerPlatform = EnZf_FindPlatform1__(&player->actor.world.pos, curPlatform); + playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, curPlatform); if (thisPos->y > 420.0f) { minPlatformDistFromPlayer = 50.0f; iMin = 8; if (curPlatform >= 15) { - maxPlatformDist_ = 400.0f; + maxPlatformDist = 400.0f; i = 23; } else { - maxPlatformDist_ = 380.0f; + maxPlatformDist = 380.0f; i = 14; } } @@ -502,7 +509,7 @@ s16 EnZf_FindPlatformWithoutPlayer__(Vec3f* thisPos, s16 curPlatform, s16 fallba continue; } platformDist = Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions_[i]); - if (platformDist > maxPlatformDist_) { + if (platformDist > maxPlatformDist) { continue; } if (platformDist < closestPlatformDist) { @@ -541,71 +548,71 @@ s16 EnZf_FindPlatformWithoutPlayer__(Vec3f* thisPos, s16 curPlatform, s16 fallba return closestPlatform; } -s32 EnZf_FindPlatformCloseToPlayer__(Vec3f* thisPos_, s16 curPlatform, s16 platform_arg2, PlayState* play) { +s32 EnZf_FindPlatformCloseToPlayer(Vec3f* thisPos_, s16 curPlatform, s16 platform_arg2, PlayState* play) { Vec3f* temp_s0; f32 platformDistToPlayer; - f32 closestPlatformToPlayerDist_; - f32 secondClosestPlatformToPlayerDist_; - f32 maxPlatformDist_; + f32 closestPlatformToPlayerDist; + f32 secondClosestPlatformToPlayerDist; + f32 maxPlatformDist; s16 temp_fp; s16 i; - s16 closestPlatformToPlayer_; - s16 secondClosestPlatformToPlayer_; - s16 playerPlatform_; + s16 closestPlatformToPlayer; + s16 secondClosestPlatformToPlayer; + s16 playerPlatform; s32 iMin; Player* player = GET_PLAYER(play); i = 7; iMin = 0; - playerPlatform_ = EnZf_FindPlatform1__(&player->actor.world.pos, -1); - maxPlatformDist_ = 500.0f; - closestPlatformToPlayerDist_ = 99998.0f; - secondClosestPlatformToPlayerDist_ = 99999.0f; - closestPlatformToPlayer_ = curPlatform; - secondClosestPlatformToPlayer_ = platform_arg2; + playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, -1); + maxPlatformDist = 500.0f; + closestPlatformToPlayerDist = 99998.0f; + secondClosestPlatformToPlayerDist = 99999.0f; + closestPlatformToPlayer = curPlatform; + secondClosestPlatformToPlayer = platform_arg2; if (thisPos_->y > 200.0f) { - maxPlatformDist_ = 290.0f; + maxPlatformDist = 290.0f; i = 23; iMin = 8; } for (; i >= iMin; i--) { - if (Math_Vec3f_DistXYZ(thisPos_, &sDCPlatformPositions_[i]) > maxPlatformDist_) { + if (Math_Vec3f_DistXYZ(thisPos_, &sDCPlatformPositions_[i]) > maxPlatformDist) { continue; } - if (i != playerPlatform_) { + if (i != playerPlatform) { platformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]); - if (platformDistToPlayer < closestPlatformToPlayerDist_) { - secondClosestPlatformToPlayerDist_ = closestPlatformToPlayerDist_; - secondClosestPlatformToPlayer_ = closestPlatformToPlayer_; - closestPlatformToPlayerDist_ = platformDistToPlayer; - closestPlatformToPlayer_ = i; - } else if (platformDistToPlayer < secondClosestPlatformToPlayerDist_) { - secondClosestPlatformToPlayerDist_ = platformDistToPlayer; - secondClosestPlatformToPlayer_ = i; + if (platformDistToPlayer < closestPlatformToPlayerDist) { + secondClosestPlatformToPlayerDist = closestPlatformToPlayerDist; + secondClosestPlatformToPlayer = closestPlatformToPlayer; + closestPlatformToPlayerDist = platformDistToPlayer; + closestPlatformToPlayer = i; + } else if (platformDistToPlayer < secondClosestPlatformToPlayerDist) { + secondClosestPlatformToPlayerDist = platformDistToPlayer; + secondClosestPlatformToPlayer = i; } } else { - closestPlatformToPlayer_ = playerPlatform_; + closestPlatformToPlayer = playerPlatform; // TODO: This break is weird, it makes the function result heavily depend on the order of // the platform positions array break; } } - if (secondClosestPlatformToPlayer_ != playerPlatform_) { - playerPlatform_ = closestPlatformToPlayer_; + if (secondClosestPlatformToPlayer != playerPlatform) { + playerPlatform = closestPlatformToPlayer; } else { - playerPlatform_ = secondClosestPlatformToPlayer_; + playerPlatform = secondClosestPlatformToPlayer; } - return playerPlatform_; + return playerPlatform; } -s32 EnZf_CanAttack_(PlayState* play, EnZf* this) { +s32 EnZf_CanAttack(PlayState* play, EnZf* this) { s32 pad; Player* player; Actor* playerFocusActor; player = GET_PLAYER(play); - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { if (player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { return false; } else { @@ -633,25 +640,25 @@ s32 EnZf_CanAttack_(PlayState* play, EnZf* this) { return false; } -void EnZf_PickAction_(EnZf* this, PlayState* play) { +void EnZf_PickAction(EnZf* this, PlayState* play) { s16 relYawTowardsPlayer; relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; relYawTowardsPlayer = ABS(relYawTowardsPlayer); if (relYawTowardsPlayer >= 0x1B58) { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && - EnZf_CanAttack_(play, this)) { + EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } } /** * @return true if an action was picked */ -s32 EnZf_DinolfosPickAction_(PlayState* play, EnZf* this) { +s32 EnZf_DinolfosPickAction(PlayState* play, EnZf* this) { s16 absRelWallYaw; Actor* explosive; @@ -661,11 +668,11 @@ s32 EnZf_DinolfosPickAction_(PlayState* play, EnZf* this) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 80.0f)) { - EnZf_SetupJumpAttack__(this); + EnZf_SetupJumpAttack(this); } else if ((this->actor.xzDistToPlayer < 90.0f) && ((play->gameplayFrames % 2) != 0)) { - EnZf_SetupJumpAttack__(this); + EnZf_SetupJumpAttack(this); } else { - EnZf_SetupJumpBackwards_(this); + EnZf_SetupJumpBackwards(this); } return true; } @@ -676,58 +683,58 @@ s32 EnZf_DinolfosPickAction_(PlayState* play, EnZf* this) { (explosive->id == ACTOR_EN_BOM_CHU)) { if ((explosive->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->actor, explosive) < 80.0f) && ((s16)(this->actor.shape.rot.y - explosive->world.rot.y + 0x8000) < 0x3E80)) { - EnZf_SetupJumpAttack__(this); + EnZf_SetupJumpAttack(this); } else { - EnZf_SetupCirclePlayer___(this, 4.0f); + EnZf_SetupCirclePlayer(this, 4.0f); } } else { - EnZf_SetupJumpBackwards_(this); + EnZf_SetupJumpBackwards(this); } return true; } return false; } -void EnZf_SetupWaitAppear_(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 0.0f, 9.0f, Animation_GetLastFrame(&gZfTauntAnim_____), - ANIMMODE_LOOP, 0.0f); +void EnZf_SetupWaitAppear(EnZf* this) { + Animation_Change(&this->skelAnime, &gZfJumpAnim, 0.0f, 9.0f, Animation_GetLastFrame(&gZfJumpAnim), ANIMMODE_LOOP, + 0.0f); this->actor.world.pos.y = this->actor.floorHeight + 300.0f; - this->alpha_ = this->actor.shape.shadowAlpha = 0; - this->timer_ = 10; - this->actionState_ = 1; - this->action = ENZF_ACTION_WAIT_APPEAR_; + this->alpha = this->actor.shape.shadowAlpha = 0; + this->timer = 10; + this->actionState = 1; + this->action = ENZF_ACTION_WAIT_APPEAR; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupAction(this, EnZf_WaitAppear_); + EnZf_SetupAction(this, EnZf_WaitAppear); } -void EnZf_WaitAppear_(EnZf* this, PlayState* play) { - if (this->timer_ == 1) { +void EnZf_WaitAppear(EnZf* this, PlayState* play) { + if (this->timer == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - if (this->actor.params == ENZF_TYPE_LIZALFOS_PAIRED_A_) { + if (this->actor.params == ENZF_TYPE_LIZALFOS_PAIRED_A) { func_800F5ACC(NA_BGM_MINI_BOSS); } } - if (this->timer_ != 0) { - if (this->actor.params != ENZF_TYPE_LIZALFOS_SINGLE_) { - this->timer_--; + if (this->timer != 0) { + if (this->actor.params != ENZF_TYPE_LIZALFOS_SINGLE) { + this->timer--; } else if (this->actor.xzDistToPlayer <= 160.0f) { - this->timer_ = 0; + this->timer = 0; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } this->actor.world.pos.y = this->actor.floorHeight + 300.0f; } else { - if (this->alpha_ < 255) { - this->alpha_ += 51; + if (this->alpha < 255) { + this->alpha += 51; } } - if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->actionState_ != 0)) { + if ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) && (this->actionState != 0)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ONGND); - Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); - this->actionState_ = 0; + Animation_Change(&this->skelAnime, &gZfLandOnFeetAnim, 1.0f, 0.0f, 17.0f, ANIMMODE_ONCE, 0.0f); + this->actionState = 0; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND_TOUCH; this->actor.world.pos.y = this->actor.floorHeight; this->actor.velocity.y = 0.0f; @@ -735,27 +742,27 @@ void EnZf_WaitAppear_(EnZf* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); } if (SkelAnime_Update(&this->skelAnime)) { - this->alpha_ = 255; - if (this->actor.params >= ENZF_TYPE_LIZALFOS_PAIRED_B_) { - EnZf_SetupJumpSeqStartTurnAround_(this, play); + this->alpha = 255; + if (this->actor.params >= ENZF_TYPE_LIZALFOS_PAIRED_B) { + EnZf_Paired_SetupJumpAwayStartTurnAround(this, play); } else { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } } - this->actor.shape.shadowAlpha = this->alpha_; + this->actor.shape.shadowAlpha = this->alpha; } -void EnZf_SetupIdle_(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfTaunt2Anim_____, 1.0f, 0.0f, Animation_GetLastFrame(&gZfTaunt2Anim_____), +void EnZf_SetupIdle(EnZf* this) { + Animation_Change(&this->skelAnime, &gZfIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZfIdleAnim), ANIMMODE_LOOP_INTERP, -4.0f); - this->action = ENZF_ACTION_IDLE_; - this->timer_ = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->action = ENZF_ACTION_IDLE; + this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; this->actor.speed = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_Idle_); + EnZf_SetupAction(this, EnZf_Idle); } -void EnZf_Idle_(EnZf* this, PlayState* play) { +void EnZf_Idle(EnZf* this, PlayState* play) { Player* player; s32 pad; s16 absYawTowardsPlayerRelToHead; @@ -765,16 +772,16 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { absYawTowardsPlayerRelToHead = this->actor.yawTowardsPlayer - this->headRot - this->actor.shape.rot.y; absYawTowardsPlayerRelToHead = ABS(absYawTowardsPlayerRelToHead); SkelAnime_Update(&this->skelAnime); - if (!EnZf_ReactToProjectile_(play, this)) { + if (!EnZf_ReactToProjectile(play, this)) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (this->timer2_ != 0) { - this->timer2_--; + if (this->timer2 != 0) { + this->timer2--; if (absYawTowardsPlayerRelToHead < 0x1FFE) { - this->timer2_ = 0; + this->timer2 = 0; } else { return; } - } else if (EnZf_DinolfosPickAction_(play, this)) { + } else if (EnZf_DinolfosPickAction(play, this)) { return; } } @@ -784,26 +791,26 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { (absYawDiffWithPlayer >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (absYawDiffWithPlayer) {} - EnZf_SetupCirclePlayerOrMainWalk___(this, play); - } else if (this->timer_ != 0) { - this->timer_--; + EnZf_SetupCirclePlayerIfFloor(this, play); + } else if (this->timer != 0) { + this->timer--; } else { if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.xzDistToPlayer > 100.0f) && (Rand_ZeroOne() < 0.3f)) { if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupJump13___(this); + EnZf_SetupJumpForwards(this); } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } } else if (Rand_ZeroOne() > 0.3f) { - EnZf_SetupMainWalk_(this, play); + EnZf_SetupMainWalk(this, play); } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } } else { - EnZf_SetupTurnTowardsPlayer_(this); + EnZf_SetupTurnTowardsPlayer(this); } if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -812,68 +819,71 @@ void EnZf_Idle_(EnZf* this, PlayState* play) { } } -void EnZf_SetupMainWalk_(EnZf* this, PlayState* play) { - Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); - this->action = ENZF_ACTION_MAIN_WALK_; - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - this->unkPlatform402_target_ = EnZf_FindPlatformCloseToPlayer__( - &this->actor.world.pos, this->unkPlatform3FE_cur, this->unkPlatform400_home___, play); - this->actionState_ = 0; +/** + * Walk and decide what action to setup next. + */ +void EnZf_SetupMainWalk(EnZf* this, PlayState* play) { + Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim, -4.0f); + this->action = ENZF_ACTION_MAIN_WALK; + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + this->targetPlatform = + EnZf_FindPlatformCloseToPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); + this->actionState = 0; } this->actor.speed = 0.0f; - EnZf_SetupAction(this, EnZf_MainWalk_); + EnZf_SetupAction(this, EnZf_MainWalk); } -void EnZf_MainWalk_(EnZf* this, PlayState* play) { +void EnZf_MainWalk(EnZf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad1; s16 absYawDiff; s16 playerPlatform; - f32 maxTargetPlatformDistForJump_; + f32 maxTargetPlatformDistForJump; f32 extraDistFromPlayer; Player* player; f32 absPlaySpeed; playerPlatform = -1; - maxTargetPlatformDistForJump_ = 350.0f; + maxTargetPlatformDistForJump = 350.0f; extraDistFromPlayer = 0.0f; player = GET_PLAYER(play); - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - playerPlatform = EnZf_FindPlatform1__(&player->actor.world.pos, -1); - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, playerPlatform); + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { + playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, -1); + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, playerPlatform); if (this->actor.world.pos.y >= 420.0f) { - maxTargetPlatformDistForJump_ = 270.0f; + maxTargetPlatformDistForJump = 270.0f; } } - if (!EnZf_ReactToProjectile_(play, this)) { - if (playerPlatform != this->unkPlatform3FE_cur) { // May only pass if type is paired - this->unkPlatform402_target_ = EnZf_FindPlatformCloseToPlayer__( - &this->actor.world.pos, this->unkPlatform3FE_cur, this->unkPlatform400_home___, play); - if ((playerPlatform < 0) && (this->unkPlatform402_target_ == this->unkPlatform3FE_cur)) { - playerPlatform = this->unkPlatform3FE_cur; + if (!EnZf_ReactToProjectile(play, this)) { + if (playerPlatform != this->curPlatform) { // May only pass if type is paired + this->targetPlatform = + EnZf_FindPlatformCloseToPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); + if ((playerPlatform < 0) && (this->targetPlatform == this->curPlatform)) { + playerPlatform = this->curPlatform; this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer = this->actor.shape.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]); + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]); absYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; if (absYawDiff < 0) { absYawDiff *= -1; } - if ((this->noFloorAhead_ && (this->actor.speed > 0.0f)) || + if ((this->noFloorAhead && (this->actor.speed > 0.0f)) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (absYawDiff >= 0x5C19))) { - if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]) < - maxTargetPlatformDistForJump_) && - !EnZf_TestNoFloorAhead_(this, play, 191.9956f)) { - EnZf_SetupJump13___(this); + if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]) < + maxTargetPlatformDistForJump) && + !EnZf_TestNoFloorAhead(this, play, 191.9956f)) { + EnZf_SetupJumpForwards(this); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.velocity.y = 20.0f; } return; } else { this->actor.world.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform3FE_cur]); + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->curPlatform]); } } else { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -894,11 +904,11 @@ void EnZf_MainWalk_(EnZf* this, PlayState* play) { if (absYawDiff < 0) { absYawDiff *= -1; } - if ((playerPlatform == this->unkPlatform3FE_cur) && (this->actor.xzDistToPlayer < 150.0f) && + if ((playerPlatform == this->curPlatform) && (this->actor.xzDistToPlayer < 150.0f) && (player->meleeWeaponState != 0) && (absYawDiff >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); return; } } @@ -906,39 +916,39 @@ void EnZf_MainWalk_(EnZf* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - if (playerPlatform == this->unkPlatform3FE_cur) { + if (playerPlatform == this->curPlatform) { if (!Actor_IsFacingPlayer(&this->actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { - EnZf_SetupSidestepOrMainWalk___(this, play); + EnZf_SetupSidestepIfFloor(this, play); } else { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } } else if (this->actor.xzDistToPlayer < 100.0f) { - if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack_(play, this)) { + if ((Rand_ZeroOne() > 0.05f) && EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else if (Rand_ZeroOne() > 0.5f) { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } else { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } - } else if (this->noFloorAhead_) { - EnZf_SetupSidestepOrMainWalk___(this, play); + } else if (this->noFloorAhead) { + EnZf_SetupSidestepIfFloor(this, play); } else if (Rand_ZeroOne() < 0.1f) { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - if (!EnZf_DinolfosPickAction_(play, this)) { + if (!EnZf_DinolfosPickAction(play, this)) { if ((this->actor.xzDistToPlayer < 180.0f) && (this->actor.xzDistToPlayer > 160.0f) && Actor_IsFacingPlayer(&this->actor, 0x71C)) { if (Actor_IsLockedOn(play, &this->actor)) { if (Rand_ZeroOne() < 0.1f) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupJump13___(this); + EnZf_SetupJumpForwards(this); return; } } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); return; } } @@ -957,39 +967,39 @@ void EnZf_MainWalk_(EnZf* this, PlayState* play) { } } -void EnZf_SetupJump13___(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); - this->timer_ = 0; - this->actionState_ = 1; +void EnZf_SetupJumpForwards(EnZf* this) { + Animation_Change(&this->skelAnime, &gZfJumpAnim, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, -3.0f); + this->timer = 0; + this->actionState = 1; this->actor.velocity.y = 15.0f; - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { this->actor.speed = 16.0f; } else { this->actor.speed = 10.0f; } - this->action = ENZF_ACTION_13_JUMP___; + this->action = ENZF_ACTION_JUMP_FORWARDS; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - EnZf_SetupAction(this, EnZf_Jump13___); + EnZf_SetupAction(this, EnZf_JumpForwards); } -void EnZf_Jump13___(EnZf* this, PlayState* play) { - if (this->timer_ != 0) { +void EnZf_JumpForwards(EnZf* this, PlayState* play) { + if (this->timer != 0) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; - this->actionState_ = 0; + this->actionState = 0; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; } } if (SkelAnime_Update(&this->skelAnime)) { - if (this->timer_ == 0) { - Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); - this->timer_ = 10; + if (this->timer == 0) { + Animation_Change(&this->skelAnime, &gZfLandOnFeetAnim, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + this->timer = 10; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else { this->actor.speed = 0.0f; - this->actionState_ = 0; - EnZf_SetupMainWalk_(this, play); + this->actionState = 0; + EnZf_SetupMainWalk(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { @@ -997,10 +1007,10 @@ void EnZf_Jump13___(EnZf* this, PlayState* play) { } if ((this->actor.params == ENZF_TYPE_DINOLFOS) && ((this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) != 0)) { - if (EnZf_CanAttack_(play, this)) { + if (EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } } } @@ -1009,13 +1019,13 @@ void EnZf_Jump13___(EnZf* this, PlayState* play) { * Note: this action does not set the actor's speed. It is always 0 because EnZf_Idle is its only user and * EnZf_SetupIdle sets the speed to 0. */ -void EnZf_SetupTurnTowardsPlayer_(EnZf* this) { - Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim_, -4.0f); - this->action = ENZF_ACTION_TURN_TOWARDS_PLAYER_; - EnZf_SetupAction(this, EnZf_TurnTowardsPlayer_); +void EnZf_SetupTurnTowardsPlayer(EnZf* this) { + Animation_MorphToLoop(&this->skelAnime, &gZfWalkAnim, -4.0f); + this->action = ENZF_ACTION_TURN_TOWARDS_PLAYER; + EnZf_SetupAction(this, EnZf_TurnTowardsPlayer); } -void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play) { +void EnZf_TurnTowardsPlayer(EnZf* this, PlayState* play) { s32 pad; s16 relYawTowardsPlayer; s16 yawSpeed; @@ -1023,8 +1033,8 @@ void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play) { f32 animPlaySpeed; player = GET_PLAYER(play); - if (!EnZf_ReactToProjectile_(play, this) && - !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { + if (!EnZf_ReactToProjectile(play, this) && + !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this))) { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (relYawTowardsPlayer > 0) { yawSpeed = (relYawTowardsPlayer * 0.25f) + 2000.0f; @@ -1046,18 +1056,18 @@ void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play) { } this->skelAnime.playSpeed = -animPlaySpeed; SkelAnime_Update(&this->skelAnime); - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE_cur) { - EnZf_SetupMainWalk_(this, play); + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + if (EnZf_FindPlatform(&player->actor.world.pos, -1) != this->curPlatform) { + EnZf_SetupMainWalk(this, play); return; } } if (Actor_IsFacingPlayer(&this->actor, 0x1555)) { if (Rand_ZeroOne() > 0.8f) { - EnZf_SetupSidestepOrMainWalk___(this, play); + EnZf_SetupSidestepIfFloor(this, play); } else { - EnZf_SetupMainWalk_(this, play); + EnZf_SetupMainWalk(this, play); } } if ((play->gameplayFrames & 0x5F) == 0) { @@ -1066,24 +1076,28 @@ void EnZf_TurnTowardsPlayer_(EnZf* this, PlayState* play) { } } -void EnZf_SetupSidestepOrMainWalk___(EnZf* this, PlayState* play) { - if (!ENZF_IS_TYPE_PAIRED_(this->actor.params) || +/** + * Setup the sidestep action if possible (avoids paired types falling from the platforms), + * or fall back to setup the main walk action. + */ +void EnZf_SetupSidestepIfFloor(EnZf* this, PlayState* play) { + if (!ENZF_IS_TYPE_PAIRED(this->actor.params) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { - Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); + Animation_PlayLoop(&this->skelAnime, &gZfWalkSidewaysAnim); this->actor.speed = Rand_CenteredFloat(12.0f); this->actor.world.rot.y = this->actor.shape.rot.y; - this->timer_ = (Rand_ZeroOne() * 10.0f) + 20.0f; - this->actionState_ = 0; - this->action = ENZF_ACTION_SIDESTEP__; - this->dodgeSpeed___ = 0.0f; - EnZf_SetupAction(this, EnZf_Sidestep__); + this->timer = (Rand_ZeroOne() * 10.0f) + 20.0f; + this->actionState = 0; + this->action = ENZF_ACTION_SIDESTEP; + this->dodgeSpeed = 0.0f; + EnZf_SetupAction(this, EnZf_Sidestep); } else { - EnZf_SetupMainWalk_(this, play); + EnZf_SetupMainWalk(this, play); } } -void EnZf_Sidestep__(EnZf* this, PlayState* play) { +void EnZf_Sidestep(EnZf* this, PlayState* play) { s16 playerYawOpposite; s32 beforeCurFrame; s32 prevFrame; @@ -1096,8 +1110,8 @@ void EnZf_Sidestep__(EnZf* this, PlayState* play) { player = GET_PLAYER(play); sp3C = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); - if (!EnZf_ReactToProjectile_(play, this) && - !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { + if (!EnZf_ReactToProjectile(play, this) && + !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this))) { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3A98; playerYawOpposite = player->actor.shape.rot.y + 0x8000; if (Math_SinS(playerYawOpposite - this->actor.shape.rot.y) >= 0.0f) { @@ -1111,8 +1125,8 @@ void EnZf_Sidestep__(EnZf* this, PlayState* play) { this->actor.speed = 8.0f; } } - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - if (this->noFloorAhead_) { + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { + if (this->noFloorAhead) { this->actor.speed = -this->actor.speed; } } else { @@ -1143,22 +1157,22 @@ void EnZf_Sidestep__(EnZf* this, PlayState* play) { sp3C = 100.0f; } if (this->actor.xzDistToPlayer <= (70.0f + sp3C)) { - Math_SmoothStepToF(&this->dodgeSpeed___, -4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed, -4.0f, 1.0f, 1.5f, 0.0f); } else if ((90.0f + sp3C) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->dodgeSpeed___, 4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->dodgeSpeed___, 0.0f, 1.0f, 5.65f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->dodgeSpeed___ != 0.0f) && !EnZf_TestNoFloorAhead2_(this, play, this->dodgeSpeed___)) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->dodgeSpeed___; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->dodgeSpeed___; + if ((this->dodgeSpeed != 0.0f) && !EnZf_TestNoFloorAheadShape(this, play, this->dodgeSpeed)) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->dodgeSpeed; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->dodgeSpeed; } - if (ABS(this->actor.speed) >= ABS(this->dodgeSpeed___)) { + if (ABS(this->actor.speed) >= ABS(this->dodgeSpeed)) { this->skelAnime.playSpeed = this->actor.speed * 0.75f; } else if (this->skelAnime.playSpeed < 0.0f) { - this->skelAnime.playSpeed = this->dodgeSpeed___ * -0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed * -0.75f; } else { - this->skelAnime.playSpeed = this->dodgeSpeed___ * 0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed * 0.75f; } prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); @@ -1172,16 +1186,16 @@ void EnZf_Sidestep__(EnZf* this, PlayState* play) { if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } - if ((Math_CosS(playerYawOpposite - this->actor.shape.rot.y) < -0.85f) || (this->timer_ == 0)) { + if ((Math_CosS(playerYawOpposite - this->actor.shape.rot.y) < -0.85f) || (this->timer == 0)) { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_CanAttack_(play, this)) { + EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } - } else if (this->timer_ != 0) { - this->timer_--; + } else if (this->timer != 0) { + this->timer--; } } } @@ -1212,16 +1226,16 @@ void EnZf_Attack(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { EffectBlure_AddSpace(Effect_GetByIndex(this->swordBlureEffectIndex)); if ((this->actor.params == ENZF_TYPE_DINOLFOS) && !Actor_IsFacingPlayer(&this->actor, 0x1554)) { - EnZf_SetupIdle_(this); - this->timer_ = (Rand_ZeroOne() * 5.0f) + 5.0f; - this->timer2_ = (Rand_ZeroOne() * 20.0f) + 100.0f; + EnZf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; + this->timer2 = (Rand_ZeroOne() * 20.0f) + 100.0f; } else if ((Rand_ZeroOne() > 0.7f) || (this->actor.xzDistToPlayer >= 120.0f)) { - EnZf_SetupIdle_(this); - this->timer_ = (Rand_ZeroOne() * 5.0f) + 5.0f; + EnZf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 5.0f; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } else { absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; absYawDiffWithPlayer = ABS(absYawDiffWithPlayer); @@ -1230,19 +1244,19 @@ void EnZf_Attack(EnZf* this, PlayState* play) { absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); if (absRelYawTowardsPlayer > 0x3E80) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } else if (player->stateFlags1 & (PLAYER_STATE1_HOSTILE_LOCK_ON | PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (this->actor.isLockedOn) { EnZf_SetupAttack(this); } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } } else { EnZf_SetupAttack(this); } } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } } } @@ -1260,44 +1274,44 @@ void EnZf_SetupAttackBounced(EnZf* this) { void EnZf_AttackBounced(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (Rand_ZeroOne() > 0.7f) { - EnZf_SetupIdle_(this); - } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack_(play, this)) { + EnZf_SetupIdle(this); + } else if ((Rand_ZeroOne() > 0.2f) && EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } } } -void EnZf_SetupJumpBackwards_(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfTauntAnim_____, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); - this->timer_ = 0; - this->actionState_ = 1; - this->action = ENZF_ACTION_JUMP_BACKWARDS_; +void EnZf_SetupJumpBackwards(EnZf* this) { + Animation_Change(&this->skelAnime, &gZfJumpAnim, -1.0f, 3.0f, 0.0f, ANIMMODE_ONCE, -3.0f); + this->timer = 0; + this->actionState = 1; + this->action = ENZF_ACTION_JUMP_BACKWARDS; this->actor.velocity.y = 15.0f; this->actor.speed = -15.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); - EnZf_SetupAction(this, EnZf_JumpBackwards_); + EnZf_SetupAction(this, EnZf_JumpBackwards); } -void EnZf_JumpBackwards_(EnZf* this, PlayState* play) { - if (this->timer_ != 0) { +void EnZf_JumpBackwards(EnZf* this, PlayState* play) { + if (this->timer != 0) { if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; - this->actionState_ = 0; + this->actionState = 0; this->actor.velocity.y = 0.0f; this->actor.speed = 0.0f; } } if (SkelAnime_Update(&this->skelAnime)) { - if (this->timer_ == 0) { - Animation_Change(&this->skelAnime, &gZfLandFromAppearingAnim__, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); - this->timer_ = 10; + if (this->timer == 0) { + Animation_Change(&this->skelAnime, &gZfLandOnFeetAnim, 3.0f, 0.0f, 17.0f, ANIMMODE_ONCE, -3.0f); + this->timer = 10; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); } else if ((play->gameplayFrames % 2) != 0) { - EnZf_SetupCirclePlayerOrMainWalk___(this, play); + EnZf_SetupCirclePlayerIfFloor(this, play); } else { - EnZf_SetupIdle_(this); + EnZf_SetupIdle(this); } } if ((play->state.frames & 0x5F) == 0) { @@ -1305,25 +1319,25 @@ void EnZf_JumpBackwards_(EnZf* this, PlayState* play) { } } -void EnZf_SetupStunned_(EnZf* this) { +void EnZf_SetupStunned(EnZf* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && (((this->actor.velocity.y == 0.0f)) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; - this->actionState_ = 0; + this->actionState = 0; } else { - this->actionState_ = 1; + this->actionState = 1; } if (this->lastDamageReaction == ENZF_DMG_REACT_ICE) { this->frozenTimer = 36; } else { - Animation_PlayOnceSetSpeed(&this->skelAnime, &gZfDamagedAnim___, 0.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &gZfDamagedAnim, 0.0f); } Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->action = ENZF_ACTION_STUNNED_; - EnZf_SetupAction(this, EnZf_Stunned_); + this->action = ENZF_ACTION_STUNNED; + EnZf_SetupAction(this, EnZf_Stunned); } -void EnZf_Stunned_(EnZf* this, PlayState* play) { +void EnZf_Stunned(EnZf* this, PlayState* play) { s16 absRelWallYaw; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1333,29 +1347,29 @@ void EnZf_Stunned_(EnZf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->actionState_ = 0; + this->actionState = 0; } if ((this->actor.colorFilterTimer == 0) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health == 0) { - EnZf_SetupDie_(this); - } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { - if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { - EnZf_PickAction_(this, play); + EnZf_SetupDie(this); + } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this))) { + if (sPairedInactiveType != ENZF_TYPE_LIZALFOS_SINGLE) { + EnZf_PickAction(this, play); } else { absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; absRelWallYaw = ABS(absRelWallYaw); if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupJumpAttack__(this); - } else if (!EnZf_ReactToProjectile_(play, this)) { + EnZf_SetupJumpAttack(this); + } else if (!EnZf_ReactToProjectile(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { - EnZf_PickAction_(this, play); + EnZf_PickAction(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) != 0) && - EnZf_CanAttack_(play, this)) { + EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_PickAction_(this, play); + EnZf_PickAction(this, play); } } } @@ -1363,85 +1377,90 @@ void EnZf_Stunned_(EnZf* this, PlayState* play) { } } -void EnZf_SetupJumpSeqStartTurnAround_(EnZf* this, PlayState* play) { +void EnZf_Paired_SetupJumpAwayStartTurnAround(EnZf* this, PlayState* play) { f32 animMorphFrames; f32 animEndFrame; animMorphFrames = 0.0f; - animEndFrame = Animation_GetLastFrame(&gZfTurnAroundAnim__); - if (this->action <= ENZF_ACTION_DAMAGED_) { + animEndFrame = Animation_GetLastFrame(&gZfRunAwayTurnAroundAnim); + if (this->action <= ENZF_ACTION_DAMAGED) { animMorphFrames = -4.0f; } - Animation_Change(&this->skelAnime, &gZfTurnAroundAnim__, 2.0f, 0.0f, animEndFrame, ANIMMODE_ONCE, animMorphFrames); - this->action = ENZF_ACTION_JUMP_SEQ_START_TURN_AROUND_; + Animation_Change(&this->skelAnime, &gZfRunAwayTurnAroundAnim, 2.0f, 0.0f, animEndFrame, ANIMMODE_ONCE, + animMorphFrames); + this->action = ENZF_ACTION_PAIRED_JUMP_AWAY_START_TURN_AROUND; this->actor.speed = 0.0f; - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__(&this->actor.world.pos, this->unkPlatform3FE_cur, - this->unkPlatform400_home___, play); + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + this->targetPlatform = + EnZf_FindPlatformWithoutPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_JumpSeqStartTurnAround_); + EnZf_SetupAction(this, EnZf_Paired_JumpAwayStartTurnAround); } -void EnZf_JumpSeqStartTurnAround_(EnZf* this, PlayState* play) { +void EnZf_Paired_JumpAwayStartTurnAround(EnZf* this, PlayState* play) { s16 yaw; - yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]) + 0x8000; + yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime)) { this->actor.world.rot.y = yaw - 0x8000; - EnZf_SetupJumpSeqJump19__(this, play); + EnZf_Paired_SetupJumpAway(this, play); this->isSwordSheathed = true; } } -void EnZf_SetupJumpSeqJump20__(EnZf* this) { - this->actionState_ = 0; +/** + * Hop in place indefinitely (until signaled to engage combat, see EnZf_Update). + * Jump away if the player gets too close. + */ +void EnZf_Paired_SetupIdleHop(EnZf* this) { + this->actionState = 0; Animation_MorphToPlayOnce(&this->skelAnime, D_80B4A280[0], -4.0f); - this->action = ENZF_ACTION_JUMP_SEQ_JUMP_20__; + this->action = ENZF_ACTION_PAIRED_IDLE_HOP; this->actor.speed = 0.0f; - this->dodgeVelocityY___ = 0.0f; - this->dodgeSpeed___ = 0.0f; - EnZf_SetupAction(this, EnZf_JumpSeqJump20__); + this->dodgeVelocityY = 0.0f; + this->dodgeSpeed = 0.0f; + EnZf_SetupAction(this, EnZf_Paired_IdleHop); } -void EnZf_JumpSeqJump20__(EnZf* this, PlayState* play) { +void EnZf_Paired_IdleHop(EnZf* this, PlayState* play) { f32 animEndFrame; - f32 sp40; + f32 minPlayerDist; - sp40 = 400.0f; + minPlayerDist = 400.0f; Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0xFA0, 0); if (this->actor.world.pos.y >= 420.0f) { - sp40 = 250.0f; + minPlayerDist = 250.0f; } - if ((this->actor.xzDistToPlayer < sp40) && (this->actionState_ != 1)) { + if ((this->actor.xzDistToPlayer < minPlayerDist) && (this->actionState != 1)) { this->actor.shape.rot.y = this->actor.world.rot.y; - EnZf_SetupJumpSeqStartTurnAround_(this, play); + EnZf_Paired_SetupJumpAwayStartTurnAround(this, play); } else { - if (this->actionState_ != 1) { - EnZf_ReactToProjectile2_____(play, this); + if (this->actionState != 1) { + EnZf_ReactToProjectileSetDodgeSpeed(play, this); } if (SkelAnime_Update(&this->skelAnime)) { - this->actionState_ += 1; - if (this->actionState_ >= 3) { - this->actionState_ = 0; + this->actionState += 1; + if (this->actionState >= 3) { + this->actionState = 0; } - if ((this->dodgeSpeed___ != 0.0f) || (this->dodgeVelocityY___ != 0.0f)) { - this->actionState_ = 1; + if ((this->dodgeSpeed != 0.0f) || (this->dodgeVelocityY != 0.0f)) { + this->actionState = 1; } - animEndFrame = Animation_GetLastFrame(D_80B4A280[this->actionState_]); - switch (this->actionState_) { + animEndFrame = Animation_GetLastFrame(D_80B4A280[this->actionState]); + switch (this->actionState) { case 0: this->actor.velocity.y = 0.0f; this->actor.world.pos.y = this->actor.floorHeight; break; case 1: - this->actor.velocity.y = this->dodgeVelocityY___ + 10.0f; - this->actor.speed = this->dodgeSpeed___; - this->dodgeSpeed___ = 0.0f; - this->dodgeVelocityY___ = 0.0f; + this->actor.velocity.y = this->dodgeVelocityY + 10.0f; + this->actor.speed = this->dodgeSpeed; + this->dodgeSpeed = 0.0f; + this->dodgeVelocityY = 0.0f; break; case 2: @@ -1449,7 +1468,7 @@ void EnZf_JumpSeqJump20__(EnZf* this, PlayState* play) { this->actor.world.pos.y = this->actor.floorHeight; break; } - Animation_Change(&this->skelAnime, D_80B4A280[this->actionState_], 1.5f, 0.0f, animEndFrame, ANIMMODE_ONCE, + Animation_Change(&this->skelAnime, D_80B4A280[this->actionState], 1.5f, 0.0f, animEndFrame, ANIMMODE_ONCE, 0.0f); } if ((play->gameplayFrames & 0x5F) == 0) { @@ -1458,18 +1477,21 @@ void EnZf_JumpSeqJump20__(EnZf* this, PlayState* play) { } } -void EnZf_SetupJumpSeqJump19__(EnZf* this, PlayState* play) { - this->actionState_ = 0; +/** + * Jump away from the player. + */ +void EnZf_Paired_SetupJumpAway(EnZf* this, PlayState* play) { + this->actionState = 0; Animation_PlayOnce(&this->skelAnime, D_80B4A280[0]); - this->action = ENZF_ACTION_JUMP_SEQ_JUMP_19__; - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__(&this->actor.world.pos, this->unkPlatform3FE_cur, - this->unkPlatform400_home___, play); - EnZf_SetupAction(this, EnZf_JumpSeqJump19__); + this->action = ENZF_ACTION_PAIRED_JUMP_AWAY; + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + this->targetPlatform = + EnZf_FindPlatformWithoutPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); + EnZf_SetupAction(this, EnZf_Paired_JumpAway); } -void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play) { - f32 distToTargetPlatform_; +void EnZf_Paired_JumpAway(EnZf* this, PlayState* play) { + f32 distToTargetPlatform; f32 animPlaySpeed; f32 var_fs0; f32 candidateDistance; @@ -1477,33 +1499,31 @@ void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play) { f32 candidateSpeed; s32 pad2; s16 yawTowardsTargetPlatform; - s32 prevActionState_; + s32 prevActionState; s32 floorAheadFlags; s32 i; animPlaySpeed = 1.0f; var_fs0 = 550.0f; - distToTargetPlatform_ = - Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]); - prevActionState_ = this->actionState_; + distToTargetPlatform = Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]); + prevActionState = this->actionState; if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); } if (this->actor.world.pos.y >= 420.0f) { var_fs0 = 280.0f; } - yawTowardsTargetPlatform = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->unkPlatform402_target_]); - switch (this->actionState_) { + yawTowardsTargetPlatform = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]); + switch (this->actionState) { case 0: this->actor.world.rot.y = yawTowardsTargetPlatform; this->actor.shape.rot.y = yawTowardsTargetPlatform + 0x8000; D_80B4AB30 = 0; - this->unkPlatform400_home___ = this->unkPlatform3FE_cur; + this->homePlatform = this->curPlatform; floorAheadFlags = 0; - floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 107.0f) << 0; - floorAheadFlags |= !EnZf_TestNoFloorAhead_(this, play, 220.0f) << 1; - this->actionState_ += 1; + floorAheadFlags |= !EnZf_TestNoFloorAhead(this, play, 107.0f) << 0; + floorAheadFlags |= !EnZf_TestNoFloorAhead(this, play, 220.0f) << 1; + this->actionState += 1; switch (floorAheadFlags) { case 1: case 3: @@ -1526,14 +1546,14 @@ void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play) { candidateSpeed = 8.0f; candidateSpeed += 1.2f; for (i = 20; i >= 0; i--, candidateDistance += 10.0f, candidateSpeed += 1.2f) { - if (!EnZf_TestNoFloorAhead_(this, play, candidateDistance)) { + if (!EnZf_TestNoFloorAhead(this, play, candidateDistance)) { this->actor.speed = candidateSpeed; this->actor.velocity.y = 12.0f; break; } } if (this->actor.speed == 0.0f) { - EnZf_SetupJumpSeqJump20__(this); + EnZf_Paired_SetupIdleHop(this); } break; } @@ -1549,13 +1569,13 @@ void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->actor, &this->leftFootPos, 3.0f, 2, 2.0f, 0, 0, false); Actor_SpawnFloorDustRing(play, &this->actor, &this->rightFootPos, 3.0f, 2, 2.0f, 0, 0, false); if (this->actor.xzDistToPlayer >= var_fs0) { - EnZf_SetupJumpSeqJump20__(this); - } else if (distToTargetPlatform_ < 80.0f) { - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__( - &this->actor.world.pos, this->unkPlatform3FE_cur, this->unkPlatform400_home___, play); + EnZf_Paired_SetupIdleHop(this); + } else if (distToTargetPlatform < 80.0f) { + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + this->targetPlatform = EnZf_FindPlatformWithoutPlayer(&this->actor.world.pos, this->curPlatform, + this->homePlatform, play); } - this->actionState_ = 0; + this->actionState = 0; animPlaySpeed = 2.0f; } else { Math_SmoothStepToS(&this->actor.world.rot.y, yawTowardsTargetPlatform, 1, 0xFA0, 0); @@ -1566,28 +1586,28 @@ void EnZf_JumpSeqJump19__(EnZf* this, PlayState* play) { case 2: if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - this->actionState_ = 0; + this->actionState = 0; } break; } - if (prevActionState_ != this->actionState_) { - Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->actionState_], animPlaySpeed); + if (prevActionState != this->actionState) { + Animation_PlayOnceSetSpeed(&this->skelAnime, D_80B4A280[this->actionState], animPlaySpeed); } SkelAnime_Update(&this->skelAnime); } -void EnZf_SetupJumpSeqFinalLanding_____(EnZf* this, PlayState* play) { - Animation_PlayOnce(&this->skelAnime, &gZfGetBackUpAndTurnAroundAnim_____); +void EnZf_Paired_SetupEngageCombat(EnZf* this, PlayState* play) { + Animation_PlayOnce(&this->skelAnime, &gZfTurnAroundUnsheathSword); this->actor.world.rot.y += 0x8000; - this->action = ENZF_ACTION_JUMP_SEQ_FINAL_LANDING_____; + this->action = ENZF_ACTION_PAIRED_ENGAGE_COMBAT; this->actor.speed = 0.0f; - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - this->unkPlatform402_target_ = EnZf_FindPlatformWithoutPlayer__(&this->actor.world.pos, this->unkPlatform3FE_cur, - this->unkPlatform400_home___, play); - EnZf_SetupAction(this, EnZf_JumpSeqFinalLanding_____); + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + this->targetPlatform = + EnZf_FindPlatformWithoutPlayer(&this->actor.world.pos, this->curPlatform, this->homePlatform, play); + EnZf_SetupAction(this, EnZf_Paired_EngageCombat); } -void EnZf_JumpSeqFinalLanding_____(EnZf* this, PlayState* play) { +void EnZf_Paired_EngageCombat(EnZf* this, PlayState* play) { s16 yawTowardsPlayer; yawTowardsPlayer = this->actor.yawTowardsPlayer; @@ -1597,36 +1617,36 @@ void EnZf_JumpSeqFinalLanding_____(EnZf* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.world.rot.y = yawTowardsPlayer; - this->actionState_ = -1; - EnZf_SetupIdle_(this); + this->actionState = -1; + EnZf_SetupIdle(this); } if (this->skelAnime.curFrame == 22.0f) { this->isSwordSheathed = false; } } -void EnZf_SetupDamaged_(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfDamagedAnim___, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDamagedAnim___), +void EnZf_SetupDamaged(EnZf* this) { + Animation_Change(&this->skelAnime, &gZfDamagedAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDamagedAnim), ANIMMODE_ONCE, -4.0f); if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = -4.0f; - this->actionState_ = 0; + this->actionState = 0; } else { - this->actionState_ = 1; + this->actionState = 1; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->skelAnime.playSpeed = 4.5f; } - if (!ENZF_IS_TYPE_PAIRED_(this->actor.params)) { + if (!ENZF_IS_TYPE_PAIRED(this->actor.params)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; } Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DAMAGE); - this->action = ENZF_ACTION_DAMAGED_; - EnZf_SetupAction(this, EnZf_Damaged_); + this->action = ENZF_ACTION_DAMAGED; + EnZf_SetupAction(this, EnZf_Damaged); } -void EnZf_Damaged_(EnZf* this, PlayState* play) { +void EnZf_Damaged(EnZf* this, PlayState* play) { s16 absRelWallYaw; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1636,22 +1656,22 @@ void EnZf_Damaged_(EnZf* this, PlayState* play) { if (this->actor.speed < 0.0f) { this->actor.speed += 0.05f; } - this->actionState_ = 0; + this->actionState = 0; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this)) && + if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this)) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { + if (sPairedInactiveType != ENZF_TYPE_LIZALFOS_SINGLE) { if (this->lastDamageReaction == ENZF_DMG_REACT_FLEE) { - sPairedActiveFleeFlag_ += 1; + sPairedActiveFleeFlag += 1; } else { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!EnZf_TestNoFloorAhead_(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_SetupJumpAttack__(this); + if (!EnZf_TestNoFloorAhead(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + EnZf_SetupJumpAttack(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { EnZf_SetupAttack(this); } else { - EnZf_PickAction_(this, play); + EnZf_PickAction(this, play); } } } else { @@ -1659,50 +1679,50 @@ void EnZf_Damaged_(EnZf* this, PlayState* play) { absRelWallYaw = ABS(absRelWallYaw); if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_SetupJumpAttack__(this); - } else if (!EnZf_ReactToProjectile_(play, this)) { + EnZf_SetupJumpAttack(this); + } else if (!EnZf_ReactToProjectile(play, this)) { if (this->actor.params != ENZF_TYPE_DINOLFOS) { this->actor.world.rot.y = this->actor.shape.rot.y; - if (!EnZf_TestNoFloorAhead_(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { - EnZf_SetupJumpAttack__(this); + if (!EnZf_TestNoFloorAhead(this, play, 135.0f) && (this->actor.xzDistToPlayer < 90.0f)) { + EnZf_SetupJumpAttack(this); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0)) { EnZf_SetupAttack(this); } else { - EnZf_PickAction_(this, play); + EnZf_PickAction(this, play); } } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_CanAttack_(play, this)) { + EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { - EnZf_PickAction_(this, play); + EnZf_PickAction(this, play); } } } } } -void EnZf_SetupJumpAttack__(EnZf* this) { - Animation_Change(&this->skelAnime, &gZfTauntAnim_____, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); - this->timer_ = 0; - this->actionState_ = 1; - this->action = ENZF_ACTION_JUMP_ATTACK__; +void EnZf_SetupJumpAttack(EnZf* this) { + Animation_Change(&this->skelAnime, &gZfJumpAnim, 1.0f, 0.0f, 3.0f, ANIMMODE_ONCE, 0.0f); + this->timer = 0; + this->actionState = 1; + this->action = ENZF_ACTION_JUMP_ATTACK; this->actor.velocity.y = 22.0f; this->actor.speed = 7.5f; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_JUMP); this->actor.world.rot.y = this->actor.shape.rot.y; - EnZf_SetupAction(this, EnZf_JumpAttack__); + EnZf_SetupAction(this, EnZf_JumpAttack); } -void EnZf_JumpAttack__(EnZf* this, PlayState* play) { +void EnZf_JumpAttack(EnZf* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->actor.velocity.y >= 5.0f) { func_800355B8(play, &this->leftFootPos); func_800355B8(play, &this->rightFootPos); } if (SkelAnime_Update(&this->skelAnime)) { - if (this->timer_ == 0) { + if (this->timer == 0) { Animation_Change(&this->skelAnime, &gZfSlashAnim, 3.0f, 0.0f, 13.0f, ANIMMODE_ONCE, -4.0f); - this->timer_ = 10; + this->timer = 10; } else if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH)) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; this->actor.velocity.y = 0.0f; @@ -1715,14 +1735,18 @@ void EnZf_JumpAttack__(EnZf* this, PlayState* play) { } } -void EnZf_SetupCirclePlayerOrMainWalk___(EnZf* this, PlayState* play) { +/** + * Setup the cicle player action if possible (avoids paired types falling from the platforms), + * or fall back to setup the main walk action. + */ +void EnZf_SetupCirclePlayerIfFloor(EnZf* this, PlayState* play) { s16 playerYaw; Player* player; - if (!ENZF_IS_TYPE_PAIRED_(this->actor.params) || + if (!ENZF_IS_TYPE_PAIRED(this->actor.params) || Actor_TestFloorInDirection(&this->actor, play, 40.0f, this->actor.shape.rot.y + 0x3FFF) || Actor_TestFloorInDirection(&this->actor, play, -40.0f, this->actor.shape.rot.y + 0x3FFF)) { - Animation_PlayLoop(&this->skelAnime, &gZfCautiousWalkAnim___); + Animation_PlayLoop(&this->skelAnime, &gZfWalkSidewaysAnim); player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); playerYaw = player->actor.shape.rot.y; @@ -1731,18 +1755,18 @@ void EnZf_SetupCirclePlayerOrMainWalk___(EnZf* this, PlayState* play) { } else if (Math_SinS(playerYaw - this->actor.shape.rot.y) < 0.0f) { this->actor.speed = 6.0f; } - this->dodgeSpeed___ = 0.0f; - this->actionState_ = 0; + this->dodgeSpeed = 0.0f; + this->actionState = 0; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - this->timer_ = (Rand_ZeroOne() * 10.0f) + 5.0f; - this->action = ENZF_ACTION_CIRCLE_PLAYER___; - EnZf_SetupAction(this, EnZf_CirclePlayer___); + this->timer = (Rand_ZeroOne() * 10.0f) + 5.0f; + this->action = ENZF_ACTION_CIRCLE_PLAYER; + EnZf_SetupAction(this, EnZf_CirclePlayer); } else { - EnZf_SetupMainWalk_(this, play); + EnZf_SetupMainWalk(this, play); } } -void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { +void EnZf_CirclePlayer(EnZf* this, PlayState* play) { s16 playerYaw; s16 yaw; Player* player; @@ -1756,8 +1780,8 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { extraRadius = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); playerYaw = player->actor.shape.rot.y; - if (ENZF_IS_TYPE_PAIRED_(this->actor.params)) { - if (this->noFloorAhead_) { + if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { + if (this->noFloorAhead) { this->actor.speed = -this->actor.speed; } } else { @@ -1797,71 +1821,71 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { extraRadius = 100.0f; } if (this->actor.xzDistToPlayer <= (70.0f + extraRadius)) { - Math_SmoothStepToF(&this->dodgeSpeed___, -4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed, -4.0f, 1.0f, 1.5f, 0.0f); } else if ((90.0f + extraRadius) < this->actor.xzDistToPlayer) { - Math_SmoothStepToF(&this->dodgeSpeed___, 4.0f, 1.0f, 1.5f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed, 4.0f, 1.0f, 1.5f, 0.0f); } else { - Math_SmoothStepToF(&this->dodgeSpeed___, 0.0f, 1.0f, 5.65f, 0.0f); + Math_SmoothStepToF(&this->dodgeSpeed, 0.0f, 1.0f, 5.65f, 0.0f); } - if ((this->dodgeSpeed___ != 0.0f) && !EnZf_TestNoFloorAhead2_(this, play, this->dodgeSpeed___)) { - this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->dodgeSpeed___; - this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->dodgeSpeed___; + if ((this->dodgeSpeed != 0.0f) && !EnZf_TestNoFloorAheadShape(this, play, this->dodgeSpeed)) { + this->actor.world.pos.x += Math_SinS(this->actor.shape.rot.y) * this->dodgeSpeed; + this->actor.world.pos.z += Math_CosS(this->actor.shape.rot.y) * this->dodgeSpeed; } - if (ABS(this->actor.speed) >= ABS(this->dodgeSpeed___)) { + if (ABS(this->actor.speed) >= ABS(this->dodgeSpeed)) { this->skelAnime.playSpeed = -this->actor.speed * 0.75f; } else { if (this->skelAnime.playSpeed < 0.0f) { - this->skelAnime.playSpeed = this->dodgeSpeed___ * -0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed * -0.75f; } else { - this->skelAnime.playSpeed = this->dodgeSpeed___ * 0.75f; + this->skelAnime.playSpeed = this->dodgeSpeed * 0.75f; } } prevFrame = (s32)this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); beforeCurFrame = (s32)(this->skelAnime.curFrame - ABS(this->skelAnime.playSpeed)); absPlaySpeed = ((void)0, ABS(this->skelAnime.playSpeed)); //! FAKE - this->unkPlatform3FE_cur = EnZf_FindPlatform1__(&this->actor.world.pos, this->unkPlatform3FE_cur); - if (EnZf_FindPlatform1__(&player->actor.world.pos, -1) != this->unkPlatform3FE_cur) { + this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, this->curPlatform); + if (EnZf_FindPlatform(&player->actor.world.pos, -1) != this->curPlatform) { this->actor.speed = 0.0f; - if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { - EnZf_SetupJumpSeqJump20__(this); + if (ENZF_IS_TYPE_PAIRED(this->actor.params) && (sPairedInactiveType == this->actor.params)) { + EnZf_Paired_SetupIdleHop(this); } else { - EnZf_SetupMainWalk_(this, play); + EnZf_SetupMainWalk(this, play); } - } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction_(play, this))) { - if (this->timer_ == 0) { + } else if (!((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this))) { + if (this->timer == 0) { yaw = player->actor.shape.rot.y - this->actor.shape.rot.y; if (yaw < 0) { yaw *= -1; } if (yaw >= 0x3A98) { - if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { - EnZf_SetupJumpSeqJump20__(this); + if (ENZF_IS_TYPE_PAIRED(this->actor.params) && (sPairedInactiveType == this->actor.params)) { + EnZf_Paired_SetupIdleHop(this); } else { - EnZf_SetupIdle_(this); - this->timer_ = (Rand_ZeroOne() * 5.0f) + 1.0f; + EnZf_SetupIdle(this); + this->timer = (Rand_ZeroOne() * 5.0f) + 1.0f; } } else { - if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) { - EnZf_SetupJumpSeqJump20__(this); + if (ENZF_IS_TYPE_PAIRED(this->actor.params) && (sPairedInactiveType == this->actor.params)) { + EnZf_Paired_SetupIdleHop(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 4) == 0) && - EnZf_CanAttack_(play, this)) { + EnZf_CanAttack(play, this)) { EnZf_SetupAttack(this); } else { if ((this->actor.xzDistToPlayer < 280.0f) && (this->actor.xzDistToPlayer > 240.0f) && - !EnZf_TestNoFloorAhead_(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { - EnZf_SetupJump13___(this); + !EnZf_TestNoFloorAhead(this, play, 191.9956f) && ((play->gameplayFrames % 2) == 0)) { + EnZf_SetupJumpForwards(this); } else { - EnZf_SetupMainWalk_(this, play); + EnZf_SetupMainWalk(this, play); } } } } y:; //! FAKE } else { - this->timer_--; + this->timer--; } if ((prevFrame != (s32)this->skelAnime.curFrame) && (((beforeCurFrame < 14) && (((s32)absPlaySpeed + prevFrame) >= 16)) || @@ -1874,7 +1898,7 @@ void EnZf_CirclePlayer___(EnZf* this, PlayState* play) { } } -void EnZf_SetupDie_(EnZf* this) { +void EnZf_SetupDie(EnZf* this) { Actor* otherEnZf; Animation_Change(&this->skelAnime, &gZfDieAnim, 1.5f, 0.0f, Animation_GetLastFrame(&gZfDieAnim), ANIMMODE_ONCE, @@ -1882,34 +1906,35 @@ void EnZf_SetupDie_(EnZf* this) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && ((this->actor.velocity.y == 0.0f) || (this->actor.velocity.y == -4.0f))) { this->actor.speed = 0.0f; - this->actionState_ = 0; + this->actionState = 0; } else { - this->actionState_ = 1; + this->actionState = 1; } - this->action = ENZF_ACTION_DIE_; + this->action = ENZF_ACTION_DIE; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { + if (sPairedInactiveType != ENZF_TYPE_LIZALFOS_SINGLE) { otherEnZf = this->actor.prev; + // Signal the other lizalfos to engage combat. if (otherEnZf != NULL) { - ((EnZf*)otherEnZf)->timer2_ = 90; + ((EnZf*)otherEnZf)->timer2 = 90; otherEnZf = this->actor.prev; if (otherEnZf->colChkInfo.health < 3) { otherEnZf->colChkInfo.health = 3; } } else { - ((EnZf*)this->actor.next)->timer2_ = 90; + ((EnZf*)this->actor.next)->timer2 = 90; otherEnZf = this->actor.next; if (otherEnZf->colChkInfo.health < 3) { otherEnZf->colChkInfo.health = 3; } } } - sPairedActiveFleeFlag_ = 0; + sPairedActiveFleeFlag = 0; Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_DEAD); - EnZf_SetupAction(this, EnZf_Die_); + EnZf_SetupAction(this, EnZf_Die); } -void EnZf_Die_(EnZf* this, PlayState* play) { +void EnZf_Die(EnZf* this, PlayState* play) { s32 temp_ft1; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { @@ -1917,21 +1942,21 @@ void EnZf_Die_(EnZf* this, PlayState* play) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.15f, 0.0f); - this->actionState_ = 0; + this->actionState = 0; } if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.category != ACTORCAT_PROP) { - if (ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == ENZF_TYPE_LIZALFOS_SINGLE_)) { + if (ENZF_IS_TYPE_PAIRED(this->actor.params) && (sPairedInactiveType == ENZF_TYPE_LIZALFOS_SINGLE)) { Flags_SetSwitch(play, this->switchFlag); func_800F5B58(); } else { - sPairedInactiveType__ = ENZF_TYPE_LIZALFOS_SINGLE_; + sPairedInactiveType = ENZF_TYPE_LIZALFOS_SINGLE; } Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } - if (this->alpha_ != 0) { - this->alpha_ -= 5; - this->actor.shape.shadowAlpha = this->alpha_; + if (this->alpha != 0) { + this->alpha -= 5; + this->actor.shape.shadowAlpha = this->alpha; } else { Actor_Kill(&this->actor); } @@ -1946,8 +1971,8 @@ void EnZf_Die_(EnZf* this, PlayState* play) { void EnZf_UpdateHeadRot(EnZf* this, PlayState* play) { s16 yawTowardsPlayerRelToHead; - if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->action == ENZF_ACTION_IDLE_) && (this->timer2_ != 0)) { - this->headRot = Math_SinS(this->timer2_ * 0x578) * 10920.0f; + if ((this->actor.params == ENZF_TYPE_DINOLFOS) && (this->action == ENZF_ACTION_IDLE) && (this->timer2 != 0)) { + this->headRot = Math_SinS(this->timer2 * 0x578) * 10920.0f; } else { yawTowardsPlayerRelToHead = this->actor.yawTowardsPlayer; yawTowardsPlayerRelToHead -= (s16)(this->headRot + this->actor.shape.rot.y); @@ -1961,38 +1986,38 @@ void EnZf_CheckCollide(EnZf* this, PlayState* play) { s32 pad; s16 dropParams; - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action <= ENZF_ACTION_STUNNED_)) { + if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action <= ENZF_ACTION_STUNNED)) { this->bodyCollider.base.acFlags &= ~AC_HIT; - if (!(ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) && + if (!(ENZF_IS_TYPE_PAIRED(this->actor.params) && (sPairedInactiveType == this->actor.params)) && (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6)) { this->lastDamageReaction = this->actor.colChkInfo.damageReaction; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, false); if ((this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_STUN) || (this->actor.colChkInfo.damageReaction == ENZF_DMG_REACT_ICE)) { - if (this->action != ENZF_ACTION_STUNNED_) { + if (this->action != ENZF_ACTION_STUNNED) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 80); Actor_ApplyDamage(&this->actor); - EnZf_SetupStunned_(this); + EnZf_SetupStunned(this); } } else { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); if (Actor_ApplyDamage(&this->actor) == 0) { dropParams = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_4, false); - EnZf_SetupDie_(this); + EnZf_SetupDie(this); if (this->actor.params == ENZF_TYPE_DINOLFOS) { dropParams = COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false); } Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, dropParams); Enemy_StartFinishingBlow(play, &this->actor); } else { - if (sPairedInactiveType__ != ENZF_TYPE_LIZALFOS_SINGLE_) { + if (sPairedInactiveType != ENZF_TYPE_LIZALFOS_SINGLE) { if (((this->actor.colChkInfo.health + this->actor.colChkInfo.damage) >= 4) && (this->actor.colChkInfo.health < 4)) { this->lastDamageReaction = ENZF_DMG_REACT_FLEE; } } - EnZf_SetupDamaged_(this); + EnZf_SetupDamaged(this); } } } @@ -2005,64 +2030,67 @@ void EnZf_Update(Actor* thisx, PlayState* play) { EnZf_CheckCollide(this, play); if (this->actor.colChkInfo.damageReaction != ENZF_DMG_REACT_6) { - this->noFloorAhead_ = false; - if ((this->actionState_ != 1) && (this->action != ENZF_ACTION_JUMP_SEQ_JUMP_19__)) { + this->noFloorAhead = false; + if ((this->actionState != 1) && (this->action != ENZF_ACTION_PAIRED_JUMP_AWAY)) { if (this->actor.speed != 0.0f) { - this->noFloorAhead_ = EnZf_TestNoFloorAhead_(this, play, this->actor.speed * 1.5f); + this->noFloorAhead = EnZf_TestNoFloorAhead(this, play, this->actor.speed * 1.5f); } - if (!this->noFloorAhead_) { - this->noFloorAhead_ = EnZf_TestNoFloorAhead_(this, play, 0.0f); + if (!this->noFloorAhead) { + this->noFloorAhead = EnZf_TestNoFloorAhead(this, play, 0.0f); } } - if (!this->noFloorAhead_) { + if (!this->noFloorAhead) { Actor_MoveXZGravity(&this->actor); } Actor_UpdateBgCheckInfo(play, &this->actor, 25.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->actionState_ = 1; + this->actionState = 1; } this->actionFunc(this, play); } if (this->actor.colChkInfo.health > 0) { - if ((this->action != ENZF_ACTION_ATTACK) && (this->action != ENZF_ACTION_STUNNED_)) { + if ((this->action != ENZF_ACTION_ATTACK) && (this->action != ENZF_ACTION_STUNNED)) { EnZf_UpdateHeadRot(this, play); } - if ((sPairedActiveFleeFlag_ != 0) && (sPairedInactiveType__ != this->actor.params)) { - EnZf_SetupJumpSeqStartTurnAround_(this, play); - sPairedInactiveType__ = this->actor.params; - sPairedActiveFleeFlag_ = 0; + if ((sPairedActiveFleeFlag != 0) && (sPairedInactiveType != this->actor.params)) { + EnZf_Paired_SetupJumpAwayStartTurnAround(this, play); + sPairedInactiveType = this->actor.params; + sPairedActiveFleeFlag = 0; + // Signal the other lizalfos to engage combat. if (this->actor.prev != NULL) { - ((EnZf*)this->actor.prev)->timer2_ = 90; + ((EnZf*)this->actor.prev)->timer2 = 90; } else { - ((EnZf*)this->actor.next)->timer2_ = 90; + ((EnZf*)this->actor.next)->timer2 = 90; } } } - if (this->action >= ENZF_ACTION_DIE_) { + if (this->action >= ENZF_ACTION_DIE) { Math_SmoothStepToS(&this->headRot, 0, 1, 0x7D0, 0); - if ((this->action <= ENZF_ACTION_JUMP_SEQ_JUMP_20__) && (this->timer2_ == 1) && + // timer2 is 0 during ENZF_ACTION_PAIRED_IDLE_HOP until it is set by the other lizalfos instance to signal it's + // our turn to engage combat. + if ((this->action <= ENZF_ACTION_PAIRED_IDLE_HOP) && (this->timer2 == 1) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { if (this->actor.colChkInfo.health > 0) { - EnZf_SetupJumpSeqFinalLanding_____(this, play); + EnZf_Paired_SetupEngageCombat(this, play); } - this->timer2_--; + this->timer2--; } - if (this->timer2_ >= 2) { - this->timer2_--; + if (this->timer2 >= 2) { + this->timer2--; } } this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 40.0f; if (this->actor.colChkInfo.health > 0) { - if (this->alpha_ == 255) { + if (this->alpha == 255) { Collider_UpdateCylinder(&this->actor, &this->bodyCollider); - if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_DAMAGED_)) { + if ((this->actor.world.pos.y == this->actor.floorHeight) && (this->action <= ENZF_ACTION_DAMAGED)) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); } - if (!(ENZF_IS_TYPE_PAIRED_(this->actor.params) && (sPairedInactiveType__ == this->actor.params)) && - ((this->actor.colorFilterTimer == 0) || !(this->actor.colorFilterParams & 0x4000))) { + if (!(ENZF_IS_TYPE_PAIRED(this->actor.params) && (sPairedInactiveType == this->actor.params)) && + !((this->actor.colorFilterTimer != 0) && (this->actor.colorFilterParams & 0x4000))) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } } @@ -2183,9 +2211,9 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { func_8002EBCC(&this->actor, play, 1); gSPTexture(D_80B4A2F8, IREG(0), IREG(1), 0, G_TX_RENDERTILE, G_ON); gSPSegment(POLY_OPA_DISP++, 8, D_80B4A2F8); - if (this->alpha_ == 255) { + if (this->alpha == 255) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha_); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_OPA_DISP++, 9, &D_80116280[2]); POLY_OPA_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_OPA_DISP); @@ -2201,7 +2229,7 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { } else { Gfx_SetupDL_25Xlu(play->state.gfxCtx); gDPPipeSync(POLY_XLU_DISP++); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha_); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); gSPSegment(POLY_XLU_DISP++, 9, D_80116280); POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnZf_OverrideLimbDraw, EnZf_PostLimbDraw, this, POLY_XLU_DISP); @@ -2209,62 +2237,66 @@ void EnZf_Draw(Actor* thisx, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_en_zf.c", 3601); } -void EnZf_SetupCirclePlayer___(EnZf* this, f32 speed) { - Animation_MorphToLoop(&this->skelAnime, &gZfCautiousWalkAnim___, -1.0f); - this->timer_ = (Rand_ZeroOne() * 10.0f) + 8.0f; +void EnZf_SetupCirclePlayer(EnZf* this, f32 speed) { + Animation_MorphToLoop(&this->skelAnime, &gZfWalkSidewaysAnim, -1.0f); + this->timer = (Rand_ZeroOne() * 10.0f) + 8.0f; if (this->actor.params == ENZF_TYPE_DINOLFOS) { this->actor.speed = 2.0f * speed; - this->timer_ /= 2; + this->timer /= 2; } else { this->actor.speed = speed; } - this->actionState_ = 0; + this->actionState = 0; this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - this->action = ENZF_ACTION_CIRCLE_PLAYER___; - EnZf_SetupAction(this, EnZf_CirclePlayer___); + this->action = ENZF_ACTION_CIRCLE_PLAYER; + EnZf_SetupAction(this, EnZf_CirclePlayer); } -s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this) { +/** + * React to projectiles by picking an adequate action. + * @return true if an action was picked + */ +s32 EnZf_ReactToProjectile(PlayState* play, EnZf* this) { Actor* projectile; s16 relYawTowardsProjectile; - s16 noFloorAheadFlags_; - s16 directionFlags_; + s16 noFloorAheadFlags; + s16 directionFlags; projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectile != NULL) { relYawTowardsProjectile = Actor_WorldYawTowardActor(&this->actor, projectile) - (s16)(this->actor.shape.rot.y + 0); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - noFloorAheadFlags_ = 0; - if (EnZf_TestNoFloorAhead_(this, play, -8.0f)) { - noFloorAheadFlags_ |= 1; + noFloorAheadFlags = 0; + if (EnZf_TestNoFloorAhead(this, play, -8.0f)) { + noFloorAheadFlags |= 1; } - if (EnZf_TestNoFloorAhead_(this, play, 8.0f)) { - noFloorAheadFlags_ |= 2; + if (EnZf_TestNoFloorAhead(this, play, 8.0f)) { + noFloorAheadFlags |= 2; } this->actor.world.rot.y = this->actor.shape.rot.y; - if ((((this->actor.xzDistToPlayer < 90.0f) || (noFloorAheadFlags_ == 3)) && - !EnZf_TestNoFloorAhead_(this, play, 135.0f)) || + if ((((this->actor.xzDistToPlayer < 90.0f) || (noFloorAheadFlags == 3)) && + !EnZf_TestNoFloorAhead(this, play, 135.0f)) || (projectile->id == ACTOR_ARMS_HOOK)) { - EnZf_SetupJumpAttack__(this); + EnZf_SetupJumpAttack(this); } else { this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - if (noFloorAheadFlags_ == 0) { - directionFlags_ = play->gameplayFrames & 1; + if (noFloorAheadFlags == 0) { + directionFlags = play->gameplayFrames & 1; } else { - directionFlags_ = noFloorAheadFlags_; + directionFlags = noFloorAheadFlags; } if ((ABS(relYawTowardsProjectile) < 0x2000) || (ABS(relYawTowardsProjectile) >= 0x6000)) { - if (directionFlags_ & 1) { - EnZf_SetupCirclePlayer___(this, 8.0f); + if (directionFlags & 1) { + EnZf_SetupCirclePlayer(this, 8.0f); } else { - EnZf_SetupCirclePlayer___(this, -8.0f); + EnZf_SetupCirclePlayer(this, -8.0f); } } else if (ABS(relYawTowardsProjectile) < 0x5FFF) { - if (directionFlags_ & 1) { - EnZf_SetupCirclePlayer___(this, 4.0f); + if (directionFlags & 1) { + EnZf_SetupCirclePlayer(this, 4.0f); } else { - EnZf_SetupCirclePlayer___(this, -4.0f); + EnZf_SetupCirclePlayer(this, -4.0f); } } //! @bug If ABS(relYawTowardsProjectile) == 0x5FFF the function returns true @@ -2275,77 +2307,77 @@ s32 EnZf_ReactToProjectile_(PlayState* play, EnZf* this) { return false; } -s32 EnZf_ReactToProjectile2_____(PlayState* play, EnZf* this) { +s32 EnZf_ReactToProjectileSetDodgeSpeed(PlayState* play, EnZf* this) { Actor* projectile; s16 relYawTowardsProjectile; - s16 noFloorAheadFlags_; - s16 dodgeSpeed_; - s16 dodgeVelocityY_; + s16 noFloorAheadFlags; + s16 dodgeSpeed; + s16 dodgeVelocityY; - dodgeVelocityY_ = 0; + dodgeVelocityY = 0; projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectile != NULL) { relYawTowardsProjectile = Actor_WorldYawTowardActor(&this->actor, projectile) - (s16)(this->actor.shape.rot.y + 0); this->actor.world.rot.y = this->actor.shape.rot.y + 0x3FFF; - noFloorAheadFlags_ = 0; - if (EnZf_TestNoFloorAhead_(this, play, -70.0f)) { - noFloorAheadFlags_ |= 1; + noFloorAheadFlags = 0; + if (EnZf_TestNoFloorAhead(this, play, -70.0f)) { + noFloorAheadFlags |= 1; } - if (EnZf_TestNoFloorAhead_(this, play, 70.0f)) { - noFloorAheadFlags_ |= 2; + if (EnZf_TestNoFloorAhead(this, play, 70.0f)) { + noFloorAheadFlags |= 2; } this->actor.speed = 0.0f; if ((ABS(relYawTowardsProjectile) < 0x2000 || ABS(relYawTowardsProjectile) > 0x5FFF)) { - if (noFloorAheadFlags_ == 0) { + if (noFloorAheadFlags == 0) { if ((play->gameplayFrames % 2) != 0) { - dodgeSpeed_ = 6; + dodgeSpeed = 6; } else { - dodgeSpeed_ = -6; + dodgeSpeed = -6; } } else { - switch (noFloorAheadFlags_) { + switch (noFloorAheadFlags) { case 1: - dodgeSpeed_ = 6; + dodgeSpeed = 6; break; case 2: - dodgeSpeed_ = -6; + dodgeSpeed = -6; break; case 3: - dodgeVelocityY_ = 5; - dodgeSpeed_ = 0; + dodgeVelocityY = 5; + dodgeSpeed = 0; break; } } } else if (ABS(relYawTowardsProjectile) < 0x5FFF) { - if (noFloorAheadFlags_ == 0) { + if (noFloorAheadFlags == 0) { if ((play->gameplayFrames % 2) != 0) { - dodgeSpeed_ = 6; + dodgeSpeed = 6; } else { - dodgeSpeed_ = -6; + dodgeSpeed = -6; } } else { - switch (noFloorAheadFlags_) { + switch (noFloorAheadFlags) { case 1: - dodgeSpeed_ = 6; + dodgeSpeed = 6; break; case 2: - dodgeSpeed_ = -6; + dodgeSpeed = -6; break; case 3: - dodgeVelocityY_ = 10; - dodgeSpeed_ = 0; + dodgeVelocityY = 10; + dodgeSpeed = 0; break; } } } - //! @bug if sp22 is exactly 0x5FFF, sp1E is used uninitialized - this->dodgeSpeed___ = dodgeSpeed_; - this->dodgeVelocityY___ = dodgeVelocityY_; + //! @bug if relYawTowardsProjectile is exactly 0x5FFF, dodgeSpeed is used uninitialized + this->dodgeSpeed = dodgeSpeed; + this->dodgeVelocityY = dodgeVelocityY; return true; } return false; 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 f0eb4f564f7..f36a5271734 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -7,13 +7,13 @@ #include "assets/objects/object_zf/object_zf.h" typedef enum EnZfType { - /* -2 */ ENZF_TYPE_DINOLFOS = -2,// Ganon's Tower room 0 x2, GTG room 7 x2 - /* -1 */ ENZF_TYPE_LIZALFOS_SINGLE_, // Spirit room 4 x2, Spirit room 26 x2 - /* 0 */ ENZF_TYPE_LIZALFOS_PAIRED_A_, // DC room 3 x2 - /* 1 */ ENZF_TYPE_LIZALFOS_PAIRED_B_ // DC room 3 x2 + /* -2 */ ENZF_TYPE_DINOLFOS = -2, + /* -1 */ ENZF_TYPE_LIZALFOS_SINGLE, + /* 0 */ ENZF_TYPE_LIZALFOS_PAIRED_A, + /* 1 */ ENZF_TYPE_LIZALFOS_PAIRED_B } EnZfType; -#define ENZF_IS_TYPE_PAIRED_(type) ((type) >= ENZF_TYPE_LIZALFOS_PAIRED_A_) +#define ENZF_IS_TYPE_PAIRED(type) ((type) >= ENZF_TYPE_LIZALFOS_PAIRED_A) struct EnZf; @@ -23,26 +23,26 @@ typedef struct EnZf { /* 0x190 */ Vec3s jointTable[ZF_LIMB_MAX]; /* 0x2B6 */ Vec3s morphTable[ZF_LIMB_MAX]; /* 0x3DC */ s32 action; - /* 0x3E0 */ s32 unk3E0; - /* 0x3E4 */ s32 actionState_; + /* 0x3E0 */ s32 unk_3E0; // unused + /* 0x3E4 */ s32 actionState; /* 0x3E8 */ void (*actionFunc)(struct EnZf*, struct PlayState*); /* 0x3EC */ s16 headRot; /* 0x3EE */ s16 headRotStep; - /* 0x3F0 */ s32 timer_; - /* 0x3F4 */ s16 timer2_; + /* 0x3F0 */ s32 timer; + /* 0x3F4 */ s16 timer2; /* 0x3F6 */ s16 frozenTimer; - /* 0x3F8 */ s16 noFloorAhead_; + /* 0x3F8 */ s16 noFloorAhead; /* 0x3FA */ s16 isSwordSheathed; /* 0x3FC */ s16 switchFlag; - /* 0x3FE */ s16 unkPlatform3FE_cur; - /* 0x400 */ s16 unkPlatform400_home___; - /* 0x402 */ s16 unkPlatform402_target_; - /* 0x404 */ u8 alpha_; - /* 0x405 */ char pad405[3]; - /* 0x408 */ f32 dodgeSpeed___; - /* 0x40C */ f32 dodgeVelocityY___; + /* 0x3FE */ s16 curPlatform; + /* 0x400 */ s16 homePlatform; + /* 0x402 */ s16 targetPlatform; + /* 0x404 */ u8 alpha; + /* 0x405 */ char pad_405[3]; + /* 0x408 */ f32 dodgeSpeed; + /* 0x40C */ f32 dodgeVelocityY; /* 0x410 */ u8 lastDamageReaction; - /* 0x411 */ char pad411[3]; + /* 0x411 */ char pad_411[3]; /* 0x414 */ s32 swordBlureEffectIndex; /* 0x418 */ ColliderCylinder bodyCollider; /* 0x464 */ ColliderQuad swordCollider; From 353a5f4dc9a1789dd97b4dd3d8268953afab074b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 5 Aug 2026 13:25:55 +0200 Subject: [PATCH 069/150] remove outdated place_title_cards.xml comment --- assets/xml/textures/place_title_cards.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/xml/textures/place_title_cards.xml b/assets/xml/textures/place_title_cards.xml index 4d21c41fb65..30851a36945 100644 --- a/assets/xml/textures/place_title_cards.xml +++ b/assets/xml/textures/place_title_cards.xml @@ -1,5 +1,4 @@ - From c3ae8577523c7897a74800a551ec0603e363f461 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 5 Aug 2026 13:28:35 +0200 Subject: [PATCH 070/150] rm unused assets/xml/textures/link_animetion.xml --- assets/xml/textures/link_animetion.xml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 assets/xml/textures/link_animetion.xml diff --git a/assets/xml/textures/link_animetion.xml b/assets/xml/textures/link_animetion.xml deleted file mode 100644 index 8df8efba470..00000000000 --- a/assets/xml/textures/link_animetion.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From b29bf865c2f01c88c9791bf049db6d35653054ef Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 6 Aug 2026 13:04:41 +0200 Subject: [PATCH 071/150] fixups --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) 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 0cec0b1433f..c8784b3b8b2 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -92,7 +92,7 @@ typedef enum EnZfAction { /** * Positions of the platforms in Dodongo's Cavern in the lizalfos fights room (room 3). */ -static Vec3f sDCPlatformPositions_[] = { +static Vec3f sDCPlatformPositions[] = { // Lower floor { 3560.0f, 100.0f, -1517.0f }, { 3170.0f, 100.0f, -1767.0f }, @@ -441,15 +441,15 @@ s16 EnZf_FindPlatform(Vec3f* pos, s16 preferred) { range = 110.0f; } if (preferred != -1) { - platformPos = &sDCPlatformPositions_[preferred]; + platformPos = &sDCPlatformPositions[preferred]; if (((platformPos->y - 150.0f) <= pos->y) && (pos->y <= (platformPos->y + 150.0f)) && ((platformPos->x - range) <= pos->x) && (pos->x <= (platformPos->x + range)) && ((platformPos->z - range) <= pos->z) && (pos->z <= (platformPos->z + range))) { return preferred; } } - for (i = ARRAY_COUNT(sDCPlatformPositions_) - 1; i >= 0; i--) { - platformPos = &sDCPlatformPositions_[i]; + for (i = ARRAY_COUNT(sDCPlatformPositions) - 1; i >= 0; i--) { + platformPos = &sDCPlatformPositions[i]; if (((platformPos->y - 150.0f) <= pos->y) && (pos->y <= (platformPos->y + 150.0f)) && ((platformPos->x - range) <= pos->x) && (pos->x <= (platformPos->x + range)) && ((platformPos->z - range) <= pos->z) && (pos->z <= (platformPos->z + range))) { @@ -505,10 +505,10 @@ s16 EnZf_FindPlatformWithoutPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallback continue; } if ((playerPlatform == -1) && - (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]) < minPlatformDistFromPlayer)) { + (Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions[i]) < minPlatformDistFromPlayer)) { continue; } - platformDist = Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions_[i]); + platformDist = Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions[i]); if (platformDist > maxPlatformDist) { continue; } @@ -523,7 +523,7 @@ s16 EnZf_FindPlatformWithoutPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallback } } - closestPlatformPos = &sDCPlatformPositions_[closestPlatform]; + closestPlatformPos = &sDCPlatformPositions[closestPlatform]; //! @bug `secondClosestPlatform` can be -1 in certain conditions and cause an out of bounds access. //! Under normal conditions, this doesn't cause problems because the data before `D_80B4A090` @@ -531,7 +531,7 @@ s16 EnZf_FindPlatformWithoutPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallback // These two function calls do nothing. Their return values aren't used and they have no side effects. #ifndef AVOID_UB Math_Vec3f_DistXYZ(&player->actor.world.pos, closestPlatformPos); - Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[secondClosestPlatform]); + Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions[secondClosestPlatform]); #endif //! @bug The check should be >= 0 @@ -548,7 +548,7 @@ s16 EnZf_FindPlatformWithoutPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallback return closestPlatform; } -s32 EnZf_FindPlatformCloseToPlayer(Vec3f* thisPos_, s16 curPlatform, s16 platform_arg2, PlayState* play) { +s32 EnZf_FindPlatformCloseToPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallbackPlatform, PlayState* play) { Vec3f* temp_s0; f32 platformDistToPlayer; f32 closestPlatformToPlayerDist; @@ -569,18 +569,18 @@ s32 EnZf_FindPlatformCloseToPlayer(Vec3f* thisPos_, s16 curPlatform, s16 platfor closestPlatformToPlayerDist = 99998.0f; secondClosestPlatformToPlayerDist = 99999.0f; closestPlatformToPlayer = curPlatform; - secondClosestPlatformToPlayer = platform_arg2; - if (thisPos_->y > 200.0f) { + secondClosestPlatformToPlayer = fallbackPlatform; + if (thisPos->y > 200.0f) { maxPlatformDist = 290.0f; i = 23; iMin = 8; } for (; i >= iMin; i--) { - if (Math_Vec3f_DistXYZ(thisPos_, &sDCPlatformPositions_[i]) > maxPlatformDist) { + if (Math_Vec3f_DistXYZ(thisPos, &sDCPlatformPositions[i]) > maxPlatformDist) { continue; } if (i != playerPlatform) { - platformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions_[i]); + platformDistToPlayer = Math_Vec3f_DistXYZ(&player->actor.world.pos, &sDCPlatformPositions[i]); if (platformDistToPlayer < closestPlatformToPlayerDist) { secondClosestPlatformToPlayerDist = closestPlatformToPlayerDist; secondClosestPlatformToPlayer = closestPlatformToPlayer; @@ -866,14 +866,14 @@ void EnZf_MainWalk(EnZf* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; } else { this->actor.world.rot.y = this->actor.yawTowardsPlayer = this->actor.shape.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]); + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]); absYawDiff = this->actor.wallYaw - this->actor.shape.rot.y; if (absYawDiff < 0) { absYawDiff *= -1; } if ((this->noFloorAhead && (this->actor.speed > 0.0f)) || ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (absYawDiff >= 0x5C19))) { - if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]) < + if ((Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]) < maxTargetPlatformDistForJump) && !EnZf_TestNoFloorAhead(this, play, 191.9956f)) { EnZf_SetupJumpForwards(this); @@ -883,7 +883,7 @@ void EnZf_MainWalk(EnZf* this, PlayState* play) { return; } else { this->actor.world.rot.y = - Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->curPlatform]); + Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions[this->curPlatform]); } } else { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -1400,7 +1400,7 @@ void EnZf_Paired_SetupJumpAwayStartTurnAround(EnZf* this, PlayState* play) { void EnZf_Paired_JumpAwayStartTurnAround(EnZf* this, PlayState* play) { s16 yaw; - yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]) + 0x8000; + yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -1505,7 +1505,7 @@ void EnZf_Paired_JumpAway(EnZf* this, PlayState* play) { animPlaySpeed = 1.0f; var_fs0 = 550.0f; - distToTargetPlatform = Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]); + distToTargetPlatform = Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]); prevActionState = this->actionState; if ((play->gameplayFrames & 0x5F) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); @@ -1513,7 +1513,7 @@ void EnZf_Paired_JumpAway(EnZf* this, PlayState* play) { if (this->actor.world.pos.y >= 420.0f) { var_fs0 = 280.0f; } - yawTowardsTargetPlatform = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions_[this->targetPlatform]); + yawTowardsTargetPlatform = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]); switch (this->actionState) { case 0: this->actor.world.rot.y = yawTowardsTargetPlatform; From 8666b2c5486de27605144ffbf92fee39f43dc136 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 6 Aug 2026 21:20:28 +0200 Subject: [PATCH 072/150] wip bowling actors docs --- assets/xml/objects/object_bg.xml | 81 +++--- assets/xml/objects/object_bowl.xml | 14 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c | 19 +- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h | 4 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 97 +++---- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h | 6 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 274 +++++++++--------- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 30 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 36 ++- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h | 4 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 13 +- tools/vt_fmt.py | 2 +- 12 files changed, 293 insertions(+), 287 deletions(-) diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index c5a09a5de89..c916e6d2aa2 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -1,63 +1,66 @@ - - - + + + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_bowl.xml b/assets/xml/objects/object_bowl.xml index 31fd9eb8416..a6d51c2b7cd 100644 --- a/assets/xml/objects/object_bowl.xml +++ b/assets/xml/objects/object_bowl.xml @@ -6,20 +6,20 @@ - - + + - - - + + + - + - + diff --git a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c index 569157c7fde..47dc6e46ed5 100644 --- a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c +++ b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c @@ -21,7 +21,7 @@ void BgBomGuard_Init(Actor* thisx, PlayState* play); void BgBomGuard_Destroy(Actor* thisx, PlayState* play); void BgBomGuard_Update(Actor* thisx, PlayState* play); -void func_8086E638(BgBomGuard* this, PlayState* play); +void BgBomGuard_UpdateImpl(BgBomGuard* this, PlayState* play); ActorProfile Bg_Bom_Guard_Profile = { /**/ ACTOR_BG_BOM_GUARD, @@ -45,8 +45,8 @@ void BgBomGuard_Init(Actor* thisx, PlayState* play) { CollisionHeader* colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gBowlingDefaultCol, &colHeader); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, thisx, colHeader); + CollisionHeader_GetVirtual(&gBowlingBgBomGuardCol, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); PRINTF("\n\n"); PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 透明ガード出現 ☆☆☆☆☆ \n", " ☆☆☆☆☆ Transparent guard appears ☆☆☆☆☆ \n") VT_RST); @@ -54,8 +54,8 @@ void BgBomGuard_Init(Actor* thisx, PlayState* play) { thisx->scale.x = 1.0f; thisx->scale.y = 1.0f; thisx->scale.z = 1.0f; - this->unk_16C = thisx->world.pos; - BgBomGuard_SetupAction(this, func_8086E638); + this->homePos = this->dyna.actor.world.pos; + BgBomGuard_SetupAction(this, BgBomGuard_UpdateImpl); } void BgBomGuard_Destroy(Actor* thisx, PlayState* play) { @@ -64,24 +64,25 @@ void BgBomGuard_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8086E638(BgBomGuard* this, PlayState* play) { +void BgBomGuard_UpdateImpl(BgBomGuard* this, PlayState* play) { Actor* it = play->actorCtx.actorLists[ACTORCAT_NPC].head; Actor* thisx = &this->dyna.actor; - this->unk_168 = 0; + this->isActive = false; while (it != NULL) { if (it->id == ACTOR_EN_BOM_BOWL_MAN) { if ((((EnBomBowlMan*)it)->unk_258 != 0) && (fabsf(play->view.eye.x) > -20.0f) && (fabsf(play->view.eye.y) > 110.0f)) { - this->unk_168 = 1; + this->isActive = true; } break; } it = it->next; } - if (this->unk_168 == 0) { + if (!this->isActive) { + // Move under ground thisx->world.pos.y = sREG(64) + -200.0f; } else { thisx->world.pos.y = 0.0f; diff --git a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h index 707027f443e..909fcc7adb1 100644 --- a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h +++ b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.h @@ -11,8 +11,8 @@ typedef void (*BgBomGuardActionFunc)(struct BgBomGuard*, struct PlayState*); typedef struct BgBomGuard { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgBomGuardActionFunc actionFunc; - /* 0x0168 */ u8 unk_168; - /* 0x016C */ Vec3f unk_16C; + /* 0x0168 */ u8 isActive; + /* 0x016C */ Vec3f homePos; } BgBomGuard; // size = 0x0178 #endif diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 607d97cd3d3..10cc8540893 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -27,8 +27,8 @@ void BgBowlWall_Destroy(Actor* thisx, PlayState* play); void BgBowlWall_Update(Actor* thisx, PlayState* play); void BgBowlWall_Draw(Actor* thisx, PlayState* play); -void func_8086F260(BgBowlWall* this, PlayState* play); -void func_8086F440(BgBowlWall* this, PlayState* play); +void BgBowlWall_InitImpl(BgBowlWall* this, PlayState* play); +void BgBowlWall_WaitUnk180_(BgBowlWall* this, PlayState* play); void func_8086F464(BgBowlWall* this, PlayState* play); void func_8086F718(BgBowlWall* this, PlayState* play); void func_8086F7F8(BgBowlWall* this, PlayState* play); @@ -57,24 +57,21 @@ Vec3f D_8086FA84 = { 0.0f, 0.0f, 0.0f }; void BgBowlWall_Init(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; s32 pad1[2]; - CollisionHeader* sp28; - s32 pad2[2]; + CollisionHeader* colHeader; - sp28 = NULL; + colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); if (this->dyna.actor.params == 0) { - CollisionHeader_GetVirtual(&gBowlingFirstAndFinalRoundCol, &sp28); + CollisionHeader_GetVirtual(&gBowlingFirstWallCol, &colHeader); } else { - CollisionHeader_GetVirtual(&gBowlingSecondRoundCol, &sp28); + CollisionHeader_GetVirtual(&gBowlingSecondWallCol, &colHeader); } - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp28); - this->unk168 = this->dyna.actor.world.pos; + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->homePos = this->dyna.actor.world.pos; PRINTF("\n\n"); - PRINTF("\x1b[32m ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n\x1b[m", this->dyna.actor.params); - this->actionFunc = func_8086F260; - this->dyna.actor.scale.z = 1.0f; - this->dyna.actor.scale.y = 1.0f; - this->dyna.actor.scale.x = 1.0f; + PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ ボーリングおじゃま壁発生 ☆☆☆☆☆ %d\n" VT_RST, this->dyna.actor.params); + this->actionFunc = BgBowlWall_InitImpl; + this->dyna.actor.scale.x = this->dyna.actor.scale.y = this->dyna.actor.scale.z = 1.0f; } void BgBowlWall_Destroy(Actor* thisx, PlayState* play) { @@ -83,8 +80,8 @@ void BgBowlWall_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, (s32)this->dyna.bgId); } -void func_8086F260(BgBowlWall* this, PlayState* play) { - Actor* var_v0_2; +void BgBowlWall_InitImpl(BgBowlWall* this, PlayState* play) { + Actor* actor; EnWallTubo* temp_v0_2; s32 pad; s16 params = this->dyna.actor.params; @@ -94,35 +91,35 @@ void func_8086F260(BgBowlWall* this, PlayState* play) { this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z = D_8086FA70[params]; PRINTF("\n\n"); } - this->unk174.x = D_8086FA40[params].x + this->dyna.actor.world.pos.x; - this->unk174.y = D_8086FA40[params].y + this->dyna.actor.world.pos.y; - this->unk174.z = D_8086FA40[params].z + this->dyna.actor.world.pos.z; + this->wallTargetPos_.x = D_8086FA40[params].x + this->dyna.actor.world.pos.x; + this->wallTargetPos_.y = D_8086FA40[params].y + this->dyna.actor.world.pos.y; + this->wallTargetPos_.z = D_8086FA40[params].z + this->dyna.actor.world.pos.z; if (0) {} - temp_v0_2 = - (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, this->unk174.x, - this->unk174.y, this->unk174.z, 0, 0, 0, this->dyna.actor.params); + temp_v0_2 = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, + this->wallTargetPos_.x, this->wallTargetPos_.y, this->wallTargetPos_.z, + 0, 0, 0, this->dyna.actor.params); if (temp_v0_2 != NULL) { - temp_v0_2->unk154 = this->unk174; + temp_v0_2->unk154 = this->wallTargetPos_; if (params != 0) { - temp_v0_2->unk154 = this->unk174 = this->dyna.actor.world.pos; + temp_v0_2->unk154 = this->wallTargetPos_ = this->dyna.actor.world.pos; } if (this->unk184 == NULL) { - var_v0_2 = play->actorCtx.actorLists[4].head; - while (var_v0_2 != NULL) { - if (var_v0_2->id != ACTOR_EN_BOM_BOWL_MAN) { - var_v0_2 = var_v0_2->next; + actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; + while (actor != NULL) { + if (actor->id != ACTOR_EN_BOM_BOWL_MAN) { + actor = actor->next; continue; } - this->unk184 = (EnBomBowlMan*)var_v0_2; + this->unk184 = (EnBomBowlMan*)actor; break; } } - this->actionFunc = func_8086F440; + this->actionFunc = BgBowlWall_WaitUnk180_; } } -void func_8086F440(BgBowlWall* this, PlayState* play) { - if (this->unk180 != 0) { +void BgBowlWall_WaitUnk180_(BgBowlWall* this, PlayState* play) { + if (this->unk180) { this->actionFunc = func_8086F464; } } @@ -143,16 +140,16 @@ void func_8086F464(BgBowlWall* this, PlayState* play) { var_s0 = true; } } else { - Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk168.y - 450.0f, 0.3f, 10.0f); - if (this->dyna.actor.world.pos.y < (this->unk168.y - 400.0f)) { + Math_ApproachF(&this->dyna.actor.world.pos.y, this->homePos.y - 450.0f, 0.3f, 10.0f); + if (this->dyna.actor.world.pos.y < (this->homePos.y - 400.0f)) { var_s0 = true; } } if (var_s0) { for (var_s0_2 = 0; var_s0_2 < 15; var_s0_2++) { - sp88.x = Rand_CenteredFloat(300.0f) + this->unk174.x; + sp88.x = Rand_CenteredFloat(300.0f) + this->wallTargetPos_.x; sp88.y = -100.0f; - sp88.z = Rand_CenteredFloat(400.0f) + this->unk174.z; + sp88.z = Rand_CenteredFloat(400.0f) + this->wallTargetPos_.z; EffectSsBomb2_SpawnLayered(play, &sp88, &sp94, &spA0, 100, 30); sp88.y = -50.0f; EffectSsHahen_SpawnBurst(play, &sp88, 10.0f, 0, 50, 15, 3, -1, 10, NULL); @@ -162,20 +159,20 @@ void func_8086F464(BgBowlWall* this, PlayState* play) { Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetPerturbations(quakeIndex, 300, 0, 0, 0); Quake_SetDuration(quakeIndex, 30); - this->unk182 = 0x14; + this->timer = 20; this->actionFunc = func_8086F718; } } void func_8086F718(BgBowlWall* this, PlayState* play) { - if (this->unk182 >= 2) { + if (this->timer >= 2) { if (this->dyna.actor.params == 0) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 0xC8, 0); } else { - Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk168.y - 450.0f, 0.3f, 10.0f); + Math_ApproachF(&this->dyna.actor.world.pos.y, this->homePos.y - 450.0f, 0.3f, 10.0f); } - } else if (this->unk182 == 1) { - this->dyna.actor.world.pos.y = this->unk168.y - 450.0f; + } else if (this->timer == 1) { + this->dyna.actor.world.pos.y = this->homePos.y - 450.0f; this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x = 0; this->unk184->unk23E_arr[this->dyna.actor.params] = 2; this->actionFunc = func_8086F7F8; @@ -184,11 +181,11 @@ void func_8086F718(BgBowlWall* this, PlayState* play) { void func_8086F7F8(BgBowlWall* this, PlayState* play) { if (this->unk184->unk23E_arr[this->dyna.actor.params] != 2) { - Math_ApproachF(&this->dyna.actor.world.pos.y, this->unk168.y, 0.3f, 50.0f); - if (fabsf(this->dyna.actor.world.pos.y - this->unk168.y) <= 10.0f) { - this->dyna.actor.world.pos.y = this->unk168.y; - this->unk180 = 0; - this->actionFunc = func_8086F260; + Math_ApproachF(&this->dyna.actor.world.pos.y, this->homePos.y, 0.3f, 50.0f); + if (fabsf(this->dyna.actor.world.pos.y - this->homePos.y) <= 10.0f) { + this->dyna.actor.world.pos.y = this->homePos.y; + this->unk180 = false; + this->actionFunc = BgBowlWall_InitImpl; } } } @@ -196,8 +193,8 @@ void func_8086F7F8(BgBowlWall* this, PlayState* play) { void BgBowlWall_Update(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; - if (this->unk182 != 0) { - this->unk182--; + if (this->timer != 0) { + this->timer--; } this->actionFunc(this, play); } @@ -214,9 +211,9 @@ void BgBowlWall_Draw(Actor* thisx, PlayState* play) { gDPPipeSync(POLY_OPA_DISP++); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_bowl_wall.c", 453); if (this->dyna.actor.params == 0) { - gSPDisplayList(POLY_OPA_DISP++, gBowlingRound1WallDL); + gSPDisplayList(POLY_OPA_DISP++, gBowlingFirstWallDL); } else { - gSPDisplayList(POLY_OPA_DISP++, gBowlingRound2WallDL); + gSPDisplayList(POLY_OPA_DISP++, gBowlingSecondWallDL); } CLOSE_DISPS(play->state.gfxCtx, "../z_bg_bowl_wall.c", 464); } diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h index 2a2568f95d2..44d14ed8892 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h @@ -11,10 +11,10 @@ typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, struct PlayState*); typedef struct BgBowlWall { /* 0x000 */ DynaPolyActor dyna; /* 0x164 */ BgBowlWallActionFunc actionFunc; - /* 0x168 */ Vec3f unk168; - /* 0x174 */ Vec3f unk174; + /* 0x168 */ Vec3f homePos; + /* 0x174 */ Vec3f wallTargetPos_; /* 0x180 */ s16 unk180; - /* 0x182 */ s16 unk182; + /* 0x182 */ s16 timer; /* 0x184 */ struct EnBomBowlMan* unk184; } BgBowlWall; // size = 0x188 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 565d6f21568..935aeeee535 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 @@ -27,8 +27,8 @@ void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play); void EnBomBowlMan_Update(Actor* thisx, PlayState* play); void EnBomBowlMan_Draw(Actor* thisx, PlayState* play); -void func_809C3820(EnBomBowlMan* this, PlayState* play); -void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_SetupWaitTalk(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_WaitTalk(EnBomBowlMan* this, PlayState* play); void func_809C395C(EnBomBowlMan* this, PlayState* play); void func_809C39D0(EnBomBowlMan* this, PlayState* play); void func_809C3A54(EnBomBowlMan* this, PlayState* play); @@ -54,73 +54,73 @@ ActorProfile En_Bom_Bowl_Man_Profile = { /**/ EnBomBowlMan_Draw, }; -typedef struct struct_809C4A10 { - f32 unk0; - f32 unk4; - s32 unk8; // unused -} struct_809C4A10; -struct_809C4A10 D_809C4A10[2] = { { 16.0f, 46.0f, 0 }, { 36.0f, 56.0f, 0 } }; -Vec3f D_809C4A28[2] = { { 60.0f, -60.0f, -430.0f }, { 0.0f, -120.0f, -620.0f } }; -f32 D_809C4A40[2] = { 0.01f, 0.03f }; +typedef struct CuccoColliderDim { + f32 radius; + f32 height; + s32 unk_8; // unused +} CuccoColliderDim; +CuccoColliderDim sCuccoColliderDims[2] = { { 16.0f, 46.0f, 0 }, { 36.0f, 56.0f, 0 } }; +Vec3f sCuccoPositions[2] = { { 60.0f, -60.0f, -430.0f }, { 0.0f, -120.0f, -620.0f } }; +f32 sCuccoScales[2] = { 0.01f, 0.03f }; Vec3f D_809C4A48 = { 0.0f, 0.1f, 0.0f }; Vec3f D_809C4A54 = { 0.0f, 0.0f, 0.0f }; Vec3f D_809C4A60[5] = { { 0.0f, 22.0f, 0.0f }, { 0.0f, 22.0f, 0.0f }, { 0.0f, 8.0f, 0.0f }, { 0.0f, 9.0f, 0.0f }, { 0.0f, -2.0f, 0.0f }, }; static s16 D_809C4A9C[6] = { 0x4268, 0x4268, -0x3E8, 0, 0x4268, 0 }; -static s32 D_809C4AA8[6] = { 0x06004110, 0x06004910, 0x06005110, 0, 0, 0 }; +static void* sEyeTextures[] = { gBowlingGirlEyeOpenTex, gBowlingGirlEyeHalfTex, gBowlingGirlEyeClosedTex }; void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; PlayState* play = play2; - s32 var_s1; - EnSyatekiNiw* temp_v0; + s32 i; + EnSyatekiNiw* cucco; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_bg_006EB0_Skel, &object_bg_000710_Anim, &this->unk190, - &this->unk1D2, 0xB); - PRINTF("\x1b[32m☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n\x1b[m"); - PRINTF("\x1b[32m☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n\x1b[m", play->bombchuBowlingStatus); + SkelAnime_InitFlex(play, &this->skelAnime, &gBowlingGirlSkel, &gBowlingGirlSleepingAnim, this->jointTable, + this->morphTable, BOWLING_GIRL_LIMB_MAX); + PRINTF(VT_FGCOL(GREEN) "☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n" VT_RST); + PRINTF(VT_FGCOL(GREEN) "☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n" VT_RST, play->bombchuBowlingStatus); this->unk248 = this->actor.world.pos; this->actor.shape.yOffset = -60.0f; Actor_SetScale(&this->actor, 0.013f); - for (var_s1 = 0; var_s1 < 2; var_s1++) { - temp_v0 = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, 0x143, D_809C4A28[var_s1].x, D_809C4A28[var_s1].y, - D_809C4A28[var_s1].z, 0, 0, 0, 1); - if (temp_v0 != NULL) { - temp_v0->scale = D_809C4A40[var_s1]; - temp_v0->collider.dim.radius = (s16)(s32)D_809C4A10[var_s1].unk0; - temp_v0->collider.dim.height = (s16)(s32)D_809C4A10[var_s1].unk4; + for (i = 0; i < 2; i++) { + cucco = (EnSyatekiNiw*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SYATEKI_NIW, sCuccoPositions[i].x, + sCuccoPositions[i].y, sCuccoPositions[i].z, 0, 0, 0, SYATEKI_MINIGAME_ALLEY); + if (cucco != NULL) { + cucco->scale = sCuccoScales[i]; + cucco->collider.dim.radius = sCuccoColliderDims[i].radius; + cucco->collider.dim.height = sCuccoColliderDims[i].height; } } - this->unk242 = (u16)(s32)Rand_ZeroFloat(4.99f); + this->unk242 = Rand_ZeroFloat(4.99f); this->actor.attentionRangeType = ATTENTION_RANGE_1; - this->actionFunc = func_809C3820; + this->actionFunc = EnBomBowlMan_SetupWaitTalk; } void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void func_809C3820(EnBomBowlMan* this, PlayState* play) { - this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_000710_Anim); - Animation_Change(&this->skelAnime, &object_bg_000710_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, - ANIMMODE_LOOP, -10.0f); +void EnBomBowlMan_SetupWaitTalk(EnBomBowlMan* this, PlayState* play) { + this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlSleepingAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlSleepingAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_LOOP, + -10.0f); this->actor.textId = 0xC0; - this->unk22E = TEXT_STATE_EVENT; - this->actionFunc = func_809C38A8_WaitTalk; + this->waitMessageState = TEXT_STATE_EVENT; + this->actionFunc = EnBomBowlMan_WaitTalk; } -void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_WaitTalk(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayer; - s16 relYawTowardsPlayerAbs; + s16 absRelYawTowardsPlayer; SkelAnime_Update(&this->skelAnime); if (Actor_TalkOfferAccepted(&this->actor, play)) { this->actionFunc = func_809C395C; } else { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayerAbs = ABS(relYawTowardsPlayer); - if (!(this->actor.xzDistToPlayer > 120.0f) && (relYawTowardsPlayerAbs < 0x4300)) { + absRelYawTowardsPlayer = ABS(relYawTowardsPlayer); + if (!(this->actor.xzDistToPlayer > 120.0f) && (absRelYawTowardsPlayer < 0x4300)) { Actor_OfferTalk(&this->actor, play, 120.0f); } } @@ -128,36 +128,36 @@ void func_809C38A8_WaitTalk(EnBomBowlMan* this, PlayState* play) { void func_809C395C(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = MSGMODE_PAUSED; this->actionFunc = func_809C39D0; } } void func_809C39D0(EnBomBowlMan* this, PlayState* play) { - this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_000080_Anim); - Animation_Change(&this->skelAnime, &object_bg_000080_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, - ANIMMODE_ONCE, -10.0f); - this->unk238 = 1; + this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlNonchalantAnim_); + Animation_Change(&this->skelAnime, &gBowlingGirlNonchalantAnim_, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_ONCE, + -10.0f); + this->eyesState = 1; this->actionFunc = func_809C3A54; } void func_809C3A54(EnBomBowlMan* this, PlayState* play) { - f32 sp1C; + f32 prevFrame; - sp1C = this->skelAnime.curFrame; + prevFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); - if (sp1C == 30.0f) { - this->unk22E = TEXT_STATE_EVENT; - if (GET_EVENTCHKINF(EVENTCHKINF_25) || (gRegEditor->data[0x962] != 0)) { + if (prevFrame == 30.0f) { + this->waitMessageState = TEXT_STATE_EVENT; + if (GET_EVENTCHKINF(EVENTCHKINF_25) || (BREG(2) != 0)) { this->actor.textId = 0xBF; } else { this->actor.textId = 0x7058; } } Message_ContinueTextbox(play, this->actor.textId); - if ((this->unk234 == 0) && (this->unk238 == 2) && (this->unk236 == 0)) { - this->unk234 = 2; + if ((this->eyeTexIndex == 0) && (this->eyesState == 2) && (this->eyesTimer == 0)) { + this->eyeTexIndex = 2; this->unk23A += 1; if (this->unk23A >= 3) { this->actionFunc = func_809C3B50; @@ -167,18 +167,18 @@ void func_809C3A54(EnBomBowlMan* this, PlayState* play) { void func_809C3B50(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk254_curAnimFraceCount = Animation_GetLastFrame(&object_bg_0072AC_Anim); - Animation_Change(&this->skelAnime, &object_bg_0072AC_Anim, 1.0f, 0.0f, this->unk254_curAnimFraceCount, + this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlHandsOnBarAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlHandsOnBarAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_LOOP, -10.0f); - this->unk238 = 3; - this->unk236 = (s16)Rand_ZeroFloat(60.0f) + 0x14; - if (!GET_EVENTCHKINF(EVENTCHKINF_25) && (gRegEditor->data[0x962] == 0)) { + this->eyesState = 3; + this->eyesTimer = (s16)Rand_ZeroFloat(60.0f) + 20; + if (!GET_EVENTCHKINF(EVENTCHKINF_25) && (BREG(2) == 0)) { this->actionFunc = func_809C3C7C; } else { this->actor.textId = 0x18; - this->unk22E = TEXT_STATE_CHOICE; + this->waitMessageState = TEXT_STATE_CHOICE; Message_ContinueTextbox(play, this->actor.textId); this->actionFunc = func_809C4040; } @@ -196,7 +196,7 @@ void func_809C3C7C(EnBomBowlMan* this, PlayState* play) { void func_809C3CD4(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actionFunc = func_809C3C7C; } @@ -205,15 +205,15 @@ void func_809C3CD4(EnBomBowlMan* this, PlayState* play) { void func_809C3D40(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_258 == 0) { - if (this->unk232 == 0) { + if (!this->unk232) { this->actor.textId = 0x18; } else { this->actor.textId = 0x1A; } - this->unk22E = TEXT_STATE_CHOICE; + this->waitMessageState = TEXT_STATE_CHOICE; } else { this->actor.textId = 0x19; - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; } this->actionFunc = func_809C3DC4; } @@ -223,32 +223,32 @@ void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayerAbs; SkelAnime_Update(&this->skelAnime); - if (gRegEditor->data[0x963] != 0) { - PRINTF("\x1b[31m☆ game_play->bomchu_game_flag ☆ %d\n\x1b[m", play->bombchuBowlingStatus); - PRINTF("\x1b[31m☆ 壁1の状態どう? ☆ %d\n\x1b[m", this->unk23E_arr[0]); - PRINTF("\x1b[31m☆ 壁2の状態どう? ☆ %d\n\x1b[m", this->unk23E_arr[1]); - PRINTF("\x1b[31m☆ 穴情報\t ☆ %d\n\x1b[m", this->unk25C->unk164); + if (BREG(3) != 0) { + PRINTF(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, play->bombchuBowlingStatus); + PRINTF(VT_FGCOL(RED) "☆ 壁1の状態どう? ☆ %d\n" VT_RST, this->unk23E_arr[0]); + PRINTF(VT_FGCOL(RED) "☆ 壁2の状態どう? ☆ %d\n" VT_RST, this->unk23E_arr[1]); + PRINTF(VT_FGCOL(RED) "☆ 穴情報\t ☆ %d\n" VT_RST, this->unk25C->unk164); PRINTF("\n\n"); } this->unk244 = 0; if (this->unk25C != NULL) { if ((this->unk23E_arr[0] != 1) && (this->unk23E_arr[1] != 1) && (this->unk25C->unk164 == 2)) { this->unk244 = 1; - this->unk25C->unk164 = 0U; - PRINTF("\x1b[35m☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n\x1b[m"); + this->unk25C->unk164 = 0; + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n" VT_RST); } if ((play->bombchuBowlingStatus == -1) && (play->actorCtx.actorLists[3].length == 0) && (this->unk25C->unk164 == 0) && (this->unk23E_arr[0] != 1) && (this->unk23E_arr[1] != 1)) { this->unk244 = 2; - PRINTF("\x1b[35m☆☆☆☆☆ ボムチュウ消化 ☆☆☆☆☆ \n\x1b[m"); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ボムチュウ消化 ☆☆☆☆☆ \n" VT_RST); } } if (this->unk244 != 0) { this->actor.textId = 0x1A; - this->unk22E = TEXT_STATE_CHOICE; + this->waitMessageState = TEXT_STATE_CHOICE; this->unk_258 = 0; if ((this->unk260 != NULL) && (this->unk260->actor.update != NULL)) { - this->unk260->killItem = 1; + this->unk260->killItem = true; this->unk260 = NULL; } play->bombchuBowlingStatus = 0; @@ -275,26 +275,26 @@ void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { void func_809C4040(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: - if (gSaveContext.save.info.playerData.rupees >= 0x1E) { - Rupees_ChangeBy(-0x1E); + if (gSaveContext.save.info.playerData.rupees >= 30) { + Rupees_ChangeBy(-30); this->unk23E_arr[1] = 0; this->unk_258 = 1; this->unk23E_arr[0] = this->unk23E_arr[1]; - play->bombchuBowlingStatus = 0xA; + play->bombchuBowlingStatus = 10; Flags_SetSwitch(play, 0x38); - if ((this->unk232 == 0) && (this->unk23C == 0)) { + if (!this->unk232 && (this->unk23C == 0)) { this->actor.textId = 0x19; Message_ContinueTextbox(play, this->actor.textId); - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } else { this->actor.textId = 0x1B; Message_ContinueTextbox(play, this->actor.textId); - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_809C4318; @@ -303,7 +303,7 @@ void func_809C4040(EnBomBowlMan* this, PlayState* play) { this->unk23C = 0; this->actor.textId = 0x85; Message_ContinueTextbox(play, this->actor.textId); - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } break; @@ -311,7 +311,7 @@ void func_809C4040(EnBomBowlMan* this, PlayState* play) { this->unk23C = 0; this->actor.textId = 0x2D; Message_ContinueTextbox(play, this->actor.textId); - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; break; } @@ -320,7 +320,7 @@ void func_809C4040(EnBomBowlMan* this, PlayState* play) { void func_809C41FC(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(play, 0x38)) { Flags_UnsetSwitch(play, 0x38); @@ -328,7 +328,7 @@ void func_809C41FC(EnBomBowlMan* this, PlayState* play) { if (this->unk_258 == 1) { this->actor.textId = 0x1B; Message_ContinueTextbox(play, this->actor.textId); - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_809C4318; @@ -342,75 +342,75 @@ void func_809C41FC(EnBomBowlMan* this, PlayState* play) { } void func_809C4318(EnBomBowlMan* this, PlayState* play) { - Vec3f sp44 = D_809C4A48; - Vec3f sp38 = D_809C4A54; - Vec3f sp2C; + Vec3f effAccel = D_809C4A48; + Vec3f effVel = D_809C4A54; + Vec3f effPos; SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { - sp2C.x = 148.0f; - sp2C.y = 40.0f; - sp2C.z = 300.0f; - EffectSsBomb2_SpawnLayered(play, &sp2C, &sp38, &sp44, 50, 15); + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + effPos.x = 148.0f; + effPos.y = 40.0f; + effPos.z = 300.0f; + EffectSsBomb2_SpawnLayered(play, &effPos, &effVel, &effAccel, 50, 15); Actor_PlaySfx(&this->actor, NA_SE_IT_GOODS_APPEAR); - this->unk22A = 0xA; + this->unk22A = 10; this->actionFunc = func_809C441C; } } void func_809C441C(EnBomBowlMan* this, PlayState* play) { - s16 var_v1; + s16 reward; s32 pad; SkelAnime_Update(&this->skelAnime); if (this->unk22A == 0) { switch (this->unk242) { case 0: - var_v1 = 0; + reward = EXITEM_BOMB_BAG_BOWLING; if (GET_ITEMGETINF(ITEMGETINF_11)) { - var_v1 = 4; + reward = EXITEM_PURPLE_RUPEE_BOWLING; } break; case 1: - var_v1 = 4; + reward = EXITEM_PURPLE_RUPEE_BOWLING; break; case 2: - var_v1 = 2; + reward = EXITEM_BOMBCHUS_BOWLING; break; case 3: - var_v1 = 1; + reward = EXITEM_HEART_PIECE_BOWLING; if (GET_ITEMGETINF(ITEMGETINF_12)) { - var_v1 = 4; + reward = EXITEM_PURPLE_RUPEE_BOWLING; } break; case 4: - var_v1 = 3; + reward = EXITEM_BOMBS_BOWLING; break; } - this->unk230 = var_v1; - if (gRegEditor->data[0x967] != 0) { - this->unk230 = gRegEditor->data[0x967] - 1; + this->reward = reward; + if (BREG(7) != 0) { + this->reward = BREG(7) - 1; } this->unk260 = (EnExItem*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, D_809C4A60[this->unk230].x + 148.0f, - D_809C4A60[this->unk230].y + 40.0f, D_809C4A60[this->unk230].z + 300.0f, 0, D_809C4A9C[this->unk230], 0, - this->unk230 + 5); - if (this->unk232 == 0) { + &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, D_809C4A60[this->reward].x + 148.0f, + D_809C4A60[this->reward].y + 40.0f, D_809C4A60[this->reward].z + 300.0f, 0, D_809C4A9C[this->reward], 0, + this->reward + EXITEM_BOMB_BAG_COUNTER); + if (!this->unk232) { this->unk25C = (EnBomBowlPit*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOM_BOWL_PIT, 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); if (this->unk25C != NULL) { - this->unk25C->unk15A = (s16)this->unk230; + this->unk25C->reward = this->reward; } } else { - this->unk25C->unk15A = (s16)this->unk230; + this->unk25C->reward = this->reward; } - this->unk25C->unk15C = 1; + this->unk25C->unk15C = true; this->unk_258 = 2; this->actor.textId = 0x405A; Message_ContinueTextbox(play, this->actor.textId); - this->unk22E = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; this->unk242 += 1; - if ((s16)this->unk242 >= 5) { + if (this->unk242 >= 5) { this->unk242 = 0; } this->actionFunc = func_809C4664; @@ -419,14 +419,14 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { void func_809C4664(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if ((this->unk22E == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); - this->unk232 = 1; - if (gRegEditor->data[0x962] != 0) { - gRegEditor->data[0x962] = 0; + this->unk232 = true; + if (BREG(2) != 0) { + BREG(2) = 0; } - PRINTF("\x1b[33m☆ わー ☆ %d\n\x1b[m", play->bombchuBowlingStatus); + PRINTF(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, play->bombchuBowlingStatus); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); this->actionFunc = func_809C3D40; } @@ -435,46 +435,46 @@ void func_809C4664(EnBomBowlMan* this, PlayState* play) { void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; - this->unk22C += 1; + this->unk_22C++; this->actor.focus.pos.y = 60.0f; Actor_SetFocus(&this->actor, 60.0f); - switch (this->unk238) { + switch (this->eyesState) { case 0: - this->unk234 = 2; + this->eyeTexIndex = 2; break; case 1: - if (this->unk234 > 0) { - this->unk234 -= 1; + if (this->eyeTexIndex > 0) { + this->eyeTexIndex--; } else { - this->unk236 = 0x1E; - this->unk238 = 2; + this->eyesTimer = 30; + this->eyesState = 2; } break; case 2: - if (this->unk236 == 0) { - if (this->unk234 > 0) { - this->unk234 -= 1; + if (this->eyesTimer == 0) { + if (this->eyeTexIndex > 0) { + this->eyeTexIndex--; } } break; default: - if (this->unk236 == 0) { - this->unk234 += 1; - if (this->unk234 >= 3) { - this->unk234 = 0; - this->unk236 = (s16)Rand_ZeroFloat(60.0f) + 0x14; + if (this->eyesTimer == 0) { + this->eyeTexIndex += 1; + if (this->eyeTexIndex >= 3) { + this->eyeTexIndex = 0; + this->eyesTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } - Actor_TrackPlayer(play, &this->actor, &this->unk218, &this->unk224, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); break; } if (this->unk22A == 0) { } else { - this->unk22A -= 1; + this->unk22A--; } - if (this->unk236 != 0) { - this->unk236 -= 1; + if (this->eyesTimer != 0) { + this->eyesTimer--; } this->actionFunc(this, play); } @@ -482,9 +482,9 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnBomBowlMan* this = thisx; - if (limbIndex == 4) { - rot->x += this->unk218.y; - rot->z += this->unk218.z; + if (limbIndex == BOWLING_GIRL_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.z; } return 0; } @@ -494,7 +494,7 @@ void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_809C4AA8[this->unk234])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnBomBowlMan_OverrideLimbDraw, NULL, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 923); diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index c9f83de3d0e..ca6c27d4ab4 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_bg/object_bg.h" + struct EnBomBowlMan; typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, struct PlayState*); @@ -11,32 +13,30 @@ typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, struct PlayState*); typedef struct EnBomBowlMan { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ Vec3s unk190; - /* 0x196 */ char pad196[0x3C]; /* maybe part of unk190[0xB]? */ - /* 0x1D2 */ Vec3s unk1D2; - /* 0x1D8 */ char pad1D8[0x3C]; /* maybe part of unk1D2[0xB]? */ + /* 0x190 */ Vec3s jointTable[BOWLING_GIRL_LIMB_MAX]; + /* 0x1D2 */ Vec3s morphTable[BOWLING_GIRL_LIMB_MAX]; /* 0x214 */ EnBomBowlManActionFunc actionFunc; - /* 0x218 */ Vec3s unk218; + /* 0x218 */ Vec3s headRot; /* 0x21E */ char pad21E[6]; - /* 0x224 */ Vec3s unk224; + /* 0x224 */ Vec3s torsoRot; /* 0x22A */ s16 unk22A; - /* 0x22C */ s16 unk22C; - /* 0x22E */ s16 unk22E; - /* 0x230 */ s16 unk230; + /* 0x22C */ s16 unk_22C; // unused + /* 0x22E */ s16 waitMessageState; + /* 0x230 */ s16 reward; /* 0x232 */ s16 unk232; - /* 0x234 */ s16 unk234; - /* 0x236 */ s16 unk236; - /* 0x238 */ s16 unk238; + /* 0x234 */ s16 eyeTexIndex; + /* 0x236 */ s16 eyesTimer; + /* 0x238 */ s16 eyesState; /* 0x23A */ s16 unk23A; /* 0x23C */ s16 unk23C; /* 0x23E */ s16 unk23E_arr[2]; /* 0x242 */ s16 unk242; /* 0x244 */ s16 unk244; - /* 0x246 */ char pad246[2]; + /* 0x246 */ char pad_246[2]; /* 0x248 */ Vec3f unk248; - /* 0x254 */ f32 unk254_curAnimFraceCount; + /* 0x254 */ f32 curAnimFrameCount; /* 0x258 */ u8 unk_258; - /* 0x259 */ char pad259[3]; /* maybe part of unk_258[4]? */ + /* 0x259 */ char pad_259[3]; /* 0x25C */ struct EnBomBowlPit* unk25C; /* 0x260 */ struct EnExItem* unk260; } EnBomBowlMan; // size = 0x0264 diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index 4fd42e74c81..2a55996f034 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -26,7 +26,11 @@ void func_809C55B0(EnBomBowlPit* this, PlayState* play); void func_809C5608(EnBomBowlPit* this, PlayState* play); static s32 D_809C56E0[5] = { - GI_BOMB_BAG_30, GI_HEART_PIECE, GI_BOMBCHUS_10, GI_BOMBS_1, GI_RUPEE_PURPLE, + GI_BOMB_BAG_30, // EXITEM_BOMB_BAG_BOWLING + GI_HEART_PIECE, // EXITEM_HEART_PIECE_BOWLING + GI_BOMBCHUS_10, // EXITEM_BOMBCHUS_BOWLING + GI_BOMBS_1, // EXITEM_BOMBS_BOWLING + GI_RUPEE_PURPLE, // EXITEM_PURPLE_RUPEE_BOWLING }; ActorProfile En_Bom_Bowl_Pit_Profile = { @@ -44,16 +48,16 @@ ActorProfile En_Bom_Bowl_Pit_Profile = { void EnBomBowlPit_Init(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->unk14C = func_809C4E60; + this->actionFunc = func_809C4E60; } void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play) { } void func_809C4E60(EnBomBowlPit* this, PlayState* play) { - if (this->unk15C != 0) { + if (this->unk15C) { this->unk15C = this->unk164 = 0; - this->unk14C = func_809C4E8C; + this->actionFunc = func_809C4E8C; } } @@ -109,7 +113,7 @@ void func_809C4E8C(EnBomBowlPit* this, PlayState* play) { Sfx_PlaySfxCentered(0x28D3U); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); this->unk164 = 1; - this->unk14C = func_809C5184; + this->actionFunc = func_809C5184; return; } var_v1 = var_v1->next; @@ -138,7 +142,7 @@ void func_809C5184(EnBomBowlPit* this, PlayState* play) { (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 5.0f)) { Message_CloseTextbox(play); this->unk158 = 0x1E; - this->unk14C = func_809C5360; + this->actionFunc = func_809C5360; } } @@ -146,17 +150,17 @@ void func_809C5360(EnBomBowlPit* this, PlayState* play) { if (this->unk158 == 0) { this->unk1E0 = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z - 70.0f, 0, 0, 0, this->unk15A); + this->actor.world.pos.y, this->actor.world.pos.z - 70.0f, 0, 0, 0, this->reward); if (this->unk1E0 != NULL) { - this->unk14C = func_809C53F0; + this->actionFunc = func_809C53F0; } } } void func_809C53F0(EnBomBowlPit* this, PlayState* play) { if (this->unk156 != 0) { - switch (this->unk15A) { - case 0: + switch (this->reward) { + case EXITEM_BOMB_BAG_BOWLING: SET_ITEMGETINF(ITEMGETINF_11); break; case EXITEM_HEART_PIECE_BOWLING: @@ -166,7 +170,7 @@ void func_809C53F0(EnBomBowlPit* this, PlayState* play) { Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->unk14C = func_809C54A8; + this->actionFunc = func_809C54A8; } } @@ -174,7 +178,7 @@ void func_809C54A8(EnBomBowlPit* this, PlayState* play) { Player* player = GET_PLAYER(play); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); - this->unk160 = D_809C56E0[this->unk15A]; + this->unk160 = D_809C56E0[this->reward]; if ((this->unk160 == GI_BOMB_BAG_30) && (CUR_CAPACITY(1) == 30)) { this->unk160 = GI_BOMB_BAG_40; } @@ -182,12 +186,12 @@ void func_809C54A8(EnBomBowlPit* this, PlayState* play) { this->actor.parent = NULL; Actor_OfferGetItem(&this->actor, play, this->unk160, 2000.0f, 1000.0f); player->stateFlags1 |= PLAYER_STATE1_29; - this->unk14C = func_809C55B0; + this->actionFunc = func_809C55B0; } void func_809C55B0(EnBomBowlPit* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - this->unk14C = func_809C5608; + this->actionFunc = func_809C5608; return; } Actor_OfferGetItem(&this->actor, play, this->unk160, 2000.0f, 1000.0f); @@ -202,14 +206,14 @@ void func_809C5608(EnBomBowlPit* this, PlayState* play) { } this->unk156 = 0; this->unk164 = 2; - this->unk14C = func_809C4E60; + this->actionFunc = func_809C4E60; } } void EnBomBowlPit_Update(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->unk14C(this, play); + this->actionFunc(this, play); if (this->unk158 != 0) { this->unk158--; } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h index 4d5883a3eb1..d8472603c1d 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h @@ -10,13 +10,13 @@ typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, struct PlayState*); typedef struct EnBomBowlPit { /* 0x0000 */ Actor actor; - /* 0x014C */ EnBomBowlPitActionFunc unk14C; + /* 0x014C */ EnBomBowlPitActionFunc actionFunc; /* 0x0150 */ char pad150[2]; /* 0x0152 */ s16 subCamId; /* 0x0154 */ s16 unk154; /* 0x0156 */ s16 unk156; /* 0x0158 */ s16 unk158; - /* 0x015A */ s16 unk15A; + /* 0x015A */ s16 reward; /* 0x015C */ s16 unk15C; /* 0x0160 */ s32 unk160; /* 0x0164 */ u8 unk164; diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index df230fdee72..1a16bf8868d 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -14,6 +14,7 @@ #include "sfx.h" #include "printf.h" #include "quake.h" +#include "terminal.h" #include "z_lib.h" #include "debug_display.h" #include "effect.h" @@ -133,12 +134,12 @@ void func_80B2F0B8(EnWallTubo* this, PlayState* play) { if (this->unk150 == 0) { temp_v0 = this->actor.parent; if ((temp_v0 != NULL) && (temp_v0->update != NULL)) { - ((BgBowlWall*)temp_v0)->unk180 = 1; - PRINTF("\x1b[32m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); - PRINTF("\x1b[33m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); - PRINTF("\x1b[34m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); - PRINTF("\x1b[35m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); - PRINTF("\x1b[36m☆☆☆☆ やった原! ☆☆☆☆☆ \n\x1b[m"); + ((BgBowlWall*)temp_v0)->unk180 = true; + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(BLUE) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); + PRINTF(VT_FGCOL(CYAN) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); } Actor_Kill(&this->actor); } diff --git a/tools/vt_fmt.py b/tools/vt_fmt.py index 139ddb7d7ad..d7191d7028b 100755 --- a/tools/vt_fmt.py +++ b/tools/vt_fmt.py @@ -9,7 +9,7 @@ 'GREEN', 'YELLOW', 'BLUE', - 'PURPLE', + 'MAGENTA', 'CYAN', 'WHITE', ] From bf43eae3290bdd9b0d7410d17d7aad10dc31a45c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 7 Aug 2026 14:02:45 +0200 Subject: [PATCH 073/150] wip bowling actors docs --- assets/xml/objects/object_bg.xml | 2 +- include/save.h | 4 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 116 ++++++------ .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h | 9 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 174 +++++++++--------- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 22 ++- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 144 ++++++++------- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h | 26 ++- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 4 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 135 +++++++------- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h | 10 +- 11 files changed, 336 insertions(+), 310 deletions(-) diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index c916e6d2aa2..25b58556120 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -61,6 +61,6 @@ - + diff --git a/include/save.h b/include/save.h index 4f83a84d88f..7628d39093c 100644 --- a/include/save.h +++ b/include/save.h @@ -745,8 +745,8 @@ typedef enum LinkAge { #define ITEMGETINF_0E 0x0E #define ITEMGETINF_0F 0x0F #define ITEMGETINF_10 0x10 -#define ITEMGETINF_11 0x11 -#define ITEMGETINF_12 0x12 +#define ITEMGETINF_BOWLING_BOMB_BAG 0x11 +#define ITEMGETINF_BOWLING_HEART_PIECE 0x12 #define ITEMGETINF_13 0x13 #define ITEMGETINF_15 0x15 #define ITEMGETINF_16 0x16 diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 10cc8540893..3afdf11d7b9 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -28,10 +28,10 @@ void BgBowlWall_Update(Actor* thisx, PlayState* play); void BgBowlWall_Draw(Actor* thisx, PlayState* play); void BgBowlWall_InitImpl(BgBowlWall* this, PlayState* play); -void BgBowlWall_WaitUnk180_(BgBowlWall* this, PlayState* play); -void func_8086F464(BgBowlWall* this, PlayState* play); -void func_8086F718(BgBowlWall* this, PlayState* play); -void func_8086F7F8(BgBowlWall* this, PlayState* play); +void BgBowlWall_WaitTargetHit(BgBowlWall* this, PlayState* play); +void BgBowlWall_Explode(BgBowlWall* this, PlayState* play); +void BgBowlWall_Disappear(BgBowlWall* this, PlayState* play); +void BgBowlWall_WaitReappear(BgBowlWall* this, PlayState* play); ActorProfile Bg_Bowl_Wall_Profile = { /**/ ACTOR_BG_BOWL_WALL, @@ -44,15 +44,19 @@ ActorProfile Bg_Bowl_Wall_Profile = { /**/ BgBowlWall_Update, /**/ BgBowlWall_Draw, }; -Vec3f D_8086FA40[4] = { - { 0.0f, 210.0f, -20.0f }, - { 0.0f, 170.0f, -20.0f }, - { -170.0f, 0.0f, -20.0f }, - { 170.0f, 0.0f, -20.0f }, + +Vec3f sWallTargetPositions[4] = { + { 0.0f, 210.0f, -20.0f }, // First wall, top + { 0.0f, 170.0f, -20.0f }, // Second wall, top + { -170.0f, 0.0f, -20.0f }, // Second wall, left + { 170.0f, 0.0f, -20.0f }, // Second wall, right +}; +s16 sWallRots[4] = { + 0, + 0, // Second wall, upright + 0x3FFF, // Second wall, target on the left + -0x3FFF, // Second wall, target on the right }; -s16 D_8086FA70[4] = { 0, 0, 0x3FFF, -0x3FFF }; -Vec3f D_8086FA78 = { 0.0f, 0.1f, 0.0f }; -Vec3f D_8086FA84 = { 0.0f, 0.0f, 0.0f }; void BgBowlWall_Init(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; @@ -61,7 +65,7 @@ void BgBowlWall_Init(Actor* thisx, PlayState* play) { colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); - if (this->dyna.actor.params == 0) { + if (this->dyna.actor.params == BG_BOWL_WALL_TYPE_FIRST_WALL) { CollisionHeader_GetVirtual(&gBowlingFirstWallCol, &colHeader); } else { CollisionHeader_GetVirtual(&gBowlingSecondWallCol, &colHeader); @@ -84,75 +88,75 @@ void BgBowlWall_InitImpl(BgBowlWall* this, PlayState* play) { Actor* actor; EnWallTubo* temp_v0_2; s32 pad; - s16 params = this->dyna.actor.params; + s16 type = this->dyna.actor.params; - if (params != 0) { - params += (s16)Rand_ZeroFloat(2.99f); - this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z = D_8086FA70[params]; + if (type != BG_BOWL_WALL_TYPE_FIRST_WALL) { + type += (s16)Rand_ZeroFloat(2.99f); + this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z = sWallRots[type]; PRINTF("\n\n"); } - this->wallTargetPos_.x = D_8086FA40[params].x + this->dyna.actor.world.pos.x; - this->wallTargetPos_.y = D_8086FA40[params].y + this->dyna.actor.world.pos.y; - this->wallTargetPos_.z = D_8086FA40[params].z + this->dyna.actor.world.pos.z; + this->wallTargetPos_.x = sWallTargetPositions[type].x + this->dyna.actor.world.pos.x; + this->wallTargetPos_.y = sWallTargetPositions[type].y + this->dyna.actor.world.pos.y; + this->wallTargetPos_.z = sWallTargetPositions[type].z + this->dyna.actor.world.pos.z; if (0) {} temp_v0_2 = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, this->wallTargetPos_.x, this->wallTargetPos_.y, this->wallTargetPos_.z, 0, 0, 0, this->dyna.actor.params); if (temp_v0_2 != NULL) { - temp_v0_2->unk154 = this->wallTargetPos_; - if (params != 0) { - temp_v0_2->unk154 = this->wallTargetPos_ = this->dyna.actor.world.pos; + temp_v0_2->effCenterPos = this->wallTargetPos_; + if (type != BG_BOWL_WALL_TYPE_FIRST_WALL) { + temp_v0_2->effCenterPos = this->wallTargetPos_ = this->dyna.actor.world.pos; } - if (this->unk184 == NULL) { + if (this->bowlingGirl == NULL) { actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; while (actor != NULL) { if (actor->id != ACTOR_EN_BOM_BOWL_MAN) { actor = actor->next; continue; } - this->unk184 = (EnBomBowlMan*)actor; + this->bowlingGirl = (EnBomBowlMan*)actor; break; } } - this->actionFunc = BgBowlWall_WaitUnk180_; + this->actionFunc = BgBowlWall_WaitTargetHit; } } -void BgBowlWall_WaitUnk180_(BgBowlWall* this, PlayState* play) { - if (this->unk180) { - this->actionFunc = func_8086F464; +void BgBowlWall_WaitTargetHit(BgBowlWall* this, PlayState* play) { + if (this->targetHit) { + this->actionFunc = BgBowlWall_Explode; } } -void func_8086F464(BgBowlWall* this, PlayState* play) { - s32 var_s0; - Vec3f spA0 = D_8086FA78; - Vec3f sp94 = D_8086FA84; - Vec3f sp88; +void BgBowlWall_Explode(BgBowlWall* this, PlayState* play) { + s32 explode; + Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; + Vec3f effVel = { 0.0f, 0.0f, 0.0f }; + Vec3f effPos; s16 quakeIndex; - s32 var_s0_2; + s32 i; - var_s0 = false; - if (this->dyna.actor.params == 0) { + explode = false; + if (this->dyna.actor.params == BG_BOWL_WALL_TYPE_FIRST_WALL) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 3, 0x1F4, 0); this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x; if (this->dyna.actor.shape.rot.x < -0x3C1E) { - var_s0 = true; + explode = true; } } else { Math_ApproachF(&this->dyna.actor.world.pos.y, this->homePos.y - 450.0f, 0.3f, 10.0f); if (this->dyna.actor.world.pos.y < (this->homePos.y - 400.0f)) { - var_s0 = true; + explode = true; } } - if (var_s0) { - for (var_s0_2 = 0; var_s0_2 < 15; var_s0_2++) { - sp88.x = Rand_CenteredFloat(300.0f) + this->wallTargetPos_.x; - sp88.y = -100.0f; - sp88.z = Rand_CenteredFloat(400.0f) + this->wallTargetPos_.z; - EffectSsBomb2_SpawnLayered(play, &sp88, &sp94, &spA0, 100, 30); - sp88.y = -50.0f; - EffectSsHahen_SpawnBurst(play, &sp88, 10.0f, 0, 50, 15, 3, -1, 10, NULL); + if (explode) { + for (i = 0; i < 15; i++) { + effPos.x = Rand_CenteredFloat(300.0f) + this->wallTargetPos_.x; + effPos.y = -100.0f; + effPos.z = Rand_CenteredFloat(400.0f) + this->wallTargetPos_.z; + EffectSsBomb2_SpawnLayered(play, &effPos, &effVel, &effAccel, 100, 30); + effPos.y = -50.0f; + EffectSsHahen_SpawnBurst(play, &effPos, 10.0f, 0, 50, 15, 3, -1, 10, NULL); Actor_PlaySfx(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); @@ -160,13 +164,13 @@ void func_8086F464(BgBowlWall* this, PlayState* play) { Quake_SetPerturbations(quakeIndex, 300, 0, 0, 0); Quake_SetDuration(quakeIndex, 30); this->timer = 20; - this->actionFunc = func_8086F718; + this->actionFunc = BgBowlWall_Disappear; } } -void func_8086F718(BgBowlWall* this, PlayState* play) { +void BgBowlWall_Disappear(BgBowlWall* this, PlayState* play) { if (this->timer >= 2) { - if (this->dyna.actor.params == 0) { + if (this->dyna.actor.params == BG_BOWL_WALL_TYPE_FIRST_WALL) { Math_SmoothStepToS(&this->dyna.actor.shape.rot.x, -0x3E80, 1, 0xC8, 0); } else { Math_ApproachF(&this->dyna.actor.world.pos.y, this->homePos.y - 450.0f, 0.3f, 10.0f); @@ -174,17 +178,17 @@ void func_8086F718(BgBowlWall* this, PlayState* play) { } else if (this->timer == 1) { this->dyna.actor.world.pos.y = this->homePos.y - 450.0f; this->dyna.actor.world.rot.x = this->dyna.actor.shape.rot.x = 0; - this->unk184->unk23E_arr[this->dyna.actor.params] = 2; - this->actionFunc = func_8086F7F8; + this->bowlingGirl->wallsState[this->dyna.actor.params] = EN_BOM_BOWL_MAN_WALL_STATE_DISAPPEARED; + this->actionFunc = BgBowlWall_WaitReappear; } } -void func_8086F7F8(BgBowlWall* this, PlayState* play) { - if (this->unk184->unk23E_arr[this->dyna.actor.params] != 2) { +void BgBowlWall_WaitReappear(BgBowlWall* this, PlayState* play) { + if (this->bowlingGirl->wallsState[this->dyna.actor.params] != EN_BOM_BOWL_MAN_WALL_STATE_DISAPPEARED) { Math_ApproachF(&this->dyna.actor.world.pos.y, this->homePos.y, 0.3f, 50.0f); if (fabsf(this->dyna.actor.world.pos.y - this->homePos.y) <= 10.0f) { this->dyna.actor.world.pos.y = this->homePos.y; - this->unk180 = false; + this->targetHit = false; this->actionFunc = BgBowlWall_InitImpl; } } @@ -210,7 +214,7 @@ void BgBowlWall_Draw(Actor* thisx, PlayState* play) { Gfx_TexScroll(play->state.gfxCtx, 0, (new_var2 = play->state.frames) * -2, 16, 16)); gDPPipeSync(POLY_OPA_DISP++); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_bowl_wall.c", 453); - if (this->dyna.actor.params == 0) { + if (this->dyna.actor.params == BG_BOWL_WALL_TYPE_FIRST_WALL) { gSPDisplayList(POLY_OPA_DISP++, gBowlingFirstWallDL); } else { gSPDisplayList(POLY_OPA_DISP++, gBowlingSecondWallDL); diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h index 44d14ed8892..82c85e4a80d 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h @@ -4,6 +4,11 @@ #include "ultra64.h" #include "actor.h" +typedef enum BgBowlWallType { + BG_BOWL_WALL_TYPE_FIRST_WALL, + BG_BOWL_WALL_TYPE_SECOND_WALL +} BgBowlWallType; + struct BgBowlWall; typedef void (*BgBowlWallActionFunc)(struct BgBowlWall*, struct PlayState*); @@ -13,9 +18,9 @@ typedef struct BgBowlWall { /* 0x164 */ BgBowlWallActionFunc actionFunc; /* 0x168 */ Vec3f homePos; /* 0x174 */ Vec3f wallTargetPos_; - /* 0x180 */ s16 unk180; + /* 0x180 */ s16 targetHit; /* 0x182 */ s16 timer; - /* 0x184 */ struct EnBomBowlMan* unk184; + /* 0x184 */ struct EnBomBowlMan* bowlingGirl; } BgBowlWall; // size = 0x188 #endif 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 935aeeee535..2f84b91feb2 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 @@ -27,21 +27,27 @@ void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play); void EnBomBowlMan_Update(Actor* thisx, PlayState* play); void EnBomBowlMan_Draw(Actor* thisx, PlayState* play); -void EnBomBowlMan_SetupWaitTalk(EnBomBowlMan* this, PlayState* play); -void EnBomBowlMan_WaitTalk(EnBomBowlMan* this, PlayState* play); -void func_809C395C(EnBomBowlMan* this, PlayState* play); -void func_809C39D0(EnBomBowlMan* this, PlayState* play); -void func_809C3A54(EnBomBowlMan* this, PlayState* play); -void func_809C3B50(EnBomBowlMan* this, PlayState* play); -void func_809C3C7C(EnBomBowlMan* this, PlayState* play); -void func_809C3CD4(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_SetupAsleepWaitTalk(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_AsleepWaitTalk(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_AsleepTalking(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_SetupWakingUpTalking(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_WakingUpTalking(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_FinishWakingUpTalking(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_NotOpenWaitTalk(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_NotOpenTalking(EnBomBowlMan* this, PlayState* play); void func_809C3DC4(EnBomBowlMan* this, PlayState* play); -void func_809C4040(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_WaitPlayAnswer(EnBomBowlMan* this, PlayState* play); void func_809C41FC(EnBomBowlMan* this, PlayState* play); void func_809C4318(EnBomBowlMan* this, PlayState* play); void func_809C441C(EnBomBowlMan* this, PlayState* play); void func_809C4664(EnBomBowlMan* this, PlayState* play); +typedef enum EnBomBowlManGameEndStatus { + EN_BOM_BOWL_MAN_GAME_END_STATUS_ONGOING, + EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_WON, + EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_LOST +} EnBomBowlManGameEndStatus; + ActorProfile En_Bom_Bowl_Man_Profile = { /**/ ACTOR_EN_BOM_BOWL_MAN, /**/ ACTORCAT_NPC, @@ -93,30 +99,30 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { cucco->collider.dim.height = sCuccoColliderDims[i].height; } } - this->unk242 = Rand_ZeroFloat(4.99f); + this->rewardState = Rand_ZeroFloat(4.99f); this->actor.attentionRangeType = ATTENTION_RANGE_1; - this->actionFunc = EnBomBowlMan_SetupWaitTalk; + this->actionFunc = EnBomBowlMan_SetupAsleepWaitTalk; } void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } -void EnBomBowlMan_SetupWaitTalk(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_SetupAsleepWaitTalk(EnBomBowlMan* this, PlayState* play) { this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlSleepingAnim); Animation_Change(&this->skelAnime, &gBowlingGirlSleepingAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0xC0; this->waitMessageState = TEXT_STATE_EVENT; - this->actionFunc = EnBomBowlMan_WaitTalk; + this->actionFunc = EnBomBowlMan_AsleepWaitTalk; } -void EnBomBowlMan_WaitTalk(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_AsleepWaitTalk(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayer; s16 absRelYawTowardsPlayer; SkelAnime_Update(&this->skelAnime); if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = func_809C395C; + this->actionFunc = EnBomBowlMan_AsleepTalking; } else { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; absRelYawTowardsPlayer = ABS(relYawTowardsPlayer); @@ -126,23 +132,23 @@ void EnBomBowlMan_WaitTalk(EnBomBowlMan* this, PlayState* play) { } } -void func_809C395C(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_AsleepTalking(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { play->msgCtx.msgMode = MSGMODE_PAUSED; - this->actionFunc = func_809C39D0; + this->actionFunc = EnBomBowlMan_SetupWakingUpTalking; } } -void func_809C39D0(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_SetupWakingUpTalking(EnBomBowlMan* this, PlayState* play) { this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlNonchalantAnim_); Animation_Change(&this->skelAnime, &gBowlingGirlNonchalantAnim_, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_ONCE, -10.0f); this->eyesState = 1; - this->actionFunc = func_809C3A54; + this->actionFunc = EnBomBowlMan_WakingUpTalking; } -void func_809C3A54(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_WakingUpTalking(EnBomBowlMan* this, PlayState* play) { f32 prevFrame; prevFrame = this->skelAnime.curFrame; @@ -160,52 +166,52 @@ void func_809C3A54(EnBomBowlMan* this, PlayState* play) { this->eyeTexIndex = 2; this->unk23A += 1; if (this->unk23A >= 3) { - this->actionFunc = func_809C3B50; + this->actionFunc = EnBomBowlMan_FinishWakingUpTalking; } } } -void func_809C3B50(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_FinishWakingUpTalking(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlHandsOnBarAnim); - Animation_Change(&this->skelAnime, &gBowlingGirlHandsOnBarAnim, 1.0f, 0.0f, this->curAnimFrameCount, + this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlHandsOnCounterAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlHandsOnCounterAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_LOOP, -10.0f); this->eyesState = 3; this->eyesTimer = (s16)Rand_ZeroFloat(60.0f) + 20; - if (!GET_EVENTCHKINF(EVENTCHKINF_25) && (BREG(2) == 0)) { - this->actionFunc = func_809C3C7C; + if (!(GET_EVENTCHKINF(EVENTCHKINF_25) || (BREG(2) != 0))) { + this->actionFunc = EnBomBowlMan_NotOpenWaitTalk; } else { this->actor.textId = 0x18; this->waitMessageState = TEXT_STATE_CHOICE; Message_ContinueTextbox(play, this->actor.textId); - this->actionFunc = func_809C4040; + this->actionFunc = EnBomBowlMan_WaitPlayAnswer; } } } -void func_809C3C7C(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_NotOpenWaitTalk(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->actionFunc = func_809C3CD4; + this->actionFunc = EnBomBowlMan_NotOpenTalking; } else { Actor_OfferTalk(&this->actor, play, 120.0f); } } -void func_809C3CD4(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_NotOpenTalking(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->actionFunc = func_809C3C7C; + this->actionFunc = EnBomBowlMan_NotOpenWaitTalk; } } void func_809C3D40(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->unk_258 == 0) { - if (!this->unk232) { + if (!this->hasPlayedBefore) { this->actor.textId = 0x18; } else { this->actor.textId = 0x1A; @@ -220,73 +226,76 @@ void func_809C3D40(EnBomBowlMan* this, PlayState* play) { void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayer; - s16 relYawTowardsPlayerAbs; + s16 absRelYawTowardsPlayer; SkelAnime_Update(&this->skelAnime); if (BREG(3) != 0) { PRINTF(VT_FGCOL(RED) "☆ game_play->bomchu_game_flag ☆ %d\n" VT_RST, play->bombchuBowlingStatus); - PRINTF(VT_FGCOL(RED) "☆ 壁1の状態どう? ☆ %d\n" VT_RST, this->unk23E_arr[0]); - PRINTF(VT_FGCOL(RED) "☆ 壁2の状態どう? ☆ %d\n" VT_RST, this->unk23E_arr[1]); - PRINTF(VT_FGCOL(RED) "☆ 穴情報\t ☆ %d\n" VT_RST, this->unk25C->unk164); + PRINTF(VT_FGCOL(RED) "☆ 壁1の状態どう? ☆ %d\n" VT_RST, this->wallsState[0]); + PRINTF(VT_FGCOL(RED) "☆ 壁2の状態どう? ☆ %d\n" VT_RST, this->wallsState[1]); + PRINTF(VT_FGCOL(RED) "☆ 穴情報\t ☆ %d\n" VT_RST, this->finalTargetManager->rewardState); PRINTF("\n\n"); } - this->unk244 = 0; - if (this->unk25C != NULL) { - if ((this->unk23E_arr[0] != 1) && (this->unk23E_arr[1] != 1) && (this->unk25C->unk164 == 2)) { - this->unk244 = 1; - this->unk25C->unk164 = 0; + this->gameEndStatus = EN_BOM_BOWL_MAN_GAME_END_STATUS_ONGOING; + if (this->finalTargetManager != NULL) { + if ((this->wallsState[0] != EN_BOM_BOWL_MAN_WALL_STATE_HIT) && + (this->wallsState[1] != EN_BOM_BOWL_MAN_WALL_STATE_HIT) && + (this->finalTargetManager->rewardState == EN_BOM_BOWL_PIT_REWARD_STATE_REWARD_GIVEN)) { + this->gameEndStatus = EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_WON; + this->finalTargetManager->rewardState = EN_BOM_BOWL_PIT_REWARD_STATE_WAIT_HIT; PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 中央HIT!!!! ☆☆☆☆☆ \n" VT_RST); } - if ((play->bombchuBowlingStatus == -1) && (play->actorCtx.actorLists[3].length == 0) && - (this->unk25C->unk164 == 0) && (this->unk23E_arr[0] != 1) && (this->unk23E_arr[1] != 1)) { - this->unk244 = 2; + if ((play->bombchuBowlingStatus == -1) && (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length == 0) && + (this->finalTargetManager->rewardState == EN_BOM_BOWL_PIT_REWARD_STATE_WAIT_HIT) && + (this->wallsState[0] != EN_BOM_BOWL_MAN_WALL_STATE_HIT) && + (this->wallsState[1] != EN_BOM_BOWL_MAN_WALL_STATE_HIT)) { + this->gameEndStatus = EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_LOST; PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ボムチュウ消化 ☆☆☆☆☆ \n" VT_RST); } } - if (this->unk244 != 0) { + if (this->gameEndStatus != EN_BOM_BOWL_MAN_GAME_END_STATUS_ONGOING) { this->actor.textId = 0x1A; this->waitMessageState = TEXT_STATE_CHOICE; this->unk_258 = 0; - if ((this->unk260 != NULL) && (this->unk260->actor.update != NULL)) { - this->unk260->killItem = true; - this->unk260 = NULL; + if ((this->rewardItemOnCounter != NULL) && (this->rewardItemOnCounter->actor.update != NULL)) { + this->rewardItemOnCounter->killItem = true; + this->rewardItemOnCounter = NULL; } play->bombchuBowlingStatus = 0; - this->unk23C = 1; + this->isAskingToPlayAgain = true; Message_StartTextbox(play, this->actor.textId, NULL); - if (this->unk244 == 2) { + if (this->gameEndStatus == EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_LOST) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); } - this->actionFunc = func_809C4040; + this->actionFunc = EnBomBowlMan_WaitPlayAnswer; } else if (Actor_TalkOfferAccepted(&this->actor, play)) { if (this->unk_258 == 0) { - this->actionFunc = func_809C4040; + this->actionFunc = EnBomBowlMan_WaitPlayAnswer; } else { this->actionFunc = func_809C41FC; } } else { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayerAbs = ABS(relYawTowardsPlayer); - if (!(this->actor.xzDistToPlayer > 120.0f) && (relYawTowardsPlayerAbs < 0x4300)) { + absRelYawTowardsPlayer = ABS(relYawTowardsPlayer); + if (!(this->actor.xzDistToPlayer > 120.0f) && (absRelYawTowardsPlayer < 0x4300)) { Actor_OfferTalk(&this->actor, play, 120.0f); } } } -void func_809C4040(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_WaitPlayAnswer(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { - case 0: + case 0: // yes if (gSaveContext.save.info.playerData.rupees >= 30) { Rupees_ChangeBy(-30); - this->unk23E_arr[1] = 0; this->unk_258 = 1; - this->unk23E_arr[0] = this->unk23E_arr[1]; + this->wallsState[0] = this->wallsState[1] = EN_BOM_BOWL_MAN_WALL_STATE_STANDING; play->bombchuBowlingStatus = 10; Flags_SetSwitch(play, 0x38); - if (!this->unk232 && (this->unk23C == 0)) { + if (!this->hasPlayedBefore && !this->isAskingToPlayAgain) { this->actor.textId = 0x19; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; @@ -300,15 +309,15 @@ void func_809C4040(EnBomBowlMan* this, PlayState* play) { this->actionFunc = func_809C4318; } } else { - this->unk23C = 0; + this->isAskingToPlayAgain = false; this->actor.textId = 0x85; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; this->actionFunc = func_809C41FC; } break; - case 1: - this->unk23C = 0; + case 1: // no + this->isAskingToPlayAgain = false; this->actor.textId = 0x2D; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; @@ -333,7 +342,7 @@ void func_809C41FC(EnBomBowlMan* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); this->actionFunc = func_809C4318; } else { - if (this->unk244 == 2) { + if (this->gameEndStatus == EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_LOST) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); } this->actionFunc = func_809C3D40; @@ -353,7 +362,7 @@ void func_809C4318(EnBomBowlMan* this, PlayState* play) { effPos.z = 300.0f; EffectSsBomb2_SpawnLayered(play, &effPos, &effVel, &effAccel, 50, 15); Actor_PlaySfx(&this->actor, NA_SE_IT_GOODS_APPEAR); - this->unk22A = 10; + this->rewardAppearTimer = 10; this->actionFunc = func_809C441C; } } @@ -363,11 +372,11 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { s32 pad; SkelAnime_Update(&this->skelAnime); - if (this->unk22A == 0) { - switch (this->unk242) { + if (this->rewardAppearTimer == 0) { + switch (this->rewardState) { case 0: reward = EXITEM_BOMB_BAG_BOWLING; - if (GET_ITEMGETINF(ITEMGETINF_11)) { + if (GET_ITEMGETINF(ITEMGETINF_BOWLING_BOMB_BAG)) { reward = EXITEM_PURPLE_RUPEE_BOWLING; } break; @@ -379,7 +388,7 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { break; case 3: reward = EXITEM_HEART_PIECE_BOWLING; - if (GET_ITEMGETINF(ITEMGETINF_12)) { + if (GET_ITEMGETINF(ITEMGETINF_BOWLING_HEART_PIECE)) { reward = EXITEM_PURPLE_RUPEE_BOWLING; } break; @@ -391,27 +400,28 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { if (BREG(7) != 0) { this->reward = BREG(7) - 1; } - this->unk260 = (EnExItem*)Actor_SpawnAsChild( + this->rewardItemOnCounter = (EnExItem*)Actor_SpawnAsChild( &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, D_809C4A60[this->reward].x + 148.0f, D_809C4A60[this->reward].y + 40.0f, D_809C4A60[this->reward].z + 300.0f, 0, D_809C4A9C[this->reward], 0, this->reward + EXITEM_BOMB_BAG_COUNTER); - if (!this->unk232) { - this->unk25C = (EnBomBowlPit*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_BOM_BOWL_PIT, - 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); - if (this->unk25C != NULL) { - this->unk25C->reward = this->reward; + if (!this->hasPlayedBefore) { + // Spawn in the center of the final wall target + this->finalTargetManager = (EnBomBowlPit*)Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_EN_BOM_BOWL_PIT, 0.0f, 90.0f, -860.0f, 0, 0, 0, 0); + if (this->finalTargetManager != NULL) { + this->finalTargetManager->reward = this->reward; } } else { - this->unk25C->reward = this->reward; + this->finalTargetManager->reward = this->reward; } - this->unk25C->unk15C = true; + this->finalTargetManager->gameStarted = true; this->unk_258 = 2; this->actor.textId = 0x405A; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; - this->unk242 += 1; - if (this->unk242 >= 5) { - this->unk242 = 0; + this->rewardState += 1; + if (this->rewardState >= 5) { + this->rewardState = 0; } this->actionFunc = func_809C4664; } @@ -422,7 +432,7 @@ void func_809C4664(EnBomBowlMan* this, PlayState* play) { if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); - this->unk232 = true; + this->hasPlayedBefore = true; if (BREG(2) != 0) { BREG(2) = 0; } @@ -468,10 +478,10 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); break; } - if (this->unk22A == 0) { + if (this->rewardAppearTimer == 0) { } else { - this->unk22A--; + this->rewardAppearTimer--; } if (this->eyesTimer != 0) { this->eyesTimer--; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index ca6c27d4ab4..766843ec41b 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -6,6 +6,12 @@ #include "assets/objects/object_bg/object_bg.h" +typedef enum EnBomBowlManWallState { + EN_BOM_BOWL_MAN_WALL_STATE_STANDING, + EN_BOM_BOWL_MAN_WALL_STATE_HIT, + EN_BOM_BOWL_MAN_WALL_STATE_DISAPPEARED +} EnBomBowlManWallState; + struct EnBomBowlMan; typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, struct PlayState*); @@ -19,26 +25,26 @@ typedef struct EnBomBowlMan { /* 0x218 */ Vec3s headRot; /* 0x21E */ char pad21E[6]; /* 0x224 */ Vec3s torsoRot; - /* 0x22A */ s16 unk22A; + /* 0x22A */ s16 rewardAppearTimer; /* 0x22C */ s16 unk_22C; // unused /* 0x22E */ s16 waitMessageState; /* 0x230 */ s16 reward; - /* 0x232 */ s16 unk232; + /* 0x232 */ s16 hasPlayedBefore; /* 0x234 */ s16 eyeTexIndex; /* 0x236 */ s16 eyesTimer; /* 0x238 */ s16 eyesState; /* 0x23A */ s16 unk23A; - /* 0x23C */ s16 unk23C; - /* 0x23E */ s16 unk23E_arr[2]; - /* 0x242 */ s16 unk242; - /* 0x244 */ s16 unk244; + /* 0x23C */ s16 isAskingToPlayAgain; + /* 0x23E */ s16 wallsState[2]; // State of the first two walls + /* 0x242 */ s16 rewardState; + /* 0x244 */ s16 gameEndStatus; /* 0x246 */ char pad_246[2]; /* 0x248 */ Vec3f unk248; /* 0x254 */ f32 curAnimFrameCount; /* 0x258 */ u8 unk_258; /* 0x259 */ char pad_259[3]; - /* 0x25C */ struct EnBomBowlPit* unk25C; - /* 0x260 */ struct EnExItem* unk260; + /* 0x25C */ struct EnBomBowlPit* finalTargetManager; + /* 0x260 */ struct EnExItem* rewardItemOnCounter; } EnBomBowlMan; // size = 0x0264 #endif diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index 2a55996f034..4aca24992a5 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -1,3 +1,9 @@ +/* + * File: z_en_bom_bowl_pit.c + * Overlay: ovl_En_Bom_Bowl_Pit + * Description: Bowling Alley bombchu detector for the final wall + */ + #include "z_en_bom_bowl_pit.h" #include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" @@ -8,6 +14,7 @@ #include "play_state.h" #include "player.h" #include "save.h" +#include "sfx.h" #include "z_lib.h" #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED @@ -16,16 +23,16 @@ void EnBomBowlPit_Init(Actor* thisx, PlayState* play); void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play); void EnBomBowlPit_Update(Actor* thisx, PlayState* play); -void func_809C4E60(EnBomBowlPit* this, PlayState* play); -void func_809C4E8C(EnBomBowlPit* this, PlayState* play); -void func_809C5184(EnBomBowlPit* this, PlayState* play); -void func_809C5360(EnBomBowlPit* this, PlayState* play); -void func_809C53F0(EnBomBowlPit* this, PlayState* play); -void func_809C54A8(EnBomBowlPit* this, PlayState* play); -void func_809C55B0(EnBomBowlPit* this, PlayState* play); -void func_809C5608(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitGameStarted(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitHit(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitCutscene(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_SpawnReward(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitRewardFinishedAppearing(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_GiveReward(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitRewardGiven(EnBomBowlPit* this, PlayState* play); +void EnBomBowlPit_WaitRewardText(EnBomBowlPit* this, PlayState* play); -static s32 D_809C56E0[5] = { +static s32 sGetItemIdRewards[5] = { GI_BOMB_BAG_30, // EXITEM_BOMB_BAG_BOWLING GI_HEART_PIECE, // EXITEM_HEART_PIECE_BOWLING GI_BOMBCHUS_10, // EXITEM_BOMBCHUS_BOWLING @@ -48,41 +55,40 @@ ActorProfile En_Bom_Bowl_Pit_Profile = { void EnBomBowlPit_Init(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; - this->actionFunc = func_809C4E60; + this->actionFunc = EnBomBowlPit_WaitGameStarted; } void EnBomBowlPit_Destroy(Actor* thisx, PlayState* play) { } -void func_809C4E60(EnBomBowlPit* this, PlayState* play) { - if (this->unk15C) { - this->unk15C = this->unk164 = 0; - this->actionFunc = func_809C4E8C; +void EnBomBowlPit_WaitGameStarted(EnBomBowlPit* this, PlayState* play) { + if (this->gameStarted) { + this->gameStarted = this->rewardState = 0; // false, EN_BOM_BOWL_PIT_REWARD_STATE_WAIT_HIT + this->actionFunc = EnBomBowlPit_WaitHit; } } -void func_809C4E8C(EnBomBowlPit* this, PlayState* play) { - Actor* var_v1; - EnBomChu* sp24; +void EnBomBowlPit_WaitHit(EnBomBowlPit* this, PlayState* play) { + Actor* explosive; + EnBomChu* bombchu; Vec3f diff; Actor* thisx = &this->actor; if (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { - var_v1 = play->actorCtx.actorLists[3].head; - while (var_v1 != NULL) { - if ((var_v1 == thisx) || (var_v1->id != ACTOR_EN_BOM_CHU)) { - var_v1 = var_v1->next; + explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + while (explosive != NULL) { + if ((explosive == thisx) || (explosive->id != ACTOR_EN_BOM_CHU)) { + explosive = explosive->next; continue; } - diff.x = var_v1->world.pos.x - this->actor.world.pos.x; - diff.y = var_v1->world.pos.y - this->actor.world.pos.y; - diff.z = var_v1->world.pos.z - this->actor.world.pos.z; - if (((fabsf(diff.x) < 40.0f) || (gRegEditor->data[0x962] != 0)) && - ((fabsf(diff.y) < 40.0f) || (gRegEditor->data[0x962] != 0)) && - ((fabsf(diff.z) < 40.0f) || (gRegEditor->data[0x962] != 0))) { - sp24 = (EnBomChu*)var_v1; + diff.x = explosive->world.pos.x - this->actor.world.pos.x; + diff.y = explosive->world.pos.y - this->actor.world.pos.y; + diff.z = explosive->world.pos.z - this->actor.world.pos.z; + if (((fabsf(diff.x) < 40.0f) || (BREG(2) != 0)) && ((fabsf(diff.y) < 40.0f) || (BREG(2) != 0)) && + ((fabsf(diff.z) < 40.0f) || (BREG(2) != 0))) { + bombchu = (EnBomChu*)explosive; Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - sp24->timer = 1; + bombchu->timer = 1; this->subCamId = Play_CreateSubCamera(play); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, this->subCamId, CAM_STAT_ACTIVE); @@ -100,28 +106,28 @@ void func_809C4E8C(EnBomBowlPit* this, PlayState* play) { this->subCamEyeNext.x = 20.0f; this->subCamEyeNext.y = 50.0f; this->subCamEyeNext.z = -485.0f; - this->subCamEyeVel.x = fabsf(this->subCamEye.x - 20.0f) * 0.02f; - this->subCamEyeVel.y = fabsf(this->subCamEye.y - 50.0f) * 0.02f; - this->subCamEyeVel.z = fabsf(this->subCamEye.z - -485.0f) * 0.02f; + this->subCamEyeVel.x = fabsf(this->subCamEye.x - this->subCamEyeNext.x) * 0.02f; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - this->subCamEyeNext.y) * 0.02f; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - this->subCamEyeNext.z) * 0.02f; this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.02f; this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.02f; this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.02f; Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); this->actor.textId = 0xF; Message_StartTextbox(play, this->actor.textId, NULL); - this->unk154 = 5; - Sfx_PlaySfxCentered(0x28D3U); + this->waitMessageState = TEXT_STATE_EVENT; + Sfx_PlaySfxCentered(NA_SE_EV_HIT_SOUND); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->unk164 = 1; - this->actionFunc = func_809C5184; + this->rewardState = EN_BOM_BOWL_PIT_REWARD_STATE_GIVING_REWARD; + this->actionFunc = EnBomBowlPit_WaitCutscene; return; } - var_v1 = var_v1->next; + explosive = explosive->next; } } } -void func_809C5184(EnBomBowlPit* this, PlayState* play) { +void EnBomBowlPit_WaitCutscene(EnBomBowlPit* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, this->subCamAtVel.x); Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, this->subCamAtVel.y); @@ -131,7 +137,7 @@ void func_809C5184(EnBomBowlPit* this, PlayState* play) { Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, this->subCamEyeVel.z); } Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); - if ((this->unk154 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); } if ((fabsf(this->subCamEye.x - this->subCamEyeNext.x) < 5.0f) && @@ -141,72 +147,72 @@ void func_809C5184(EnBomBowlPit* this, PlayState* play) { (fabsf(this->subCamAt.y - this->subCamAtNext.y) < 5.0f) && (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 5.0f)) { Message_CloseTextbox(play); - this->unk158 = 0x1E; - this->actionFunc = func_809C5360; + this->timer = 30; + this->actionFunc = EnBomBowlPit_SpawnReward; } } -void func_809C5360(EnBomBowlPit* this, PlayState* play) { - if (this->unk158 == 0) { - this->unk1E0 = +void EnBomBowlPit_SpawnReward(EnBomBowlPit* this, PlayState* play) { + if (this->timer == 0) { + this->rewardItem = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z - 70.0f, 0, 0, 0, this->reward); - if (this->unk1E0 != NULL) { - this->actionFunc = func_809C53F0; + if (this->rewardItem != NULL) { + this->actionFunc = EnBomBowlPit_WaitRewardFinishedAppearing; } } } -void func_809C53F0(EnBomBowlPit* this, PlayState* play) { - if (this->unk156 != 0) { +void EnBomBowlPit_WaitRewardFinishedAppearing(EnBomBowlPit* this, PlayState* play) { + if (this->hasRewardFinishedAppearing) { switch (this->reward) { case EXITEM_BOMB_BAG_BOWLING: - SET_ITEMGETINF(ITEMGETINF_11); + SET_ITEMGETINF(ITEMGETINF_BOWLING_BOMB_BAG); break; case EXITEM_HEART_PIECE_BOWLING: - SET_ITEMGETINF(ITEMGETINF_12); + SET_ITEMGETINF(ITEMGETINF_BOWLING_HEART_PIECE); break; } Play_ClearCamera(play, this->subCamId); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_809C54A8; + this->actionFunc = EnBomBowlPit_GiveReward; } } -void func_809C54A8(EnBomBowlPit* this, PlayState* play) { +void EnBomBowlPit_GiveReward(EnBomBowlPit* this, PlayState* play) { Player* player = GET_PLAYER(play); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); - this->unk160 = D_809C56E0[this->reward]; - if ((this->unk160 == GI_BOMB_BAG_30) && (CUR_CAPACITY(1) == 30)) { - this->unk160 = GI_BOMB_BAG_40; + this->rewardGetItemId = sGetItemIdRewards[this->reward]; + if ((this->rewardGetItemId == GI_BOMB_BAG_30) && (CUR_CAPACITY(UPG_BOMB_BAG) == 30)) { + this->rewardGetItemId = GI_BOMB_BAG_40; } player->stateFlags1 &= ~PLAYER_STATE1_29; this->actor.parent = NULL; - Actor_OfferGetItem(&this->actor, play, this->unk160, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->rewardGetItemId, 2000.0f, 1000.0f); player->stateFlags1 |= PLAYER_STATE1_29; - this->actionFunc = func_809C55B0; + this->actionFunc = EnBomBowlPit_WaitRewardGiven; } -void func_809C55B0(EnBomBowlPit* this, PlayState* play) { +void EnBomBowlPit_WaitRewardGiven(EnBomBowlPit* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - this->actionFunc = func_809C5608; + this->actionFunc = EnBomBowlPit_WaitRewardText; return; } - Actor_OfferGetItem(&this->actor, play, this->unk160, 2000.0f, 1000.0f); + Actor_OfferGetItem(&this->actor, play, this->rewardGetItemId, 2000.0f, 1000.0f); } -void func_809C5608(EnBomBowlPit* this, PlayState* play) { +void EnBomBowlPit_WaitRewardText(EnBomBowlPit* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - PRINTF("\x1b[32m☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n\x1b[m"); - if (this->unk160 == GI_HEART_PIECE) { + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 正常終了 ☆☆☆☆☆ \n" VT_RST); + if (this->rewardGetItemId == GI_HEART_PIECE) { gSaveContext.healthAccumulator = 0x140; - PRINTF("\x1b[32m☆☆☆☆☆ あぁ回復! ☆☆☆☆☆ \n\x1b[m"); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ あぁ回復! ☆☆☆☆☆ \n" VT_RST); } - this->unk156 = 0; - this->unk164 = 2; - this->actionFunc = func_809C4E60; + this->hasRewardFinishedAppearing = false; + this->rewardState = EN_BOM_BOWL_PIT_REWARD_STATE_REWARD_GIVEN; + this->actionFunc = EnBomBowlPit_WaitGameStarted; } } @@ -214,7 +220,7 @@ void EnBomBowlPit_Update(Actor* thisx, PlayState* play) { EnBomBowlPit* this = (EnBomBowlPit*)thisx; this->actionFunc(this, play); - if (this->unk158 != 0) { - this->unk158--; + if (this->timer != 0) { + this->timer--; } } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h index d8472603c1d..12612a72834 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h @@ -4,6 +4,12 @@ #include "ultra64.h" #include "actor.h" +typedef enum EnBomBowlPitRewardState { + EN_BOM_BOWL_PIT_REWARD_STATE_WAIT_HIT, + EN_BOM_BOWL_PIT_REWARD_STATE_GIVING_REWARD, + EN_BOM_BOWL_PIT_REWARD_STATE_REWARD_GIVEN +} EnBomBowlPitRewardState; + struct EnBomBowlPit; typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, struct PlayState*); @@ -11,15 +17,15 @@ typedef void (*EnBomBowlPitActionFunc)(struct EnBomBowlPit*, struct PlayState*); typedef struct EnBomBowlPit { /* 0x0000 */ Actor actor; /* 0x014C */ EnBomBowlPitActionFunc actionFunc; - /* 0x0150 */ char pad150[2]; + /* 0x0150 */ char pad_150[2]; /* 0x0152 */ s16 subCamId; - /* 0x0154 */ s16 unk154; - /* 0x0156 */ s16 unk156; - /* 0x0158 */ s16 unk158; + /* 0x0154 */ s16 waitMessageState; + /* 0x0156 */ s16 hasRewardFinishedAppearing; + /* 0x0158 */ s16 timer; /* 0x015A */ s16 reward; - /* 0x015C */ s16 unk15C; - /* 0x0160 */ s32 unk160; - /* 0x0164 */ u8 unk164; + /* 0x015C */ s16 gameStarted; + /* 0x0160 */ s32 rewardGetItemId; + /* 0x0164 */ u8 rewardState; /* 0x0168 */ Vec3f viewAt; /* 0x0174 */ Vec3f viewEye; /* 0x0180 */ Vec3f subCamAt; @@ -30,8 +36,8 @@ typedef struct EnBomBowlPit { /* 0x01BC */ Vec3f subCamAtNext; /* 0x01C8 */ Vec3f subCamAtMaxVelFrac; /* 0x01D4 */ Vec3f subCamAtVel; - /* 0x01E0 */ Actor* unk1E0; - /* 0x01E4 */ char pad1E4[0x3520]; -} EnBomBowlPit; // size = 0x3704 + /* 0x01E0 */ Actor* rewardItem; + /* 0x01E4 */ char pad_1E4[0x3520]; //! @bug Large unused amount of memory +} EnBomBowlPit; // size = 0x3704 #endif 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 344d813db78..62d658490a0 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 @@ -161,7 +161,7 @@ void EnExItem_WaitForObject(EnExItem* this, PlayState* play) { this->timer = 65; this->prizeRotateTimer = 35; this->scale = 0.5f; - if (onCounter == 0) { + if (!onCounter) { this->actionFunc = EnExItem_BowlPrize; } else { this->actionFunc = EnExItem_SetupBowlCounter; @@ -325,7 +325,7 @@ void EnExItem_BowlPrize(EnExItem* this, PlayState* play) { PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 動いてねー? ☆☆☆☆☆ %x\n", " ☆☆☆☆☆ Is it moving? ☆☆☆☆☆ %x\n") VT_RST, this->actor.parent->update); if ((this->actor.parent != NULL) && (this->actor.parent->update != NULL)) { - ((EnBomBowlPit*)this->actor.parent)->unk156 = 1; + ((EnBomBowlPit*)this->actor.parent)->hasRewardFinishedAppearing = true; PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ さぁきえるぞ! ☆☆☆☆☆ \n", " ☆☆☆☆☆ Now it's gone! ☆☆☆☆☆ \n") VT_RST); } Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index 1a16bf8868d..8fbc645cc28 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -1,7 +1,7 @@ /* * File: z_en_wall_tubo.c * Overlay: ovl_En_Wall_Tubo - * Description: Bombchu Bowling Alley Wall 2 + * Description: Bowling Alley bombchu detector for the first two walls */ #include "z_en_wall_tubo.h" @@ -26,9 +26,9 @@ void EnWallTubo_Init(Actor* thisx, PlayState* play); void EnWallTubo_Destroy(Actor* thisx, PlayState* play); void EnWallTubo_Update(Actor* thisx, PlayState* play); -void func_80B2EE5C(EnWallTubo* this, PlayState* play); -void func_80B2EE9C(EnWallTubo* this, PlayState* play); -void func_80B2F0B8(EnWallTubo* this, PlayState* play); +void EnWallTubo_InitImpl(EnWallTubo* this, PlayState* play); +void EnWallTubo_WaitTargetHit(EnWallTubo* this, PlayState* play); +void EnWallTubo_Explode(EnWallTubo* this, PlayState* play); ActorProfile En_Wall_Tubo_Profile = { /**/ ACTOR_EN_WALL_TUBO, @@ -41,100 +41,89 @@ ActorProfile En_Wall_Tubo_Profile = { /**/ EnWallTubo_Update, /**/ NULL, }; -Vec3f D_80B2F340 = { 0.0f, 0.1f, 0.0f }; -Vec3f D_80B2F34C = { 0.0f, 0.0f, 0.0f }; -Vec3f D_80B2F358 = { 0.0f, 0.1f, 0.0f }; -Vec3f D_80B2F364 = { 0.0f, 0.0f, 0.0f }; void EnWallTubo_Init(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; PRINTF("\n\n"); - PRINTF("\x1b[33m☆☆☆☆☆ 壁のツボ ☆☆☆☆☆ \n\x1b[m"); - this->unk164 = this->actor.world.pos; - this->unk14C = func_80B2EE5C; + PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ 壁のツボ ☆☆☆☆☆ \n" VT_RST); + this->homePos = this->actor.world.pos; + this->actionFunc = EnWallTubo_InitImpl; } void EnWallTubo_Destroy(Actor* thisx, PlayState* play) { } -void func_80B2EE5C(EnWallTubo* this, PlayState* play) { - Actor* var_v0; +void EnWallTubo_InitImpl(EnWallTubo* this, PlayState* play) { + Actor* actor; - var_v0 = play->actorCtx.actorLists[4].head; - while (var_v0 != NULL) { - if (var_v0->id != ACTOR_EN_BOM_BOWL_MAN) { - var_v0 = var_v0->next; + actor = play->actorCtx.actorLists[4].head; + while (actor != NULL) { + if (actor->id != ACTOR_EN_BOM_BOWL_MAN) { + actor = actor->next; continue; } - this->unk160 = (EnBomBowlMan*)var_v0; + this->bowlingGirl = (EnBomBowlMan*)actor; break; } - this->unk14C = func_80B2EE9C; + this->actionFunc = EnWallTubo_WaitTargetHit; } -void func_80B2EE9C(EnWallTubo* this, PlayState* play) { - Actor* var_v0; +void EnWallTubo_WaitTargetHit(EnWallTubo* this, PlayState* play) { + Actor* explosive; Actor* thisx = &this->actor; - Vec3f sp4C; - Vec3f sp40; + Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; + Vec3f effVel = { 0.0f, 0.0f, 0.0f }; Vec3f diff; - s16 sp32; - s16 temp_v0; - - sp4C = D_80B2F340; - sp40 = D_80B2F34C; - if ((this->unk160->unk_258 != 0) && (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING)) { - var_v0 = play->actorCtx.actorLists[3].head; - while (var_v0 != NULL) { - if ((var_v0 == thisx) || (var_v0->id != ACTOR_EN_BOM_CHU)) { - var_v0 = var_v0->next; + s16 quakeIndex; + + if ((this->bowlingGirl->unk_258 != 0) && (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING)) { + explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; + while (explosive != NULL) { + if ((explosive == thisx) || (explosive->id != ACTOR_EN_BOM_CHU)) { + explosive = explosive->next; continue; } - diff.x = var_v0->world.pos.x - this->actor.world.pos.x; - diff.y = var_v0->world.pos.y - this->actor.world.pos.y; - diff.z = var_v0->world.pos.z - this->actor.world.pos.z; - if (((fabsf(diff.x) < 40.0f) || (gRegEditor->data[0x962] != 0)) && - ((fabsf(diff.y) < 40.0f) || (gRegEditor->data[0x962] != 0)) && - ((fabsf(diff.z) < 40.0f) || (gRegEditor->data[0x962] != 0))) { - this->unk160->unk23E_arr[this->actor.params] = 1; - ((EnBomChu*)var_v0)->timer = 2; + diff.x = explosive->world.pos.x - this->actor.world.pos.x; + diff.y = explosive->world.pos.y - this->actor.world.pos.y; + diff.z = explosive->world.pos.z - this->actor.world.pos.z; + if (((fabsf(diff.x) < 40.0f) || (BREG(2) != 0)) && ((fabsf(diff.y) < 40.0f) || (BREG(2) != 0)) && + ((fabsf(diff.z) < 40.0f) || (BREG(2) != 0))) { + this->bowlingGirl->wallsState[this->actor.params] = EN_BOM_BOWL_MAN_WALL_STATE_HIT; + ((EnBomChu*)explosive)->timer = 2; Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR); - this->unk150 = 0x3C; - EffectSsBomb2_SpawnLayered(play, &this->unk154, &sp40, &sp4C, 200, 40); - temp_v0 = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_1); - sp32 = temp_v0; - Quake_SetSpeed(temp_v0, 0x7FFF); - Quake_SetPerturbations(sp32, 0x64, 0, 0, 0); - Quake_SetDuration(sp32, 0x64); - this->unk14C = func_80B2F0B8; + this->timer = 60; + EffectSsBomb2_SpawnLayered(play, &this->effCenterPos, &effVel, &effAccel, 200, 40); + quakeIndex = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_1); + Quake_SetSpeed(quakeIndex, 0x7FFF); + Quake_SetPerturbations(quakeIndex, 100, 0, 0, 0); + Quake_SetDuration(quakeIndex, 100); + this->actionFunc = EnWallTubo_Explode; return; } - var_v0 = var_v0->next; + explosive = explosive->next; } } } -void func_80B2F0B8(EnWallTubo* this, PlayState* play) { - Actor* temp_v0; - Vec3f sp50; - Vec3f sp44; - Vec3f sp38; - - sp50 = D_80B2F358; - sp44 = D_80B2F364; - if (!(play->gameplayFrames & 1)) { - sp38.x = Rand_CenteredFloat(300.0f) + this->unk154.x; - sp38.y = Rand_CenteredFloat(300.0f) + this->unk154.y; - sp38.z = this->unk154.z; - EffectSsBomb2_SpawnLayered(play, &sp38, &sp44, &sp50, 100, 30); - EffectSsHahen_SpawnBurst(play, &sp38, 10.0f, 0, 50, 15, 3, -1, 10, NULL); - Actor_PlaySfx(&this->actor, 0x180EU); +void EnWallTubo_Explode(EnWallTubo* this, PlayState* play) { + BgBowlWall* wall; + Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; + Vec3f effVel = { 0.0f, 0.0f, 0.0f }; + Vec3f effPos; + + if ((play->gameplayFrames & 1) == 0) { + effPos.x = Rand_CenteredFloat(300.0f) + this->effCenterPos.x; + effPos.y = Rand_CenteredFloat(300.0f) + this->effCenterPos.y; + effPos.z = this->effCenterPos.z; + EffectSsBomb2_SpawnLayered(play, &effPos, &effVel, &effAccel, 100, 30); + EffectSsHahen_SpawnBurst(play, &effPos, 10.0f, 0, 50, 15, 3, -1, 10, NULL); + Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); } - if (this->unk150 == 0) { - temp_v0 = this->actor.parent; - if ((temp_v0 != NULL) && (temp_v0->update != NULL)) { - ((BgBowlWall*)temp_v0)->unk180 = true; + if (this->timer == 0) { + wall = (BgBowlWall*)this->actor.parent; + if ((wall != NULL) && (wall->dyna.actor.update != NULL)) { + wall->targetHit = true; PRINTF(VT_FGCOL(GREEN) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); PRINTF(VT_FGCOL(BLUE) "☆☆☆☆ やった原! ☆☆☆☆☆ \n" VT_RST); @@ -148,11 +137,11 @@ void func_80B2F0B8(EnWallTubo* this, PlayState* play) { void EnWallTubo_Update(Actor* thisx, PlayState* play) { EnWallTubo* this = (EnWallTubo*)thisx; - if (this->unk150 != 0) { - this->unk150--; + if (this->timer != 0) { + this->timer--; } - this->unk14C(this, play); - if (DEBUG_FEATURES && gRegEditor->data[0x960] != 0) { + this->actionFunc(this, play); + if (DEBUG_FEATURES && (BREG(0) != 0)) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 0, 0, 255, 255, 4, play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h index 05005234ed5..fd54c5f034b 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h @@ -10,12 +10,12 @@ typedef void (*EnWallTuboActionFunc)(struct EnWallTubo*, struct PlayState*); typedef struct EnWallTubo { /* 0x000 */ Actor actor; - /* 0x14C */ EnWallTuboActionFunc unk14C; - /* 0x150 */ s16 unk150; + /* 0x14C */ EnWallTuboActionFunc actionFunc; + /* 0x150 */ s16 timer; /* 0x152 */ char pad152[2]; - /* 0x154 */ Vec3f unk154; - /* 0x160 */ struct EnBomBowlMan* unk160; - /* 0x164 */ Vec3f unk164; + /* 0x154 */ Vec3f effCenterPos; + /* 0x160 */ struct EnBomBowlMan* bowlingGirl; + /* 0x164 */ Vec3f homePos; } EnWallTubo; // size = 0x0170 #endif From 1ca4aeeaf553bc450fc608e95fa49b1ce300d6dc Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 7 Aug 2026 17:14:26 +0200 Subject: [PATCH 074/150] finish bowling actors docs --- .../actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c | 17 ++-- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 90 ++++++++++--------- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 14 ++- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 3 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h | 2 +- 5 files changed, 68 insertions(+), 58 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c index 47dc6e46ed5..487edb3e5cb 100644 --- a/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c +++ b/src/overlays/actors/ovl_Bg_Bom_Guard/z_bg_bom_guard.c @@ -1,7 +1,7 @@ /* * File: z_bg_bom_guard.c * Overlay: Bg_Bom_Guard - * Description: Bombchu Bowling Alley Walls + * Description: Bombchu Bowling Alley invisible wall locking the player in the game area */ #include "z_bg_bom_guard.h" @@ -51,9 +51,9 @@ void BgBomGuard_Init(Actor* thisx, PlayState* play) { PRINTF("\n\n"); PRINTF(VT_FGCOL(GREEN) T(" ☆☆☆☆☆ 透明ガード出現 ☆☆☆☆☆ \n", " ☆☆☆☆☆ Transparent guard appears ☆☆☆☆☆ \n") VT_RST); - thisx->scale.x = 1.0f; - thisx->scale.y = 1.0f; - thisx->scale.z = 1.0f; + this->dyna.actor.scale.x = 1.0f; + this->dyna.actor.scale.y = 1.0f; + this->dyna.actor.scale.z = 1.0f; this->homePos = this->dyna.actor.world.pos; BgBomGuard_SetupAction(this, BgBomGuard_UpdateImpl); } @@ -66,14 +66,13 @@ void BgBomGuard_Destroy(Actor* thisx, PlayState* play) { void BgBomGuard_UpdateImpl(BgBomGuard* this, PlayState* play) { Actor* it = play->actorCtx.actorLists[ACTORCAT_NPC].head; - Actor* thisx = &this->dyna.actor; this->isActive = false; while (it != NULL) { if (it->id == ACTOR_EN_BOM_BOWL_MAN) { - if ((((EnBomBowlMan*)it)->unk_258 != 0) && (fabsf(play->view.eye.x) > -20.0f) && - (fabsf(play->view.eye.y) > 110.0f)) { + if ((((EnBomBowlMan*)it)->gameStartStatus != EN_BOM_BOWL_MAN_GAME_START_STATUS_INACTIVE) && + (fabsf(play->view.eye.x) > -20.0f) && (fabsf(play->view.eye.y) > 110.0f)) { this->isActive = true; } break; @@ -83,9 +82,9 @@ void BgBomGuard_UpdateImpl(BgBomGuard* this, PlayState* play) { if (!this->isActive) { // Move under ground - thisx->world.pos.y = sREG(64) + -200.0f; + this->dyna.actor.world.pos.y = sREG(64) + -200.0f; } else { - thisx->world.pos.y = 0.0f; + this->dyna.actor.world.pos.y = 0.0f; } } 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 2f84b91feb2..eafc868f28b 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 @@ -1,3 +1,9 @@ +/* + * File: z_en_bom_bowl_man.c + * Overlay: ovl_En_Bom_Bowl_Man + * Description: Bombchu Bowling Alley girl + */ + #include "z_en_bom_bowl_man.h" #include "overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" @@ -35,12 +41,12 @@ void EnBomBowlMan_WakingUpTalking(EnBomBowlMan* this, PlayState* play); void EnBomBowlMan_FinishWakingUpTalking(EnBomBowlMan* this, PlayState* play); void EnBomBowlMan_NotOpenWaitTalk(EnBomBowlMan* this, PlayState* play); void EnBomBowlMan_NotOpenTalking(EnBomBowlMan* this, PlayState* play); -void func_809C3DC4(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_WaitGameEndOrTalk(EnBomBowlMan* this, PlayState* play); void EnBomBowlMan_WaitPlayAnswer(EnBomBowlMan* this, PlayState* play); -void func_809C41FC(EnBomBowlMan* this, PlayState* play); -void func_809C4318(EnBomBowlMan* this, PlayState* play); -void func_809C441C(EnBomBowlMan* this, PlayState* play); -void func_809C4664(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_Talking(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_WaitToShowReward(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_ShowReward(EnBomBowlMan* this, PlayState* play); +void EnBomBowlMan_WaitGameStart(EnBomBowlMan* this, PlayState* play); typedef enum EnBomBowlManGameEndStatus { EN_BOM_BOWL_MAN_GAME_END_STATUS_ONGOING, @@ -68,13 +74,6 @@ typedef struct CuccoColliderDim { CuccoColliderDim sCuccoColliderDims[2] = { { 16.0f, 46.0f, 0 }, { 36.0f, 56.0f, 0 } }; Vec3f sCuccoPositions[2] = { { 60.0f, -60.0f, -430.0f }, { 0.0f, -120.0f, -620.0f } }; f32 sCuccoScales[2] = { 0.01f, 0.03f }; -Vec3f D_809C4A48 = { 0.0f, 0.1f, 0.0f }; -Vec3f D_809C4A54 = { 0.0f, 0.0f, 0.0f }; -Vec3f D_809C4A60[5] = { - { 0.0f, 22.0f, 0.0f }, { 0.0f, 22.0f, 0.0f }, { 0.0f, 8.0f, 0.0f }, { 0.0f, 9.0f, 0.0f }, { 0.0f, -2.0f, 0.0f }, -}; -static s16 D_809C4A9C[6] = { 0x4268, 0x4268, -0x3E8, 0, 0x4268, 0 }; -static void* sEyeTextures[] = { gBowlingGirlEyeOpenTex, gBowlingGirlEyeHalfTex, gBowlingGirlEyeClosedTex }; void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; @@ -87,7 +86,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { this->morphTable, BOWLING_GIRL_LIMB_MAX); PRINTF(VT_FGCOL(GREEN) "☆ もー 肩こっちゃうよねぇ〜 \t\t ☆ \n" VT_RST); PRINTF(VT_FGCOL(GREEN) "☆ もっとラクしてもうかるバイトないかしら? ☆ %d\n" VT_RST, play->bombchuBowlingStatus); - this->unk248 = this->actor.world.pos; + this->homePos = this->actor.world.pos; this->actor.shape.yOffset = -60.0f; Actor_SetScale(&this->actor, 0.013f); for (i = 0; i < 2; i++) { @@ -164,8 +163,8 @@ void EnBomBowlMan_WakingUpTalking(EnBomBowlMan* this, PlayState* play) { Message_ContinueTextbox(play, this->actor.textId); if ((this->eyeTexIndex == 0) && (this->eyesState == 2) && (this->eyesTimer == 0)) { this->eyeTexIndex = 2; - this->unk23A += 1; - if (this->unk23A >= 3) { + this->wakingUpTimer++; + if (this->wakingUpTimer >= 3) { this->actionFunc = EnBomBowlMan_FinishWakingUpTalking; } } @@ -208,9 +207,9 @@ void EnBomBowlMan_NotOpenTalking(EnBomBowlMan* this, PlayState* play) { } } -void func_809C3D40(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_SetupWaitGameEndOrTalk(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk_258 == 0) { + if (this->gameStartStatus == EN_BOM_BOWL_MAN_GAME_START_STATUS_INACTIVE) { if (!this->hasPlayedBefore) { this->actor.textId = 0x18; } else { @@ -221,10 +220,10 @@ void func_809C3D40(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x19; this->waitMessageState = TEXT_STATE_EVENT; } - this->actionFunc = func_809C3DC4; + this->actionFunc = EnBomBowlMan_WaitGameEndOrTalk; } -void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_WaitGameEndOrTalk(EnBomBowlMan* this, PlayState* play) { s16 relYawTowardsPlayer; s16 absRelYawTowardsPlayer; @@ -256,7 +255,7 @@ void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { if (this->gameEndStatus != EN_BOM_BOWL_MAN_GAME_END_STATUS_ONGOING) { this->actor.textId = 0x1A; this->waitMessageState = TEXT_STATE_CHOICE; - this->unk_258 = 0; + this->gameStartStatus = EN_BOM_BOWL_MAN_GAME_START_STATUS_INACTIVE; if ((this->rewardItemOnCounter != NULL) && (this->rewardItemOnCounter->actor.update != NULL)) { this->rewardItemOnCounter->killItem = true; this->rewardItemOnCounter = NULL; @@ -269,10 +268,10 @@ void func_809C3DC4(EnBomBowlMan* this, PlayState* play) { } this->actionFunc = EnBomBowlMan_WaitPlayAnswer; } else if (Actor_TalkOfferAccepted(&this->actor, play)) { - if (this->unk_258 == 0) { + if (this->gameStartStatus == EN_BOM_BOWL_MAN_GAME_START_STATUS_INACTIVE) { this->actionFunc = EnBomBowlMan_WaitPlayAnswer; } else { - this->actionFunc = func_809C41FC; + this->actionFunc = EnBomBowlMan_Talking; } } else { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -291,7 +290,7 @@ void EnBomBowlMan_WaitPlayAnswer(EnBomBowlMan* this, PlayState* play) { case 0: // yes if (gSaveContext.save.info.playerData.rupees >= 30) { Rupees_ChangeBy(-30); - this->unk_258 = 1; + this->gameStartStatus = EN_BOM_BOWL_MAN_GAME_START_STATUS_PAID; this->wallsState[0] = this->wallsState[1] = EN_BOM_BOWL_MAN_WALL_STATE_STANDING; play->bombchuBowlingStatus = 10; Flags_SetSwitch(play, 0x38); @@ -299,21 +298,21 @@ void EnBomBowlMan_WaitPlayAnswer(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x19; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; - this->actionFunc = func_809C41FC; + this->actionFunc = EnBomBowlMan_Talking; } else { this->actor.textId = 0x1B; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_809C4318; + this->actionFunc = EnBomBowlMan_WaitToShowReward; } } else { this->isAskingToPlayAgain = false; this->actor.textId = 0x85; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; - this->actionFunc = func_809C41FC; + this->actionFunc = EnBomBowlMan_Talking; } break; case 1: // no @@ -321,38 +320,38 @@ void EnBomBowlMan_WaitPlayAnswer(EnBomBowlMan* this, PlayState* play) { this->actor.textId = 0x2D; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; - this->actionFunc = func_809C41FC; + this->actionFunc = EnBomBowlMan_Talking; break; } } } -void func_809C41FC(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_Talking(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); if (((this->actor.textId == 0x2D) || (this->actor.textId == 0x85)) && Flags_GetSwitch(play, 0x38)) { Flags_UnsetSwitch(play, 0x38); } - if (this->unk_258 == 1) { + if (this->gameStartStatus == EN_BOM_BOWL_MAN_GAME_START_STATUS_PAID) { this->actor.textId = 0x1B; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; OnePointCutscene_Init(play, 8010, -99, NULL, CAM_ID_MAIN); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_8); - this->actionFunc = func_809C4318; + this->actionFunc = EnBomBowlMan_WaitToShowReward; } else { if (this->gameEndStatus == EN_BOM_BOWL_MAN_GAME_END_STATUS_ENDED_LOST) { Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); } - this->actionFunc = func_809C3D40; + this->actionFunc = EnBomBowlMan_SetupWaitGameEndOrTalk; } } } -void func_809C4318(EnBomBowlMan* this, PlayState* play) { - Vec3f effAccel = D_809C4A48; - Vec3f effVel = D_809C4A54; +void EnBomBowlMan_WaitToShowReward(EnBomBowlMan* this, PlayState* play) { + Vec3f effAccel = { 0.0f, 0.1f, 0.0f }; + Vec3f effVel = { 0.0f, 0.0f, 0.0f }; Vec3f effPos; SkelAnime_Update(&this->skelAnime); @@ -363,11 +362,15 @@ void func_809C4318(EnBomBowlMan* this, PlayState* play) { EffectSsBomb2_SpawnLayered(play, &effPos, &effVel, &effAccel, 50, 15); Actor_PlaySfx(&this->actor, NA_SE_IT_GOODS_APPEAR); this->rewardAppearTimer = 10; - this->actionFunc = func_809C441C; + this->actionFunc = EnBomBowlMan_ShowReward; } } -void func_809C441C(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_ShowReward(EnBomBowlMan* this, PlayState* play) { + static Vec3f sCounterRewardPosOffset[5] = { + { 0.0f, 22.0f, 0.0f }, { 0.0f, 22.0f, 0.0f }, { 0.0f, 8.0f, 0.0f }, { 0.0f, 9.0f, 0.0f }, { 0.0f, -2.0f, 0.0f }, + }; + static s16 sCounterRewardSpawnYaw[5] = { 0x4268, 0x4268, -0x3E8, 0, 0x4268 }; s16 reward; s32 pad; @@ -401,9 +404,9 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { this->reward = BREG(7) - 1; } this->rewardItemOnCounter = (EnExItem*)Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, D_809C4A60[this->reward].x + 148.0f, - D_809C4A60[this->reward].y + 40.0f, D_809C4A60[this->reward].z + 300.0f, 0, D_809C4A9C[this->reward], 0, - this->reward + EXITEM_BOMB_BAG_COUNTER); + &play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, sCounterRewardPosOffset[this->reward].x + 148.0f, + sCounterRewardPosOffset[this->reward].y + 40.0f, sCounterRewardPosOffset[this->reward].z + 300.0f, 0, + sCounterRewardSpawnYaw[this->reward], 0, this->reward + EXITEM_BOMB_BAG_COUNTER); if (!this->hasPlayedBefore) { // Spawn in the center of the final wall target this->finalTargetManager = (EnBomBowlPit*)Actor_SpawnAsChild( @@ -415,7 +418,7 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { this->finalTargetManager->reward = this->reward; } this->finalTargetManager->gameStarted = true; - this->unk_258 = 2; + this->gameStartStatus = EN_BOM_BOWL_MAN_GAME_START_STATUS_STARTED; this->actor.textId = 0x405A; Message_ContinueTextbox(play, this->actor.textId); this->waitMessageState = TEXT_STATE_EVENT; @@ -423,11 +426,11 @@ void func_809C441C(EnBomBowlMan* this, PlayState* play) { if (this->rewardState >= 5) { this->rewardState = 0; } - this->actionFunc = func_809C4664; + this->actionFunc = EnBomBowlMan_WaitGameStart; } } -void func_809C4664(EnBomBowlMan* this, PlayState* play) { +void EnBomBowlMan_WaitGameStart(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); @@ -438,7 +441,7 @@ void func_809C4664(EnBomBowlMan* this, PlayState* play) { } PRINTF(VT_FGCOL(YELLOW) "☆ わー ☆ %d\n" VT_RST, play->bombchuBowlingStatus); Player_SetCsActionWithHaltedActors(play, NULL, PLAYER_CSACTION_7); - this->actionFunc = func_809C3D40; + this->actionFunc = EnBomBowlMan_SetupWaitGameEndOrTalk; } } @@ -500,6 +503,7 @@ s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, V } void EnBomBowlMan_Draw(Actor* thisx, PlayState* play) { + static void* sEyeTextures[] = { gBowlingGirlEyeOpenTex, gBowlingGirlEyeHalfTex, gBowlingGirlEyeClosedTex }; EnBomBowlMan* this = (EnBomBowlMan*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_bom_bowl_man.c", 907); diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index 766843ec41b..e162188ee1e 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -12,6 +12,12 @@ typedef enum EnBomBowlManWallState { EN_BOM_BOWL_MAN_WALL_STATE_DISAPPEARED } EnBomBowlManWallState; +typedef enum EnBomBowlManGameStartStatus { + EN_BOM_BOWL_MAN_GAME_START_STATUS_INACTIVE, + EN_BOM_BOWL_MAN_GAME_START_STATUS_PAID, + EN_BOM_BOWL_MAN_GAME_START_STATUS_STARTED +} EnBomBowlManGameStartStatus; + struct EnBomBowlMan; typedef void (*EnBomBowlManActionFunc)(struct EnBomBowlMan*, struct PlayState*); @@ -23,7 +29,7 @@ typedef struct EnBomBowlMan { /* 0x1D2 */ Vec3s morphTable[BOWLING_GIRL_LIMB_MAX]; /* 0x214 */ EnBomBowlManActionFunc actionFunc; /* 0x218 */ Vec3s headRot; - /* 0x21E */ char pad21E[6]; + /* 0x21E */ char pad_21E[6]; /* 0x224 */ Vec3s torsoRot; /* 0x22A */ s16 rewardAppearTimer; /* 0x22C */ s16 unk_22C; // unused @@ -33,15 +39,15 @@ typedef struct EnBomBowlMan { /* 0x234 */ s16 eyeTexIndex; /* 0x236 */ s16 eyesTimer; /* 0x238 */ s16 eyesState; - /* 0x23A */ s16 unk23A; + /* 0x23A */ s16 wakingUpTimer; /* 0x23C */ s16 isAskingToPlayAgain; /* 0x23E */ s16 wallsState[2]; // State of the first two walls /* 0x242 */ s16 rewardState; /* 0x244 */ s16 gameEndStatus; /* 0x246 */ char pad_246[2]; - /* 0x248 */ Vec3f unk248; + /* 0x248 */ Vec3f homePos; /* 0x254 */ f32 curAnimFrameCount; - /* 0x258 */ u8 unk_258; + /* 0x258 */ u8 gameStartStatus; /* 0x259 */ char pad_259[3]; /* 0x25C */ struct EnBomBowlPit* finalTargetManager; /* 0x260 */ struct EnExItem* rewardItemOnCounter; diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index 8fbc645cc28..dd11f699a61 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -77,7 +77,8 @@ void EnWallTubo_WaitTargetHit(EnWallTubo* this, PlayState* play) { Vec3f diff; s16 quakeIndex; - if ((this->bowlingGirl->unk_258 != 0) && (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING)) { + if ((this->bowlingGirl->gameStartStatus != EN_BOM_BOWL_MAN_GAME_START_STATUS_INACTIVE) && + (play->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING)) { explosive = play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (explosive != NULL) { if ((explosive == thisx) || (explosive->id != ACTOR_EN_BOM_CHU)) { diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h index fd54c5f034b..72a22243028 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h @@ -12,7 +12,7 @@ typedef struct EnWallTubo { /* 0x000 */ Actor actor; /* 0x14C */ EnWallTuboActionFunc actionFunc; /* 0x150 */ s16 timer; - /* 0x152 */ char pad152[2]; + /* 0x152 */ char pad_152[2]; /* 0x154 */ Vec3f effCenterPos; /* 0x160 */ struct EnBomBowlMan* bowlingGirl; /* 0x164 */ Vec3f homePos; From 5fb2d1b468ea70f26f01284fb1f76ae06178809c Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 7 Aug 2026 17:16:16 +0200 Subject: [PATCH 075/150] some more static --- src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 4 ++-- src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 3afdf11d7b9..22deab38f9a 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -45,13 +45,13 @@ ActorProfile Bg_Bowl_Wall_Profile = { /**/ BgBowlWall_Draw, }; -Vec3f sWallTargetPositions[4] = { +static Vec3f sWallTargetPositions[4] = { { 0.0f, 210.0f, -20.0f }, // First wall, top { 0.0f, 170.0f, -20.0f }, // Second wall, top { -170.0f, 0.0f, -20.0f }, // Second wall, left { 170.0f, 0.0f, -20.0f }, // Second wall, right }; -s16 sWallRots[4] = { +static s16 sWallRots[4] = { 0, 0, // Second wall, upright 0x3FFF, // Second wall, target on the left 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 eafc868f28b..abdfeba588f 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 @@ -71,9 +71,9 @@ typedef struct CuccoColliderDim { f32 height; s32 unk_8; // unused } CuccoColliderDim; -CuccoColliderDim sCuccoColliderDims[2] = { { 16.0f, 46.0f, 0 }, { 36.0f, 56.0f, 0 } }; -Vec3f sCuccoPositions[2] = { { 60.0f, -60.0f, -430.0f }, { 0.0f, -120.0f, -620.0f } }; -f32 sCuccoScales[2] = { 0.01f, 0.03f }; +static CuccoColliderDim sCuccoColliderDims[2] = { { 16.0f, 46.0f, 0 }, { 36.0f, 56.0f, 0 } }; +static Vec3f sCuccoPositions[2] = { { 60.0f, -60.0f, -430.0f }, { 0.0f, -120.0f, -620.0f } }; +static f32 sCuccoScales[2] = { 0.01f, 0.03f }; void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { EnBomBowlMan* this = (EnBomBowlMan*)thisx; From 6641aa272b6c77af00f12d2a2a571ab73bad4635 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 7 Aug 2026 17:30:21 +0200 Subject: [PATCH 076/150] bowling fixups --- assets/xml/objects/object_bg.xml | 2 +- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 24 +++++++++---------- .../actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h | 2 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 4 ++-- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/assets/xml/objects/object_bg.xml b/assets/xml/objects/object_bg.xml index 25b58556120..b66cf6366da 100644 --- a/assets/xml/objects/object_bg.xml +++ b/assets/xml/objects/object_bg.xml @@ -1,6 +1,6 @@ - + diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 22deab38f9a..1fee0dfa891 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -86,7 +86,7 @@ void BgBowlWall_Destroy(Actor* thisx, PlayState* play) { void BgBowlWall_InitImpl(BgBowlWall* this, PlayState* play) { Actor* actor; - EnWallTubo* temp_v0_2; + EnWallTubo* target; s32 pad; s16 type = this->dyna.actor.params; @@ -95,17 +95,17 @@ void BgBowlWall_InitImpl(BgBowlWall* this, PlayState* play) { this->dyna.actor.shape.rot.z = this->dyna.actor.world.rot.z = sWallRots[type]; PRINTF("\n\n"); } - this->wallTargetPos_.x = sWallTargetPositions[type].x + this->dyna.actor.world.pos.x; - this->wallTargetPos_.y = sWallTargetPositions[type].y + this->dyna.actor.world.pos.y; - this->wallTargetPos_.z = sWallTargetPositions[type].z + this->dyna.actor.world.pos.z; + this->effCenterPos.x = sWallTargetPositions[type].x + this->dyna.actor.world.pos.x; + this->effCenterPos.y = sWallTargetPositions[type].y + this->dyna.actor.world.pos.y; + this->effCenterPos.z = sWallTargetPositions[type].z + this->dyna.actor.world.pos.z; if (0) {} - temp_v0_2 = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, - this->wallTargetPos_.x, this->wallTargetPos_.y, this->wallTargetPos_.z, - 0, 0, 0, this->dyna.actor.params); - if (temp_v0_2 != NULL) { - temp_v0_2->effCenterPos = this->wallTargetPos_; + target = (EnWallTubo*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_WALL_TUBO, + this->effCenterPos.x, this->effCenterPos.y, this->effCenterPos.z, 0, 0, 0, + this->dyna.actor.params); + if (target != NULL) { + target->effCenterPos = this->effCenterPos; if (type != BG_BOWL_WALL_TYPE_FIRST_WALL) { - temp_v0_2->effCenterPos = this->wallTargetPos_ = this->dyna.actor.world.pos; + target->effCenterPos = this->effCenterPos = this->dyna.actor.world.pos; } if (this->bowlingGirl == NULL) { actor = play->actorCtx.actorLists[ACTORCAT_NPC].head; @@ -151,9 +151,9 @@ void BgBowlWall_Explode(BgBowlWall* this, PlayState* play) { } if (explode) { for (i = 0; i < 15; i++) { - effPos.x = Rand_CenteredFloat(300.0f) + this->wallTargetPos_.x; + effPos.x = Rand_CenteredFloat(300.0f) + this->effCenterPos.x; effPos.y = -100.0f; - effPos.z = Rand_CenteredFloat(400.0f) + this->wallTargetPos_.z; + effPos.z = Rand_CenteredFloat(400.0f) + this->effCenterPos.z; EffectSsBomb2_SpawnLayered(play, &effPos, &effVel, &effAccel, 100, 30); effPos.y = -50.0f; EffectSsHahen_SpawnBurst(play, &effPos, 10.0f, 0, 50, 15, 3, -1, 10, NULL); diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h index 82c85e4a80d..adf5816c009 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h @@ -17,7 +17,7 @@ typedef struct BgBowlWall { /* 0x000 */ DynaPolyActor dyna; /* 0x164 */ BgBowlWallActionFunc actionFunc; /* 0x168 */ Vec3f homePos; - /* 0x174 */ Vec3f wallTargetPos_; + /* 0x174 */ Vec3f effCenterPos; /* 0x180 */ s16 targetHit; /* 0x182 */ s16 timer; /* 0x184 */ struct EnBomBowlMan* bowlingGirl; 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 abdfeba588f..fd9dc6b5918 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 @@ -140,8 +140,8 @@ void EnBomBowlMan_AsleepTalking(EnBomBowlMan* this, PlayState* play) { } void EnBomBowlMan_SetupWakingUpTalking(EnBomBowlMan* this, PlayState* play) { - this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlNonchalantAnim_); - Animation_Change(&this->skelAnime, &gBowlingGirlNonchalantAnim_, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_ONCE, + this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlWakingUpAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlWakingUpAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_ONCE, -10.0f); this->eyesState = 1; this->actionFunc = EnBomBowlMan_WakingUpTalking; From 90719847608f6ae6ad11763ac154b88b98b34bdf Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 06:43:42 +0200 Subject: [PATCH 077/150] doc bari --- assets/xml/objects/object_bl.xml | 31 +- assets/xml/overlays/ovl_En_Bili.xml | 5 +- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 690 ++++++++++---------- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 20 +- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 3 +- 5 files changed, 376 insertions(+), 373 deletions(-) diff --git a/assets/xml/objects/object_bl.xml b/assets/xml/objects/object_bl.xml index d94789ecba2..74603370269 100644 --- a/assets/xml/objects/object_bl.xml +++ b/assets/xml/objects/object_bl.xml @@ -3,21 +3,32 @@ - + - + - + - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/overlays/ovl_En_Bili.xml b/assets/xml/overlays/ovl_En_Bili.xml index ed2fda6cacd..5d2aee0762e 100644 --- a/assets/xml/overlays/ovl_En_Bili.xml +++ b/assets/xml/overlays/ovl_En_Bili.xml @@ -1,7 +1,6 @@ - - - + + 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 7a066cd6f8d..b1e7495acd1 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -1,6 +1,7 @@ #include "z_en_bili.h" #include "libc64/qrand.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" @@ -24,35 +25,19 @@ void EnBili_Destroy(Actor* thisx, PlayState* play); void EnBili_Update(Actor* thisx, PlayState* play2); void EnBili_Draw(Actor* thisx, PlayState* play); -void func_809BF9BC(EnBili* this); -void func_809BFA14(EnBili* this); -void func_809BFA8C(EnBili* this); -void func_809BFAE8(EnBili* this); -void func_809BFB40(EnBili* this); -void func_809BFB5C(EnBili* this); -void func_809BFBC4(EnBili* this); -void func_809BFC48(EnBili* this); -void func_809BFCE8(EnBili* this); -void func_809BFD18(EnBili* this); -void func_809BFD94(EnBili* this, PlayState* play); -void func_809BFF6C(EnBili* this); -void func_809C008C(EnBili* this); -void func_809C0174(EnBili* this, PlayState* play); -void func_809C0260(EnBili* this, PlayState* play); -void func_809C02B8(EnBili* this, PlayState* play); -void func_809C04B4(EnBili* this, PlayState* play); -void func_809C0570(EnBili* this, PlayState* play); -void func_809C0600(EnBili* this, PlayState* play); -void func_809C067C(EnBili* this, PlayState* play); -void func_809C06E0(EnBili* this, PlayState* play); -void func_809C0754(EnBili* this, PlayState* play); -void func_809C0980(EnBili* this, PlayState* play); -void func_809C09E0(EnBili* this, PlayState* play); -void func_809C0A70(EnBili* this, PlayState* play); -void func_809C0E08(EnBili* this, f32 arg1, Vec3f* arg2); -void func_809C1020(EnBili* this, f32 arg1, Vec3f* arg2); -void func_809C1240(EnBili* this, f32 arg1, Vec3f* arg2); -s32 EnBili_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx); +void EnBili_SetupIdle(EnBili* this); +void EnBili_SetupSpawnedByBari(EnBili* this); +void EnBili_Idle(EnBili* this, PlayState* play); +void EnBili_SpawnedByBari(EnBili* this, PlayState* play); +void EnBili_Electrify(EnBili* this, PlayState* play); +void EnBili_AscendAway(EnBili* this, PlayState* play); +void EnBili_ApproachPlayer(EnBili* this, PlayState* play); +void EnBili_FleePlayer(EnBili* this, PlayState* play); +void EnBili_SlingshotKnockback(EnBili* this, PlayState* play); +void EnBili_Damaged(EnBili* this, PlayState* play); +void EnBili_Die(EnBili* this, PlayState* play); +void EnBili_Stunned(EnBili* this, PlayState* play); +void EnBili_Frozen(EnBili* this, PlayState* play); ActorProfile En_Bili_Profile = { /**/ ACTOR_EN_BILI, @@ -87,46 +72,54 @@ static ColliderCylinderInit sCylinderInit = { }; static CollisionCheckInfoInit2 sColChkInfoInit = { 1, 9, 28, -20, 30 }; + +typedef enum EnBiliDamageReaction { + EN_BILI_DMG_REACT_NONE, + EN_BILI_DMG_REACT_STUN, + EN_BILI_DMG_REACT_FIRE, + EN_BILI_DMG_REACT_ICE, + EN_BILI_DMG_REACT_SLINGSHOT = 0xE, + EN_BILI_DMG_REACT_SWORD_SLASH +} EnBiliDamageReaction; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(0, 0xE), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(2, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0xF), - /* Master sword */ DMG_ENTRY(2, 0xF), - /* Giant's Knife */ DMG_ENTRY(4, 0xF), - /* Fire arrow */ DMG_ENTRY(4, 0x2), - /* Ice arrow */ DMG_ENTRY(4, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(4, 0x2), - /* Ice magic */ DMG_ENTRY(4, 0x3), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0x0), - /* Giant spin */ DMG_ENTRY(4, 0x0), - /* Master spin */ DMG_ENTRY(2, 0x0), - /* Kokiri jump */ DMG_ENTRY(2, 0x0), - /* Giant jump */ DMG_ENTRY(8, 0x0), - /* Master jump */ DMG_ENTRY(4, 0x0), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, EN_BILI_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(0, EN_BILI_DMG_REACT_SLINGSHOT), + /* Explosive */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(1, EN_BILI_DMG_REACT_NONE), + /* Normal arrow */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Kokiri sword */ DMG_ENTRY(1, EN_BILI_DMG_REACT_SWORD_SLASH), + /* Master sword */ DMG_ENTRY(2, EN_BILI_DMG_REACT_SWORD_SLASH), + /* Giant's Knife */ DMG_ENTRY(4, EN_BILI_DMG_REACT_SWORD_SLASH), + /* Fire arrow */ DMG_ENTRY(4, EN_BILI_DMG_REACT_FIRE), + /* Ice arrow */ DMG_ENTRY(4, EN_BILI_DMG_REACT_ICE), + /* Light arrow */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Unk arrow 1 */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Unk arrow 2 */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Unk arrow 3 */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Fire magic */ DMG_ENTRY(4, EN_BILI_DMG_REACT_FIRE), + /* Ice magic */ DMG_ENTRY(4, EN_BILI_DMG_REACT_ICE), + /* Light magic */ DMG_ENTRY(0, EN_BILI_DMG_REACT_NONE), + /* Shield */ DMG_ENTRY(0, EN_BILI_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, EN_BILI_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, EN_BILI_DMG_REACT_NONE), + /* Giant spin */ DMG_ENTRY(4, EN_BILI_DMG_REACT_NONE), + /* Master spin */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Kokiri jump */ DMG_ENTRY(2, EN_BILI_DMG_REACT_NONE), + /* Giant jump */ DMG_ENTRY(8, EN_BILI_DMG_REACT_NONE), + /* Master jump */ DMG_ENTRY(4, EN_BILI_DMG_REACT_NONE), + /* Unknown 1 */ DMG_ENTRY(0, EN_BILI_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_BILI_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, EN_BILI_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, EN_BILI_DMG_REACT_NONE), }; static InitChainEntry sInitChain[] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BIRI, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_STOP), }; -static Color_RGBA8 D_809C16A0 = { 0xFF, 0xFF, 0xFF, 0xFF }; -static Color_RGBA8 D_809C16A4 = { 0xC8, 0xFF, 0xFF, 0xFF }; void EnBili_Init(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; @@ -134,16 +127,16 @@ void EnBili_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &object_bl_005848_Skel, &object_bl_Anim_0000A4, this->jointTable, - this->morphTable, 5); + SkelAnime_Init(play, &this->skelAnime, &gBiriSkel, &object_bl_Anim_0000A4, this->jointTable, this->morphTable, + BIRI_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - this->unk195 = 0; - if (this->actor.params == -1) { - func_809BF9BC(this); + this->playFlySfx = false; + if (this->actor.params == EN_BILI_TYPE_NORMAL) { + EnBili_SetupIdle(this); } else { - func_809BFA14(this); + EnBili_SetupSpawnedByBari(this); } } @@ -153,308 +146,304 @@ void EnBili_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_809BF9BC(EnBili* this) { +void EnBili_SetupIdle(EnBili* this) { this->actor.speed = 0.7f; this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; - this->unk196 = 0x20; + this->timer = 32; this->actor.home.pos.y = this->actor.world.pos.y; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->collider.base.atFlags |= AT_ON; this->collider.base.acFlags |= AC_ON; - this->unk190 = func_809C0174; + this->actionFunc = EnBili_Idle; } -void func_809BFA14(EnBili* this) { +void EnBili_SetupSpawnedByBari(EnBili* this) { Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); - this->unk196 = 0x19; + this->timer = 25; this->actor.velocity.y = 6.0f; this->actor.gravity = -0.3f; this->actor.speed = 3.0f; this->collider.base.atFlags &= ~AT_ON; - this->unk190 = func_809C0260; + this->actionFunc = EnBili_SpawnedByBari; } -void func_809BFA8C(EnBili* this) { +void EnBili_SetupElectrify(EnBili* this) { Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_000024); - this->unk196 = 0xA; - this->unk190 = func_809C02B8; + this->timer = 10; + this->actionFunc = EnBili_Electrify; this->actor.speed = 0.0f; this->actor.velocity.y = -1.0f; } -void func_809BFAE8(EnBili* this) { +void EnBili_SetupAscendAway(EnBili* this) { Animation_PlayOnce(&this->skelAnime, &object_bl_Anim_000064); this->collider.base.atFlags &= ~AT_ON; - this->unk190 = func_809C04B4; + this->actionFunc = EnBili_AscendAway; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; } -void func_809BFB40(EnBili* this) { +void EnBili_SetupApproachPlayer(EnBili* this) { this->actor.speed = 1.2f; - this->unk190 = func_809C0570; + this->actionFunc = EnBili_ApproachPlayer; } -void func_809BFB5C(EnBili* this) { +void EnBili_SetupFleePlayer(EnBili* this) { Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); - this->unk196 = 0x60; + this->timer = 96; this->actor.speed = 0.9f; this->actor.home.pos.y = this->actor.world.pos.y; this->collider.base.atFlags |= AT_ON; - this->unk190 = func_809C0600; + this->actionFunc = EnBili_FleePlayer; } -void func_809BFBC4(EnBili* this) { +void EnBili_SetupSlingshotKnockback(EnBili* this) { if (this->skelAnime.animation != &object_bl_Anim_0000A4) { Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); } this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->collider.base.ac->prevPos) + 0x8000; this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->collider.base.ac->prevPos); - this->unk190 = func_809C067C; + this->actionFunc = EnBili_SlingshotKnockback; this->actor.speed = 5.0f; } -void func_809BFC48(EnBili* this) { - if (this->unk190 == func_809C04B4) { +void EnBili_SetupDamaged(EnBili* this) { + if (this->actionFunc == EnBili_AscendAway) { Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); } - this->unk196 = 0x14; + this->timer = 20; this->collider.base.atFlags &= ~AT_ON; this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_XLU, 20); - this->unk190 = func_809C06E0; + this->actionFunc = EnBili_Damaged; } -void func_809BFCE8(EnBili* this) { - this->unk196 = 0x12; +void EnBili_SetupDie(EnBili* this) { + this->timer = 18; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk190 = func_809C0754; + this->actionFunc = EnBili_Die; this->actor.speed = 0.0f; } -void func_809BFD18(EnBili* this) { - this->unk196 = 0x50; +void EnBili_SetupStunned(EnBili* this) { + this->timer = 80; this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; this->actor.gravity = -1.0f; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 80); Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->collider.base.atFlags &= ~AT_ON; - this->unk190 = func_809C0980; + this->actionFunc = EnBili_Stunned; } -void func_809BFD94(EnBili* this, PlayState* play) { - s32 var_s0; - Vec3f sp80; +void EnBili_SetupFrozen(EnBili* this, PlayState* play) { + s32 i; + Vec3f effPos; if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { this->actor.gravity = -1.0f; } this->actor.velocity.y = 0.0f; - sp80.y = this->actor.world.pos.y - 15.0f; - for (var_s0 = 0; var_s0 < 8; var_s0++) { - sp80.x = ((var_s0 & 1) ? 7.0f : -7.0f) + this->actor.world.pos.x; - sp80.y += 2.5f; - sp80.z = ((var_s0 & 4) ? 7.0f : -7.0f) + this->actor.world.pos.z; - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp80, 150, 150, 150, 250, 235, 245, 255, + effPos.y = this->actor.world.pos.y - 15.0f; + for (i = 0; i < 8; i++) { + effPos.x = ((i & 1) ? 7.0f : -7.0f) + this->actor.world.pos.x; + effPos.y += 2.5f; + effPos.z = ((i & 4) ? 7.0f : -7.0f) + this->actor.world.pos.z; + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effPos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 0.7f); } this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 150, COLORFILTER_BUFFLAG_XLU, 10); this->collider.base.atFlags &= ~AT_ON; this->collider.base.acFlags &= ~AC_ON; - this->unk196 = 0x12C; - this->unk190 = func_809C09E0; -} - -void func_809BFF6C(EnBili* this) { - s16 temp_v1_2; - s16 temp_v1_4; - s16 temp_ft1; - s16 temp_v1_3; - - temp_ft1 = this->skelAnime.curFrame; - if (this->unk190 == func_809C02B8) { - temp_v1_2 = 3 - temp_ft1; - this->unk194 = (ABS(temp_v1_2) + 5) % 8; - } else if (this->unk190 == func_809C04B4) { - temp_v1_3 = temp_ft1 >> 1; - if (temp_ft1 < 0xA) { - if (temp_v1_3 >= 4) { - this->unk194 = 3; + this->timer = 300; + this->actionFunc = EnBili_Frozen; +} + +void EnBili_UpdateTentaclesTexIndex(EnBili* this) { + s16 n; + s16 animCurFrame; + + animCurFrame = this->skelAnime.curFrame; + if (this->actionFunc == EnBili_Electrify) { + n = 3 - animCurFrame; + this->tentaclesTexIndex = (ABS(n) + 5) % 8; + } else if (this->actionFunc == EnBili_AscendAway) { + n = animCurFrame >> 1; + if (animCurFrame < 10) { + if (n >= 4) { + this->tentaclesTexIndex = 3; } else { - this->unk194 = temp_v1_3; + this->tentaclesTexIndex = n; } - } else if (temp_ft1 < 0x13) { - temp_v1_4 = 0x11 - temp_ft1; - this->unk194 = CLAMP_MIN(temp_v1_4, 0) >> 1; - } else if (temp_ft1 < 0x25) { - this->unk194 = ((0x24 - temp_ft1) / 3) + 2; + } else if (animCurFrame < 19) { + n = 17 - animCurFrame; + this->tentaclesTexIndex = CLAMP_MIN(n, 0) >> 1; + } else if (animCurFrame < 37) { + this->tentaclesTexIndex = ((36 - animCurFrame) / 3) + 2; } else { - this->unk194 = (0x28 - temp_ft1) >> 1; + this->tentaclesTexIndex = (40 - animCurFrame) >> 1; } } else { - this->unk194 = temp_ft1 >> 1; + this->tentaclesTexIndex = animCurFrame >> 1; } } -void func_809C008C(EnBili* this) { - f32 temp_fv0; - f32 temp_fv1; - f32 var_fa0; - f32 var_fa1; +void EnBili_UpdateMovement(EnBili* this) { + f32 playerY; + f32 floorY; + f32 targetY; + f32 targetYOffset; - temp_fv0 = this->actor.world.pos.y + this->actor.yDistToPlayer; - if (this->unk190 == func_809C0600) { - var_fa1 = 100.0f; + playerY = this->actor.world.pos.y + this->actor.yDistToPlayer; + if (this->actionFunc == EnBili_FleePlayer) { + targetYOffset = 100.0f; } else { - var_fa1 = 40.0f; + targetYOffset = 40.0f; } - temp_fv1 = this->actor.floorHeight; - if (temp_fv1 < temp_fv0) { - var_fa0 = temp_fv0; - } else { - var_fa0 = temp_fv1; - } - Math_StepToF(&this->actor.home.pos.y, var_fa0 + var_fa1, 1.0f); - this->actor.world.pos.y = (sinf(this->unk196 * 0.19634955f) * 3.0f) + this->actor.home.pos.y; + floorY = this->actor.floorHeight; + targetY = MAX(playerY, floorY); + Math_StepToF(&this->actor.home.pos.y, targetY + targetYOffset, 1.0f); + this->actor.world.pos.y = (sinf(this->timer * 0.19634955f) * 3.0f) + this->actor.home.pos.y; if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { this->actor.world.rot.y = this->actor.wallYaw; } } -void func_809C0174(EnBili* this, PlayState* play) { +void EnBili_Idle(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } - if (!(this->unk196 % 4)) { + if (!(this->timer % 4)) { this->actor.world.rot.y += Rand_CenteredFloat(1820.0f); } - func_809C008C(this); - if (this->unk196 == 0) { - this->unk196 = 0x20; + EnBili_UpdateMovement(this); + if (this->timer == 0) { + this->timer = 32; } if ((this->actor.xzDistToPlayer < 160.0f) && (fabsf(this->actor.yDistToPlayer) < 45.0f)) { - func_809BFB40(this); + EnBili_SetupApproachPlayer(this); } } -void func_809C0260(EnBili* this, PlayState* play) { +void EnBili_SpawnedByBari(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } - if (this->unk196 == 0) { - func_809BF9BC(this); + if (this->timer == 0) { + EnBili_SetupIdle(this); } } -void func_809C02B8(EnBili* this, PlayState* play) { - s16 temp_s1; - Vec3f sp78; - s32 var_s0; +void EnBili_Electrify(EnBili* this, PlayState* play) { + static Color_RGBA8 sEffEnvColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sEffPrimColor = { 200, 255, 255, 255 }; + s16 effYaw; + Vec3f effPos; + s32 i; - for (var_s0 = 0; var_s0 < 4; var_s0++) { - if (!((s32)(this->unk196 + (var_s0 << 1)) % 4)) { - temp_s1 = (s16)Rand_CenteredFloat(12288.0f) + (var_s0 * 0x4000) + 0x2000; - sp78.x = Rand_CenteredFloat(5.0f) + this->actor.world.pos.x; - sp78.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y + 2.5f; - sp78.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; - EffectSsLightning_Spawn(play, (Vec3f*)&sp78, &D_809C16A0, &D_809C16A4, 0xF, (s16)(s32)temp_s1, 6, 2); + for (i = 0; i < 4; i++) { + if (!((s32)(this->timer + (i << 1)) % 4)) { + effYaw = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; + effPos.x = Rand_CenteredFloat(5.0f) + this->actor.world.pos.x; + effPos.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y + 2.5f; + effPos.z = Rand_CenteredFloat(5.0f) + this->actor.world.pos.z; + EffectSsLightning_Spawn(play, &effPos, &sEffEnvColor, &sEffPrimColor, 15, effYaw, 6, 2); } } SkelAnime_Update(&this->skelAnime); Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } this->actor.velocity.y *= -1.0f; - if ((this->unk196 == 0) && Animation_OnFrame(&this->skelAnime, 0.0f)) { - if (this->actor.params == 1) { - func_809BFCE8(this); + if ((this->timer == 0) && Animation_OnFrame(&this->skelAnime, 0.0f)) { + if (this->actor.params == EN_BILI_TYPE_DIE_AFTER_ELECTRIFY) { + EnBili_SetupDie(this); } else { - func_809BFAE8(this); + EnBili_SetupAscendAway(this); } } } -void func_809C04B4(EnBili* this, PlayState* play) { +void EnBili_AscendAway(EnBili* this, PlayState* play) { s32 animFinished; - f32 sp28; + f32 animCurFrame; animFinished = SkelAnime_Update(&this->skelAnime); - sp28 = this->skelAnime.curFrame; + animCurFrame = this->skelAnime.curFrame; if (Animation_OnFrame(&this->skelAnime, 9.0f)) { - Actor_PlaySfx(&this->actor, 0x3899U); + Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_JUMP); } - if (sp28 > 9.0f) { + if (animCurFrame > 9.0f) { Math_ApproachF(&this->actor.world.pos.y, this->actor.world.pos.y + this->actor.yDistToPlayer + 100.0f, 0.5f, 5.0f); } if (animFinished) { - func_809BFB5C(this); + EnBili_SetupFleePlayer(this); } } -void func_809C0570(EnBili* this, PlayState* play) { +void EnBili_ApproachPlayer(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x71C); - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } - func_809C008C(this); - if (this->unk196 == 0) { - this->unk196 = 0x20; + EnBili_UpdateMovement(this); + if (this->timer == 0) { + this->timer = 32; } if (this->actor.xzDistToPlayer > 200.0f) { - func_809BF9BC(this); + EnBili_SetupIdle(this); } } -void func_809C0600(EnBili* this, PlayState* play) { +void EnBili_FleePlayer(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } Math_ScaledStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer + 0x8000, 0x38E); - func_809C008C(this); - if (this->unk196 == 0) { - func_809BF9BC(this); + EnBili_UpdateMovement(this); + if (this->timer == 0) { + EnBili_SetupIdle(this); } } -void func_809C067C(EnBili* this, PlayState* play) { +void EnBili_SlingshotKnockback(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (Math_StepToF(&this->actor.speed, 0.0f, 0.3f) != 0) { + if (Math_StepToF(&this->actor.speed, 0.0f, 0.3f)) { this->actor.world.rot.y += 0x8000; - func_809BF9BC(this); + EnBili_SetupIdle(this); } } -void func_809C06E0(EnBili* this, PlayState* play) { +void EnBili_Damaged(EnBili* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { - this->actor.colorFilterTimer = 0x14; + this->actor.colorFilterTimer = 20; } else { - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } - if (this->unk196 == 0) { - func_809BFCE8(this); + if (this->timer == 0) { + EnBili_SetupDie(this); } } } -void func_809C0754(EnBili* this, PlayState* play) { - static Vec3f D_809C16A8 = { 0.0f, 0.0f, 0.0f }; - static Vec3f D_809C16B4 = { 0.0f, 0.0f, 0.0f }; - s16 temp_s0; - Vec3f sp78; - s32 var_s1; +void EnBili_Die(EnBili* this, PlayState* play) { + static Vec3f sEffVel = { 0.0f, 0.0f, 0.0f }; + static Vec3f sEffAccel = { 0.0f, 0.0f, 0.0f }; + s16 effScale; + Vec3f effPos; + s32 i; if (this->actor.draw != NULL) { if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { @@ -465,51 +454,45 @@ void func_809C0754(EnBili* this, PlayState* play) { return; } } - if (this->unk196 != 0) { - this->unk196--; + if (this->timer != 0) { + this->timer--; } - if (this->unk196 != 0) { - for (var_s1 = 0; var_s1 < 2; var_s1++) { - sp78.x = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.x - 5.0f; - sp78.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y - 2.5f; - sp78.z = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z - 5.0f; - D_809C16A8.y = Rand_ZeroOne() + 1.0f; - temp_s0 = Rand_S16Offset(0x28, 0x28); + if (this->timer != 0) { + for (i = 0; i < 2; i++) { + effPos.x = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.x - 5.0f; + effPos.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y - 2.5f; + effPos.z = (Rand_ZeroOne() * 10.0f) + this->actor.world.pos.z - 5.0f; + sEffVel.y = Rand_ZeroOne() + 1.0f; + effScale = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(play, (Vec3f*)&sp78, &D_809C16A8, &D_809C16B4, temp_s0, 0x19, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effPos, &sEffVel, &sEffAccel, effScale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(play, (Vec3f*)&sp78, &D_809C16A8, &D_809C16B4, temp_s0, 0x19, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effPos, &sEffVel, &sEffAccel, effScale, 25, 0, 1); } } } else { Actor_Kill(&this->actor); } - if (this->unk196 == 0xE) { - SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 0x28, NA_SE_EN_BIRI_BUBLE); + if (this->timer == 14) { + SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BIRI_BUBLE); } } -static Vec3f D_809C16C0 = { 1.0f, 1.0f, 1.0f }; -static s32 D_809C16CC[9] = { - 0x06000E08, 0x06001708, 0x06002008, 0x06002908, 0x06003208, 0x06003B08, 0x06004408, 0x06004D08, 0, -}; -#include "assets/overlays/ovl_En_Bili/ovl_En_Bili.c" - -void func_809C0980(EnBili* this, PlayState* play) { - if (this->unk196 != 0) { - this->unk196--; +void EnBili_Stunned(EnBili* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); } - if (this->unk196 == 0) { - func_809BF9BC(this); + if (this->timer == 0) { + EnBili_SetupIdle(this); } } -void func_809C09E0(EnBili* this, PlayState* play) { - if (this->unk196 != 0) { - this->unk196--; +void EnBili_Frozen(EnBili* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; } if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { this->actor.gravity = -1.0f; @@ -520,45 +503,45 @@ void func_809C09E0(EnBili* this, PlayState* play) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #endif this->actor.colorFilterTimer = 0; - func_809BFCE8(this); + EnBili_SetupDie(this); } else { - this->actor.colorFilterTimer = 0xA; + this->actor.colorFilterTimer = 10; } } -void func_809C0A70(EnBili* this, PlayState* play) { +void EnBili_CheckCollide(EnBili* this, PlayState* play) { if ((this->actor.colChkInfo.health != 0) && (this->collider.base.acFlags & AC_HIT)) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlag(&this->actor, &this->collider.elem, true); - if ((((this->actor.colChkInfo.damageReaction != 0)) || (this->actor.colChkInfo.damage != 0))) { + if ((this->actor.colChkInfo.damageReaction != EN_BILI_DMG_REACT_NONE) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_DEAD); Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } - if (this->actor.colChkInfo.damageReaction == 1) { - if (this->unk190 != func_809C0980) { - func_809BFD18(this); + if (this->actor.colChkInfo.damageReaction == EN_BILI_DMG_REACT_STUN) { + if (this->actionFunc != EnBili_Stunned) { + EnBili_SetupStunned(this); } - } else if (this->actor.colChkInfo.damageReaction == 0xF) { - if (this->unk190 != func_809C0980) { + } else if (this->actor.colChkInfo.damageReaction == EN_BILI_DMG_REACT_SWORD_SLASH) { + if (this->actionFunc != EnBili_Stunned) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 200, COLORFILTER_BUFFLAG_XLU, 10); if (this->actor.colChkInfo.health == 0) { - this->actor.params = 1; + this->actor.params = EN_BILI_TYPE_DIE_AFTER_ELECTRIFY; } - func_809BFA8C(this); + EnBili_SetupElectrify(this); } else { - func_809BFC48(this); + EnBili_SetupDamaged(this); } - } else if (this->actor.colChkInfo.damageReaction == 2) { - func_809BFC48(this); - this->unk196 = 2; - } else if (this->actor.colChkInfo.damageReaction == 3) { - func_809BFD94(this, play); - } else if (this->actor.colChkInfo.damageReaction == 0xE) { - func_809BFBC4(this); + } else if (this->actor.colChkInfo.damageReaction == EN_BILI_DMG_REACT_FIRE) { + EnBili_SetupDamaged(this); + this->timer = 2; + } else if (this->actor.colChkInfo.damageReaction == EN_BILI_DMG_REACT_ICE) { + EnBili_SetupFrozen(this, play); + } else if (this->actor.colChkInfo.damageReaction == EN_BILI_DMG_REACT_SLINGSHOT) { + EnBili_SetupSlingshotKnockback(this); } else { - func_809BFC48(this); + EnBili_SetupDamaged(this); } if (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_ARROW) { this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; @@ -573,23 +556,23 @@ void EnBili_Update(Actor* thisx, PlayState* play2) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_809BFA8C(this); + EnBili_SetupElectrify(this); } - func_809C0A70(this, play); - this->unk190(this, play); - if (this->unk190 != func_809C0754) { - func_809BFF6C(this); + EnBili_CheckCollide(this, play); + this->actionFunc(this, play); + if (this->actionFunc != EnBili_Die) { + EnBili_UpdateTentaclesTexIndex(this); if (Animation_OnFrame(&this->skelAnime, 9.0f) && - (((this->unk190 == func_809C0174)) || (this->unk190 == func_809C0600) || (this->unk190 == func_809C0570) || - (this->unk190 == func_809C067C))) { - if (this->unk195 != 0) { - Actor_PlaySfx(&this->actor, 0x3898U); - this->unk195 = 0; + ((this->actionFunc == EnBili_Idle) || (this->actionFunc == EnBili_FleePlayer) || + (this->actionFunc == EnBili_ApproachPlayer) || (this->actionFunc == EnBili_SlingshotKnockback))) { + if (this->playFlySfx) { + Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_FLY); + this->playFlySfx = false; } else { - this->unk195 = 1; + this->playFlySfx = true; } } - if (this->unk190 == func_809C067C) { + if (this->actionFunc == EnBili_SlingshotKnockback) { Actor_MoveXYZ(&this->actor); } else { Actor_MoveXZGravity(&this->actor); @@ -608,117 +591,118 @@ void EnBili_Update(Actor* thisx, PlayState* play2) { } } -void func_809C0E08(EnBili* this, f32 arg1, Vec3f* arg2) { - f32 temp_fv0; - f32 temp_fv0_2; - f32 temp_fv1; +void EnBili_GetHoodLimbScale(EnBili* this, f32 frame, Vec3f* scale) { + f32 f; - if (this->unk190 == func_809C02B8) { - arg2->y = 1.0f - (sinf(0.5236092f * arg1) * 0.26f); - } else if (this->unk190 == func_809C04B4) { - if (arg1 <= 8.0f) { - arg2->y = (cosf(0.3926991f * arg1) * 0.15f) + 0.85f; - } else if (arg1 <= 18.0f) { - temp_fv0 = cosf((arg1 - 8.0f) * 0.31415927f); - arg2->y = 1.0f - (0.3f * temp_fv0); - arg2->x = (0.2f * temp_fv0) + 0.8f; + if (this->actionFunc == EnBili_Electrify) { + scale->y = 1.0f - (sinf(0.5236092f * frame) * 0.26f); + } else if (this->actionFunc == EnBili_AscendAway) { + if (frame <= 8.0f) { + scale->y = (cosf(0.3926991f * frame) * 0.15f) + 0.85f; + } else if (frame <= 18.0f) { + f = cosf((frame - 8.0f) * 0.31415927f); + scale->y = 1.0f - (0.3f * f); + scale->x = (0.2f * f) + 0.8f; } else { - temp_fv0_2 = cosf((arg1 - 18.0f) * 0.071314156f); - arg2->y = (0.31f * temp_fv0_2) + 1.0f; - arg2->x = 1.0f - (0.4f * temp_fv0_2); + f = cosf((frame - 18.0f) * 0.071314156f); + scale->y = (0.31f * f) + 1.0f; + scale->x = 1.0f - (0.4f * f); } - arg2->z = arg2->x; - } else if (this->unk190 == func_809C0980) { - temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; - arg2->x -= temp_fv1; - arg2->y += temp_fv1; - arg2->z -= temp_fv1; + scale->z = scale->x; + } else if (this->actionFunc == EnBili_Stunned) { + f = sinf(this->timer * 0.31415927f) * 0.08f; + scale->x -= f; + scale->y += f; + scale->z -= f; } else { - arg2->y = (cosf(0.3926991f * arg1) * 0.13f) + 0.87f; + scale->y = (cosf(0.3926991f * frame) * 0.13f) + 0.87f; } } -void func_809C1020(EnBili* this, f32 arg1, Vec3f* arg2) { - f32 temp_fv0; - f32 temp_fv0_2; - f32 temp_fv1; +void EnBili_GetCoreLimbScale(EnBili* this, f32 frame, Vec3f* scale) { + f32 f; - if (this->unk190 == func_809C02B8) { - arg2->y = (sinf(0.5236092f * arg1) * 0.2f) + 1.0f; - } else if (this->unk190 == func_809C04B4) { - if (arg1 <= 8.0f) { - arg2->x = 1.125f - (cosf(0.3926991f * arg1) * 0.125f); - } else if (arg1 <= 18.0f) { - temp_fv0 = cosf((arg1 - 8.0f) * 0.31415927f); - arg2->x = (0.275f * temp_fv0) + 0.975f; - arg2->y = 1.25f - (0.25f * temp_fv0); + if (this->actionFunc == EnBili_Electrify) { + scale->y = (sinf(0.5236092f * frame) * 0.2f) + 1.0f; + } else if (this->actionFunc == EnBili_AscendAway) { + if (frame <= 8.0f) { + scale->x = 1.125f - (cosf(0.3926991f * frame) * 0.125f); + } else if (frame <= 18.0f) { + f = cosf((frame - 8.0f) * 0.31415927f); + scale->x = (0.275f * f) + 0.975f; + scale->y = 1.25f - (0.25f * f); } else { - temp_fv0_2 = cosf((arg1 - 18.0f) * 0.071314156f); - arg2->x = 1.0f - (0.3f * temp_fv0_2); - arg2->y = (0.48f * temp_fv0_2) + 1.0f; + f = cosf((frame - 18.0f) * 0.071314156f); + scale->x = 1.0f - (0.3f * f); + scale->y = (0.48f * f) + 1.0f; } - arg2->z = arg2->x; - } else if (this->unk190 == func_809C0980) { - temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; - arg2->x += temp_fv1; - arg2->y -= temp_fv1; - arg2->z += temp_fv1; + scale->z = scale->x; + } else if (this->actionFunc == EnBili_Stunned) { + f = sinf(this->timer * 0.31415927f) * 0.08f; + scale->x += f; + scale->y -= f; + scale->z += f; } else { - arg2->y = 1.1f - (cosf(0.3926991f * arg1) * 0.1f); + scale->y = 1.1f - (cosf(0.3926991f * frame) * 0.1f); } } -void func_809C1240(EnBili* this, f32 arg1, Vec3f* arg2) { - f32 temp_fv0; +void EnBili_GetTentaclesLimbScale(EnBili* this, f32 frame, Vec3f* scale) { + f32 f; - if (this->unk190 == func_809C04B4) { - if (arg1 <= 8.0f) { - temp_fv0 = cosf(0.3926991f * arg1); - arg2->x = 1.125f - (0.125f * temp_fv0); - arg2->y = (0.3f * temp_fv0) + 0.7f; - } else if (arg1 <= 18.0f) { - temp_fv0 = cosf((arg1 - 8.0f) * 0.31415927f); - arg2->x = (0.325f * temp_fv0) + 0.925f; - arg2->y = 0.95f - (0.55f * temp_fv0); + if (this->actionFunc == EnBili_AscendAway) { + if (frame <= 8.0f) { + f = cosf(0.3926991f * frame); + scale->x = 1.125f - (0.125f * f); + scale->y = (0.3f * f) + 0.7f; + } else if (frame <= 18.0f) { + f = cosf((frame - 8.0f) * 0.31415927f); + scale->x = (0.325f * f) + 0.925f; + scale->y = 0.95f - (0.55f * f); } else { - temp_fv0 = cosf((arg1 - 18.0f) * 0.071314156f); - arg2->x = 1.0f - (0.4f * temp_fv0); - arg2->y = (0.52f * temp_fv0) + 1.0f; + f = cosf((frame - 18.0f) * 0.071314156f); + scale->x = 1.0f - (0.4f * f); + scale->y = (0.52f * f) + 1.0f; } - arg2->z = arg2->x; + scale->z = scale->x; } } -s32 EnBili_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx) { +s32 EnBili_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfx) { EnBili* this = thisx; - Vec3f sp20; - f32 temp_fv0; + Vec3f scale = { 1.0f, 1.0f, 1.0f }; + f32 animCurFrame = this->skelAnime.curFrame; - sp20 = D_809C16C0; - temp_fv0 = this->skelAnime.curFrame; - if (arg1 == 3) { - func_809C0E08(this, temp_fv0, &sp20); - } else if (arg1 == 2) { - func_809C1020(this, temp_fv0, &sp20); - } else if (arg1 == 4) { - func_809C1240(this, temp_fv0, &sp20); - arg4->y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000; + if (limbIndex == BIRI_LIMB_HOOD) { + EnBili_GetHoodLimbScale(this, animCurFrame, &scale); + } else if (limbIndex == BIRI_LIMB_CORE) { + EnBili_GetCoreLimbScale(this, animCurFrame, &scale); + } else if (limbIndex == BIRI_LIMB_TENTACLES) { + EnBili_GetTentaclesLimbScale(this, animCurFrame, &scale); + rot->y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) - this->actor.shape.rot.y + 0x8000; } - Matrix_Scale(sp20.x, sp20.y, sp20.z, MTXMODE_APPLY); - return 0; + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); + return false; } +static void* sTentaclesTextures[8] = { + gBiriTentacle0Tex, gBiriTentacle1Tex, gBiriTentacle2Tex, gBiriTentacle3Tex, + gBiriTentacle4Tex, gBiriTentacle5Tex, gBiriTentacle6Tex, gBiriTentacle7Tex, +}; +#include "assets/overlays/ovl_En_Bili/ovl_En_Bili.c" + void EnBili_Draw(Actor* thisx, PlayState* play) { EnBili* this = (EnBili*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_bili.c", 1521); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - this->unk194 = CLAMP_MAX(this->unk194, 7); - gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_809C16CC[this->unk194])); - if ((this->unk190 == func_809C02B8) && (this->unk196 & 1)) { - gSPSegment(POLY_XLU_DISP++, 9, D_809C16F0); + this->tentaclesTexIndex = CLAMP_MAX(this->tentaclesTexIndex, ARRAY_COUNT(sTentaclesTextures) - 1); + gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(sTentaclesTextures[this->tentaclesTexIndex])); + if ((this->actionFunc == EnBili_Electrify) && (this->timer & 1)) { + gSPSegment(POLY_XLU_DISP++, 9, sBariCoreInvertTexCombinerDL); } else { - gSPSegment(POLY_XLU_DISP++, 9, D_809C1700); + gSPSegment(POLY_XLU_DISP++, 9, sBariCoreNormalCombinerDL); } POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBili_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); 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 a7b09741b29..ae2d507dcd3 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -4,17 +4,25 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_bl/object_bl.h" + +typedef enum EnBiliType { + EN_BILI_TYPE_NORMAL = -1, + EN_BILI_TYPE_SPAWNED_BY_BARI, + EN_BILI_TYPE_DIE_AFTER_ELECTRIFY // internal +} EnBiliType; + struct EnBili; typedef struct EnBili { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ void (*unk190)(struct EnBili*, struct PlayState*); - /* 0x194 */ u8 unk194; - /* 0x195 */ u8 unk195; - /* 0x196 */ s16 unk196; - /* 0x198 */ Vec3s jointTable[5]; - /* 0x1B6 */ Vec3s morphTable[5]; + /* 0x190 */ void (*actionFunc)(struct EnBili*, struct PlayState*); + /* 0x194 */ u8 tentaclesTexIndex; + /* 0x195 */ u8 playFlySfx; + /* 0x196 */ s16 timer; + /* 0x198 */ Vec3s jointTable[BIRI_LIMB_MAX]; + /* 0x1B6 */ Vec3s morphTable[BIRI_LIMB_MAX]; /* 0x1D4 */ ColliderCylinder collider; } EnBili; // size = 0x220 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 620b09fc212..b5d94b6af94 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -5,6 +5,7 @@ */ #include "z_en_vali.h" +#include "src/overlays/actors/ovl_En_Bili/z_en_bili.h" #include "libc64/qrand.h" #include "gfx.h" @@ -262,7 +263,7 @@ void func_80B26C50(EnVali* this, PlayState* play) { for (var_s1 = 0; var_s1 < 3; var_s1++) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BILI, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, 0); + this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, EN_BILI_TYPE_SPAWNED_BY_BARI); this->actor.world.rot.y += 0x5555; } temp_s1 = &this->actor.world; From 7531c9bee78a39a1dde4a3eaf1b997c8c597f007 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 06:55:04 +0200 Subject: [PATCH 078/150] name biri anims (by usage, Z64Utils cant preview them) --- assets/xml/objects/object_bl.xml | 6 +++--- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/assets/xml/objects/object_bl.xml b/assets/xml/objects/object_bl.xml index 74603370269..be9b1550467 100644 --- a/assets/xml/objects/object_bl.xml +++ b/assets/xml/objects/object_bl.xml @@ -1,8 +1,8 @@ - - - + + + 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 b1e7495acd1..02026d77360 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -127,7 +127,7 @@ void EnBili_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 17.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &gBiriSkel, &object_bl_Anim_0000A4, this->jointTable, this->morphTable, + SkelAnime_Init(play, &this->skelAnime, &gBiriSkel, &gBiriMainAnim, this->jointTable, this->morphTable, BIRI_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -159,7 +159,7 @@ void EnBili_SetupIdle(EnBili* this) { } void EnBili_SetupSpawnedByBari(EnBili* this) { - Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); + Animation_PlayLoop(&this->skelAnime, &gBiriMainAnim); this->timer = 25; this->actor.velocity.y = 6.0f; this->actor.gravity = -0.3f; @@ -169,7 +169,7 @@ void EnBili_SetupSpawnedByBari(EnBili* this) { } void EnBili_SetupElectrify(EnBili* this) { - Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_000024); + Animation_PlayLoop(&this->skelAnime, &gBiriElectrifyAnim); this->timer = 10; this->actionFunc = EnBili_Electrify; this->actor.speed = 0.0f; @@ -177,7 +177,7 @@ void EnBili_SetupElectrify(EnBili* this) { } void EnBili_SetupAscendAway(EnBili* this) { - Animation_PlayOnce(&this->skelAnime, &object_bl_Anim_000064); + Animation_PlayOnce(&this->skelAnime, &gBiriAscendAwayAnim); this->collider.base.atFlags &= ~AT_ON; this->actionFunc = EnBili_AscendAway; this->actor.speed = 0.0f; @@ -190,7 +190,7 @@ void EnBili_SetupApproachPlayer(EnBili* this) { } void EnBili_SetupFleePlayer(EnBili* this) { - Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); + Animation_PlayLoop(&this->skelAnime, &gBiriMainAnim); this->timer = 96; this->actor.speed = 0.9f; this->actor.home.pos.y = this->actor.world.pos.y; @@ -199,8 +199,8 @@ void EnBili_SetupFleePlayer(EnBili* this) { } void EnBili_SetupSlingshotKnockback(EnBili* this) { - if (this->skelAnime.animation != &object_bl_Anim_0000A4) { - Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); + if (this->skelAnime.animation != &gBiriMainAnim) { + Animation_PlayLoop(&this->skelAnime, &gBiriMainAnim); } this->actor.world.rot.y = Actor_WorldYawTowardPoint(&this->actor, &this->collider.base.ac->prevPos) + 0x8000; this->actor.world.rot.x = Actor_WorldPitchTowardPoint(&this->actor, &this->collider.base.ac->prevPos); @@ -210,7 +210,7 @@ void EnBili_SetupSlingshotKnockback(EnBili* this) { void EnBili_SetupDamaged(EnBili* this) { if (this->actionFunc == EnBili_AscendAway) { - Animation_PlayLoop(&this->skelAnime, &object_bl_Anim_0000A4); + Animation_PlayLoop(&this->skelAnime, &gBiriMainAnim); } this->timer = 20; this->collider.base.atFlags &= ~AT_ON; From 620cf25433a8928f3a2cb4ed4fa492c241b64cb5 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 07:40:40 +0200 Subject: [PATCH 079/150] fixup bari/biri mixup --- assets/xml/overlays/ovl_En_Bili.xml | 4 ++-- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/xml/overlays/ovl_En_Bili.xml b/assets/xml/overlays/ovl_En_Bili.xml index 5d2aee0762e..c7b86fc7461 100644 --- a/assets/xml/overlays/ovl_En_Bili.xml +++ b/assets/xml/overlays/ovl_En_Bili.xml @@ -1,6 +1,6 @@ - - + + 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 02026d77360..975deafbce5 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -700,9 +700,9 @@ void EnBili_Draw(Actor* thisx, PlayState* play) { this->tentaclesTexIndex = CLAMP_MAX(this->tentaclesTexIndex, ARRAY_COUNT(sTentaclesTextures) - 1); gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(sTentaclesTextures[this->tentaclesTexIndex])); if ((this->actionFunc == EnBili_Electrify) && (this->timer & 1)) { - gSPSegment(POLY_XLU_DISP++, 9, sBariCoreInvertTexCombinerDL); + gSPSegment(POLY_XLU_DISP++, 9, sBiriCoreInvertTexCombinerDL); } else { - gSPSegment(POLY_XLU_DISP++, 9, sBariCoreNormalCombinerDL); + gSPSegment(POLY_XLU_DISP++, 9, sBiriCoreNormalCombinerDL); } POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnBili_OverrideLimbDraw, NULL, this, POLY_XLU_DISP); From b1c2625bf260e31af2010f68204b141684570a95 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 11:57:23 +0200 Subject: [PATCH 080/150] doc bari --- assets/xml/objects/object_vali.xml | 102 ++- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 824 ++++++++++---------- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 24 +- 3 files changed, 498 insertions(+), 452 deletions(-) diff --git a/assets/xml/objects/object_vali.xml b/assets/xml/objects/object_vali.xml index ee98b1de9b9..f00e92bd898 100644 --- a/assets/xml/objects/object_vali.xml +++ b/assets/xml/objects/object_vali.xml @@ -1,67 +1,95 @@ - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 b5d94b6af94..47acd3b61ac 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -29,18 +29,18 @@ void EnVali_Destroy(Actor* thisx, PlayState* play); void EnVali_Update(Actor* thisx, PlayState* play); void EnVali_Draw(Actor* thisx, PlayState* play); -void func_80B26878(EnVali* this); -void func_80B27098(EnVali* this, PlayState* play); -void func_80B270D8(EnVali* this, PlayState* play); -void func_80B2716C(EnVali* this, PlayState* play); -void func_80B27318(EnVali* this, PlayState* play); -void func_80B273D0(EnVali* this, PlayState* play); -void func_80B2742C(EnVali* this, PlayState* play); -void func_80B27464(EnVali* this, PlayState* play); -void func_80B274A0(EnVali* this, PlayState* play); -void func_80B27654(EnVali* this, PlayState* play); -void func_80B27710(EnVali* this, PlayState* play); -void func_80B278A0(EnVali* this, PlayState* play); +void EnVali_SetupWaitPlayerNear(EnVali* this); +void EnVali_WaitPlayerNear(EnVali* this, PlayState* play); +void EnVali_Appear(EnVali* this, PlayState* play); +void EnVali_Spin(EnVali* this, PlayState* play); +void EnVali_Electrify(EnVali* this, PlayState* play); +void EnVali_Damaged(EnVali* this, PlayState* play); +void EnVali_Recover(EnVali* this, PlayState* play); +void EnVali_Burnt(EnVali* this, PlayState* play); +void EnVali_Die(EnVali* this, PlayState* play); +void EnVali_Stunned(EnVali* this, PlayState* play); +void EnVali_Frozen(EnVali* this, PlayState* play); +void EnVali_Bury(EnVali* this, PlayState* play); ActorProfile En_Vali_Profile = { /**/ ACTOR_EN_VALI, @@ -95,69 +95,78 @@ static ColliderCylinderInit sCylinderInit = { }; static CollisionCheckInfoInit sColChkInfoInit = { 2, 18, 32, MASS_HEAVY }; + +typedef enum EnValiDamageReaction { + EN_VALI_DMG_REACT_NONE, + EN_VALI_DMG_REACT_STUN, + EN_VALI_DMG_REACT_FIRE, + EN_VALI_DMG_REACT_ICE, + EN_VALI_DMG_REACT_SLINGSHOT = 0xE, + EN_VALI_DMG_REACT_SWORD_SLASH +} EnValiDamageReaction; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(0, 0xE), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(0, 0x1), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(2, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0xF), - /* Master sword */ DMG_ENTRY(2, 0xF), - /* Giant's Knife */ DMG_ENTRY(4, 0xF), - /* Fire arrow */ DMG_ENTRY(4, 0x2), - /* Ice arrow */ DMG_ENTRY(4, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(4, 0x2), - /* Ice magic */ DMG_ENTRY(4, 0x3), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0x0), - /* Giant spin */ DMG_ENTRY(4, 0x0), - /* Master spin */ DMG_ENTRY(2, 0x0), - /* Kokiri jump */ DMG_ENTRY(2, 0x0), - /* Giant jump */ DMG_ENTRY(8, 0x0), - /* Master jump */ DMG_ENTRY(4, 0x0), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, EN_VALI_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(0, EN_VALI_DMG_REACT_SLINGSHOT), + /* Explosive */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(0, EN_VALI_DMG_REACT_STUN), + /* Normal arrow */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Kokiri sword */ DMG_ENTRY(1, EN_VALI_DMG_REACT_SWORD_SLASH), + /* Master sword */ DMG_ENTRY(2, EN_VALI_DMG_REACT_SWORD_SLASH), + /* Giant's Knife */ DMG_ENTRY(4, EN_VALI_DMG_REACT_SWORD_SLASH), + /* Fire arrow */ DMG_ENTRY(4, EN_VALI_DMG_REACT_FIRE), + /* Ice arrow */ DMG_ENTRY(4, EN_VALI_DMG_REACT_ICE), + /* Light arrow */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Unk arrow 1 */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Unk arrow 2 */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Unk arrow 3 */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Fire magic */ DMG_ENTRY(4, EN_VALI_DMG_REACT_FIRE), + /* Ice magic */ DMG_ENTRY(4, EN_VALI_DMG_REACT_ICE), + /* Light magic */ DMG_ENTRY(0, EN_VALI_DMG_REACT_NONE), + /* Shield */ DMG_ENTRY(0, EN_VALI_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, EN_VALI_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, EN_VALI_DMG_REACT_NONE), + /* Giant spin */ DMG_ENTRY(4, EN_VALI_DMG_REACT_NONE), + /* Master spin */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Kokiri jump */ DMG_ENTRY(2, EN_VALI_DMG_REACT_NONE), + /* Giant jump */ DMG_ENTRY(8, EN_VALI_DMG_REACT_NONE), + /* Master jump */ DMG_ENTRY(4, EN_VALI_DMG_REACT_NONE), + /* Unknown 1 */ DMG_ENTRY(0, EN_VALI_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_VALI_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, EN_VALI_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, EN_VALI_DMG_REACT_NONE), }; + static InitChainEntry sInitChain[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BARI, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 5000, ICHAIN_STOP), }; -static Color_RGBA8 D_80B28950 = { 255, 255, 255, 255 }; -static Color_RGBA8 D_80B28954 = { 200, 255, 255, 255 }; void EnVali_Init(Actor* thisx, PlayState* play) { s32 pad; EnVali* this = (EnVali*)thisx; - s32 sp34; + s32 bgId; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 27.0f); this->actor.shape.shadowAlpha = 155; - SkelAnime_Init(play, &this->skelAnime, &object_vali_004848_Skel, &object_vali_Anim_0014AC, this->jointTable, - this->morphTable, 29); - Collider_InitQuad(play, &this->unk2FC); - Collider_SetQuad(play, &this->unk2FC, &this->actor, &sColliderQuadInit); - Collider_InitQuad(play, &this->unk37C); - Collider_SetQuad(play, &this->unk37C, &this->actor, &sColliderQuadInit); - Collider_InitCylinder(play, &this->unk3FC); - Collider_SetCylinder(play, &this->unk3FC, &this->actor, &sCylinderInit); + SkelAnime_Init(play, &this->skelAnime, &gBariSkel, &gBariIdleAnim, this->jointTable, this->morphTable, + BARI_LIMB_MAX); + Collider_InitQuad(play, &this->leftTentacleCollider); + Collider_SetQuad(play, &this->leftTentacleCollider, &this->actor, &sColliderQuadInit); + Collider_InitQuad(play, &this->rightTentacleCollider); + Collider_SetQuad(play, &this->rightTentacleCollider, &this->actor, &sColliderQuadInit); + Collider_InitCylinder(play, &this->collider); + Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - func_80B26878(this); + EnVali_SetupWaitPlayerNear(this); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.floorHeight = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &sp34, &this->actor, &this->actor.world.pos); + BgCheck_EntityRaycastDown4(&play->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &this->actor.world.pos); this->actor.params = 0; if (this->actor.floorHeight == BGCHECK_Y_MIN) { Actor_Kill(&this->actor); @@ -166,26 +175,26 @@ void EnVali_Init(Actor* thisx, PlayState* play) { void EnVali_Destroy(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; - Collider_DestroyQuad(play, &this->unk2FC); - Collider_DestroyQuad(play, &this->unk37C); - Collider_DestroyCylinder(play, &this->unk3FC); + Collider_DestroyQuad(play, &this->leftTentacleCollider); + Collider_DestroyQuad(play, &this->rightTentacleCollider); + Collider_DestroyCylinder(play, &this->collider); } -void func_80B26878(EnVali* this) { - Animation_PlayLoop(&this->skelAnime, &object_vali_Anim_0014AC); +void EnVali_SetupWaitPlayerNear(EnVali* this) { + Animation_PlayLoop(&this->skelAnime, &gBariIdleAnim); this->actor.draw = NULL; - this->unk3FC.base.acFlags &= ~AC_ON; - this->unk190 = func_80B27098; + this->collider.base.acFlags &= ~AC_ON; + this->actionFunc = EnVali_WaitPlayerNear; } -void func_80B268C8(EnVali* this) { +void EnVali_SetupAppear(EnVali* this) { this->actor.draw = EnVali_Draw; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - this->unk190 = func_80B270D8; + this->actionFunc = EnVali_Appear; this->actor.velocity.y = 1.0f; } -void func_80B268FC(EnVali* this) { +void EnVali_SetupSpin(EnVali* this) { Vec3f sp84; Vec3f sp78; Vec3f sp6C; @@ -197,191 +206,191 @@ void func_80B268FC(EnVali* this) { f32 temp_fv1; s32 pad[6]; - Animation_MorphToLoop(&this->skelAnime, &object_vali_Anim_000710, -3.0f); + Animation_MorphToLoop(&this->skelAnime, &gBariAttackAnim, -3.0f); sp3C = this->actor.world.pos; - this->unk37C.dim.quad[1] = sp3C; + this->rightTentacleCollider.dim.quad[1] = sp3C; sp48 = sp3C; - this->unk37C.dim.quad[0] = sp48; + this->rightTentacleCollider.dim.quad[0] = sp48; sp54 = sp48; - this->unk2FC.dim.quad[1] = sp54; + this->leftTentacleCollider.dim.quad[1] = sp54; sp60 = sp54; - this->unk2FC.dim.quad[0] = sp60; + this->leftTentacleCollider.dim.quad[0] = sp60; sp6C = sp60; - this->unk37C.dim.quad[3] = sp6C; + this->rightTentacleCollider.dim.quad[3] = sp6C; sp78 = sp6C; - this->unk37C.dim.quad[2] = sp78; + this->rightTentacleCollider.dim.quad[2] = sp78; sp84 = sp78; - this->unk2FC.dim.quad[3] = sp84; + this->leftTentacleCollider.dim.quad[3] = sp84; temp_fv1 = this->actor.world.pos.y; temp_fv0 = temp_fv1 - 10.0f; - this->unk2FC.dim.quad[2] = sp84; - this->unk2FC.dim.quad[2].y = temp_fv0; - this->unk2FC.dim.quad[3].y = temp_fv0; - this->unk37C.dim.quad[2].y = temp_fv0; - this->unk37C.dim.quad[3].y = temp_fv0; - this->unk2FC.dim.quad[0].y = temp_fv0; - this->unk2FC.dim.quad[1].y = temp_fv0; - this->unk37C.dim.quad[0].y = temp_fv0; - this->unk37C.dim.quad[1].y = temp_fv0; + this->leftTentacleCollider.dim.quad[2] = sp84; + this->leftTentacleCollider.dim.quad[2].y = temp_fv0; + this->leftTentacleCollider.dim.quad[3].y = temp_fv0; + this->rightTentacleCollider.dim.quad[2].y = temp_fv0; + this->rightTentacleCollider.dim.quad[3].y = temp_fv0; + this->leftTentacleCollider.dim.quad[0].y = temp_fv0; + this->leftTentacleCollider.dim.quad[1].y = temp_fv0; + this->rightTentacleCollider.dim.quad[0].y = temp_fv0; + this->rightTentacleCollider.dim.quad[1].y = temp_fv0; this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->unk3FC.base.acFlags |= AC_ON; - this->unk195 = 0; - this->unk190 = func_80B2716C; - this->unk2F8 = temp_fv1; + this->collider.base.acFlags |= AC_ON; + this->spinTimer = 0; + this->actionFunc = EnVali_Spin; + this->spinHeight = temp_fv1; } -void func_80B26B18(EnVali* this) { - this->unk194 = 0x14; +void EnVali_SetupElectrify(EnVali* this) { + this->electrifyTimer = 20; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk3FC.base.acFlags &= ~AC_ON; - this->unk190 = func_80B27318; + this->collider.base.acFlags &= ~AC_ON; + this->actionFunc = EnVali_Electrify; } -void func_80B26B4C(EnVali* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_vali_Anim_000854, -5.0f); +void EnVali_SetupDamaged(EnVali* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gBariDamagedAnim, -5.0f); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); this->actor.params = 0; - this->unk3FC.base.acFlags &= ~AC_ON; - this->unk190 = func_80B273D0; + this->collider.base.acFlags &= ~AC_ON; + this->actionFunc = EnVali_Damaged; } -void func_80B26BBC(EnVali* this) { - Animation_PlayOnce(&this->skelAnime, &object_vali_Anim_000B34); - this->unk190 = func_80B2742C; +void EnVali_SetupRecover(EnVali* this) { + Animation_PlayOnce(&this->skelAnime, &gBariRecoverAnim); + this->actionFunc = EnVali_Recover; } -void func_80B26BF8(EnVali* this) { - this->unk196 = 2; - this->unk3FC.base.acFlags &= ~AC_ON; +void EnVali_SetupBurnt(EnVali* this) { + this->timer = 2; + this->collider.base.acFlags &= ~AC_ON; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); - this->unk190 = func_80B27464; + this->actionFunc = EnVali_Burnt; } -void func_80B26C50(EnVali* this, PlayState* play) { - PosRot* temp_s1; - s32 var_s1; +void EnVali_SetupDie(EnVali* this, PlayState* play) { + s32 i; - for (var_s1 = 0; var_s1 < 3; var_s1++) { + for (i = 0; i < 3; i++) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BILI, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.world.rot.y, 0, EN_BILI_TYPE_SPAWNED_BY_BARI); this->actor.world.rot.y += 0x5555; } - temp_s1 = &this->actor.world; - Item_DropCollectibleRandom(play, &this->actor, &temp_s1->pos, + Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_5, false)); - this->unk196 = Rand_S16Offset(0xA, 0xA); - this->unk3FC.base.acFlags &= ~AC_ON; - SfxSource_PlaySfxAtFixedWorldPos(play, &temp_s1->pos, 40, NA_SE_EN_BARI_SPLIT); + this->timer = Rand_S16Offset(10, 10); + this->collider.base.acFlags &= ~AC_ON; + SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_BARI_SPLIT); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.draw = NULL; - this->unk190 = func_80B274A0; + this->actionFunc = EnVali_Die; } -void func_80B26D54(EnVali* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_vali_Anim_000710, 10.0f); - this->unk196 = 0x50; +void EnVali_SetupStunned(EnVali* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gBariAttackAnim, 10.0f); + this->timer = 80; this->actor.velocity.y = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 80); - this->unk3FC.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; - Actor_PlaySfx(&this->actor, 0x389EU); - this->unk190 = func_80B27654; + this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_NONE; + Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); + this->actionFunc = EnVali_Stunned; this->actor.velocity.y = 1.0f; } -void func_80B26DE0(EnVali* this) { +void EnVali_SetupFrozen(EnVali* this) { this->actor.velocity.y = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_XLU, 36); - this->unk3FC.base.acFlags &= ~AC_ON; - this->unk196 = 0x24; - this->unk190 = func_80B27710; + this->collider.base.acFlags &= ~AC_ON; + this->timer = 36; + this->actionFunc = EnVali_Frozen; } -void func_80B26E40(EnVali* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_vali_Anim_0014AC, 10.0f); +void EnVali_SetupBury(EnVali* this) { + Animation_MorphToPlayOnce(&this->skelAnime, &gBariIdleAnim, 10.0f); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk190 = func_80B278A0; -} - -void func_80B26E9C(EnVali* this, PlayState* play) { - Vec3f sp8C; - f32 temp_fs1; - f32 temp_fs2; - s32 var_s1; - s16 temp_v0; - - for (var_s1 = 0; var_s1 < 4; var_s1++) { - temp_fs1 = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); - temp_fs2 = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); - if (!((this->unk194 + (var_s1 << 1)) % 4)) { - temp_v0 = (s16)Rand_CenteredFloat(12288.0f) + (var_s1 * 0x4000) + 0x2000; - sp8C.x = this->actor.world.pos.x + (Math_SinS(temp_v0) * 12.0f * temp_fs1); - sp8C.y = this->actor.world.pos.y - (Math_CosS(temp_v0) * 12.0f) + 10.0f; - sp8C.z = this->actor.world.pos.z + (Math_SinS(temp_v0) * 12.0f * temp_fs2); - EffectSsLightning_Spawn(play, &sp8C, &D_80B28950, &D_80B28954, 17, temp_v0, 6, 2); + this->actionFunc = EnVali_Bury; +} + +void EnVali_DoElectricEffectsAndSfx(EnVali* this, PlayState* play) { + static Color_RGBA8 sEffPrimColor = { 255, 255, 255, 255 }; + static Color_RGBA8 sEffEnvColor = { 200, 255, 255, 255 }; + Vec3f effPos; + f32 cosCamYaw; + f32 sinCamYaw; + s32 i; + s16 angle; + + for (i = 0; i < 4; i++) { + cosCamYaw = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + sinCamYaw = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play))); + if (!((this->electrifyTimer + (i << 1)) % 4)) { + angle = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; + effPos.x = this->actor.world.pos.x + (Math_SinS(angle) * 12.0f * cosCamYaw); + effPos.y = this->actor.world.pos.y - (Math_CosS(angle) * 12.0f) + 10.0f; + effPos.z = this->actor.world.pos.z + (Math_SinS(angle) * 12.0f * sinCamYaw); + EffectSsLightning_Spawn(play, &effPos, &sEffPrimColor, &sEffEnvColor, 17, angle, 6, 2); } } Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_BIRI_SPARK - SFX_FLAG); } -void func_80B27098(EnVali* this, PlayState* play) { +void EnVali_WaitPlayerNear(EnVali* this, PlayState* play) { if (this->actor.xzDistToPlayer < 150.0f) { - func_80B268C8(this); + EnVali_SetupAppear(this); } } -void func_80B270D8(EnVali* this, PlayState* play) { +void EnVali_Appear(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); this->actor.velocity.y *= 1.5f; this->actor.velocity.y = CLAMP_MAX(this->actor.velocity.y, 40.0f); if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); - func_80B268FC(this); + EnVali_SetupSpin(this); } } -void func_80B2716C(EnVali* this, PlayState* play) { - s32 var_v1; +void EnVali_Spin(EnVali* this, PlayState* play) { + s32 animCurFrame; SkelAnime_Update(&this->skelAnime); - if (this->unk195 != 0) { - this->unk195 -= 1; + if (this->spinTimer != 0) { + this->spinTimer -= 1; } - var_v1 = (s32)this->skelAnime.curFrame; - Math_StepToF(&this->unk2F8, this->actor.floorHeight + 40.0f, 1.2f); - this->actor.world.pos.y = this->unk2F8 - (sinf(var_v1 * 3.1415927f * 0.0125f) * 8.0f); - if (this->unk195 != 0) { + animCurFrame = (s32)this->skelAnime.curFrame; + Math_StepToF(&this->spinHeight, this->actor.floorHeight + 40.0f, 1.2f); + this->actor.world.pos.y = this->spinHeight - (sinf(animCurFrame * M_PI * 0.0125f) * 8.0f); + if (this->spinTimer != 0) { this->actor.shape.rot.y += 0x800; - if (((this->unk195 % 6) == 0) && (var_v1 >= 0x10) && (var_v1 < 0x38)) { + if (((this->spinTimer % 6) == 0) && (animCurFrame >= 16) && (animCurFrame < 56)) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_ROLL); } - } else if ((var_v1 == 0x10) || (var_v1 == 0x1E) || (var_v1 == 0x2A) || (var_v1 == 0x37)) { + } else if ((animCurFrame == 16) || (animCurFrame == 30) || (animCurFrame == 42) || (animCurFrame == 55)) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_ROLL); } - if (var_v1 >= 0x29) { - var_v1 = 0x50 - var_v1; + if (animCurFrame > 40) { + animCurFrame = 80 - animCurFrame; } - this->actor.shape.rot.y += DEG_TO_BINANG((var_v1 + 4) * 0.4f); + this->actor.shape.rot.y += DEG_TO_BINANG((animCurFrame + 4) * 0.4f); if (this->actor.xzDistToPlayer > 250.0f) { - func_80B26E40(this); + EnVali_SetupBury(this); } } -void func_80B27318(EnVali* this, PlayState* play) { - if (this->unk194 != 0) { - this->unk194 -= 1; +void EnVali_Electrify(EnVali* this, PlayState* play) { + if (this->electrifyTimer != 0) { + this->electrifyTimer--; } - func_80B26E9C(this, play); - if (this->unk194 == 0) { + EnVali_DoElectricEffectsAndSfx(this, play); + if (this->electrifyTimer == 0) { this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - this->unk3FC.base.acFlags |= AC_ON; + this->collider.base.acFlags |= AC_ON; if (this->actor.params == 1) { - func_80B26B4C(this); + EnVali_SetupDamaged(this); } else { - this->unk190 = func_80B2716C; + this->actionFunc = EnVali_Spin; } } else { - if (this->unk194 & 1) { + if (this->electrifyTimer & 1) { this->actor.world.pos.y += 1.0f; } else { this->actor.world.pos.y -= 1.0f; @@ -389,76 +398,62 @@ void func_80B27318(EnVali* this, PlayState* play) { } } -void func_80B273D0(EnVali* this, PlayState* play) { +void EnVali_Damaged(EnVali* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->actor.colChkInfo.health != 0) { - func_80B26BBC(this); + EnVali_SetupRecover(this); } else { - func_80B26C50(this, play); + EnVali_SetupDie(this, play); } } } -void func_80B2742C(EnVali* this, PlayState* play) { +void EnVali_Recover(EnVali* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { - func_80B268FC(this); + EnVali_SetupSpin(this); } } -void func_80B27464(EnVali* this, PlayState* play) { - if (this->unk196 != 0) { - this->unk196 -= 1; +void EnVali_Burnt(EnVali* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; } - if (this->unk196 == 0) { - func_80B26C50(this, play); + if (this->timer == 0) { + EnVali_SetupDie(this, play); } } -void func_80B274A0(EnVali* this, PlayState* play) { - static Vec3f D_80B28958 = { 0.0f, 0.0f, 0.0f }; - static Vec3f D_80B28964 = { 0.0f, 0.0f, 0.0f }; - s16 temp_s0; - Vec3f sp70; - s32 var_s1; +void EnVali_Die(EnVali* this, PlayState* play) { + static Vec3f sEffVel = { 0.0f, 0.0f, 0.0f }; + static Vec3f sEffAccel = { 0.0f, 0.0f, 0.0f }; + s16 effScale; + Vec3f effPos; + s32 i; - if (this->unk196 != 0) { - this->unk196 -= 1; + if (this->timer != 0) { + this->timer--; } - for (var_s1 = 0; var_s1 < 2; var_s1++) { - sp70.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; - sp70.y = Rand_CenteredFloat(8.0f) + this->actor.world.pos.y; - sp70.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; - D_80B28958.y = Rand_ZeroOne() + 1.0f; - temp_s0 = Rand_S16Offset(40, 40); + for (i = 0; i < 2; i++) { + effPos.x = Rand_CenteredFloat(20.0f) + this->actor.world.pos.x; + effPos.y = Rand_CenteredFloat(8.0f) + this->actor.world.pos.y; + effPos.z = Rand_CenteredFloat(20.0f) + this->actor.world.pos.z; + sEffVel.y = Rand_ZeroOne() + 1.0f; + effScale = Rand_S16Offset(40, 40); if (Rand_ZeroOne() < 0.7f) { - EffectSsDtBubble_SpawnColorProfile(play, &sp70, &D_80B28958, &D_80B28964, temp_s0, 25, 2, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effPos, &sEffVel, &sEffAccel, effScale, 25, 2, 1); } else { - EffectSsDtBubble_SpawnColorProfile(play, &sp70, &D_80B28958, &D_80B28964, temp_s0, 25, 0, 1); + EffectSsDtBubble_SpawnColorProfile(play, &effPos, &sEffVel, &sEffAccel, effScale, 25, 0, 1); } } - if (this->unk196 == 0) { + if (this->timer == 0) { Actor_Kill(&this->actor); } } -static Vec3f D_80B28970 = { 3000.0f, 0.0f, 0.0f }; -static Vec3f D_80B2897C = { -1000.0f, 0.0f, 0.0f }; -static Vec3f D_80B28988 = { 1.0f, 1.0f, 1.0f }; -static Gfx D_80B28998[] = { - gsDPSetCombineLERP(1, TEXEL0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, - PRIM_LOD_FRAC, COMBINED), - gsSPEndDisplayList(), -}; -static Gfx D_80B289A8[] = { - gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, - PRIM_LOD_FRAC, COMBINED), - gsSPEndDisplayList(), -}; - -void func_80B27654(EnVali* this, PlayState* play) { +void EnVali_Stunned(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk196 != 0) { - this->unk196 -= 1; + if (this->timer != 0) { + this->timer--; } if (this->actor.velocity.y != 0.0f) { if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { @@ -468,85 +463,86 @@ void func_80B27654(EnVali* this, PlayState* play) { this->actor.velocity.y += 1.0f; } } - if (this->unk196 == 0) { - this->unk3FC.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; - func_80B268FC(this); + if (this->timer == 0) { + this->collider.elem.acDmgInfo.hitBacklash = HIT_BACKLASH_ELECTRIC; + EnVali_SetupSpin(this); } } -void func_80B27710(EnVali* this, PlayState* play) { - Vec3f sp54; +void EnVali_Frozen(EnVali* this, PlayState* play) { + Vec3f effPos; s32 temp_v0_2; s32 temp_v1; - if (this->unk196 != 0) { - this->unk196 -= 1; + if (this->timer != 0) { + this->timer--; } - temp_v1 = this->unk196 - 0x14; + temp_v1 = this->timer - 20; this->actor.colorFilterTimer = 36; if (temp_v1 > 0) { temp_v0_2 = temp_v1 >> 1; - if (this->unk196 & 1) { - sp54.y = (this->actor.world.pos.y - 20.0f) + ((-temp_v0_2 * 5) + 40); - sp54.x = this->actor.world.pos.x + ((temp_v0_2 & 2) ? 12.0f : -12.0f); - sp54.z = this->actor.world.pos.z + ((temp_v0_2 & 1) ? 12.0f : -12.0f); - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp54, 150, 150, 150, 250, 235, 245, 255, + if (this->timer & 1) { + effPos.y = (this->actor.world.pos.y - 20.0f) + ((-temp_v0_2 * 5) + 40); + effPos.x = this->actor.world.pos.x + ((temp_v0_2 & 2) ? 12.0f : -12.0f); + effPos.z = this->actor.world.pos.z + ((temp_v0_2 & 1) ? 12.0f : -12.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effPos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.2f) + 1.3f); } - } else if (this->unk196 == 0) { + } else if (this->timer == 0) { this->actor.velocity.y += 1.0f; if (Math_StepToF(&this->actor.world.pos.y, this->actor.floorHeight, this->actor.velocity.y)) { - func_80B26C50(this, play); + EnVali_SetupDie(this, play); this->actor.colorFilterTimer = 0; } } } -void func_80B278A0(EnVali* this, PlayState* play) { +void EnVali_Bury(EnVali* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.5f, 15.0f, 0.1f) < 0.01f) { - func_80B26878(this); + EnVali_SetupWaitPlayerNear(this); } } -void func_80B2790C(EnVali* this, PlayState* play) { - if ((this->unk3FC.base.acFlags & AC_HIT)) { - this->unk3FC.base.acFlags &= ~AC_HIT; - if (((Actor_SetDropFlag(&this->actor, &this->unk3FC.elem, true), - (this->actor.colChkInfo.damageReaction != 0)) || +void EnVali_CheckCollide(EnVali* this, PlayState* play) { + if ((this->collider.base.acFlags & AC_HIT)) { + this->collider.base.acFlags &= ~AC_HIT; + if (((Actor_SetDropFlag(&this->actor, &this->collider.elem, true), + (this->actor.colChkInfo.damageReaction != EN_VALI_DMG_REACT_NONE)) || (this->actor.colChkInfo.damage != 0))) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_DEAD); Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } else { - if ((this->actor.colChkInfo.damageReaction != 1) && (this->actor.colChkInfo.damageReaction != 0xE)) { + if ((this->actor.colChkInfo.damageReaction != EN_VALI_DMG_REACT_STUN) && + (this->actor.colChkInfo.damageReaction != EN_VALI_DMG_REACT_SLINGSHOT)) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_DAMAGE); } } - if (this->actor.colChkInfo.damageReaction == 1) { - if (this->unk190 != func_80B27654) { - func_80B26D54(this); + if (this->actor.colChkInfo.damageReaction == EN_VALI_DMG_REACT_STUN) { + if (this->actionFunc != EnVali_Stunned) { + EnVali_SetupStunned(this); } } else { - if (this->actor.colChkInfo.damageReaction == 0xF) { - if (this->unk190 != func_80B27654) { + if (this->actor.colChkInfo.damageReaction == EN_VALI_DMG_REACT_SWORD_SLASH) { + if (this->actionFunc != EnVali_Stunned) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 150, COLORFILTER_BUFFLAG_XLU, 30); this->actor.params = 1; - func_80B26B18(this); + EnVali_SetupElectrify(this); } else { - func_80B26B4C(this); + EnVali_SetupDamaged(this); } - } else if (this->actor.colChkInfo.damageReaction == 2) { - func_80B26BF8(this); - } else if (this->actor.colChkInfo.damageReaction == 3) { - func_80B26DE0(this); - } else if (this->actor.colChkInfo.damageReaction == 0xE) { - if (this->unk195 == 0) { - this->unk195 = 0x14; + } else if (this->actor.colChkInfo.damageReaction == EN_VALI_DMG_REACT_FIRE) { + EnVali_SetupBurnt(this); + } else if (this->actor.colChkInfo.damageReaction == EN_VALI_DMG_REACT_ICE) { + EnVali_SetupFrozen(this); + } else if (this->actor.colChkInfo.damageReaction == EN_VALI_DMG_REACT_SLINGSHOT) { + if (this->spinTimer == 0) { + this->spinTimer = 20; } } else { - func_80B26B4C(this); + EnVali_SetupDamaged(this); } } } @@ -557,206 +553,226 @@ void EnVali_Update(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; s32 pad; - if ((this->unk3FC.base.atFlags & AT_HIT) || (this->unk2FC.base.atFlags & AT_HIT) || - (this->unk37C.base.atFlags & AT_HIT)) { - this->unk2FC.base.atFlags &= ~AT_HIT; - this->unk37C.base.atFlags &= ~AT_HIT; - this->unk3FC.base.atFlags &= ~AT_HIT; - func_80B26B18(this); - } - func_80B2790C(this, play); - this->unk190(this, play); - if ((this->unk190 != func_80B274A0) && (this->unk190 != func_80B27098)) { - Collider_UpdateCylinder(&this->actor, &this->unk3FC); - if (this->unk190 == func_80B2716C) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk2FC.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk37C.base); - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk3FC.base); + if ((this->collider.base.atFlags & AT_HIT) || (this->leftTentacleCollider.base.atFlags & AT_HIT) || + (this->rightTentacleCollider.base.atFlags & AT_HIT)) { + this->leftTentacleCollider.base.atFlags &= ~AT_HIT; + this->rightTentacleCollider.base.atFlags &= ~AT_HIT; + this->collider.base.atFlags &= ~AT_HIT; + EnVali_SetupElectrify(this); + } + EnVali_CheckCollide(this, play); + this->actionFunc(this, play); + if ((this->actionFunc != EnVali_Die) && (this->actionFunc != EnVali_WaitPlayerNear)) { + Collider_UpdateCylinder(&this->actor, &this->collider); + if (this->actionFunc == EnVali_Spin) { + CollisionCheck_SetAT(play, &play->colChkCtx, &this->leftTentacleCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->rightTentacleCollider.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } - if (this->unk3FC.base.acFlags & AC_ON) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk3FC.base); + if (this->collider.base.acFlags & AC_ON) { + CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk3FC.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_SetFocus(&this->actor, 0.0f); } } -void func_80B27C1C(EnVali* this, f32 arg1, Vec3f* arg2) { - f32 temp_fv0; - f32 temp_fv0_2; - f32 temp_fv1; - s32 var_v0; +void EnVali_GetHoodScale(EnVali* this, f32 frame, Vec3f* scale) { + f32 f; + s32 n; - if (this->unk190 == func_80B27318) { - var_v0 = 0x14 - (this->unk194 % 20); - if (var_v0 >= 0xA) { - var_v0 -= 0xA; + if (this->actionFunc == EnVali_Electrify) { + n = 20 - (this->electrifyTimer % 20); + if (n >= 10) { + n -= 10; } - arg2->y -= 0.2f * sinf(var_v0 * 0.31415927f); - } else if (this->unk190 == func_80B273D0) { - temp_fv0 = sinf(0.31415927f * arg1); - arg2->y -= 0.24f * temp_fv0; - arg2->x -= 0.13f * temp_fv0; - arg2->z = arg2->x; - } else if (this->unk190 == func_80B2742C) { - temp_fv0_2 = cosf(0.06283186f * arg1); - arg2->y -= 0.24f * temp_fv0_2; - arg2->x -= 0.13f * temp_fv0_2; - arg2->z = arg2->x; - } else if (this->unk190 == func_80B27654) { - temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; - arg2->x += temp_fv1; - arg2->y -= temp_fv1; - arg2->z += temp_fv1; + scale->y -= 0.2f * sinf(n * 0.31415927f); + } else if (this->actionFunc == EnVali_Damaged) { + f = sinf(0.31415927f * frame); + scale->y -= 0.24f * f; + scale->x -= 0.13f * f; + scale->z = scale->x; + } else if (this->actionFunc == EnVali_Recover) { + f = cosf(0.06283186f * frame); + scale->y -= 0.24f * f; + scale->x -= 0.13f * f; + scale->z = scale->x; + } else if (this->actionFunc == EnVali_Stunned) { + f = sinf(this->timer * 0.31415927f) * 0.08f; + scale->x += f; + scale->y -= f; + scale->z += f; } else { - if (arg1 >= 40.0f) { - arg1 -= 40.0f; + if (frame >= 40.0f) { + frame -= 40.0f; } - arg2->y -= 0.2f * sinf(0.07853982f * arg1); + scale->y -= 0.2f * sinf(0.07853982f * frame); } } -void func_80B27E38(EnVali* this, f32 arg1, Vec3f* arg2) { - f32 temp_fv0; - f32 temp_fv0_2; - f32 temp_fv1; - s32 var_v0; +void EnVali_GetCoreScale(EnVali* this, f32 frame, Vec3f* scale) { + f32 f; + s32 n; - if (this->unk190 == func_80B27318) { - var_v0 = 0x14 - (this->unk194 % 20); - if (var_v0 >= 0xA) { - var_v0 -= 0xA; + if (this->actionFunc == EnVali_Electrify) { + n = 0x14 - (this->electrifyTimer % 20); + if (n >= 0xA) { + n -= 0xA; } - arg2->y -= 0.13f * sinf(var_v0 * 0.31415927f); - } else if (this->unk190 == func_80B273D0) { - temp_fv0 = sinf(0.31415927f * arg1); - arg2->y -= 0.18f * temp_fv0; - arg2->x -= 0.1f * temp_fv0; - arg2->z = arg2->x; - } else if (this->unk190 == func_80B2742C) { - temp_fv0_2 = cosf(0.06283186f * arg1); - arg2->y -= 0.18f * temp_fv0_2; - arg2->x -= 0.1f * temp_fv0_2; - arg2->z = arg2->x; - } else if (this->unk190 == func_80B27654) { - temp_fv1 = sinf(this->unk196 * 0.31415927f) * 0.08f; - arg2->x -= temp_fv1; - arg2->y += temp_fv1; - arg2->z -= temp_fv1; + scale->y -= 0.13f * sinf(n * 0.31415927f); + } else if (this->actionFunc == EnVali_Damaged) { + f = sinf(0.31415927f * frame); + scale->y -= 0.18f * f; + scale->x -= 0.1f * f; + scale->z = scale->x; + } else if (this->actionFunc == EnVali_Recover) { + f = cosf(0.06283186f * frame); + scale->y -= 0.18f * f; + scale->x -= 0.1f * f; + scale->z = scale->x; + } else if (this->actionFunc == EnVali_Stunned) { + f = sinf(this->timer * 0.31415927f) * 0.08f; + scale->x -= f; + scale->y += f; + scale->z -= f; } else { - if (arg1 >= 40.0f) { - arg1 -= 40.0f; + if (frame >= 40.0f) { + frame -= 40.0f; } - arg2->y -= 0.13f * sinf(0.07853982f * arg1); + scale->y -= 0.13f * sinf(0.07853982f * frame); } } -s32 func_80B28054(EnVali* this, f32 arg1) { - f32 var_fv1; +s32 EnVali_UpdateTentaclesLengthFactor(EnVali* this, f32 frame) { + f32 target; - if (this->unk190 == func_80B2716C) { - if (arg1 <= 10.0f) { - var_fv1 = (arg1 * 0.05f) + 1.0f; - } else if (arg1 > 70.0f) { - var_fv1 = ((80.0f - arg1) * 0.05f) + 1.0f; + if (this->actionFunc == EnVali_Spin) { + if (frame <= 10.0f) { + target = (frame * 0.05f) + 1.0f; + } else if (frame > 70.0f) { + target = ((80.0f - frame) * 0.05f) + 1.0f; } else { - var_fv1 = 1.5f; + target = 1.5f; } - } else if (this->unk190 == func_80B273D0) { - var_fv1 = 1.0f - (sinf(0.31415927f * arg1) * 0.35f); - } else if (this->unk190 == func_80B2742C) { - var_fv1 = 1.0f - (cosf(0.06283186f * arg1) * 0.35f); - } else if ((this->unk190 == func_80B27318) || (this->unk190 == func_80B27710)) { - var_fv1 = this->unk2F4; + } else if (this->actionFunc == EnVali_Damaged) { + target = 1.0f - (sinf(0.31415927f * frame) * 0.35f); + } else if (this->actionFunc == EnVali_Recover) { + target = 1.0f - (cosf(0.06283186f * frame) * 0.35f); + } else if ((this->actionFunc == EnVali_Electrify) || (this->actionFunc == EnVali_Frozen)) { + target = this->tentaclesLengthFactor; } else { - var_fv1 = 1.0f; + target = 1.0f; } - Math_StepToF(&this->unk2F4, var_fv1, 0.1f); - if (this->unk2F4 == 1.0f) { - return 0; + Math_StepToF(&this->tentaclesLengthFactor, target, 0.1f); + if (this->tentaclesLengthFactor == 1.0f) { + return false; } else { - return 1; + return true; } } -s32 func_80B281F0(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx, Gfx** gfx) { +s32 EnVali_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfx) { EnVali* this = thisx; - f32 new_var; + f32 animCurFrame; - if ((arg1 == 2) || (arg1 == 0x1C) || (arg1 == 0x1B)) { - *arg2 = NULL; - return 0; + if ((limbIndex == BARI_LIMB_NUCLEUS) || (limbIndex == BARI_LIMB_HOOD) || (limbIndex == BARI_LIMB_CORE)) { + *dList = NULL; + return false; } else { - new_var = this->skelAnime.curFrame; - if (((arg1 == 9) || (arg1 == 0x12)) && (func_80B28054(this, new_var) != 0)) { - Matrix_Scale(this->unk2F4, 1.0f, 1.0f, MTXMODE_APPLY); + animCurFrame = this->skelAnime.curFrame; + if (((limbIndex == BARI_LIMB_LEFT_TENTACLE_ROOT) || (limbIndex == BARI_LIMB_RIGHT_TENTACLE_ROOT)) && + EnVali_UpdateTentaclesLengthFactor(this, animCurFrame)) { + Matrix_Scale(this->tentaclesLengthFactor, 1.0f, 1.0f, MTXMODE_APPLY); } - return 0; + return false; } } -void func_80B28280(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx, Gfx** gfx) { - Vec3f sp3C; - Vec3f sp30; +void EnVali_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { + static Vec3f D_80B28970 = { 3000.0f, 0.0f, 0.0f }; + static Vec3f D_80B2897C = { -1000.0f, 0.0f, 0.0f }; + Vec3f tentacleTipPos; + Vec3f tentacleBasePos; EnVali* this = thisx; - if (this->unk190 == func_80B2716C) { - switch (arg1) { - case 0xB: - case 0x14: - Matrix_MultVec3f(&D_80B28970, &sp3C); - Matrix_MultVec3f(&D_80B2897C, &sp30); - if (arg1 == 0xB) { - Collider_SetQuadVertices(&this->unk2FC, &sp30, &sp3C, this->unk2FC.dim.quad, - &this->unk2FC.dim.quad[1]); + if (this->actionFunc == EnVali_Spin) { + switch (limbIndex) { + case BARI_LIMB_LEFT_TENTACLE_BODY_ROOT: + case BARI_LIMB_RIGHT_TENTACLE_BODY_ROOT: + Matrix_MultVec3f(&D_80B28970, &tentacleTipPos); + Matrix_MultVec3f(&D_80B2897C, &tentacleBasePos); + if (limbIndex == BARI_LIMB_LEFT_TENTACLE_BODY_ROOT) { + Collider_SetQuadVertices(&this->leftTentacleCollider, &tentacleBasePos, &tentacleTipPos, + &this->leftTentacleCollider.dim.quad[0], + &this->leftTentacleCollider.dim.quad[1]); } else { - Collider_SetQuadVertices(&this->unk37C, &sp30, &sp3C, this->unk37C.dim.quad, - &this->unk37C.dim.quad[1]); + Collider_SetQuadVertices(&this->rightTentacleCollider, &tentacleBasePos, &tentacleTipPos, + &this->rightTentacleCollider.dim.quad[0], + &this->rightTentacleCollider.dim.quad[1]); } break; } } } -void func_80B28344(EnVali* this, PlayState* play) { - MtxF sp80; - f32 sp7C; - f32 sp78; - f32 sp74; - Vec3f sp68; +void EnVali_DrawBody(EnVali* this, PlayState* play) { + MtxF mf; + f32 cosYaw; + f32 sinYaw; + f32 animCurFrame; + Vec3f scale = { 1.0f, 1.0f, 1.0f }; - sp68 = D_80B28988; OPEN_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1428); - Matrix_Get(&sp80); - sp74 = this->skelAnime.curFrame; - func_80B27E38(this, sp74, &sp68); - Matrix_Scale(sp68.x, sp68.y, sp68.z, 1U); + + Matrix_Get(&mf); + + animCurFrame = this->skelAnime.curFrame; + EnVali_GetCoreScale(this, animCurFrame, &scale); + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1436); - gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002610); - Matrix_Put(&sp80); + gSPDisplayList(POLY_XLU_DISP++, gBariCoreDL); + + Matrix_Put(&mf); + Matrix_RotateY(BINANG_TO_RAD(-this->actor.shape.rot.y), MTXMODE_APPLY); - sp7C = Math_CosS(this->actor.shape.rot.y); - sp78 = Math_SinS(this->actor.shape.rot.y); + cosYaw = Math_CosS(this->actor.shape.rot.y); + sinYaw = Math_SinS(this->actor.shape.rot.y); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1446); - gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002740); - Matrix_Translate((506.0f * sp7C) + (372.0f * sp78), 1114.0f, (372.0f * sp7C) - (506.0f * sp78), MTXMODE_APPLY); + gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); + Matrix_Translate((506.0f * cosYaw) + (372.0f * sinYaw), 1114.0f, (372.0f * cosYaw) - (506.0f * sinYaw), + MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1455); - gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002740); - Matrix_Translate((-964.0f * sp7C) - (804.0f * sp78), -108.0f, (-804.0f * sp7C) + (964.0f * sp78), MTXMODE_APPLY); + gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); + Matrix_Translate((-964.0f * cosYaw) - (804.0f * sinYaw), -108.0f, (-804.0f * cosYaw) + (964.0f * sinYaw), + MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1463); - gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_002740); - Matrix_Put(&sp80); - sp68.z = 1.0f; - sp68.y = 1.0f; - sp68.x = 1.0f; - func_80B27C1C(this, sp74, &sp68); - Matrix_Scale(sp68.x, sp68.y, sp68.z, MTXMODE_APPLY); + gSPDisplayList(POLY_XLU_DISP++, gBariNucleusDL); + + Matrix_Put(&mf); + + scale.x = scale.y = scale.z = 1.0f; + EnVali_GetHoodScale(this, animCurFrame, &scale); + Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_vali.c", 1471); - gSPDisplayList(POLY_XLU_DISP++, object_vali_DL_0027D8); - Matrix_Put(&sp80); + gSPDisplayList(POLY_XLU_DISP++, gBariHoodDL); + + Matrix_Put(&mf); + CLOSE_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1477); } +static Gfx sBariCoreInvertTexCombinerDL[] = { + gsDPSetCombineLERP(1, TEXEL0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, + PRIM_LOD_FRAC, COMBINED), + gsSPEndDisplayList(), +}; +static Gfx sBariCoreNormalCombinerDL[] = { + gsDPSetCombineLERP(TEXEL0, 0, SHADE, 0, TEXEL0, 0, PRIMITIVE, 0, COMBINED, 0, PRIMITIVE, 0, TEXEL1, 0, + PRIM_LOD_FRAC, COMBINED), + gsSPEndDisplayList(), +}; + void EnVali_Draw(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; s32 pad; @@ -764,14 +780,14 @@ void EnVali_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1505); Gfx_SetupDL_25Xlu(play->state.gfxCtx); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TexScroll(play->state.gfxCtx, 0U, (0x7F - (play->gameplayFrames * 0xC)) & 0x7F, 32, 32)); - if (this->unk194 & 1) { - gSPSegment(POLY_XLU_DISP++, 9, D_80B28998); + Gfx_TexScroll(play->state.gfxCtx, 0, (0x7F - (play->gameplayFrames * 12)) & 0x7F, 32, 32)); + if (this->electrifyTimer & 1) { + gSPSegment(POLY_XLU_DISP++, 9, sBariCoreInvertTexCombinerDL); } else { - gSPSegment(POLY_XLU_DISP++, 9, D_80B289A8); + gSPSegment(POLY_XLU_DISP++, 9, sBariCoreNormalCombinerDL); } - func_80B28344(this, play); - POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80B281F0, - func_80B28280, this, POLY_XLU_DISP); + EnVali_DrawBody(this, play); + POLY_XLU_DISP = SkelAnime_Draw(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnVali_OverrideLimbDraw, + EnVali_PostLimbDraw, this, POLY_XLU_DISP); CLOSE_DISPS(play->state.gfxCtx, "../z_en_vali.c", 1538); } 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 5c1806197c4..11283789e1b 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -4,22 +4,24 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_vali/object_vali.h" + struct EnVali; typedef struct EnVali { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ void (*unk190)(struct EnVali*, struct PlayState*); - /* 0x194 */ u8 unk194; - /* 0x195 */ u8 unk195; - /* 0x196 */ s16 unk196; - /* 0x198 */ Vec3s jointTable[29]; - /* 0x246 */ Vec3s morphTable[29]; - /* 0x2F4 */ f32 unk2F4; - /* 0x2F8 */ f32 unk2F8; - /* 0x2FC */ ColliderQuad unk2FC; - /* 0x37C */ ColliderQuad unk37C; - /* 0x3FC */ ColliderCylinder unk3FC; + /* 0x190 */ void (*actionFunc)(struct EnVali*, struct PlayState*); + /* 0x194 */ u8 electrifyTimer; + /* 0x195 */ u8 spinTimer; + /* 0x196 */ s16 timer; + /* 0x198 */ Vec3s jointTable[BARI_LIMB_MAX]; + /* 0x246 */ Vec3s morphTable[BARI_LIMB_MAX]; + /* 0x2F4 */ f32 tentaclesLengthFactor; + /* 0x2F8 */ f32 spinHeight; + /* 0x2FC */ ColliderQuad leftTentacleCollider; + /* 0x37C */ ColliderQuad rightTentacleCollider; + /* 0x3FC */ ColliderCylinder collider; } EnVali; // size = 0x448 #endif From 27c516d573767b1e429e6e6005338ea77eeaf9ea Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 12:05:39 +0200 Subject: [PATCH 081/150] ENZF_TYPE_LIZALFOS_PAIRED_ -> ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_ --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 10 +++++----- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) 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 c8784b3b8b2..158d3d757f5 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -131,10 +131,10 @@ static Vec3f sDCPlatformPositions[] = { static s16 sPairedActiveFleeFlag = 0; /** * When a pair is spawned, this tracks the type of the inactive / background / not fighting one - * (ENZF_TYPE_LIZALFOS_PAIRED_A or ENZF_TYPE_LIZALFOS_PAIRED_B). + * (ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_A or ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_B). * When no pair, or once one of the pair is defeated, this is ENZF_TYPE_LIZALFOS_SINGLE. */ -static s16 sPairedInactiveType = ENZF_TYPE_LIZALFOS_PAIRED_B; +static s16 sPairedInactiveType = ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_B; ActorProfile En_Zf_Profile = { /**/ ACTOR_EN_ZF, @@ -412,7 +412,7 @@ void EnZf_Init(Actor* thisx, PlayState* play) { if ((ABS(yDiff) <= 100.0f) && !Flags_GetSwitch(play, this->switchFlag)) { this->homePlatform = this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, 0); EnZf_SetupWaitAppear(this); - sPairedInactiveType = ENZF_TYPE_LIZALFOS_PAIRED_B; + sPairedInactiveType = ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_B; } else { Actor_Kill(&this->actor); } @@ -713,7 +713,7 @@ void EnZf_WaitAppear(EnZf* this, PlayState* play) { if (this->timer == 1) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_CRY); this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - if (this->actor.params == ENZF_TYPE_LIZALFOS_PAIRED_A) { + if (this->actor.params == ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_A) { func_800F5ACC(NA_BGM_MINI_BOSS); } } @@ -743,7 +743,7 @@ void EnZf_WaitAppear(EnZf* this, PlayState* play) { } if (SkelAnime_Update(&this->skelAnime)) { this->alpha = 255; - if (this->actor.params >= ENZF_TYPE_LIZALFOS_PAIRED_B) { + if (this->actor.params >= ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_B) { EnZf_Paired_SetupJumpAwayStartTurnAround(this, play); } else { EnZf_SetupIdle(this); 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 f36a5271734..692825531ef 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -9,11 +9,11 @@ typedef enum EnZfType { /* -2 */ ENZF_TYPE_DINOLFOS = -2, /* -1 */ ENZF_TYPE_LIZALFOS_SINGLE, - /* 0 */ ENZF_TYPE_LIZALFOS_PAIRED_A, - /* 1 */ ENZF_TYPE_LIZALFOS_PAIRED_B + /* 0 */ ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_A, + /* 1 */ ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_B } EnZfType; -#define ENZF_IS_TYPE_PAIRED(type) ((type) >= ENZF_TYPE_LIZALFOS_PAIRED_A) +#define ENZF_IS_TYPE_PAIRED(type) ((type) >= ENZF_TYPE_LIZALFOS_PAIRED_MINIBOSS_A) struct EnZf; From 2b5a1cea0ef1628e90716d6e3fd4b6a2145929d0 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 16:47:24 +0200 Subject: [PATCH 082/150] doc BgDyYoseizo --- assets/xml/objects/object_dy_obj.xml | 2 +- include/save.h | 8 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 996 +++++++++--------- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 102 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.c | 72 +- .../actors/ovl_En_Dy_Extra/z_en_dy_extra.h | 10 +- 6 files changed, 613 insertions(+), 577 deletions(-) diff --git a/assets/xml/objects/object_dy_obj.xml b/assets/xml/objects/object_dy_obj.xml index 42b2f6340ad..dfad6acf07f 100644 --- a/assets/xml/objects/object_dy_obj.xml +++ b/assets/xml/objects/object_dy_obj.xml @@ -105,7 +105,7 @@ - + diff --git a/include/save.h b/include/save.h index 7628d39093c..a9b79d94376 100644 --- a/include/save.h +++ b/include/save.h @@ -753,10 +753,10 @@ typedef enum LinkAge { #define ITEMGETINF_17 0x17 // ITEMGETINF 0x18-0x1A -#define ITEMGETINF_INDEX_18_19_1A 1 -#define ITEMGETINF_18 0x18 -#define ITEMGETINF_19 0x19 -#define ITEMGETINF_1A 0x1A +#define ITEMGETINF_INDEX_SPELLS 1 +#define ITEMGETINF_FARORES_WIND 0x18 +#define ITEMGETINF_DINS_FIRE 0x19 +#define ITEMGETINF_NAYRUS_LOVE 0x1A #define ITEMGETINF_1B 0x1B #define ITEMGETINF_1C 0x1C 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 307a2bc8a2d..cb9bccc972e 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 @@ -5,6 +5,8 @@ */ #include "z_bg_dy_yoseizo.h" +#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h" +#include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h" #include "overlays/actors/ovl_En_Ex_Item/z_en_ex_item.h" @@ -38,28 +40,41 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2); void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play); void BgDyYoseizo_Update(Actor* thisx, PlayState* play2); -void func_80872D20(BgDyYoseizo* this, PlayState* play); -void func_80872DE4(BgDyYoseizo* this, PlayState* play); -void func_8087328C(BgDyYoseizo* this, PlayState* play); -void func_80873380(BgDyYoseizo* this, PlayState* play); -void func_808734DC(BgDyYoseizo* this, PlayState* play); -void func_8087358C(BgDyYoseizo* this, PlayState* play); -void func_808736A4(BgDyYoseizo* this, PlayState* play); -void func_80873780(BgDyYoseizo* this, PlayState* play); -void func_80873868(BgDyYoseizo* this, PlayState* play); -void func_80873B3C(BgDyYoseizo* this, PlayState* play); -void func_80873C14(BgDyYoseizo* this, PlayState* play); -void func_80873D14(BgDyYoseizo* this, PlayState* play); -void func_80873E04(BgDyYoseizo* this, PlayState* play); -void func_80873EA4(BgDyYoseizo* this, PlayState* play); -void func_80873FD8(BgDyYoseizo* this, PlayState* play); -void func_80874304(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_WaitSong(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupCutscene(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_SetupAppear(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_Appear(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_FinishAppear(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_SetupTalk(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_Talk(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_SetupRefillPlayerEnergy(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_RefillPlayerEnergy(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Revisit_WaitTalkEnd(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_SetupDisappear(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Disappear(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Kill(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Reward_WaitCutscene(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Reward_Appear(BgDyYoseizo* this, PlayState* play); +void BgDyYoseizo_Reward_GiveReward(BgDyYoseizo* this, PlayState* play); void BgDyYoseizo_Draw(Actor* thisx, PlayState* play); void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f*, Vec3f*, Vec3f*, Color_RGB8*, Color_RGB8*, f32, s16, s16); void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play); void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play); +typedef enum BgDyYoseizoRewardSpell { + BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND, + BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE, + BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE +} BgDyYoseizoRewardSpell; + +typedef enum BgDyYoseizoRewardMagic { + BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC, + BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC, + BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE +} BgDyYoseizoRewardMagic; + static s32 D_80875440[3] = { 0x5D, 0x5E, 0x5C }; + ActorProfile Bg_Dy_Yoseizo_Profile = { /**/ ACTOR_BG_DY_YOSEIZO, /**/ ACTORCAT_PROP, @@ -71,57 +86,32 @@ ActorProfile Bg_Dy_Yoseizo_Profile = { /**/ BgDyYoseizo_Update, /**/ NULL, }; -static Color_RGB8 D_8087546C[9] = { - { 0xFF, 0xFF, 0xFF }, { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0xFF, 0xFF, 0xAA }, - { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0xFF, 0xFF, 0xAA }, -}; -static Color_RGB8 D_80875488[9] = { - { 0x9B, 0xFF, 0xFF }, { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0xFF, 0x64, 0xFF }, - { 0xFF, 0xFF, 0x64 }, { 0x64, 0xFF, 0x64 }, { 0xFF, 0x64, 0x64 }, { 0x64, 0xFF, 0xFF }, -}; -static Vec3f D_808754A4 = { 0.0f, 0.0f, 0.0f }; -static s16 D_808754B0[4] = { 2, 0, 1, 0 }; -static s16 D_808754B8[4] = { 0x11, 0x10, 0x12, 0 }; -static s16 D_808754C0[] = { ITEMGETINF_MASK(ITEMGETINF_18), ITEMGETINF_MASK(ITEMGETINF_19), - ITEMGETINF_MASK(ITEMGETINF_1A) }; -static u8 D_808754C8[4] = { 0xD, 5, 0x13, 0 }; - -static void* D_808754CC[] = { - gGreatFairyEyeOpenTex, - gGreatFairyEyeHalfTex, - gGreatFairyEyeClosedTex, -}; - -static void* D_808754D8[] = { - gGreatFairyMouthClosedTex, - gGreatFairyMouthOpenTex, -}; void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; PlayState* play = play2; - this->unk2EC = (s16)play->spawn; - if (this->unk2EC < 0) { - this->unk2EC = 0; + this->reward = play->spawn; + if (this->reward < 0) { + this->reward = 0; } - this->unk310 = this->actor.world.pos.y; - this->unk30C = this->actor.world.pos.y + 40.0f; + this->homePosY = this->actor.world.pos.y; + this->aboveFountainY = this->actor.world.pos.y + 40.0f; this->actor.focus.pos = this->actor.world.pos; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - PRINTF("\x1b[32m☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n\x1b[m", play->spawn); - SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, this->unk194, - this->unk23C, 28); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 大妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->spawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, + this->jointTable, this->morphTable, 28); #if OOT_VERSION < NTSC_1_1 - if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->unk2EC != 0)) { + if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->reward_ != BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC)) { Actor_Kill(&this->actor); return; } #endif } else { - PRINTF("\x1b[32m☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n\x1b[m", play->spawn); - SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, this->unk194, - this->unk23C, 28); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 石妖精の泉 ☆☆☆☆☆ %d\n" VT_RST, play->spawn); + SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairyLayingDownTransitionAnim, + this->jointTable, this->morphTable, 28); #if OOT_VERSION < NTSC_1_1 if (!gSaveContext.save.info.playerData.isMagicAcquired) { Actor_Kill(&this->actor); @@ -130,85 +120,126 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { #endif } #if OOT_VERSION < NTSC_1_1 - this->actionFunc = func_80872DE4; + this->actionFunc = BgDyYoseizo_SetupCutscene_; #else - this->actionFunc = func_80872D20; + this->actionFunc = BgDyYoseizo_WaitSong; #endif } void BgDyYoseizo_Destroy(Actor* thisx, PlayState* play) { } -void func_80872960(BgDyYoseizo* this, PlayState* play, s16 arg2) { - Vec3f spC4; - Vec3f spB8; - Vec3f spAC; - Color_RGB8 spA8; - Color_RGB8 spA4; - f32 temp_fs0; - f32 var_fs2; - s32 var_s1; - s32 var_s2; - s32 var_s3; - - spC4 = D_808754A4; - if (!(this->unk308 < 0.01f)) { - temp_fs0 = this->unk308 * 3500.0f; - spB8.x = Rand_ZeroOne() - 0.5f; - spB8.y = Rand_ZeroOne() - 0.5f; - spB8.z = Rand_ZeroOne() - 0.5f; - for (var_s3 = 0; var_s3 < 2; var_s3++) { - if (arg2 == 0) { - var_s1 = 0; - var_fs2 = 0.4f; - var_s2 = 0x5A; - spAC.x = this->actor.world.pos.x; - spAC.y = this->actor.world.pos.y + temp_fs0 + (temp_fs0 * 0.5f * (Rand_ZeroOne() - 0.5f)); - spAC.z = this->actor.world.pos.z + 30.0f; +static Color_RGB8 sInnerColors[9] = { + { 255, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 }, + { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 255, 170 }, +}; +static Color_RGB8 sOuterColors[9] = { + { 155, 255, 255 }, { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 255, 100, 255 }, + { 255, 255, 100 }, { 100, 255, 100 }, { 255, 100, 100 }, { 100, 255, 255 }, +}; + +void BgDyYoseizo_SpawnEffectsType(BgDyYoseizo* this, PlayState* play, s16 effType) { + Vec3f vel = { 0.0f, 0.0f, 0.0f }; + Vec3f accel; + Vec3f pos; + Color_RGB8 innerColor; + Color_RGB8 outerColor; + f32 yOffset; + f32 scale; + s32 type; + s32 life; + s32 i; + + if (!(this->scale < 0.01f)) { + yOffset = this->scale * 3500.0f; + accel.x = Rand_ZeroOne() - 0.5f; + accel.y = Rand_ZeroOne() - 0.5f; + accel.z = Rand_ZeroOne() - 0.5f; + for (i = 0; i < 2; i++) { + if (effType == 0) { + type = 0; + scale = 0.4f; + life = 90; + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + yOffset + (yOffset * 0.5f * (Rand_ZeroOne() - 0.5f)); + pos.z = this->actor.world.pos.z + 30.0f; } else { - var_fs2 = 0.2f; - var_s2 = 0x32; - var_s1 = arg2; - spAC.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; + scale = 0.2f; + life = 50; + type = effType; + pos.x = Rand_CenteredFloat(10.0f) + this->actor.world.pos.x; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - spAC.y = this->actor.world.pos.y + temp_fs0 + 50.0f + (temp_fs0 * 0.1f * (Rand_ZeroOne() - 0.5f)); - spAC.z = this->actor.world.pos.z + 30.0f; + pos.y = this->actor.world.pos.y + yOffset + 50.0f + (yOffset * 0.1f * (Rand_ZeroOne() - 0.5f)); + pos.z = this->actor.world.pos.z + 30.0f; } else { - spAC.y = this->actor.world.pos.y + temp_fs0 - 30.0f + (temp_fs0 * 0.1f * (Rand_ZeroOne() - 0.5f)); - spAC.z = this->actor.world.pos.z + 60.0f; + pos.y = this->actor.world.pos.y + yOffset - 30.0f + (yOffset * 0.1f * (Rand_ZeroOne() - 0.5f)); + pos.z = this->actor.world.pos.z + 60.0f; } if (LINK_IS_ADULT) { - spAC.y += 20.0f; + pos.y += 20.0f; } } - spA8.r = D_8087546C[var_s1].r; - spA8.g = D_8087546C[var_s1].g; - spA8.b = D_8087546C[var_s1].b; - spA4.r = D_80875488[var_s1].r; - spA4.g = D_80875488[var_s1].g; - spA4.b = D_80875488[var_s1].b; - BgDyYoseizo_SpawnEffect(this, &spAC, &spC4, &spB8, &spA8, &spA4, var_fs2, var_s2, var_s1); + innerColor.r = sInnerColors[type].r; + innerColor.g = sInnerColors[type].g; + innerColor.b = sInnerColors[type].b; + outerColor.r = sOuterColors[type].r; + outerColor.g = sOuterColors[type].g; + outerColor.b = sOuterColors[type].b; + BgDyYoseizo_SpawnEffect(this, &pos, &vel, &accel, &innerColor, &outerColor, scale, life, type); } } } -void func_80872C58(BgDyYoseizo* this, PlayState* play) { - this->unk31C = this->unk30C + this->unk320; - Math_ApproachF(&this->actor.world.pos.y, this->unk31C, 0.1f, 10.0f); - Math_ApproachF(&this->unk320, 10.0f, 0.1f, 0.5f); +static s16 sSpellRewardsDemoEffectLightColor[3] = { + DEMO_EFFECT_LIGHT_GREEN, // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND + DEMO_EFFECT_LIGHT_RED, // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE + DEMO_EFFECT_LIGHT_BLUE, // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE +}; +static s16 sSpellRewardsEnExItemParams[3] = { + EXITEM_MAGIC_WIND, // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND + EXITEM_MAGIC_FIRE, // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE + EXITEM_MAGIC_DARK, // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE +}; +static s16 sSpellRewardsItemGetInfMask[3] = { + ITEMGETINF_MASK(ITEMGETINF_FARORES_WIND), // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND + ITEMGETINF_MASK(ITEMGETINF_DINS_FIRE), // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE + ITEMGETINF_MASK(ITEMGETINF_NAYRUS_LOVE), // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE +}; +static u8 sSpellRewardsItem[3] = { + ITEM_FARORES_WIND, // BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND + ITEM_DINS_FIRE, // BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE + ITEM_NAYRUS_LOVE, // BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE +}; + +static void* sEyeTextures[] = { + gGreatFairyEyeOpenTex, + gGreatFairyEyeHalfTex, + gGreatFairyEyeClosedTex, +}; + +static void* sMouthTextures[] = { + gGreatFairyMouthClosedTex, + gGreatFairyMouthOpenTex, +}; + +void BgDyYoseizo_UpdatePosY(BgDyYoseizo* this, PlayState* play) { + this->targetPosY = this->aboveFountainY + this->offsetY; + Math_ApproachF(&this->actor.world.pos.y, this->targetPosY, 0.1f, 10.0f); + Math_ApproachF(&this->offsetY, 10.0f, 0.1f, 0.5f); if (play->csCtx.state == CS_STATE_IDLE) { - this->actor.velocity.y = Math_SinS((s16)(s32)this->unk324); + this->actor.velocity.y = Math_SinS(TRUNCF_BINANG(this->yVelocityPhase)); } else { - this->actor.velocity.y = Math_SinS((s16)(s32)this->unk324) * 0.4f; + this->actor.velocity.y = Math_SinS(TRUNCF_BINANG(this->yVelocityPhase)) * 0.4f; } } #if OOT_VERSION >= NTSC_1_1 -void func_80872D20(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_WaitSong(BgDyYoseizo* this, PlayState* play) { if (Flags_GetSwitch(play, 0x38)) { play->msgCtx.ocarinaMode = OCARINA_MODE_04; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->unk2EC != 0)) { + if (!gSaveContext.save.info.playerData.isMagicAcquired && + (this->reward != BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC)) { Actor_Kill(&this->actor); return; } @@ -219,13 +250,13 @@ void func_80872D20(BgDyYoseizo* this, PlayState* play) { } } Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - this->actionFunc = func_80872DE4; + this->actionFunc = BgDyYoseizo_SetupCutscene; } } #endif -void func_80872DE4(BgDyYoseizo* this, PlayState* play) { - s32 var_v1; +void BgDyYoseizo_SetupCutscene(BgDyYoseizo* this, PlayState* play) { + s32 isNewAcquire; #if OOT_VERSION < NTSC_1_1 if (!Flags_GetSwitch(play, 0x38)) { @@ -239,94 +270,94 @@ void func_80872DE4(BgDyYoseizo* this, PlayState* play) { #endif Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - PRINTF("\x1b[33m☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n\x1b[m", play->msgCtx.ocarinaMode); - var_v1 = 0; + PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ もうど ☆☆☆☆☆ %d\n" VT_RST, play->msgCtx.ocarinaMode); + isNewAcquire = false; if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - switch (this->unk2EC) { - case 0: - if (!GET_ITEMGETINF(ITEMGETINF_18)) { - var_v1 = 1; + switch (this->reward) { + case BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND: + if (!GET_ITEMGETINF(ITEMGETINF_FARORES_WIND)) { + isNewAcquire = true; } break; - case 1: - if (!GET_ITEMGETINF(ITEMGETINF_19)) { - var_v1 = 1; + case BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE: + if (!GET_ITEMGETINF(ITEMGETINF_DINS_FIRE)) { + isNewAcquire = true; } break; - case 2: - if (!GET_ITEMGETINF(ITEMGETINF_1A)) { - var_v1 = 1; + case BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE: + if (!GET_ITEMGETINF(ITEMGETINF_NAYRUS_LOVE)) { + isNewAcquire = true; } break; } } else { - switch (this->unk2EC) { - case 0: - if (!gSaveContext.save.info.playerData.isMagicAcquired || (gRegEditor->data[0x962] != 0)) { - PRINTF("\x1b[32m ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n\x1b[m"); - var_v1 = 1; - this->unk2EA = 1; + switch (this->reward) { + case BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC: + if (!gSaveContext.save.info.playerData.isMagicAcquired || (BREG(2) != 0)) { + PRINTF(VT_FGCOL(GREEN) " ☆☆☆☆☆ 回転切り速度UP ☆☆☆☆☆ \n" VT_RST); + isNewAcquire = true; + this->isNewAcquireMagic = true; } break; - case 1: + case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC: if (!gSaveContext.save.info.playerData.isDoubleMagicAcquired) { - PRINTF("\x1b[33m ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n\x1b[m"); - this->unk2EA = 1; - var_v1 = 1; + PRINTF(VT_FGCOL(YELLOW) " ☆☆☆☆☆ 魔法ゲージメーター倍増 ☆☆☆☆☆ \n" VT_RST); + this->isNewAcquireMagic = true; + isNewAcquire = true; } break; - case 2: + case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE: if (!gSaveContext.save.info.playerData.isDoubleDefenseAcquired) { - PRINTF("\x1b[35m ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n\x1b[m"); - this->unk2EA = 1; - var_v1 = 1; + PRINTF(VT_FGCOL(MAGENTA) " ☆☆☆☆☆ ダメージ半減 ☆☆☆☆☆ \n" VT_RST); + this->isNewAcquireMagic = true; + isNewAcquire = true; } break; } } - if (var_v1 != 0) { + if (isNewAcquire) { if (!IS_CUTSCENE_LAYER || !DEBUG_FEATURES) { if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - switch (this->unk2EC) { - case 0: + switch (this->reward) { + case BG_DY_YOSEIZO_REWARD_SPELL_FARORES_WIND: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyFaroresWindCs); gSaveContext.cutsceneTrigger = 1; break; - case 1: + case BG_DY_YOSEIZO_REWARD_SPELL_DINS_FIRE: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDinsFireCs); gSaveContext.cutsceneTrigger = 1; break; - case 2: + case BG_DY_YOSEIZO_REWARD_SPELL_NAYRUS_LOVE: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyNayrusLoveCs); gSaveContext.cutsceneTrigger = 1; break; } } else { - switch (this->unk2EC) { - case 0: + switch (this->reward) { + case BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyMagicCs); gSaveContext.cutsceneTrigger = 1; break; - case 1: + case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleMagicCs); gSaveContext.cutsceneTrigger = 1; break; - case 2: + case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE: play->csCtx.script = SEGMENTED_TO_VIRTUAL(gGreatFairyDoubleDefenseCs); gSaveContext.cutsceneTrigger = 1; break; } } } - this->actionFunc = func_80873EA4; + this->actionFunc = BgDyYoseizo_Reward_WaitCutscene; } else { play->envCtx.lightSettingOverride = 2; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { @@ -336,41 +367,41 @@ void func_80872DE4(BgDyYoseizo* this, PlayState* play) { } Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); this->actor.draw = BgDyYoseizo_Draw; - this->actionFunc = func_8087328C; + this->actionFunc = BgDyYoseizo_Revisit_SetupAppear; } } -void func_8087328C(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Revisit_SetupAppear(BgDyYoseizo* this, PlayState* play) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_ONCE, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); } Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - this->actionFunc = func_80873380; + this->actionFunc = BgDyYoseizo_Revisit_Appear; } -void func_80873380(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Revisit_Appear(BgDyYoseizo* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - Math_ApproachF(&this->actor.world.pos.y, this->unk30C, this->unk314, 100.0f); - Math_ApproachF(&this->unk308, 0.035f, this->unk318, 0.005f); - Math_ApproachF(&this->unk314, 0.8f, 0.1f, 0.02f); - Math_ApproachF(&this->unk318, 0.2f, 0.03f, 0.05f); - if (this->unk308 >= 0.034f) { - if ((this->actor.shape.rot.y >= -0x1F3F) && (this->actor.shape.rot.y < 0x3E8)) { + Math_ApproachF(&this->actor.world.pos.y, this->aboveFountainY, this->yApproachFraction, 100.0f); + Math_ApproachF(&this->scale, 0.035f, this->scaleApproachFraction, 0.005f); + Math_ApproachF(&this->yApproachFraction, 0.8f, 0.1f, 0.02f); + Math_ApproachF(&this->scaleApproachFraction, 0.2f, 0.03f, 0.05f); + if (this->scale >= 0.034f) { + if ((this->actor.shape.rot.y > -0x1F40) && (this->actor.shape.rot.y < 0x3E8)) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, 0, 5, 0x3E8, 0); if (fabsf(this->actor.shape.rot.y) < 50.0f) { - this->actionFunc = func_808734DC; + this->actionFunc = BgDyYoseizo_Revisit_FinishAppear; } } else { this->actor.shape.rot.y += 0xBB8; @@ -378,211 +409,213 @@ void func_80873380(BgDyYoseizo* this, PlayState* play) { } else { this->actor.shape.rot.y += 0xBB8; } - func_80872960(this, play, 0); + BgDyYoseizo_SpawnEffectsType(this, play, 0); } -void func_808734DC(BgDyYoseizo* this, PlayState* play) { - f32 sp1C; +void BgDyYoseizo_Revisit_FinishAppear(BgDyYoseizo* this, PlayState* play) { + f32 animPrevFrame; - sp1C = this->skelAnime.curFrame; + animPrevFrame = this->skelAnime.curFrame; #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - if ((this->unk32C * 1273.0f) <= this->unk324) { - this->unk324 = 0.0f; + if ((this->curAnimLastFrame * 1273.0f) <= this->yVelocityPhase) { + this->yVelocityPhase = 0.0f; } SkelAnime_Update(&this->skelAnime); - if ((this->unk32C <= sp1C) && (this->unk2FC == 0)) { - this->actionFunc = func_8087358C; + if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) { + this->actionFunc = BgDyYoseizo_Revisit_SetupTalk; } } -void func_8087358C(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Revisit_SetupTalk(BgDyYoseizo* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairySittingAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, -10.0f); - } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_LOOP, -10.0f); + } else { + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_LOOP, -10.0f); } this->actor.textId = 0xDB; - this->unk2EE = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; Message_StartTextbox(play, this->actor.textId, NULL); - func_80872960(this, play, 0); - this->actionFunc = func_808736A4; + BgDyYoseizo_SpawnEffectsType(this, play, 0); + this->actionFunc = BgDyYoseizo_Revisit_Talk; } -void func_808736A4(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Revisit_Talk(BgDyYoseizo* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif - this->unk324 = this->skelAnime.curFrame * 1273.0f; - if (this->unk324 >= (this->unk32C * 1273.0f)) { - this->unk324 = 0.0f; + this->yVelocityPhase = this->skelAnime.curFrame * 1273.0f; + if (this->yVelocityPhase >= (this->curAnimLastFrame * 1273.0f)) { + this->yVelocityPhase = 0.0f; } SkelAnime_Update(&this->skelAnime); - if ((this->unk2EE == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_A_HEARTS_MAGIC_FORCE); - this->actionFunc = func_80873780; + this->actionFunc = BgDyYoseizo_Revisit_SetupRefillPlayerEnergy; } - func_80872C58(this, play); - func_80872960(this, play, 0); + BgDyYoseizo_UpdatePosY(this, play); + BgDyYoseizo_SpawnEffectsType(this, play, 0); } -void func_80873780(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Revisit_SetupRefillPlayerEnergy(BgDyYoseizo* this, PlayState* play) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_ONCE, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyAnim_005810); - Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingSpellAnim); + Animation_Change(&this->skelAnime, &gGreatFairyGivingSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_ONCE, -10.0f); } Actor_PlaySfx(&this->actor, NA_SE_VO_FR_SMILE_0); - this->unk2F6 = 1; - this->actionFunc = func_80873868; + this->mouthTexIndex = 1; + this->actionFunc = BgDyYoseizo_Revisit_RefillPlayerEnergy; } -void func_80873868(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Revisit_RefillPlayerEnergy(BgDyYoseizo* this, PlayState* play) { Player* player; - f32 temp_fv1; - s16 var_v0; - Vec3f vec; + f32 animPrevFrame; + s16 beamType; + Vec3f beamPos; player = GET_PLAYER(play); - temp_fv1 = this->skelAnime.curFrame; - if (this->unk2FC != 0) { - this->unk324 = this->skelAnime.curFrame * 1300.0f; - if ((this->unk32C * 1300.0f) <= this->unk324) { - this->unk324 = 0.0f; + animPrevFrame = this->skelAnime.curFrame; + if (this->hasSwitchedAnim) { + this->yVelocityPhase = this->skelAnime.curFrame * 1300.0f; + if ((this->curAnimLastFrame * 1300.0f) <= this->yVelocityPhase) { + this->yVelocityPhase = 0.0f; } } SkelAnime_Update(&this->skelAnime); - if ((this->unk32C <= temp_fv1) && (this->unk2FC == 0)) { + if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_LOOP, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, - -10.0f); - } - this->unk302 = 0x96; - this->unk2FC = 1; - if (this->unk2EA == 0) { - vec.x = player->actor.world.pos.x; - vec.y = player->actor.world.pos.y + 200.0f; - vec.z = player->actor.world.pos.z; + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_LOOP, -10.0f); + } + this->refillTimer = 150; + this->hasSwitchedAnim = true; + if (!this->isNewAcquireMagic) { + beamPos.x = player->actor.world.pos.x; + beamPos.y = player->actor.world.pos.y + 200.0f; + beamPos.z = player->actor.world.pos.z; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - var_v0 = 0; + beamType = 0; } else { - var_v0 = 1; + beamType = 1; } - this->unk340 = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA, vec.x, - vec.y, vec.z, 0, 0, 0, var_v0); + this->refillBeam = (EnDyExtra*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_DY_EXTRA, + beamPos.x, beamPos.y, beamPos.z, 0, 0, 0, beamType); } } - if (this->unk306 >= 2) { - this->unk306--; + if (this->refillTimeoutTimer > 1) { + this->refillTimeoutTimer--; } - if (this->unk302 >= 0x6E) { - this->unk302--; + if (this->refillTimer >= 110) { + this->refillTimer--; } - if (this->unk302 == 0x6E) { + if (this->refillTimer == 110) { gSaveContext.healthAccumulator = 0x140; Magic_Fill(play); - this->unk306 = 0xC8; + this->refillTimeoutTimer = 200; } if (((gSaveContext.save.info.playerData.healthCapacity == gSaveContext.save.info.playerData.health) && (gSaveContext.save.info.playerData.magic == gSaveContext.magicCapacity)) || - (this->unk306 == 1)) { - this->unk302--; - if (this->unk302 == 0x5A) { - if (this->unk2EA == 0) { - this->unk340->unk_152 = 1; + (this->refillTimeoutTimer == 1)) { + this->refillTimer--; + if (this->refillTimer == 90) { + if (!this->isNewAcquireMagic) { + this->refillBeam->startDisappearing = true; } - this->unk2EA = 0; + this->isNewAcquireMagic = false; } } - if (this->unk302 == 1) { + if (this->refillTimer == 1) { this->actor.textId = 0xDA; - this->unk2EE = TEXT_STATE_EVENT; + this->waitMessageState = TEXT_STATE_EVENT; Message_ContinueTextbox(play, this->actor.textId); - this->actionFunc = func_80873B3C; + this->actionFunc = BgDyYoseizo_Revisit_WaitTalkEnd; } else { - func_80872C58(this, play); + BgDyYoseizo_UpdatePosY(this, play); } } -void func_80873B3C(BgDyYoseizo* this, PlayState* play) { - this->unk324 = this->skelAnime.curFrame * 1400.0f; - if (this->unk324 >= (this->unk32C * 1400.0f)) { - this->unk324 = 0.0f; +void BgDyYoseizo_Revisit_WaitTalkEnd(BgDyYoseizo* this, PlayState* play) { + this->yVelocityPhase = this->skelAnime.curFrame * 1400.0f; + if (this->yVelocityPhase >= (this->curAnimLastFrame * 1400.0f)) { + this->yVelocityPhase = 0.0f; } SkelAnime_Update(&this->skelAnime); - if ((this->unk2EE == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { + if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk2F6 = 0; - this->actionFunc = func_80873C14; + this->mouthTexIndex = 0; + this->actionFunc = BgDyYoseizo_SetupDisappear; Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); } - func_80872C58(this, play); - func_80872960(this, play, 0); + BgDyYoseizo_UpdatePosY(this, play); + BgDyYoseizo_SpawnEffectsType(this, play, 0); } -void func_80873C14(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_SetupDisappear(BgDyYoseizo* this, PlayState* play) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim); - Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyJewelFountainSpinShrinkAnim); + Animation_Change(&this->skelAnime, &gGreatFairyJewelFountainSpinShrinkAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairySpellFountainSpinShrinkAnim); - Animation_Change(&this->skelAnime, &gGreatFairySpellFountainSpinShrinkAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySpellFountainSpinShrinkAnim); + Animation_Change(&this->skelAnime, &gGreatFairySpellFountainSpinShrinkAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); } - this->unk2E8 = 5; - this->unk318 = 0.0f; - this->unk314 = 0.0f; + this->disappearTimer = 5; + this->scaleApproachFraction = 0.0f; + this->yApproachFraction = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_VANISH); - this->actionFunc = func_80873D14; + this->actionFunc = BgDyYoseizo_Disappear; } -void func_80873D14(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Disappear(BgDyYoseizo* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk2E8 == 0) { - if (this->unk308 < 0.003f) { - this->unk2E8 = 0x1E; - this->actionFunc = func_80873E04; + if (this->disappearTimer == 0) { + if (this->scale < 0.003f) { + this->disappearTimer = 30; + this->actionFunc = BgDyYoseizo_Kill; } else { - Math_ApproachF(&this->actor.world.pos.y, this->unk310, this->unk314, 100.0f); - Math_ApproachZeroF(&this->unk308, this->unk318, 0.005f); - Math_ApproachF(&this->unk314, 0.8f, 0.1f, 0.02f); - Math_ApproachF(&this->unk318, 0.2f, 0.03f, 0.05f); + Math_ApproachF(&this->actor.world.pos.y, this->homePosY, this->yApproachFraction, 100.0f); + Math_ApproachZeroF(&this->scale, this->scaleApproachFraction, 0.005f); + Math_ApproachF(&this->yApproachFraction, 0.8f, 0.1f, 0.02f); + Math_ApproachF(&this->scaleApproachFraction, 0.2f, 0.03f, 0.05f); this->actor.shape.rot.y += 0xBB8; - func_80872960(this, play, 0); + BgDyYoseizo_SpawnEffectsType(this, play, 0); } } } -void func_80873E04(BgDyYoseizo* this, PlayState* play) { - Actor* var_a0; +void BgDyYoseizo_Kill(BgDyYoseizo* this, PlayState* play) { + Actor* actor; - if (this->unk2E8 == 0) { + if (this->disappearTimer == 0) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); play->envCtx.lightSettingOverride = 0; - var_a0 = play->actorCtx.actorLists[ACTORCAT_PROP].head; - while (var_a0 != NULL) { - if (var_a0->id != ACTOR_EN_OKARINA_TAG) { - var_a0 = var_a0->next; + actor = play->actorCtx.actorLists[ACTORCAT_PROP].head; + while (actor != NULL) { + if (actor->id != ACTOR_EN_OKARINA_TAG) { + actor = actor->next; } else { - Actor_Kill(var_a0); + Actor_Kill(actor); break; } } @@ -591,41 +624,41 @@ void func_80873E04(BgDyYoseizo* this, PlayState* play) { } } -void func_80873EA4(BgDyYoseizo* this, PlayState* play) { +void BgDyYoseizo_Reward_WaitCutscene(BgDyYoseizo* this, PlayState* play) { if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 2)) { this->actor.draw = BgDyYoseizo_Draw; Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); - this->unk2FE = 0; + this->isDoneAppearing = false; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingDownTransitionAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingDownTransitionAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); } Actor_PlaySfx(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); - this->actionFunc = func_80873FD8; + this->actionFunc = BgDyYoseizo_Reward_Appear; } } -void func_80873FD8(BgDyYoseizo* this, PlayState* play) { - f32 temp_fv0; +void BgDyYoseizo_Reward_Appear(BgDyYoseizo* this, PlayState* play) { + f32 animPrevFrame; - temp_fv0 = this->skelAnime.curFrame; - if (this->unk2FE == 0) { - Math_ApproachF(&this->actor.world.pos.y, this->unk30C, this->unk314, 100.0f); - Math_ApproachF(&this->unk308, 0.035f, this->unk318, 0.005f); - Math_ApproachF(&this->unk314, 0.8f, 0.1f, 0.02f); - Math_ApproachF(&this->unk318, 0.2f, 0.03f, 0.05f); - if (this->unk308 >= 0.034f) { + animPrevFrame = this->skelAnime.curFrame; + if (!this->isDoneAppearing) { + Math_ApproachF(&this->actor.world.pos.y, this->aboveFountainY, this->yApproachFraction, 100.0f); + Math_ApproachF(&this->scale, 0.035f, this->scaleApproachFraction, 0.005f); + Math_ApproachF(&this->yApproachFraction, 0.8f, 0.1f, 0.02f); + Math_ApproachF(&this->scaleApproachFraction, 0.2f, 0.03f, 0.05f); + if (this->scale >= 0.034f) { if ((this->actor.shape.rot.y >= -0x1F3F) && (this->actor.shape.rot.y < 0x3E8)) { SkelAnime_Update(&this->skelAnime); Math_ApproachS(&this->actor.shape.rot.y, 0, 5, 0x3E8); if (fabsf(this->actor.shape.rot.y) < 50.0f) { - this->unk2FE = 1; + this->isDoneAppearing = true; } } else { this->actor.shape.rot.y += 0xBB8; @@ -635,348 +668,345 @@ void func_80873FD8(BgDyYoseizo* this, PlayState* play) { } } else { SkelAnime_Update(&this->skelAnime); - if ((this->unk32C <= temp_fv0) && (this->unk2FC == 0)) { + if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairySittingAnim); - Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairySittingAnim); + Animation_Change(&this->skelAnime, &gGreatFairySittingAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_LOOP, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); - Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyLayingSidewaysAnim); + Animation_Change(&this->skelAnime, &gGreatFairyLayingSidewaysAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_LOOP, -10.0f); } - this->unk2FC = 1; + this->hasSwitchedAnim = true; } if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[0] != NULL) && (play->csCtx.actorCues[0]->id == 3)) { - this->unk2FE = this->unk2FC = 0; + this->isDoneAppearing = this->hasSwitchedAnim = false; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->unk32C, + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyGivingUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyAnim_005810); - Animation_Change(&this->skelAnime, &gGreatFairyAnim_005810, 1.0f, 0.0f, this->unk32C, ANIMMODE_ONCE, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyGivingSpellAnim); + Animation_Change(&this->skelAnime, &gGreatFairyGivingSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_ONCE, -10.0f); } - this->unk2F6 = 1; - this->actionFunc = func_80874304; + this->mouthTexIndex = 1; + this->actionFunc = BgDyYoseizo_Reward_GiveReward; } } - func_80872960(this, play, 0); + BgDyYoseizo_SpawnEffectsType(this, play, 0); } -void func_80874304(BgDyYoseizo* this, PlayState* play) { - f32 temp_fv1_sp5C; +void BgDyYoseizo_Reward_GiveReward(BgDyYoseizo* this, PlayState* play) { + f32 animPrevFrame; Player* player; - s16 var_v1; - s16 sp56; - Vec3f var_fv1; + s16 n; + s16 demoEffectParams; + Vec3f itemPos; - temp_fv1_sp5C = this->skelAnime.curFrame; + animPrevFrame = this->skelAnime.curFrame; player = GET_PLAYER(play); - if (this->unk2FC != 0) { - this->unk324 = this->skelAnime.curFrame * 1400.0f; - if (this->unk324 >= (this->unk32C * 1400.0f)) { - this->unk324 = 0.0f; + if (this->hasSwitchedAnim) { + this->yVelocityPhase = this->skelAnime.curFrame * 1400.0f; + if (this->yVelocityPhase >= (this->curAnimLastFrame * 1400.0f)) { + this->yVelocityPhase = 0.0f; } } SkelAnime_Update(&this->skelAnime); - if ((this->unk32C <= temp_fv1_sp5C) && (this->unk2FC == 0)) { + if ((this->curAnimLastFrame <= animPrevFrame) && !this->hasSwitchedAnim) { if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterUpgradeAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterUpgradeAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_LOOP, -10.0f); } else { - this->unk32C = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); - Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->unk32C, ANIMMODE_LOOP, - -10.0f); + this->curAnimLastFrame = Animation_GetLastFrame(&gGreatFairyAfterSpellAnim); + Animation_Change(&this->skelAnime, &gGreatFairyAfterSpellAnim, 1.0f, 0.0f, this->curAnimLastFrame, + ANIMMODE_LOOP, -10.0f); } - this->unk2FC = 1; + this->hasSwitchedAnim = true; } - if (play->csCtx.actorCues[0]->id == 0xD) { - this->actionFunc = func_80873C14; + if (play->csCtx.actorCues[0]->id == 13) { + this->actionFunc = BgDyYoseizo_SetupDisappear; return; } - if ((play->csCtx.actorCues[0]->id >= 4) && (play->csCtx.actorCues[0]->id < 7)) { - var_v1 = play->csCtx.actorCues[0]->id - 4; + if ((play->csCtx.actorCues[0]->id >= 4) && (play->csCtx.actorCues[0]->id <= 6)) { + n = play->csCtx.actorCues[0]->id - 4; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - var_v1 += 1; - func_80872960(this, play, var_v1); - } else if (this->unk2E4 == 0) { - sp56 = D_808754B0[var_v1] << 0xC; - sp56 |= 0x12; + n += 1; + BgDyYoseizo_SpawnEffectsType(this, play, n); + } else if (!this->hasSpawnedDemoEffect) { + demoEffectParams = sSpellRewardsDemoEffectLightColor[n] << 12; + demoEffectParams |= DEMO_EFFECT_LIGHT; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_EFFECT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, sp56); - this->unk2E4 = 1; + this->actor.world.pos.z, 0, 0, 0, demoEffectParams); + this->hasSpawnedDemoEffect = true; } } else { - func_80872960(this, play, 0); + BgDyYoseizo_SpawnEffectsType(this, play, 0); } if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - if ((play->csCtx.actorCues[0]->id >= 0xA) && (play->csCtx.actorCues[0]->id < 0xD)) { - var_v1 = play->csCtx.actorCues[0]->id - 0xA; - switch (var_v1) { - case 0: - gSaveContext.save.info.playerData.isMagicAcquired = 1; + if ((play->csCtx.actorCues[0]->id >= 10) && (play->csCtx.actorCues[0]->id <= 12)) { + n = play->csCtx.actorCues[0]->id - 10; + switch (n) { + case BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC: + gSaveContext.save.info.playerData.isMagicAcquired = true; gSaveContext.magicFillTarget = 0x30; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; - case 1: - if (gSaveContext.save.info.playerData.isMagicAcquired == 0) { - gSaveContext.save.info.playerData.isMagicAcquired = 1; + case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_MAGIC: + if (!gSaveContext.save.info.playerData.isMagicAcquired) { + gSaveContext.save.info.playerData.isMagicAcquired = true; } - gSaveContext.save.info.playerData.isDoubleMagicAcquired = 1; + gSaveContext.save.info.playerData.isDoubleMagicAcquired = true; gSaveContext.magicFillTarget = 0x60; gSaveContext.save.info.playerData.magicLevel = 0; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; - case 2: - gSaveContext.save.info.playerData.isDoubleDefenseAcquired = 1; + case BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE: + gSaveContext.save.info.playerData.isDoubleDefenseAcquired = true; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; } - if (this->unk2E6 == 0) { + if (this->energyRefilled) { gSaveContext.healthAccumulator = 0x140; - this->unk2E6 = 1; - if (var_v1 == 2) { + this->energyRefilled = true; + if (n == 2) { Magic_Fill(play); } } } } if (play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { - if ((play->csCtx.actorCues[0]->id >= 0xE) && (play->csCtx.actorCues[0]->id < 0x11)) { - var_v1 = play->csCtx.actorCues[0]->id - 0xE; - if (this->unk300 == 0) { - var_fv1.x = player->actor.world.pos.x; + if ((play->csCtx.actorCues[0]->id >= 14) && (play->csCtx.actorCues[0]->id <= 16)) { + n = play->csCtx.actorCues[0]->id - 14; + if (!this->hasSpawnedItem) { + itemPos.x = player->actor.world.pos.x; if (LINK_IS_ADULT) { - var_fv1.y = player->actor.world.pos.y + 73.0f; + itemPos.y = player->actor.world.pos.y + 73.0f; } else { - var_fv1.y = player->actor.world.pos.y + 53.0f; + itemPos.y = player->actor.world.pos.y + 53.0f; } - var_fv1.z = player->actor.world.pos.z; - this->unk344 = - (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, var_fv1.x, - var_fv1.y, var_fv1.z, 0, 0, 0, D_808754B8[var_v1]); - if (this->unk344 != NULL) { + itemPos.z = player->actor.world.pos.z; + this->item = + (EnExItem*)Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_EX_ITEM, itemPos.x, + itemPos.y, itemPos.z, 0, 0, 0, sSpellRewardsEnExItemParams[n]); + if (this->item != NULL) { if (!gSaveContext.save.info.playerData.isMagicAcquired) { gSaveContext.save.info.playerData.isMagicAcquired = true; } else { Magic_Fill(play); } - this->unk300 = 1; + this->hasSpawnedItem = true; gSaveContext.healthAccumulator = 0x140; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); - gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_18_19_1A] |= D_808754C0[var_v1]; - Item_Give(play, D_808754C8[var_v1]); + gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_SPELLS] |= sSpellRewardsItemGetInfMask[n]; + Item_Give(play, sSpellRewardsItem[n]); } } else { - this->unk344->actor.world.pos.x = player->actor.world.pos.x; + this->item->actor.world.pos.x = player->actor.world.pos.x; if (LINK_IS_ADULT) { - this->unk344->actor.world.pos.y = player->actor.world.pos.y + 73.0f; + this->item->actor.world.pos.y = player->actor.world.pos.y + 73.0f; } else { - this->unk344->actor.world.pos.y = player->actor.world.pos.y + 53.0f; + this->item->actor.world.pos.y = player->actor.world.pos.y + 53.0f; } - this->unk344->actor.world.pos.z = player->actor.world.pos.z; - this->unk344->scale = 0.3f; + this->item->actor.world.pos.z = player->actor.world.pos.z; + this->item->scale = 0.3f; } } } - if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 0x11)) { - if (this->unk344 != NULL) { - Actor_Kill(&this->unk344->actor); - this->unk344 = NULL; + if ((play->sceneId != SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 17)) { + if (this->item != NULL) { + Actor_Kill(&this->item->actor); + this->item = NULL; } } - if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 0x12)) { - this->unk2E5 = 1; + if ((play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) && (play->csCtx.actorCues[0]->id == 18)) { + this->giveDoubleDefense = true; } - if (this->unk2E5 != 0) { + if (this->giveDoubleDefense) { if (gSaveContext.save.info.inventory.defenseHearts < 20) { gSaveContext.save.info.inventory.defenseHearts += 1; } } - if ((play->csCtx.actorCues[0]->id >= 0x13) && (play->csCtx.actorCues[0]->id < 0x16) && (this->unk304 == 0)) { - var_v1 = play->csCtx.actorCues[0]->id - 0xB; + if ((play->csCtx.actorCues[0]->id >= 19) && (play->csCtx.actorCues[0]->id <= 21) && (this->unk304 == 0)) { + n = play->csCtx.actorCues[0]->id - (19 - WARP_ORANGE); Actor_Spawn(&play->actorCtx, play, ACTOR_DOOR_WARP1, player->actor.world.pos.x, player->actor.world.pos.y, - player->actor.world.pos.z, 0, 0, 0, var_v1); + player->actor.world.pos.z, 0, 0, 0, n); this->unk304 = 1; } - func_80872C58(this, play); + BgDyYoseizo_UpdatePosY(this, play); } void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; PlayState* play = play2; - s32 var_v1; + s32 sfx; - this->unk2F0 += 1; - if (this->unk2E8 != 0) { - this->unk2E8--; + this->unk_2F0++; + if (this->disappearTimer != 0) { + this->disappearTimer--; } - if (this->unk2F8 != 0) { - this->unk2F8--; + if (this->eyeTimer != 0) { + this->eyeTimer--; } - if (this->unk2FA != 0) { - this->unk2FA--; + if (this->unk_2FA != 0) { + this->unk_2FA--; } this->actionFunc(this, play); if (play->csCtx.state != CS_STATE_IDLE) { - var_v1 = 0; + sfx = 0; if (play->sceneId == SCENE_GREAT_FAIRYS_FOUNTAIN_MAGIC) { if ((play->csCtx.curFrame == 32) || (play->csCtx.curFrame == 291) || (play->csCtx.curFrame == 426) || (play->csCtx.curFrame == 851)) { - var_v1 = 1; + sfx = 1; } if (play->csCtx.curFrame == 101) { - var_v1 = 2; + sfx = 2; } } else { if ((play->csCtx.curFrame == 35) || (play->csCtx.curFrame == 181) || (play->csCtx.curFrame == 462) || (play->csCtx.curFrame == 795)) { - var_v1 = 1; + sfx = 1; } if (play->csCtx.curFrame == 90) { - var_v1 = 2; + sfx = 2; } } - if (var_v1 == 1) { + if (sfx == 1) { Actor_PlaySfx(&this->actor, NA_SE_VO_FR_SMILE_0); } - if (var_v1 == 2) { + if (sfx == 2) { Actor_PlaySfx(&this->actor, NA_SE_VO_FR_LAUGH_0); } } - if ((this->unk2F8 == 0) && (this->actionFunc != func_80873868)) { - this->unk2F2 += 1; - this->unk2F4 += 1; - if (this->unk2F2 >= 3) { - this->unk2F4 = 0; - this->unk2F2 = this->unk2F4; - this->unk2F8 = (s16)Rand_ZeroFloat(60.0f) + 0x14; + if ((this->eyeTimer == 0) && (this->actionFunc != BgDyYoseizo_Revisit_RefillPlayerEnergy)) { + this->eyeTexIndex += 1; + this->unusedEyeTexIndex += 1; + if (this->eyeTexIndex >= 3) { + this->eyeTexIndex = this->unusedEyeTexIndex = 0; + this->eyeTimer = (s16)Rand_ZeroFloat(60.0f) + 20; } } Actor_MoveXZGravity(&this->actor); - this->unk328 = this->unk308 * 7500.0f; - Actor_SetFocus(&this->actor, this->unk328); - this->actor.focus.pos.y = this->unk328; - Actor_TrackPlayer(play, &this->actor, &this->unk334, &this->unk33A, this->actor.focus.pos); + this->focusY = this->scale * 7500.0f; + Actor_SetFocus(&this->actor, this->focusY); + this->actor.focus.pos.y = this->focusY; + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); BgDyYoseizo_UpdateEffects(this, play); - Actor_SetScale(&this->actor, this->unk308); + Actor_SetScale(&this->actor, this->scale); } -s32 func_80874B7C(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { +s32 BgDyYoseizo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { BgDyYoseizo* this = thisx; if (limbIndex == 8) { - rot->x += this->unk33A.y; + rot->x += this->torsoRot.y; } if (limbIndex == 15) { - rot->x += this->unk334.y; - rot->z += this->unk334.z; + rot->x += this->headRot.y; + rot->z += this->headRot.z; } - return 0; + return false; } void BgDyYoseizo_Draw(Actor* thisx, PlayState* play) { BgDyYoseizo* this = (BgDyYoseizo*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1609); - if (this->actionFunc != func_80873E04) { + if (this->actionFunc != BgDyYoseizo_Kill) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_808754CC[this->unk2F2])); - gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(D_808754CC[this->unk2F4])); - gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(D_808754D8[this->unk2F6])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); + // The model doesn't access segment 9 + gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->unusedEyeTexIndex])); + gSPSegment(POLY_OPA_DISP++, 10, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80874B7C, NULL, this); + BgDyYoseizo_OverrideLimbDraw, NULL, this); } CLOSE_DISPS(play->state.gfxCtx, "../z_bg_dy_yoseizo.c", 1629); BgDyYoseizo_DrawEffects(this, play); } -void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* arg1, Vec3f* arg2, Vec3f* arg3, Color_RGB8* arg4, - Color_RGB8* arg5, f32 arg6, s16 arg7, s16 arg8) { +void BgDyYoseizo_SpawnEffect(BgDyYoseizo* this, Vec3f* pos, Vec3f* vel, Vec3f* accel, Color_RGB8* innerColor, + Color_RGB8* outerColor, f32 scale, s16 life, s16 type) { BgDyYoseizoEffect* effect; - s16 var_v1; + s16 i; effect = this->effects; - for (var_v1 = 0; var_v1 < BG_DY_YOSEIZO_EFFECT_COUNT; var_v1++, effect++) { - if (effect->unk0 == 0) { - effect->unk0 = 1; - effect->unk4 = *arg1; - effect->unk10 = *arg2; - effect->unk1C = *arg3; - effect->unk28 = *arg4; - effect->unk2E = 0; - effect->unk2B = *arg5; - effect->unk30 = arg6; - effect->unk34 = arg7; - effect->unk36 = arg8; - effect->unk38 = 0.0f; - effect->unk3C = Rand_CenteredFloat(30000.0f); - effect->unk40 = 0.0f; + for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { + if (effect->active == 0) { + effect->active = 1; + effect->pos = *pos; + effect->vel = *vel; + effect->accel = *accel; + effect->innerColor = *innerColor; + effect->alpha = 0; + effect->outerColor = *outerColor; + effect->scale = scale; + effect->life = life; + effect->type = type; + effect->pitch = 0.0f; + effect->yaw = Rand_CenteredFloat(30000.0f); + effect->rot = 0.0f; break; } } } void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) { - s16 var_s5; + s16 i; Player* player; - Vec3f sp94; - Vec3f sp88; + Vec3f offset; + Vec3f vel; BgDyYoseizoEffect* effect; - f32 temp_fs0; - f32 temp_fs1; + f32 targetPitch; + f32 targetYaw; effect = this->effects; player = GET_PLAYER(play); - for (var_s5 = 0; var_s5 < BG_DY_YOSEIZO_EFFECT_COUNT; var_s5++, effect++) { - if (effect->unk0 != 0) { - effect->unk40 += 3000.0f; - if (effect->unk36 == 0) { - effect->unk4.x += effect->unk10.x; - effect->unk4.y += effect->unk10.y; - effect->unk4.z += effect->unk10.z; - effect->unk10.x += effect->unk1C.x; - effect->unk10.y += effect->unk1C.y; - effect->unk10.z += effect->unk1C.z; + for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { + if (effect->active != 0) { + effect->rot += 3000.0f; + if (effect->type == 0) { + effect->pos.x += effect->vel.x; + effect->pos.y += effect->vel.y; + effect->pos.z += effect->vel.z; + effect->vel.x += effect->accel.x; + effect->vel.y += effect->accel.y; + effect->vel.z += effect->accel.z; } else { Actor_PlaySfx(&this->actor, NA_SE_EV_HEALING - SFX_FLAG); - sp94 = player->actor.world.pos; - sp94.y = player->actor.world.pos.y - 150.0f; - sp94.z = player->actor.world.pos.z - 50.0f; - temp_fs0 = Math_Vec3f_Pitch(&effect->unk4, &sp94); - temp_fs1 = Math_Vec3f_Yaw(&effect->unk4, &sp94); - Math_ApproachF(&effect->unk38, temp_fs0, 0.9f, 5000.0f); - Math_ApproachF(&effect->unk3C, temp_fs1, 0.9f, 5000.0f); + offset = player->actor.world.pos; + offset.y = player->actor.world.pos.y - 150.0f; + offset.z = player->actor.world.pos.z - 50.0f; + targetPitch = Math_Vec3f_Pitch(&effect->pos, &offset); + targetYaw = Math_Vec3f_Yaw(&effect->pos, &offset); + Math_ApproachF(&effect->pitch, targetPitch, 0.9f, 5000.0f); + Math_ApproachF(&effect->yaw, targetYaw, 0.9f, 5000.0f); Matrix_Push(); - Matrix_RotateY(BINANG_TO_RAD_ALT(effect->unk3C), MTXMODE_NEW); - Matrix_RotateX(BINANG_TO_RAD_ALT(effect->unk38), MTXMODE_APPLY); - sp94.z = 3.0f; - sp94.y = 3.0f; - sp94.x = 3.0f; - Matrix_MultVec3f(&sp94, &sp88); + Matrix_RotateY(BINANG_TO_RAD_ALT(effect->yaw), MTXMODE_NEW); + Matrix_RotateX(BINANG_TO_RAD_ALT(effect->pitch), MTXMODE_APPLY); + offset.x = offset.y = offset.z = 3.0f; + Matrix_MultVec3f(&offset, &vel); Matrix_Pop(); - effect->unk4.x += sp88.x; - effect->unk4.y += sp88.y; - effect->unk4.z += sp88.z; + effect->pos.x += vel.x; + effect->pos.y += vel.y; + effect->pos.z += vel.z; } } - if (effect->unk34 != 0) { - effect->unk34 -= 1; - effect->unk2E += 0x1E; - if (effect->unk2E >= 0x100) { - effect->unk2E = 0xFF; + if (effect->life != 0) { + effect->life--; + effect->alpha += 30; + if (effect->alpha > 255) { + effect->alpha = 255; } } else { - effect->unk2E -= 0x1E; - if (effect->unk2E <= 0) { - effect->unk0 = 0; - effect->unk2E = effect->unk0; + effect->alpha -= 30; + if (effect->alpha <= 0) { + effect->alpha = effect->active = 0; } } } @@ -984,7 +1014,7 @@ void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) { void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play) { GraphicsContext* gfxCtx; - s16 var_s4; + s16 i; BgDyYoseizoEffect* effect; u8 materialFlag; @@ -993,20 +1023,20 @@ void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play) { effect = this->effects; OPEN_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1767); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - for (var_s4 = 0; var_s4 < BG_DY_YOSEIZO_EFFECT_COUNT; var_s4++, effect++) { - if (effect->unk0 == 1) { + for (i = 0; i < BG_DY_YOSEIZO_EFFECT_COUNT; i++, effect++) { + if (effect->active == 1) { if (materialFlag == 0) { gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleMaterialDL)); gDPPipeSync(POLY_XLU_DISP++); materialFlag++; } - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, effect->unk28.r, effect->unk28.g, effect->unk28.b, - effect->unk2E); - gDPSetEnvColor(POLY_XLU_DISP++, effect->unk2B.r, effect->unk2B.g, effect->unk2B.b, 0); - Matrix_Translate(effect->unk4.x, effect->unk4.y, effect->unk4.z, MTXMODE_NEW); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, effect->innerColor.r, effect->innerColor.g, + effect->innerColor.b, effect->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, effect->outerColor.r, effect->outerColor.g, effect->outerColor.b, 0); + Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(effect->unk30, effect->unk30, 1.0f, MTXMODE_APPLY); - Matrix_RotateZ(effect->unk40, MTXMODE_APPLY); + Matrix_Scale(effect->scale, effect->scale, 1.0f, MTXMODE_APPLY); + Matrix_RotateZ(effect->rot, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, gfxCtx, "../z_bg_dy_yoseizo.c", 1810); gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gGreatFairyParticleModelDL)); } 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 616c208d0b9..fc587a4d27b 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 @@ -7,20 +7,20 @@ #define BG_DY_YOSEIZO_EFFECT_COUNT 200 typedef struct BgDyYoseizoEffect { - /* 0x00 */ u8 unk0; - /* 0x01 */ char pad1[3]; /* maybe part of unk0[4]? */ - /* 0x04 */ Vec3f unk4; - /* 0x10 */ Vec3f unk10; - /* 0x1C */ Vec3f unk1C; - /* 0x28 */ Color_RGB8 unk28; - /* 0x2B */ Color_RGB8 unk2B; - /* 0x2E */ s16 unk2E; - /* 0x30 */ f32 unk30; - /* 0x34 */ s16 unk34; - /* 0x36 */ s16 unk36; - /* 0x38 */ f32 unk38; - /* 0x3C */ f32 unk3C; - /* 0x40 */ f32 unk40; + /* 0x00 */ u8 active; + /* 0x01 */ char pad_1[3]; + /* 0x04 */ Vec3f pos; + /* 0x10 */ Vec3f vel; // for type == 0 + /* 0x1C */ Vec3f accel; // for type == 0 + /* 0x28 */ Color_RGB8 innerColor; + /* 0x2B */ Color_RGB8 outerColor; + /* 0x2E */ s16 alpha; + /* 0x30 */ f32 scale; + /* 0x34 */ s16 life; + /* 0x36 */ s16 type; + /* 0x38 */ f32 pitch; // for type != 0 + /* 0x3C */ f32 yaw; // for type != 0 + /* 0x40 */ f32 rot; } BgDyYoseizoEffect; // size = 0x44 struct BgDyYoseizo; @@ -31,44 +31,44 @@ typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; /* 0x014C */ void (*actionFunc)(struct BgDyYoseizo*, struct PlayState*); /* 0x0150 */ SkelAnime skelAnime; - /* 0x0194 */ Vec3s unk194[28]; - /* 0x023C */ Vec3s unk23C[28]; - /* 0x02E4 */ u8 unk2E4; - /* 0x02E5 */ u8 unk2E5; - /* 0x02E6 */ u8 unk2E6; - /* 0x02E7 */ char pad2E7[1]; - /* 0x02E8 */ s16 unk2E8; - /* 0x02EA */ s16 unk2EA; - /* 0x02EC */ s16 unk2EC; - /* 0x02EE */ s16 unk2EE; - /* 0x02F0 */ s16 unk2F0; - /* 0x02F2 */ s16 unk2F2; - /* 0x02F4 */ s16 unk2F4; - /* 0x02F6 */ s16 unk2F6; - /* 0x02F8 */ s16 unk2F8; - /* 0x02FA */ s16 unk2FA; - /* 0x02FC */ s16 unk2FC; - /* 0x02FE */ s16 unk2FE; - /* 0x0300 */ s16 unk300; - /* 0x0302 */ s16 unk302; + /* 0x0194 */ Vec3s jointTable[28]; + /* 0x023C */ Vec3s morphTable[28]; + /* 0x02E4 */ u8 hasSpawnedDemoEffect; + /* 0x02E5 */ u8 giveDoubleDefense; + /* 0x02E6 */ u8 energyRefilled; + /* 0x02E7 */ char pad_2E7[1]; + /* 0x02E8 */ s16 disappearTimer; + /* 0x02EA */ s16 isNewAcquireMagic; + /* 0x02EC */ s16 reward; + /* 0x02EE */ s16 waitMessageState; + /* 0x02F0 */ s16 unk_2F0; // unused + /* 0x02F2 */ s16 eyeTexIndex; + /* 0x02F4 */ s16 unusedEyeTexIndex; + /* 0x02F6 */ s16 mouthTexIndex; + /* 0x02F8 */ s16 eyeTimer; + /* 0x02FA */ s16 unk_2FA; // unused + /* 0x02FC */ s16 hasSwitchedAnim; + /* 0x02FE */ s16 isDoneAppearing; + /* 0x0300 */ s16 hasSpawnedItem; + /* 0x0302 */ s16 refillTimer; /* 0x0304 */ s16 unk304; - /* 0x0306 */ s16 unk306; - /* 0x0308 */ f32 unk308; - /* 0x030C */ f32 unk30C; - /* 0x0310 */ f32 unk310; - /* 0x0314 */ f32 unk314; - /* 0x0318 */ f32 unk318; - /* 0x031C */ f32 unk31C; - /* 0x0320 */ f32 unk320; - /* 0x0324 */ f32 unk324; - /* 0x0328 */ f32 unk328; - /* 0x032C */ f32 unk32C; - /* 0x0330 */ char pad330[4]; - /* 0x0334 */ Vec3s unk334; - /* 0x033A */ Vec3s unk33A; - /* 0x0340 */ struct EnDyExtra* unk340; - /* 0x0344 */ struct EnExItem* unk344; - /* 0x0348 */ char pad348[0x4C]; + /* 0x0306 */ s16 refillTimeoutTimer; + /* 0x0308 */ f32 scale; + /* 0x030C */ f32 aboveFountainY; + /* 0x0310 */ f32 homePosY; + /* 0x0314 */ f32 yApproachFraction; + /* 0x0318 */ f32 scaleApproachFraction; + /* 0x031C */ f32 targetPosY; + /* 0x0320 */ f32 offsetY; + /* 0x0324 */ f32 yVelocityPhase; + /* 0x0328 */ f32 focusY; + /* 0x032C */ f32 curAnimLastFrame; + /* 0x0330 */ char pad_330[4]; + /* 0x0334 */ Vec3s headRot; + /* 0x033A */ Vec3s torsoRot; + /* 0x0340 */ struct EnDyExtra* refillBeam; + /* 0x0344 */ struct EnExItem* item; + /* 0x0348 */ char pad_348[0x4C]; /* 0x0394 */ BgDyYoseizoEffect effects[BG_DY_YOSEIZO_EFFECT_COUNT]; } BgDyYoseizo; // size = 0x38B4 diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c index 5d1c85a63a2..b34857b2708 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.c @@ -26,8 +26,8 @@ void EnDyExtra_Destroy(Actor* thisx, PlayState* play); void EnDyExtra_Update(Actor* thisx, PlayState* play); void EnDyExtra_Draw(Actor* thisx, PlayState* play); -void func_809FF7AC(EnDyExtra* this, PlayState* play); -void func_809FF840(EnDyExtra* this, PlayState* play); +void EnDyExtra_Wait(EnDyExtra* this, PlayState* play); +void EnDyExtra_Disappear(EnDyExtra* this, PlayState* play); ActorProfile En_Dy_Extra_Profile = { /**/ ACTOR_EN_DY_EXTRA, @@ -51,34 +51,34 @@ void EnDyExtra_Init(Actor* thisx, PlayState* play) { PRINTF(VT_FGCOL(YELLOW) T("☆☆☆☆☆ 大妖精効果 ☆☆☆☆☆ %d\n", "☆☆☆☆☆ Big fairy effect ☆☆☆☆☆ %d\n") VT_RST, this->actor.params); this->type = this->actor.params; - this->unk_15C.x = 0.025f; - this->unk_15C.y = 0.039f; - this->unk_15C.z = 0.025f; - this->unk_168 = this->actor.world.pos; + this->scale.x = 0.025f; + this->scale.y = 0.039f; + this->scale.z = 0.025f; + this->homePos = this->actor.world.pos; this->actor.gravity = -0.2f; - this->unk_158 = 1.0f; - this->unk_154 = 0x3C; - this->actionFunc = func_809FF7AC; + this->alphaFac = 1.0f; + this->timer = 60; + this->actionFunc = EnDyExtra_Wait; } -void func_809FF7AC(EnDyExtra* this, PlayState* play) { +void EnDyExtra_Wait(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); if (this->actor.world.pos.y < -55.0f) { this->actor.velocity.y = 0.0f; } - if (this->unk_154 == 0 && this->unk_152 != 0) { - this->unk_154 = 0xC8; - this->actionFunc = func_809FF840; + if ((this->timer == 0) && this->startDisappearing) { + this->timer = 200; + this->actionFunc = EnDyExtra_Disappear; } } -void func_809FF840(EnDyExtra* this, PlayState* play) { +void EnDyExtra_Disappear(EnDyExtra* this, PlayState* play) { Math_ApproachF(&this->actor.gravity, 0.0f, 0.1f, 0.005f); - if (this->unk_154 == 0 || this->unk_158 < 0.02f) { + if ((this->timer == 0) || (this->alphaFac < 0.02f)) { Actor_Kill(&this->actor); return; } - Math_ApproachZeroF(&this->unk_158, 0.03f, 0.05f); + Math_ApproachZeroF(&this->alphaFac, 0.03f, 0.05f); if (this->actor.world.pos.y < -55.0f) { this->actor.velocity.y = 0.0f; } @@ -87,34 +87,40 @@ void func_809FF840(EnDyExtra* this, PlayState* play) { void EnDyExtra_Update(Actor* thisx, PlayState* play) { EnDyExtra* this = (EnDyExtra*)thisx; - DECR(this->unk_154); - this->actor.scale.x = this->unk_15C.x; - this->actor.scale.y = this->unk_15C.y; - this->actor.scale.z = this->unk_15C.z; + DECR(this->timer); + this->actor.scale.x = this->scale.x; + this->actor.scale.y = this->scale.y; + this->actor.scale.z = this->scale.z; Actor_PlaySfx(&this->actor, NA_SE_PL_SPIRAL_HEAL_BEAM - SFX_FLAG); this->actionFunc(this, play); Actor_MoveXZGravity(&this->actor); } void EnDyExtra_Draw(Actor* thisx, PlayState* play) { - static Color_RGBA8 primColors[] = { { 255, 255, 170, 255 }, { 255, 255, 170, 255 } }; - static Color_RGBA8 envColors[] = { { 255, 100, 255, 255 }, { 100, 255, 255, 255 } }; - static u8 D_809FFC50[] = { 0x02, 0x01, 0x01, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, - 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x01, 0x02, 0x00 }; + static Color_RGBA8 sPrimColors[] = { { 255, 255, 170, 255 }, { 255, 255, 170, 255 } }; + static Color_RGBA8 sEnvColors[] = { { 255, 100, 255, 255 }, { 100, 255, 255, 255 } }; + static u8 sVerticesAlphaType[] = { + 2, 1, 1, 2, 0, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 2, 1, 0, 1, 2, 0 + }; EnDyExtra* this = (EnDyExtra*)thisx; GraphicsContext* gfxCtx = play->state.gfxCtx; s32 pad; Vtx* vertices = SEGMENTED_TO_VIRTUAL(gGreatFairySpiralBeamVtx); s32 i; - u8 unk[3]; + u8 alphaVals[3]; - unk[0] = 0.0f; - unk[1] = (s8)(this->unk_158 * 240.0f); - unk[2] = (s8)(this->unk_158 * 255.0f); + alphaVals[0] = 0.0f; +#ifndef AVOID_UB + alphaVals[1] = (s8)(this->alphaFac * 240.0f); + alphaVals[2] = (s8)(this->alphaFac * 255.0f); +#else + alphaVals[1] = (u8)(this->alphaFac * 240.0f); + alphaVals[2] = (u8)(this->alphaFac * 255.0f); +#endif for (i = 0; i < 27; i++) { - if (D_809FFC50[i]) { - vertices[i].v.cn[3] = unk[D_809FFC50[i]]; + if (sVerticesAlphaType[i] != 0) { + vertices[i].n.a = alphaVals[sVerticesAlphaType[i]]; } } @@ -126,9 +132,9 @@ void EnDyExtra_Draw(Actor* thisx, PlayState* play) { play->state.frames, play->state.frames * -8, 0x10, 0x10)); gDPPipeSync(POLY_XLU_DISP++); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_dy_extra.c", 307); - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, primColors[this->type].r, primColors[this->type].g, - primColors[this->type].b, 255); - gDPSetEnvColor(POLY_XLU_DISP++, envColors[this->type].r, envColors[this->type].g, envColors[this->type].b, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, sPrimColors[this->type].r, sPrimColors[this->type].g, + sPrimColors[this->type].b, 255); + gDPSetEnvColor(POLY_XLU_DISP++, sEnvColors[this->type].r, sEnvColors[this->type].g, sEnvColors[this->type].b, 128); gSPDisplayList(POLY_XLU_DISP++, gGreatFairySpiralBeamDL); CLOSE_DISPS(gfxCtx, "../z_en_dy_extra.c", 325); diff --git a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h index 59f0329c024..9c6da5bd133 100644 --- a/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h +++ b/src/overlays/actors/ovl_En_Dy_Extra/z_en_dy_extra.h @@ -12,11 +12,11 @@ typedef struct EnDyExtra { /* 0x0000 */ Actor actor; /* 0x014C */ EnDyExtraActionFunc actionFunc; /* 0x0150 */ s16 type; - /* 0x0152 */ s16 unk_152; - /* 0x0154 */ s16 unk_154; - /* 0x0158 */ f32 unk_158; - /* 0x015C */ Vec3f unk_15C; - /* 0x0168 */ Vec3f unk_168; + /* 0x0152 */ s16 startDisappearing; + /* 0x0154 */ s16 timer; + /* 0x0158 */ f32 alphaFac; + /* 0x015C */ Vec3f scale; + /* 0x0168 */ Vec3f homePos; } EnDyExtra; // size = 0x0174 #endif From 30fb0db59b81b616b0bc85aaf59021f6a5fb38a6 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 16:47:40 +0200 Subject: [PATCH 083/150] misc. cleanup --- src/boot/z_std_dma.c | 2 +- .../actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 12 ++++++------ .../actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h | 2 +- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index a2a3d810d98..9aeaff7d76f 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -338,7 +338,7 @@ const char* DmaMgr_FindFileName(uintptr_t vrom) { name++; } //! @bug Since there is no return, in case the file isn't found, the return value will be a pointer to the end - // of gDmaDataTable + //! of gDmaDataTable #ifdef AVOID_UB return ""; #endif 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 fd9dc6b5918..f2b3cb1f4ce 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 @@ -107,8 +107,8 @@ void EnBomBowlMan_Destroy(Actor* thisx, PlayState* play) { } void EnBomBowlMan_SetupAsleepWaitTalk(EnBomBowlMan* this, PlayState* play) { - this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlSleepingAnim); - Animation_Change(&this->skelAnime, &gBowlingGirlSleepingAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_LOOP, + this->curAnimLastFrame = Animation_GetLastFrame(&gBowlingGirlSleepingAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlSleepingAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_LOOP, -10.0f); this->actor.textId = 0xC0; this->waitMessageState = TEXT_STATE_EVENT; @@ -140,8 +140,8 @@ void EnBomBowlMan_AsleepTalking(EnBomBowlMan* this, PlayState* play) { } void EnBomBowlMan_SetupWakingUpTalking(EnBomBowlMan* this, PlayState* play) { - this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlWakingUpAnim); - Animation_Change(&this->skelAnime, &gBowlingGirlWakingUpAnim, 1.0f, 0.0f, this->curAnimFrameCount, ANIMMODE_ONCE, + this->curAnimLastFrame = Animation_GetLastFrame(&gBowlingGirlWakingUpAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlWakingUpAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_ONCE, -10.0f); this->eyesState = 1; this->actionFunc = EnBomBowlMan_WakingUpTalking; @@ -174,8 +174,8 @@ void EnBomBowlMan_FinishWakingUpTalking(EnBomBowlMan* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->waitMessageState == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->curAnimFrameCount = Animation_GetLastFrame(&gBowlingGirlHandsOnCounterAnim); - Animation_Change(&this->skelAnime, &gBowlingGirlHandsOnCounterAnim, 1.0f, 0.0f, this->curAnimFrameCount, + this->curAnimLastFrame = Animation_GetLastFrame(&gBowlingGirlHandsOnCounterAnim); + Animation_Change(&this->skelAnime, &gBowlingGirlHandsOnCounterAnim, 1.0f, 0.0f, this->curAnimLastFrame, ANIMMODE_LOOP, -10.0f); this->eyesState = 3; this->eyesTimer = (s16)Rand_ZeroFloat(60.0f) + 20; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h index e162188ee1e..f6dfa5634e6 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.h @@ -46,7 +46,7 @@ typedef struct EnBomBowlMan { /* 0x244 */ s16 gameEndStatus; /* 0x246 */ char pad_246[2]; /* 0x248 */ Vec3f homePos; - /* 0x254 */ f32 curAnimFrameCount; + /* 0x254 */ f32 curAnimLastFrame; /* 0x258 */ u8 gameStartStatus; /* 0x259 */ char pad_259[3]; /* 0x25C */ struct EnBomBowlPit* finalTargetManager; 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 79e785b91b8..4a79450cc84 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 @@ -100,8 +100,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.1f); this->isUsingMagic = false; if (player->stateFlags2 & PLAYER_STATE2_17) { - if (((gSaveContext.save.info.playerData.isMagicAcquired) == 0) || - (gSaveContext.magicState != MAGIC_STATE_IDLE) || + if (!gSaveContext.save.info.playerData.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) || ((PARAMS_GET_S(this->actor.params, 8, 8) != 0) && (Magic_RequestChange(play, PARAMS_GET_S(this->actor.params, 8, 8), MAGIC_CONSUME_NOW) == 0))) { SFX_PLAY_AT_POS(&player->actor.projectedPos, NA_SE_IT_ROLLING_CUT); From e6bcfa9c95fd738616226cacaca5bc91abe21993 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 16:55:30 +0200 Subject: [PATCH 084/150] fixup ok --- src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 cb9bccc972e..a1e4746de66 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 @@ -771,7 +771,7 @@ void BgDyYoseizo_Reward_GiveReward(BgDyYoseizo* this, PlayState* play) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC); break; } - if (this->energyRefilled) { + if (!this->energyRefilled) { gSaveContext.healthAccumulator = 0x140; this->energyRefilled = true; if (n == 2) { From 094587bd037b67c2fe473da6fc49e03b8759d5c3 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 8 Aug 2026 16:57:02 +0200 Subject: [PATCH 085/150] more fixups --- src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 a1e4746de66..fa4956159c8 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 @@ -103,7 +103,7 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { SkelAnime_InitFlex(play, &this->skelAnime, &gGreatFairySkel, &gGreatFairySittingTransitionAnim, this->jointTable, this->morphTable, 28); #if OOT_VERSION < NTSC_1_1 - if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->reward_ != BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC)) { + if (!gSaveContext.save.info.playerData.isMagicAcquired && (this->reward != BG_DY_YOSEIZO_REWARD_MAGIC_MAGIC)) { Actor_Kill(&this->actor); return; } @@ -120,7 +120,7 @@ void BgDyYoseizo_Init(Actor* thisx, PlayState* play2) { #endif } #if OOT_VERSION < NTSC_1_1 - this->actionFunc = BgDyYoseizo_SetupCutscene_; + this->actionFunc = BgDyYoseizo_SetupCutscene; #else this->actionFunc = BgDyYoseizo_WaitSong; #endif From 852eef9f235ff74d42290faa4bf1d22675afaa24 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 9 Aug 2026 00:14:41 +0200 Subject: [PATCH 086/150] doc dekubaba --- assets/xml/objects/object_dekubaba.xml | 60 +- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 1217 +++++++++-------- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 31 +- .../actors/ovl_En_Karebaba/z_en_karebaba.c | 22 +- .../actors/ovl_En_Karebaba/z_en_karebaba.h | 6 +- 5 files changed, 678 insertions(+), 658 deletions(-) diff --git a/assets/xml/objects/object_dekubaba.xml b/assets/xml/objects/object_dekubaba.xml index 4f93fb60ba2..ce1a15f14ab 100644 --- a/assets/xml/objects/object_dekubaba.xml +++ b/assets/xml/objects/object_dekubaba.xml @@ -1,48 +1,48 @@ - - - + + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - + + 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 87d25e03bd6..bee913e5878 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -23,23 +23,23 @@ void EnDekubaba_Destroy(Actor* thisx, PlayState* play); void EnDekubaba_Update(Actor* thisx, PlayState* play); void EnDekubaba_Draw(Actor* thisx, PlayState* play); -void func_809E5ABC(EnDekubaba* this); -void func_809E64F4(EnDekubaba* this, PlayState* play); -void func_809E65A0(EnDekubaba* this, PlayState* play); -void func_809E6A04(EnDekubaba* this, PlayState* play); -void func_809E6ED4(EnDekubaba* this, PlayState* play); -void func_809E7104(EnDekubaba* this, PlayState* play); -void func_809E738C(EnDekubaba* this, PlayState* play); -void func_809E7458(EnDekubaba* this, PlayState* play); -void func_809E77E4(EnDekubaba* this, PlayState* play); -void func_809E78DC(EnDekubaba* this, PlayState* play); -void func_809E79EC(EnDekubaba* this, PlayState* play); -void func_809E7A88(EnDekubaba* this, PlayState* play); -void func_809E7BB0(EnDekubaba* this, PlayState* play); -void func_809E7F14(EnDekubaba* this, PlayState* play); -void func_809E80D8(EnDekubaba* this, PlayState* play); - -static Vec3f D_809E8EA0 = { 0.0f, 0.0f, 0.0f }; +void EnDekubaba_SetupWaitPlayerNear(EnDekubaba* this); +void EnDekubaba_WaitPlayerNear(EnDekubaba* this, PlayState* play); +void EnDekubaba_ExitGround(EnDekubaba* this, PlayState* play); +void EnDekubaba_EnterGround(EnDekubaba* this, PlayState* play); +void EnDekubaba_ChompAir(EnDekubaba* this, PlayState* play); +void EnDekubaba_Attack(EnDekubaba* this, PlayState* play); +void EnDekubaba_PrepareAttack(EnDekubaba* this, PlayState* play); +void EnDekubaba_RecoverFromAttackMiss(EnDekubaba* this, PlayState* play); +void EnDekubaba_Soothe(EnDekubaba* this, PlayState* play); +void EnDekubaba_Attacked(EnDekubaba* this, PlayState* play); +void EnDekubaba_Vulnerable(EnDekubaba* this, PlayState* play); +void EnDekubaba_Wobble(EnDekubaba* this, PlayState* play); +void EnDekubaba_DieDropStick(EnDekubaba* this, PlayState* play); +void EnDekubaba_Die(EnDekubaba* this, PlayState* play); +void EnDekubaba_DekuStick(EnDekubaba* this, PlayState* play); + +static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; ActorProfile En_Dekubaba_Profile = { /**/ ACTOR_EN_DEKUBABA, @@ -63,7 +63,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_ON, OCELEM_ON, }, - { 1, { { 0, 100, 1000 }, 15 }, 100 }, + { DEKUBABA_HEAD_LIMB_ROOT, { { 0, 100, 1000 }, 15 }, 100 }, }, { { @@ -147,126 +147,128 @@ static ColliderJntSphInit sJntSphInit = { }; static CollisionCheckInfoInit sColChkInfoInit = { 2, 25, 25, MASS_IMMOVABLE }; + +typedef enum EnDekubabaDamageReaction { + EN_DEKUBABA_DMG_REACT_NONE, + EN_DEKUBABA_DMG_REACT_STUN, + EN_DEKUBABA_DMG_REACT_FIRE, + EN_DEKUBABA_DMG_REACT_BOOMERANG = 0xE, + EN_DEKUBABA_DMG_REACT_SWORD +} EnDekubabaDamageReaction; + static DamageTable D_809E8FE0 = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0x0), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(2, 0xE), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(2, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0xF), - /* Master sword */ DMG_ENTRY(2, 0xF), - /* Giant's Knife */ DMG_ENTRY(4, 0xF), - /* Fire arrow */ DMG_ENTRY(4, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x0), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(4, 0x2), - /* Ice magic */ DMG_ENTRY(0, 0x0), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0xF), - /* Giant spin */ DMG_ENTRY(4, 0xF), - /* Master spin */ DMG_ENTRY(2, 0xF), - /* Kokiri jump */ DMG_ENTRY(2, 0xF), - /* Giant jump */ DMG_ENTRY(8, 0xF), - /* Master jump */ DMG_ENTRY(4, 0xF), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_NONE), + /* Explosive */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_BOOMERANG), + /* Normal arrow */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Kokiri sword */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_SWORD), + /* Master sword */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_SWORD), + /* Giant's Knife */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_SWORD), + /* Fire arrow */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_FIRE), + /* Ice arrow */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Light arrow */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Unk arrow 1 */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Unk arrow 2 */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Unk arrow 3 */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Fire magic */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_FIRE), + /* Ice magic */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Light magic */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Shield */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_SWORD), + /* Giant spin */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_SWORD), + /* Master spin */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_SWORD), + /* Kokiri jump */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_SWORD), + /* Giant jump */ DMG_ENTRY(8, EN_DEKUBABA_DMG_REACT_SWORD), + /* Master jump */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_SWORD), + /* Unknown 1 */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), }; + static DamageTable D_809E9000 = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0x0), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(2, 0xE), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0x1), - /* Kokiri sword */ DMG_ENTRY(1, 0xF), - /* Master sword */ DMG_ENTRY(2, 0xF), - /* Giant's Knife */ DMG_ENTRY(4, 0xF), - /* Fire arrow */ DMG_ENTRY(4, 0x2), - /* Ice arrow */ DMG_ENTRY(2, 0x0), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(4, 0x2), - /* Ice magic */ DMG_ENTRY(0, 0x0), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0xF), - /* Giant spin */ DMG_ENTRY(4, 0xF), - /* Master spin */ DMG_ENTRY(2, 0xF), - /* Kokiri jump */ DMG_ENTRY(2, 0xF), - /* Giant jump */ DMG_ENTRY(8, 0xF), - /* Master jump */ DMG_ENTRY(4, 0xF), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_NONE), + /* Explosive */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_BOOMERANG), + /* Normal arrow */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_STUN), + /* Kokiri sword */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_SWORD), + /* Master sword */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_SWORD), + /* Giant's Knife */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_SWORD), + /* Fire arrow */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_FIRE), + /* Ice arrow */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Light arrow */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Unk arrow 1 */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Unk arrow 2 */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Unk arrow 3 */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), + /* Fire magic */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_FIRE), + /* Ice magic */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Light magic */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Shield */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_SWORD), + /* Giant spin */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_SWORD), + /* Master spin */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_SWORD), + /* Kokiri jump */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_SWORD), + /* Giant jump */ DMG_ENTRY(8, EN_DEKUBABA_DMG_REACT_SWORD), + /* Master jump */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_SWORD), + /* Unknown 1 */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), }; + static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 1500, ICHAIN_STOP), }; -static Color_RGBA8 D_809E9024 = { 0x69, 0xFF, 0x69, 0xFF }; -static Color_RGBA8 D_809E9028 = { 0x96, 0xFA, 0x96, 0 }; -static Gfx* D_809E902C[] = { - object_dekubaba_DL_001330, - object_dekubaba_DL_001628, - object_dekubaba_DL_001828, -}; void EnDekubaba_Init(Actor* thisx, PlayState* play) { - s32 var_a0; + s32 i; EnDekubaba* this = (EnDekubaba*)thisx; Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, - this->morphTable, 8); + SkelAnime_Init(play, &this->skelAnime, &gDekubabaHeadSkel, &gDekubabaChompAnim, this->jointTable, this->morphTable, + DEKUBABA_HEAD_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - if (this->actor.params == 1) { - this->unk230 = 2.50f; - for (var_a0 = 0; var_a0 < sJntSphInit.count; var_a0++) { - this->collider.elements[var_a0].dim.worldSphere.radius = - this->collider.elements[var_a0].dim.modelSphere.radius = - sJntSphElementsInit[var_a0].dim.modelSphere.radius * 2.5f; + if (this->actor.params == EN_DEKUBABA_TYPE_1) { + this->scaleFac = 2.50f; + for (i = 0; i < sJntSphInit.count; i++) { + this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius = + sJntSphElementsInit[i].dim.modelSphere.radius * 2.5f; } if (!LINK_IS_ADULT) { - D_809E9000.table[0x1B] = 4; + D_809E9000.table[27] = 4; } CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E9000, &sColChkInfoInit); this->actor.colChkInfo.health = 4; this->actor.naviEnemyId = NAVI_ENEMY_BIG_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_2; } else { - this->unk230 = 1.0f; - for (var_a0 = 0; var_a0 < sJntSphInit.count; var_a0++) { - this->collider.elements[var_a0].dim.worldSphere.radius = - this->collider.elements[var_a0].dim.modelSphere.radius; + this->scaleFac = 1.0f; + for (i = 0; i < sJntSphInit.count; i++) { + this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } if (!LINK_IS_ADULT) { - D_809E8FE0.table[0x1B] = 4; + D_809E8FE0.table[27] = 4; } CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E8FE0, &sColChkInfoInit); this->actor.naviEnemyId = NAVI_ENEMY_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_1; } - func_809E5ABC(this); - this->unk1C6 = 0; - this->unk170 = this->actor.home.pos; - this->unk234 = NULL; + EnDekubaba_SetupWaitPlayerNear(this); + this->actionState = 0; + this->homePos = this->actor.home.pos; + this->floorPoly = NULL; } void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { @@ -275,7 +277,7 @@ void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -void func_809E5A38(EnDekubaba* this) { +void EnDekubaba_DisableStemColliderAC(EnDekubaba* this) { s32 i; for (i = 1; i < 7; i++) { @@ -283,626 +285,627 @@ void func_809E5A38(EnDekubaba* this) { } } -void func_809E5ABC(EnDekubaba* this) { - ColliderJntSphElement* temp_v0_2; - s16 temp_v0; +void EnDekubaba_SetupWaitPlayerNear(EnDekubaba* this) { + ColliderJntSphElement* elem; s32 i; - this->unk1CA_arr[0] = this->unk1CA_arr[1] = this->unk1CA_arr[2] = this->actor.shape.rot.x = -0x4000; + this->stemPartsRot[0] = this->stemPartsRot[1] = this->stemPartsRot[2] = this->actor.shape.rot.x = -0x4000; this->actor.world.pos.x = this->actor.home.pos.x; this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->unk230); - Actor_SetScale(&this->actor, this->unk230 * 0.01f * 0.5f); + this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->scaleFac); + Actor_SetScale(&this->actor, this->scaleFac * 0.01f * 0.5f); this->collider.base.colMaterial = COL_MATERIAL_HARD; this->collider.base.acFlags |= AC_HARD; - this->unk1C6 = 0x2D; + this->actionState = 45; for (i = 1; i < 7; i++) { - temp_v0_2 = &this->collider.elements[i]; - temp_v0_2->dim.worldSphere.center.x = this->actor.world.pos.x; - temp_v0_2->dim.worldSphere.center.y = (s16)this->actor.world.pos.y - 7; - temp_v0_2->dim.worldSphere.center.z = this->actor.world.pos.z; + elem = &this->collider.elements[i]; + elem->dim.worldSphere.center.x = this->actor.world.pos.x; + elem->dim.worldSphere.center.y = (s16)this->actor.world.pos.y - 7; + elem->dim.worldSphere.center.z = this->actor.world.pos.z; } - this->unk1C0 = func_809E64F4; + this->actionFunc = EnDekubaba_WaitPlayerNear; } -void func_809E5D28(EnDekubaba* this) { +void EnDekubaba_SetupExitGround(EnDekubaba* this) { s32 i; - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8) * 0.06666667f, 0.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_ONCE, 0.0f); - this->unk1C6 = 0xF; + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, Animation_GetLastFrame(&gDekubabaChompAnim) * 0.06666667f, + 0.0f, Animation_GetLastFrame(&gDekubabaChompAnim), ANIMMODE_ONCE, 0.0f); + this->actionState = 15; for (i = 2; i < 7; i++) { - this->collider.elements[i].base.ocElemFlags |= 1; + this->collider.elements[i].base.ocElemFlags |= OCELEM_ON; } this->collider.base.colMaterial = COL_MATERIAL_HIT6; this->collider.base.acFlags &= ~AC_HARD; Actor_PlaySfx(&this->actor, NA_SE_EN_DUMMY482); - this->unk1C0 = func_809E65A0; + this->actionFunc = EnDekubaba_ExitGround; } -void func_809E5E58(EnDekubaba* this) { +void EnDekubaba_SetupEnterGround(EnDekubaba* this) { s32 i; - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -1.5f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); - this->unk1C6 = 0xF; + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, -1.5f, Animation_GetLastFrame(&gDekubabaChompAnim), 0.0f, + ANIMMODE_ONCE, -3.0f); + this->actionState = 15; for (i = 2; i < 7; i++) { - this->collider.elements[i].base.ocElemFlags &= ~1; + this->collider.elements[i].base.ocElemFlags &= ~OCELEM_ON; } - this->unk1C0 = func_809E6A04; + this->actionFunc = EnDekubaba_EnterGround; } -void func_809E5F44(EnDekubaba* this) { - this->unk1C6 = Animation_GetLastFrame(&object_dekubaba_Anim_0002B8) * 2; - Animation_MorphToLoop(&this->skelAnime, &object_dekubaba_Anim_0002B8, -3.0f); - this->unk1C0 = func_809E6ED4; +void EnDekubaba_SetupChompAir(EnDekubaba* this) { + this->actionState = Animation_GetLastFrame(&gDekubabaChompAnim) * 2; + Animation_MorphToLoop(&this->skelAnime, &gDekubabaChompAnim, -3.0f); + this->actionFunc = EnDekubaba_ChompAir; } -void func_809E5F9C(EnDekubaba* this) { - this->unk1C6 = 8; - this->unk1C0 = func_809E738C; +void EnDekubaba_SetupPrepareAttack(EnDekubaba* this) { + this->actionState = 8; + this->actionFunc = EnDekubaba_PrepareAttack; this->skelAnime.playSpeed = 0.0f; } -void func_809E5FBC(EnDekubaba* this) { - Animation_PlayOnce(&this->skelAnime, &object_dekubaba_Anim_000208); - this->unk1C6 = 0; - this->unk1C0 = func_809E7104; +void EnDekubaba_SetupAttack(EnDekubaba* this) { + Animation_PlayOnce(&this->skelAnime, &gDekubabaIdleAnim); + this->actionState = 0; + this->actionFunc = EnDekubaba_Attack; } -void func_809E6000(EnDekubaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_000208, 1.0f, 15.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_000208), ANIMMODE_ONCE, -3.0f); - this->unk1C6 = 0; - this->unk1C0 = func_809E7458; +void EnDekubaba_SetupRecoverFromAttackMiss(EnDekubaba* this) { + Animation_Change(&this->skelAnime, &gDekubabaIdleAnim, 1.0f, 15.0f, Animation_GetLastFrame(&gDekubabaIdleAnim), + ANIMMODE_ONCE, -3.0f); + this->actionState = 0; + this->actionFunc = EnDekubaba_RecoverFromAttackMiss; } -void func_809E6078(EnDekubaba* this) { - this->unk1C6 = 9; +void EnDekubaba_SetupSoothe(EnDekubaba* this) { + this->actionState = 9; this->collider.base.acFlags |= AC_ON; - this->unk1C0 = func_809E77E4; + this->actionFunc = EnDekubaba_Soothe; this->skelAnime.playSpeed = -1.0f; } -void func_809E60A8(EnDekubaba* this, s32 arg1) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_dekubaba_Anim_000208, -5.0f); - this->unk1C6 = arg1; +typedef enum EnDekubabaAttackedType { + EN_DEKUBABA_ATTACKED_TYPE_STRENGTHENED, + EN_DEKUBABA_ATTACKED_TYPE_WEAKENED, + EN_DEKUBABA_ATTACKED_TYPE_STUNNED +} EnDekubabaAttackedType; + +void EnDekubaba_SetupAttacked(EnDekubaba* this, s32 type) { + Animation_MorphToPlayOnce(&this->skelAnime, &gDekubabaIdleAnim, -5.0f); + this->actionState = type; this->collider.base.acFlags &= ~AC_ON; - Actor_SetScale(&this->actor, this->unk230 * 0.01f); - if (arg1 == 2) { + Actor_SetScale(&this->actor, this->scaleFac * 0.01f); + if (type == EN_DEKUBABA_ATTACKED_TYPE_STUNNED) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 155, COLORFILTER_BUFFLAG_OPA, 62); } else { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 42); } - this->unk1C0 = func_809E78DC; + this->actionFunc = EnDekubaba_Attacked; } -void func_809E6170(EnDekubaba* this) { - this->unk1C6 = 0; +void EnDekubaba_SetupDieDropStick(EnDekubaba* this) { + this->actionState = 0; this->skelAnime.playSpeed = 0.0f; this->actor.gravity = -0.8f; this->actor.velocity.y = 4.0f; this->actor.world.rot.y = this->actor.shape.rot.y + 0x8000; - this->actor.speed = this->unk230 * 3.0f; + this->actor.speed = this->scaleFac * 3.0f; this->collider.base.acFlags &= ~AC_ON; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED; - this->unk1C0 = func_809E7BB0; + this->actionFunc = EnDekubaba_DieDropStick; } -void func_809E61E0(EnDekubaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -1.5f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); +void EnDekubaba_SetupDie(EnDekubaba* this) { + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, -1.5f, Animation_GetLastFrame(&gDekubabaChompAnim), 0.0f, + ANIMMODE_ONCE, -3.0f); this->collider.base.acFlags &= ~AC_ON; - this->unk1C0 = func_809E7F14; + this->actionFunc = EnDekubaba_Die; } -void func_809E6264(EnDekubaba* this) { +void EnDekubaba_SetupVulnerable(EnDekubaba* this) { s32 i; for (i = 1; i < 7; i++) { this->collider.elements[i].base.acElemFlags |= ACELEM_ON; } - if (this->unk1C6 == 1) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); - this->unk1C6 = 0x28; - } else { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); - this->unk1C6 = 0x3C; + if (this->actionState == EN_DEKUBABA_ATTACKED_TYPE_WEAKENED) { + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, 4.0f, 0.0f, Animation_GetLastFrame(&gDekubabaChompAnim), + ANIMMODE_LOOP, -3.0f); + this->actionState = 40; + } else { // EN_DEKUBABA_ATTACKED_TYPE_STUNNED + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, 0.0f, 0.0f, Animation_GetLastFrame(&gDekubabaChompAnim), + ANIMMODE_LOOP, -3.0f); + this->actionState = 60; } this->actor.world.pos.x = this->actor.home.pos.x; - this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * this->unk230); + this->actor.world.pos.y = this->actor.home.pos.y + (60.0f * this->scaleFac); this->actor.world.pos.z = this->actor.home.pos.z; - this->unk1C0 = func_809E79EC; + this->actionFunc = EnDekubaba_Vulnerable; } -void func_809E63EC(EnDekubaba* this) { - this->unk1C8 = -0x6000; - this->unk1CA_arr[2] = -0x5000; - this->unk1CA_arr[1] = -0x4800; - func_809E5A38(this); +void EnDekubaba_SetupWobble(EnDekubaba* this) { + this->wobbleTarget = -0x6000; + this->stemPartsRot[2] = -0x5000; + this->stemPartsRot[1] = -0x4800; + EnDekubaba_DisableStemColliderAC(this); Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 35); this->collider.base.acFlags &= ~AC_ON; - this->unk1C0 = func_809E7A88; + this->actionFunc = EnDekubaba_Wobble; } -void func_809E645C(EnDekubaba* this, PlayState* arg1) { +void EnDekubaba_SetupDekuStick(EnDekubaba* this, PlayState* play) { Actor_SetScale(&this->actor, 0.03f); this->actor.shape.rot.x -= 0x4000; this->actor.shape.yOffset = 1000.0f; this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; this->actor.shape.shadowScale = 3.0f; - Actor_ChangeCategory(arg1, &arg1->actorCtx, &this->actor, ACTORCAT_MISC); + Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_MISC); this->actor.flags &= ~ACTOR_FLAG_DRAW_CULLING_DISABLED; - this->unk1C6 = 0xC8; - this->unk1C0 = func_809E80D8; + this->actionState = 200; + this->actionFunc = EnDekubaba_DekuStick; } -void func_809E64F4(EnDekubaba* this, PlayState* arg1) { - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; +void EnDekubaba_WaitPlayerNear(EnDekubaba* this, PlayState* play) { + if (this->actionState != 0) { + this->actionState--; } this->actor.world.pos.x = this->actor.home.pos.x; this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->unk230); - if ((this->unk1C6 == 0) && (this->actor.xzDistToPlayer < (200.0f * this->unk230)) && - (fabsf(this->actor.yDistToPlayer) < (30.0f * this->unk230))) { - func_809E5D28(this); + this->actor.world.pos.y = this->actor.home.pos.y + (14.0f * this->scaleFac); + if ((this->actionState == 0) && (this->actor.xzDistToPlayer < (200.0f * this->scaleFac)) && + (fabsf(this->actor.yDistToPlayer) < (30.0f * this->scaleFac))) { + EnDekubaba_SetupExitGround(this); } } -void func_809E65A0(EnDekubaba* this, PlayState* play) { - Actor* sp64; - f32 var_fa0; - f32 sp5C; - f32 sp58; - f32 temp_ft5; +void EnDekubaba_ExitGround(EnDekubaba* this, PlayState* play) { + Player* player; + f32 dxz; + f32 dy; + f32 dx; + f32 dz; - sp64 = play->actorCtx.actorLists[2].head; + player = GET_PLAYER(play); - if (this->unk1C6 != 0) { - this->unk1C6--; + if (this->actionState != 0) { + this->actionState--; } SkelAnime_Update(&this->skelAnime); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = - this->unk230 * 0.01f * (0.5f + (((0xF - this->unk1C6) * 0.5f) / 15.0f)); + this->scaleFac * 0.01f * (0.5f + (((15 - this->actionState) * 0.5f) / 15.0f)); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800); - sp5C = (sinf(CLAMP_MAX(((0xF - this->unk1C6)) * 0.06666667014f, 0.7f) * 3.1415927f) * 32.0f) + 14.0f; + dy = (sinf(CLAMP_MAX(((15 - this->actionState)) * 0.06666667014f, 0.7f) * 3.1415927f) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { - var_fa0 = 0.0f; + dxz = 0.0f; } else if (this->actor.shape.rot.x < -0x238E) { - Math_ScaledStepToS(&this->unk1CA_arr[0], -0x5555, 0x38E); - var_fa0 = 20.0f * Math_CosS(this->unk1CA_arr[0]); + Math_ScaledStepToS(&this->stemPartsRot[0], -0x5555, 0x38E); + dxz = 20.0f * Math_CosS(this->stemPartsRot[0]); } else if (this->actor.shape.rot.x < -0xE38) { - Math_ScaledStepToS(&this->unk1CA_arr[0], -0xAAA, 0x38E); - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x5555, 0x38E); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5555, 0x222); - var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + - (((sp5C - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * - Math_CosS(this->unk1CA_arr[2])) / - -Math_SinS(this->unk1CA_arr[2])); + Math_ScaledStepToS(&this->stemPartsRot[0], -0xAAA, 0x38E); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x5555, 0x38E); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x5555, 0x222); + dxz = (20.0f * (Math_CosS(this->stemPartsRot[0]) + Math_CosS(this->stemPartsRot[1]))) + + (((dy - (20.0f * (-Math_SinS(this->stemPartsRot[0]) - Math_SinS(this->stemPartsRot[1])))) * + Math_CosS(this->stemPartsRot[2])) / + -Math_SinS(this->stemPartsRot[2])); } else { - Math_ScaledStepToS(&this->unk1CA_arr[0], -0xAAA, 0x38E); - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x31C7, 0x222); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5555, 0x222); - var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + - (((sp5C - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * - Math_CosS(this->unk1CA_arr[2])) / - -Math_SinS(this->unk1CA_arr[2])); + Math_ScaledStepToS(&this->stemPartsRot[0], -0xAAA, 0x38E); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x31C7, 0x222); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x5555, 0x222); + dxz = (20.0f * (Math_CosS(this->stemPartsRot[0]) + Math_CosS(this->stemPartsRot[1]))) + + (((dy - (20.0f * (-Math_SinS(this->stemPartsRot[0]) - Math_SinS(this->stemPartsRot[1])))) * + Math_CosS(this->stemPartsRot[2])) / + -Math_SinS(this->stemPartsRot[2])); } - if (this->unk1C6 < 0xA) { - Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &sp64->world.pos), 2, 0xE38); + if (this->actionState < 10) { + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, + 0xE38); } - this->actor.world.pos.y = this->actor.home.pos.y + (sp5C * this->unk230); - sp58 = Math_SinS(this->actor.shape.rot.y) * (var_fa0 * this->unk230); - temp_ft5 = var_fa0; - temp_ft5 = Math_CosS(this->actor.shape.rot.y) * (temp_ft5 * this->unk230); - this->actor.world.pos.x = this->actor.home.pos.x + sp58; - this->actor.world.pos.z = this->actor.home.pos.z + temp_ft5; - EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, - this->unk230 * 5.0f, 1, -1, 10, NULL); - if (this->unk1C6 == 0) { - if (Math_Vec3f_DistXZ(&this->actor.home.pos, &sp64->world.pos) < (240.0f * this->unk230)) { - func_809E5F9C(this); + this->actor.world.pos.y = this->actor.home.pos.y + (dy * this->scaleFac); + dx = dxz * this->scaleFac * Math_SinS(this->actor.shape.rot.y); + dz = dxz; + dz = dz * this->scaleFac * Math_CosS(this->actor.shape.rot.y); + this->actor.world.pos.x = this->actor.home.pos.x + dx; + this->actor.world.pos.z = this->actor.home.pos.z + dz; + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->scaleFac * 3.0f, 0, this->scaleFac * 12.0f, + this->scaleFac * 5.0f, 1, -1, 10, NULL); + if (this->actionState == 0) { + if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < (240.0f * this->scaleFac)) { + EnDekubaba_SetupPrepareAttack(this); } else { - func_809E5E58(this); + EnDekubaba_SetupEnterGround(this); } } } -void func_809E6A04(EnDekubaba* this, PlayState* play) { - f32 var_fa0; - f32 sp58; - f32 sp54; - f32 temp_ft5; +void EnDekubaba_EnterGround(EnDekubaba* this, PlayState* play) { + f32 dxz; + f32 dy; + f32 dx; + f32 dz; - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; + if (this->actionState != 0) { + this->actionState--; } SkelAnime_Update(&this->skelAnime); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = - this->unk230 * 0.01f * (0.5f + (this->unk1C6 * 0.033333335f)); + this->scaleFac * 0.01f * (0.5f + (this->actionState * 0.033333335f)); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); - sp58 = (sinf(CLAMP_MAX(this->unk1C6 * 0.033f, 0.7f) * 3.1415927f) * 32.0f) + 14.0f; + dy = (sinf(CLAMP_MAX(this->actionState * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { - var_fa0 = 0.0f; + dxz = 0.0f; } else if (this->actor.shape.rot.x < -0x238E) { - Math_ScaledStepToS(&this->unk1CA_arr[0], -0x4000, 0x555); - var_fa0 = Math_CosS(this->unk1CA_arr[0]) * 20.0f; + Math_ScaledStepToS(&this->stemPartsRot[0], -0x4000, 0x555); + dxz = Math_CosS(this->stemPartsRot[0]) * 20.0f; } else if (this->actor.shape.rot.x < -0xE38) { - Math_ScaledStepToS(&this->unk1CA_arr[0], -0x5555, 0x555); - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x4000, 0x555); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x4000, 0x333); - var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + - (((sp58 - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * - Math_CosS(this->unk1CA_arr[2])) / - -Math_SinS(this->unk1CA_arr[2])); + Math_ScaledStepToS(&this->stemPartsRot[0], -0x5555, 0x555); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x4000, 0x555); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x4000, 0x333); + dxz = (20.0f * (Math_CosS(this->stemPartsRot[0]) + Math_CosS(this->stemPartsRot[1]))) + + (((dy - (20.0f * (-Math_SinS(this->stemPartsRot[0]) - Math_SinS(this->stemPartsRot[1])))) * + Math_CosS(this->stemPartsRot[2])) / + -Math_SinS(this->stemPartsRot[2])); } else { - Math_ScaledStepToS(&this->unk1CA_arr[0], -0x5555, 0x555); - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x5555, 0x333); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x4000, 0x333); - var_fa0 = (20.0f * (Math_CosS(this->unk1CA_arr[0]) + Math_CosS(this->unk1CA_arr[1]))) + - (((sp58 - (20.0f * (-Math_SinS(this->unk1CA_arr[0]) - Math_SinS(this->unk1CA_arr[1])))) * - Math_CosS(this->unk1CA_arr[2])) / - -Math_SinS(this->unk1CA_arr[2])); + Math_ScaledStepToS(&this->stemPartsRot[0], -0x5555, 0x555); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x5555, 0x333); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x4000, 0x333); + dxz = (20.0f * (Math_CosS(this->stemPartsRot[0]) + Math_CosS(this->stemPartsRot[1]))) + + (((dy - (20.0f * (-Math_SinS(this->stemPartsRot[0]) - Math_SinS(this->stemPartsRot[1])))) * + Math_CosS(this->stemPartsRot[2])) / + -Math_SinS(this->stemPartsRot[2])); } - this->actor.world.pos.y = this->actor.home.pos.y + (sp58 * this->unk230); - sp54 = Math_SinS(this->actor.shape.rot.y) * (var_fa0 * this->unk230); - temp_ft5 = Math_CosS(this->actor.shape.rot.y) * (var_fa0 * this->unk230); - this->actor.world.pos.x = this->actor.home.pos.x + sp54; - this->actor.world.pos.z = this->actor.home.pos.z + temp_ft5; - EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, - this->unk230 * 5.0f, 1, -1, 10, NULL); - if (this->unk1C6 == 0) { - func_809E5ABC(this); + this->actor.world.pos.y = this->actor.home.pos.y + (dy * this->scaleFac); + dx = dxz * this->scaleFac * Math_SinS(this->actor.shape.rot.y); + dz = dxz * this->scaleFac * Math_CosS(this->actor.shape.rot.y); + this->actor.world.pos.x = this->actor.home.pos.x + dx; + this->actor.world.pos.z = this->actor.home.pos.z + dz; + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->scaleFac * 3.0f, 0, this->scaleFac * 12.0f, + this->scaleFac * 5.0f, 1, -1, 10, NULL); + if (this->actionState == 0) { + EnDekubaba_SetupWaitPlayerNear(this); } } -void func_809E6DCC(EnDekubaba* this) { - f32 sp2C; - f32 sp28; - f32 sp24; - - sp24 = Math_CosS(this->unk1CA_arr[1]); - sp28 = Math_CosS(this->unk1CA_arr[0]); - sp2C = (Math_CosS(this->unk1CA_arr[2]) + (sp28 + sp24)) * 20.0f; - this->actor.world.pos.x = (Math_SinS(this->actor.shape.rot.y) * (sp2C * this->unk230)) + this->actor.home.pos.x; - sp24 = Math_SinS(this->unk1CA_arr[1]); - sp28 = Math_SinS(this->unk1CA_arr[0]); +void EnDekubaba_ComputeHeadPos(EnDekubaba* this) { + f32 dxz; + + dxz = (Math_CosS(this->stemPartsRot[0]) + Math_CosS(this->stemPartsRot[1]) + Math_CosS(this->stemPartsRot[2])) * + 20.0f; + this->actor.world.pos.x = this->actor.home.pos.x + (dxz * this->scaleFac * Math_SinS(this->actor.shape.rot.y)); this->actor.world.pos.y = - this->actor.home.pos.y - ((Math_SinS(this->unk1CA_arr[2]) + (sp28 + sp24)) * 20.0f * this->unk230); - this->actor.world.pos.z = (Math_CosS(this->actor.shape.rot.y) * (sp2C * this->unk230)) + this->actor.home.pos.z; + this->actor.home.pos.y - + ((Math_SinS(this->stemPartsRot[0]) + Math_SinS(this->stemPartsRot[1]) + Math_SinS(this->stemPartsRot[2])) * + 20.0f * this->scaleFac); + this->actor.world.pos.z = this->actor.home.pos.z + (dxz * this->scaleFac * Math_CosS(this->actor.shape.rot.y)); } -void func_809E6ED4(EnDekubaba* this, PlayState* play) { - Actor* sp34; +void EnDekubaba_ChompAir(EnDekubaba* this, PlayState* play) { + Player* player = GET_PLAYER(play); - sp34 = play->actorCtx.actorLists[2].head; SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - if (this->actor.params == 1) { + if (this->actor.params == EN_DEKUBABA_TYPE_1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_MOUTH); } } - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; + if (this->actionState != 0) { + this->actionState--; } - Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &sp34->world.pos), 2, - (this->unk1C6 % 5) * 0x222); - if (this->unk1C6 < 0xA) { - this->unk1CA_arr[0] += 0x16C; - this->unk1CA_arr[1] += 0x16C; - this->unk1CA_arr[2] += 0xB6; + Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, + (this->actionState % 5) * 0x222); + if (this->actionState < 10) { + this->stemPartsRot[0] += 0x16C; + this->stemPartsRot[1] += 0x16C; + this->stemPartsRot[2] += 0xB6; this->actor.shape.rot.x += 0x222; + } else if (this->actionState < 20) { + this->stemPartsRot[0] -= 0x16C; + this->stemPartsRot[1] += 0x111; + this->actor.shape.rot.x += 0x16C; + } else if (this->actionState < 30) { + this->stemPartsRot[1] -= 0x111; + this->actor.shape.rot.x -= 0xB6; } else { - if (this->unk1C6 < 0x14) { - this->unk1CA_arr[0] -= 0x16C; - this->unk1CA_arr[1] += 0x111; - this->actor.shape.rot.x += 0x16C; - } else if (this->unk1C6 < 0x1E) { - this->unk1CA_arr[1] -= 0x111; - this->actor.shape.rot.x -= 0xB6; - } else { - this->unk1CA_arr[1] -= 0xB6; - this->unk1CA_arr[2] += 0xB6; - this->actor.shape.rot.x -= 0x16C; - } + this->stemPartsRot[1] -= 0xB6; + this->stemPartsRot[2] += 0xB6; + this->actor.shape.rot.x -= 0x16C; } - func_809E6DCC(this); - if ((240.0f * this->unk230) < Math_Vec3f_DistXZ(&this->actor.home.pos, &sp34->world.pos)) { - func_809E5E58(this); - } else if ((this->unk1C6 == 0) || (this->actor.xzDistToPlayer < (80.0f * this->unk230))) { - func_809E5F9C(this); + EnDekubaba_ComputeHeadPos(this); + if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > (240.0f * this->scaleFac)) { + EnDekubaba_SetupEnterGround(this); + } else if ((this->actionState == 0) || (this->actor.xzDistToPlayer < (80.0f * this->scaleFac))) { + EnDekubaba_SetupPrepareAttack(this); } } -void func_809E7104(EnDekubaba* this, PlayState* play) { - s32 sp4C; - s16 sp4A; - Vec3f sp3C; +void EnDekubaba_Attack(EnDekubaba* this, PlayState* play) { + static Color_RGBA8 sEffPrimColor = { 105, 255, 105, 255 }; + static Color_RGBA8 sEffEnvColor = { 150, 250, 150, 0 }; + s32 lyingDown; + s16 stepBase; + Vec3f effVel; SkelAnime_Update(&this->skelAnime); - if (this->unk1C6 == 0) { + if (this->actionState == 0) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - if (this->actor.params == 1) { + if (this->actor.params == EN_DEKUBABA_TYPE_1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_ATTACK); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_ATTACK); } } Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x222); - sp4A = this->skelAnime.curFrame * 10.0f; - sp4C = true; - sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[0], -0xE38, sp4A + 0x38E); - sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[1], -0xE38, sp4A + 0x71C); - sp4C &= Math_ScaledStepToS(&this->unk1CA_arr[2], -0xE38, sp4A + 0xE38); - if (sp4C) { - Animation_PlayLoopSetSpeed(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f); - sp3C.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; - sp3C.y = 0.0f; - sp3C.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; - func_8002829C(play, &this->actor.world.pos, &sp3C, &D_809E8EA0, &D_809E9024, &D_809E9028, 1, - this->unk230 * 100.0f); - this->unk1C6 = 1; + stepBase = this->skelAnime.curFrame * 10.0f; + lyingDown = true; + lyingDown &= Math_ScaledStepToS(&this->stemPartsRot[0], -0xE38, stepBase + 0x38E); + lyingDown &= Math_ScaledStepToS(&this->stemPartsRot[1], -0xE38, stepBase + 0x71C); + lyingDown &= Math_ScaledStepToS(&this->stemPartsRot[2], -0xE38, stepBase + 0xE38); + if (lyingDown) { + Animation_PlayLoopSetSpeed(&this->skelAnime, &gDekubabaChompAnim, 4.0f); + effVel.x = Math_SinS(this->actor.shape.rot.y) * 5.0f; + effVel.y = 0.0f; + effVel.z = Math_CosS(this->actor.shape.rot.y) * 5.0f; + func_8002829C(play, &this->actor.world.pos, &effVel, &sZeroVec, &sEffPrimColor, &sEffEnvColor, 1, + this->scaleFac * 100.0f); + this->actionState = 1; this->collider.base.acFlags |= AC_ON; } - } else if (this->unk1C6 >= 0xB) { - func_809E6000(this); + } else if (this->actionState > 10) { + EnDekubaba_SetupRecoverFromAttackMiss(this); } else { - this->unk1C6 += 1; - if ((this->unk1C6 >= 4) && !Actor_IsFacingPlayer(&this->actor, 0x16C)) { + this->actionState++; + if ((this->actionState >= 4) && !Actor_IsFacingPlayer(&this->actor, 0x16C)) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 15, 0x71C); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - if (this->actor.params == 1) { + if (this->actor.params == EN_DEKUBABA_TYPE_1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_MOUTH); } } } - func_809E6DCC(this); + EnDekubaba_ComputeHeadPos(this); } -void func_809E738C(EnDekubaba* this, PlayState* play) { +void EnDekubaba_PrepareAttack(EnDekubaba* this, PlayState* play) { Player* player; player = GET_PLAYER(play); - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; + if (this->actionState != 0) { + this->actionState--; } Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 2, 0xE38, 0x71C); Math_ApproachS(&this->actor.shape.rot.y, Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos), 2, 0xE38); - Math_ScaledStepToS(&this->unk1CA_arr[0], 0xAAA, 0x444); - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x4718, 0x888); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x6AA4, 0x888); - if (this->unk1C6 == 0) { - func_809E5FBC(this); + Math_ScaledStepToS(&this->stemPartsRot[0], 0xAAA, 0x444); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x4718, 0x888); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x6AA4, 0x888); + if (this->actionState == 0) { + EnDekubaba_SetupAttack(this); } - func_809E6DCC(this); + EnDekubaba_ComputeHeadPos(this); } -void func_809E7458(EnDekubaba* this, PlayState* play) { - Vec3f sp3C; - f32 sp38; - f32 var_fv1; - s32 var_v0; +void EnDekubaba_RecoverFromAttackMiss(EnDekubaba* this, PlayState* play) { + Vec3f effPos; + f32 dx; + f32 dz; + s32 i; SkelAnime_Update(&this->skelAnime); - if (this->unk1C6 == 0) { + if (this->actionState == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x38E); - Math_ScaledStepToS(&this->unk1CA_arr[0], -0x888, 0x16C); - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x888, 0x16C); - if (Math_ScaledStepToS(&this->unk1CA_arr[2], -0x888, 0x16C) != 0) { - sp38 = Math_SinS(this->actor.shape.rot.y) * 30.0f * this->unk230; - var_fv1 = Math_CosS(this->actor.shape.rot.y) * 30.0f * this->unk230; - sp3C = this->actor.home.pos; - for (var_v0 = 0; var_v0 < 3; var_v0++) { - func_800286CC(play, &sp3C, &D_809E8EA0, &D_809E8EA0, this->unk230 * 500.0f, this->unk230 * 50.0f); - sp3C.x += sp38; - sp3C.z += var_fv1; + Math_ScaledStepToS(&this->stemPartsRot[0], -0x888, 0x16C); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x888, 0x16C); + if (Math_ScaledStepToS(&this->stemPartsRot[2], -0x888, 0x16C) != 0) { + dx = Math_SinS(this->actor.shape.rot.y) * 30.0f * this->scaleFac; + dz = Math_CosS(this->actor.shape.rot.y) * 30.0f * this->scaleFac; + effPos = this->actor.home.pos; + for (i = 0; i < 3; i++) { + func_800286CC(play, &effPos, &sZeroVec, &sZeroVec, this->scaleFac * 500.0f, this->scaleFac * 50.0f); + effPos.x += dx; + effPos.z += dz; } - this->unk1C6 = 1; + this->actionState = 1; } - } else if (this->unk1C6 == 0xB) { + } else if (this->actionState == 11) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x93E, 0x200); - Math_ScaledStepToS(&this->unk1CA_arr[0], -0xAAA, 0x200); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x200); - if (Math_ScaledStepToS(&this->unk1CA_arr[1], 0x238C, 0x200)) { - this->unk1C6 = 0xC; + Math_ScaledStepToS(&this->stemPartsRot[0], -0xAAA, 0x200); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x5C71, 0x200); + if (Math_ScaledStepToS(&this->stemPartsRot[1], 0x238C, 0x200)) { + this->actionState = 12; } - } else if (this->unk1C6 == 0x12) { + } else if (this->actionState == 18) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x2AA8, 0xAAA); - if (Math_ScaledStepToS(&this->unk1CA_arr[0], 0x1554, 0x5B0)) { - this->unk1C6 = 0x19; + if (Math_ScaledStepToS(&this->stemPartsRot[0], 0x1554, 0x5B0)) { + this->actionState = 25; } - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x38E3, 0xAAA); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x2D8); - } else if (this->unk1C6 == 0x19) { + Math_ScaledStepToS(&this->stemPartsRot[1], -0x38E3, 0xAAA); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x5C71, 0x2D8); + } else if (this->actionState == 25) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0x5550, 0xAAA); - if (Math_ScaledStepToS(&this->unk1CA_arr[0], -0x6388, 0x93E)) { - this->unk1C6 = 0x1A; + if (Math_ScaledStepToS(&this->stemPartsRot[0], -0x6388, 0x93E)) { + this->actionState = 26; } - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x3FFC, 0x4FA); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x238C, 0x444); - } else if (this->unk1C6 == 0x1A) { + Math_ScaledStepToS(&this->stemPartsRot[1], -0x3FFC, 0x4FA); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x238C, 0x444); + } else if (this->actionState == 26) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x93E); - if (Math_ScaledStepToS(&this->unk1CA_arr[0], -0x1555, 0x71C)) { - this->unk1C6 = 0x1B; + if (Math_ScaledStepToS(&this->stemPartsRot[0], -0x1555, 0x71C)) { + this->actionState = 27; } - Math_ScaledStepToS(&this->unk1CA_arr[1], -0x38E3, 0x2D8); - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x5B0); - } else if (this->unk1C6 >= 0x1B) { - this->unk1C6 += 1; - if (this->unk1C6 >= 0x1F) { - if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { - func_809E5F9C(this); + Math_ScaledStepToS(&this->stemPartsRot[1], -0x38E3, 0x2D8); + Math_ScaledStepToS(&this->stemPartsRot[2], -0x5C71, 0x5B0); + } else if (this->actionState >= 27) { + this->actionState++; + if (this->actionState > 30) { + if (this->actor.xzDistToPlayer < (80.0f * this->scaleFac)) { + EnDekubaba_SetupPrepareAttack(this); } else { - func_809E5F44(this); + EnDekubaba_SetupChompAir(this); } } } else { - this->unk1C6 += 1; - if (this->unk1C6 == 0xA) { + this->actionState++; + if (this->actionState == 10) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_SCRAPE); } - if (this->unk1C6 >= 0xC) { - Math_ScaledStepToS(&this->unk1CA_arr[2], -0x5C71, 0x88); + if (this->actionState >= 12) { + Math_ScaledStepToS(&this->stemPartsRot[2], -0x5C71, 0x88); } } - func_809E6DCC(this); + EnDekubaba_ComputeHeadPos(this); } -void func_809E77E4(EnDekubaba* this, PlayState* play) { - s32 temp_s0; +void EnDekubaba_Soothe(EnDekubaba* this, PlayState* play) { + s32 remains; SkelAnime_Update(&this->skelAnime); - if (this->unk1C6 >= 9) { - temp_s0 = 0; - temp_s0 |= Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 1, 0x11C6, 0x71C); - temp_s0 |= Math_SmoothStepToS(&this->unk1CA_arr[0], -0x1555, 1, 0xAAA, 0x71C); - temp_s0 |= Math_SmoothStepToS(&this->unk1CA_arr[1], -0x38E3, 1, 0xE38, 0x71C); - temp_s0 |= Math_SmoothStepToS(&this->unk1CA_arr[2], -0x5C71, 1, 0x11C6, 0x71C); - if (temp_s0 == 0) { - this->unk1C6 = 8; + if (this->actionState >= 9) { + remains = 0; + remains |= Math_SmoothStepToS(&this->actor.shape.rot.x, 0x1800, 1, 0x11C6, 0x71C); + remains |= Math_SmoothStepToS(&this->stemPartsRot[0], -0x1555, 1, 0xAAA, 0x71C); + remains |= Math_SmoothStepToS(&this->stemPartsRot[1], -0x38E3, 1, 0xE38, 0x71C); + remains |= Math_SmoothStepToS(&this->stemPartsRot[2], -0x5C71, 1, 0x11C6, 0x71C); + if (remains == 0) { + this->actionState = 8; } } else { - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; + if (this->actionState != 0) { + this->actionState--; } - if (this->unk1C6 == 0) { - func_809E5F44(this); + if (this->actionState == 0) { + EnDekubaba_SetupChompAir(this); } } - func_809E6DCC(this); + EnDekubaba_ComputeHeadPos(this); } -void func_809E78DC(EnDekubaba* this, PlayState* play) { - s32 temp_s0; +void EnDekubaba_Attacked(EnDekubaba* this, PlayState* play) { + s32 isUpright; SkelAnime_Update(&this->skelAnime); - temp_s0 = true; - temp_s0 &= Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0xE38); - temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[0], -0x4000, 0xE38); - temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[1], -0x4000, 0xE38); - temp_s0 &= Math_ScaledStepToS(&this->unk1CA_arr[2], -0x4000, 0xE38); - if (temp_s0) { + isUpright = true; + isUpright &= Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0xE38); + isUpright &= Math_ScaledStepToS(&this->stemPartsRot[0], -0x4000, 0xE38); + isUpright &= Math_ScaledStepToS(&this->stemPartsRot[1], -0x4000, 0xE38); + isUpright &= Math_ScaledStepToS(&this->stemPartsRot[2], -0x4000, 0xE38); + if (isUpright) { if (this->actor.colChkInfo.health == 0) { - func_809E61E0(this); + EnDekubaba_SetupDie(this); } else { this->collider.base.acFlags |= AC_ON; - if (this->unk1C6 == 0) { - if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { - func_809E5F9C(this); + if (this->actionState == EN_DEKUBABA_ATTACKED_TYPE_STRENGTHENED) { + if (this->actor.xzDistToPlayer < (80.0f * this->scaleFac)) { + EnDekubaba_SetupPrepareAttack(this); } else { - func_809E6078(this); + EnDekubaba_SetupSoothe(this); } } else { - func_809E6264(this); + EnDekubaba_SetupVulnerable(this); } } } - func_809E6DCC(this); + EnDekubaba_ComputeHeadPos(this); } -void func_809E79EC(EnDekubaba* this, PlayState* play) { +void EnDekubaba_Vulnerable(EnDekubaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; + if (this->actionState != 0) { + this->actionState--; } - if (this->unk1C6 == 0) { - func_809E5A38(this); - if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { - func_809E5F9C(this); + if (this->actionState == 0) { + EnDekubaba_DisableStemColliderAC(this); + if (this->actor.xzDistToPlayer < (80.0f * this->scaleFac)) { + EnDekubaba_SetupPrepareAttack(this); } else { - func_809E6078(this); + EnDekubaba_SetupSoothe(this); } } } -void func_809E7A88(EnDekubaba* this, PlayState* play) { +void EnDekubaba_Wobble(EnDekubaba* this, PlayState* play) { s16 temp_v0; SkelAnime_Update(&this->skelAnime); - Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1CA_arr[0], 0x71C); - Math_ScaledStepToS(&this->unk1CA_arr[0], this->unk1CA_arr[1], 0x71C); - Math_ScaledStepToS(&this->unk1CA_arr[1], this->unk1CA_arr[2], 0x71C); - if (Math_ScaledStepToS(&this->unk1CA_arr[2], this->unk1C8, 0x71C)) { - this->unk1C8 = (s16)(s32)(-16384.0f - ((this->unk1C8 + 0x4000) * 0.8f)); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->stemPartsRot[0], 0x71C); + Math_ScaledStepToS(&this->stemPartsRot[0], this->stemPartsRot[1], 0x71C); + Math_ScaledStepToS(&this->stemPartsRot[1], this->stemPartsRot[2], 0x71C); + if (Math_ScaledStepToS(&this->stemPartsRot[2], this->wobbleTarget, 0x71C)) { + this->wobbleTarget = (s16)(s32)(-16384.0f - ((this->wobbleTarget + 0x4000) * 0.8f)); } - temp_v0 = this->unk1C8 + 0x4000; + temp_v0 = this->wobbleTarget + 0x4000; if (ABS(temp_v0) < 0x100) { this->collider.base.acFlags |= AC_ON; - if (this->actor.xzDistToPlayer < (80.0f * this->unk230)) { - func_809E5F9C(this); + if (this->actor.xzDistToPlayer < (80.0f * this->scaleFac)) { + EnDekubaba_SetupPrepareAttack(this); } else { - func_809E6078(this); + EnDekubaba_SetupSoothe(this); } } - func_809E6DCC(this); + EnDekubaba_ComputeHeadPos(this); } -void func_809E7BB0(EnDekubaba* this, PlayState* play) { - s32 var_s0; - Vec3f sp78; - f32 temp_fs0; - f32 temp_fs1; - f32 temp_fs2; +void EnDekubaba_DieDropStick(EnDekubaba* this, PlayState* play) { + s32 i; + Vec3f effPos; + f32 dx; + f32 dz; + f32 dy; - Math_StepToF(&this->actor.speed, 0.0f, this->unk230 * 0.1f); - if (this->unk1C6 == 0) { + Math_StepToF(&this->actor.speed, 0.0f, this->scaleFac * 0.1f); + if (this->actionState == 0) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4800, 0x71C); - Math_ScaledStepToS(&this->unk1CA_arr[0], 0x4800, 0x71C); - Math_ScaledStepToS(&this->unk1CA_arr[1], 0x4800, 0x71C); - EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, - this->unk230 * 5.0f, 1, -1, 10, NULL); - if ((this->actor.scale.x > 0.005f) && ((((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) != 0)) || - (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { + Math_ScaledStepToS(&this->stemPartsRot[0], 0x4800, 0x71C); + Math_ScaledStepToS(&this->stemPartsRot[1], 0x4800, 0x71C); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->scaleFac * 3.0f, 0, this->scaleFac * 12.0f, + this->scaleFac * 5.0f, 1, -1, 10, NULL); + if ((this->actor.scale.x > 0.005f) && + ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.bgCheckFlags & BGCHECKFLAG_WALL))) { this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = 0.0f; this->actor.speed = 0.0f; this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE); - EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, - this->unk230 * 5.0f, 15, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.world.pos, this->scaleFac * 3.0f, 0, this->scaleFac * 12.0f, + this->scaleFac * 5.0f, 15, -1, 10, NULL); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { Actor_PlaySfx(&this->actor, NA_SE_EN_DODO_M_GND); - this->unk1C6 = 1; + this->actionState = 1; } - } else if (this->unk1C6 == 1) { - sp78 = this->actor.world.pos; - temp_fs2 = Math_SinS(this->actor.shape.rot.x) * 20.0f; - temp_fs0 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_SinS(this->actor.shape.rot.y); - temp_fs1 = (-20.0f * Math_CosS(this->actor.shape.rot.x)) * Math_CosS(this->actor.shape.rot.y); - for (var_s0 = 0; var_s0 < 4; var_s0++) { - func_800286CC(play, &sp78, &D_809E8EA0, &D_809E8EA0, 500, 50); - sp78.x += temp_fs0; - sp78.y += temp_fs2; - sp78.z += temp_fs1; + } else if (this->actionState == 1) { + effPos = this->actor.world.pos; + dy = Math_SinS(this->actor.shape.rot.x) * 20.0f; + dx = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y); + dz = -20.0f * Math_CosS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y); + for (i = 0; i < 4; i++) { + func_800286CC(play, &effPos, &sZeroVec, &sZeroVec, 500, 50); + effPos.x += dx; + effPos.y += dy; + effPos.z += dz; } - func_800286CC(play, &this->actor.home.pos, &D_809E8EA0, &D_809E8EA0, this->unk230 * 500.0f, - this->unk230 * 100.0f); - func_809E645C(this, play); + func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->scaleFac * 500.0f, + this->scaleFac * 100.0f); + EnDekubaba_SetupDekuStick(this, play); } } -void func_809E7F14(EnDekubaba* this, PlayState* play) { - Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, this->unk230 * 5.0f); - if (Math_StepToF(&this->actor.scale.x, this->unk230 * 0.1f * 0.01f, this->unk230 * 0.1f * 0.01f) != 0) { - func_800286CC(play, &this->actor.home.pos, &D_809E8EA0, &D_809E8EA0, this->unk230 * 500.0f, - this->unk230 * 100.0f); +void EnDekubaba_Die(EnDekubaba* this, PlayState* play) { + Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, this->scaleFac * 5.0f); + if (Math_StepToF(&this->actor.scale.x, this->scaleFac * 0.1f * 0.01f, this->scaleFac * 0.1f * 0.01f)) { + func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->scaleFac * 500.0f, + this->scaleFac * 100.0f); if (this->actor.dropFlag == 0) { Item_DropCollectible(play, &this->actor.world.pos, 0xC); - if (this->actor.params == 1) { + if (this->actor.params == EN_DEKUBABA_TYPE_1) { Item_DropCollectible(play, &this->actor.world.pos, 0xC); Item_DropCollectible(play, &this->actor.world.pos, 0xC); } @@ -914,65 +917,67 @@ void func_809E7F14(EnDekubaba* this, PlayState* play) { } this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; this->actor.shape.rot.z += 0x1C70; - EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->unk230 * 3.0f, 0, this->unk230 * 12.0f, - this->unk230 * 5.0f, 1, -1, 10, NULL); + EffectSsHahen_SpawnBurst(play, &this->actor.home.pos, this->scaleFac * 3.0f, 0, this->scaleFac * 12.0f, + this->scaleFac * 5.0f, 1, -1, 10, NULL); } -void func_809E80D8(EnDekubaba* this, PlayState* play) { - if (this->unk1C6 != 0) { - this->unk1C6 -= 1; +void EnDekubaba_DekuStick(EnDekubaba* this, PlayState* play) { + if (this->actionState != 0) { + this->actionState--; } - if (Actor_HasParent(&this->actor, play) || (this->unk1C6 == 0)) { + if (Actor_HasParent(&this->actor, play) || (this->actionState == 0)) { Actor_Kill(&this->actor); } else { Actor_OfferGetItemNearby(&this->actor, play, GI_DEKU_STICKS_1); } } -void func_809E8140(EnDekubaba* this, PlayState* play) { - float new_var2; - s32 var_s0; +void EnDekubaba_CheckCollide(EnDekubaba* this, PlayState* play) { + f32 new_var2; + s32 newHealth; s32 i; if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; Actor_SetDropFlagJntSph(&this->actor, &this->collider, true); if ((this->collider.base.colMaterial != COL_MATERIAL_HARD) && - (((this->actor.colChkInfo.damageReaction != 0)) || (this->actor.colChkInfo.damage != 0))) { - var_s0 = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; - if (this->unk1C0 != func_809E79EC) { - if ((this->actor.colChkInfo.damageReaction == 0xE) || (this->actor.colChkInfo.damageReaction == 1)) { - if (this->actor.colChkInfo.damageReaction == 0xE) { - var_s0 = this->actor.colChkInfo.health; + (((this->actor.colChkInfo.damageReaction != EN_DEKUBABA_DMG_REACT_NONE)) || + (this->actor.colChkInfo.damage != 0))) { + newHealth = this->actor.colChkInfo.health - this->actor.colChkInfo.damage; + if (this->actionFunc != EnDekubaba_Vulnerable) { + if ((this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_BOOMERANG) || + (this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_STUN)) { + if (this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_BOOMERANG) { + newHealth = this->actor.colChkInfo.health; } - func_809E60A8(this, 2); - } else if (this->unk1C0 == func_809E7458) { - if (var_s0 <= 0) { - var_s0 = 1; + EnDekubaba_SetupAttacked(this, EN_DEKUBABA_ATTACKED_TYPE_STUNNED); + } else if (this->actionFunc == EnDekubaba_RecoverFromAttackMiss) { + if (newHealth <= 0) { + newHealth = 1; } - func_809E60A8(this, 1); + EnDekubaba_SetupAttacked(this, EN_DEKUBABA_ATTACKED_TYPE_WEAKENED); } else { - func_809E60A8(this, 0); + EnDekubaba_SetupAttacked(this, EN_DEKUBABA_ATTACKED_TYPE_STRENGTHENED); } - } else if ((this->actor.colChkInfo.damageReaction == 0xE) || - (this->actor.colChkInfo.damageReaction == 0xF)) { - if (var_s0 > 0) { - func_809E63EC(this); + } else if ((this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_BOOMERANG) || + (this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_SWORD)) { + if (newHealth > 0) { + EnDekubaba_SetupWobble(this); } else { - func_809E6170(this); + EnDekubaba_SetupDieDropStick(this); } - } else if (this->actor.colChkInfo.damageReaction != 1) { - func_809E60A8(this, 0); + } else if (this->actor.colChkInfo.damageReaction != EN_DEKUBABA_DMG_REACT_STUN) { + EnDekubaba_SetupAttacked(this, EN_DEKUBABA_ATTACKED_TYPE_STRENGTHENED); } else { return; } - if (var_s0 < 0) { + if (newHealth < 0) { this->actor.colChkInfo.health = 0; } else { - this->actor.colChkInfo.health = var_s0; + this->actor.colChkInfo.health = newHealth; } - if (this->actor.colChkInfo.damageReaction == 2) { - new_var2 = this->unk230 * 70.0f; + if (this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_FIRE) { + new_var2 = this->scaleFac * 70.0f; for (i = 0; i < 4; i++) { EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, new_var2, 0, 0, i); } @@ -981,23 +986,23 @@ void func_809E8140(EnDekubaba* this, PlayState* play) { return; } } else if ((play->actorCtx.unk_02 != 0) && (this->collider.base.colMaterial != COL_MATERIAL_HARD) && - (this->unk1C0 != func_809E79EC) && (this->unk1C0 != func_809E78DC) && + (this->actionFunc != EnDekubaba_Vulnerable) && (this->actionFunc != EnDekubaba_Attacked) && (this->actor.colChkInfo.health != 0)) { this->actor.colChkInfo.health--; this->actor.dropFlag = 0; - func_809E60A8(this, 1); + EnDekubaba_SetupAttacked(this, EN_DEKUBABA_ATTACKED_TYPE_WEAKENED); } else { return; } if (this->actor.colChkInfo.health != 0) { - if (this->unk1C6 == 2) { + if (this->actionState == 2) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DAMAGE); } } else { Enemy_StartFinishingBlow(play, &this->actor); - if (this->actor.params == 1) { + if (this->actor.params == EN_DEKUBABA_TYPE_1) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DEAD); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); @@ -1011,168 +1016,174 @@ void EnDekubaba_Update(Actor* thisx, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_809E6078(this); + EnDekubaba_SetupSoothe(this); } - func_809E8140(this, play); - this->unk1C0(this, play); - if (this->unk1C0 == func_809E7BB0) { + EnDekubaba_CheckCollide(this, play); + this->actionFunc(this, play); + if (this->actionFunc == EnDekubaba_DieDropStick) { Actor_MoveXZGravity(&this->actor); - Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->unk230 * 15.0f, 10.0f, + Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, this->scaleFac * 15.0f, 10.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - } else { - if (this->unk1C0 != func_809E80D8) { - Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - if (this->unk234 == NULL) { - this->unk234 = this->actor.floorPoly; - } + } else if (this->actionFunc != EnDekubaba_DekuStick) { + Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); + if (this->floorPoly == NULL) { + this->floorPoly = this->actor.floorPoly; } } - if (this->unk1C0 == func_809E7104) { + if (this->actionFunc == EnDekubaba_Attack) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); this->actor.flags |= ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT; } if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - if (this->unk1C0 != func_809E80D8) { + if (this->actionFunc != EnDekubaba_DekuStick) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } -void func_809E858C(EnDekubaba* this, PlayState* play) { - f32 sp44; +void EnDekubaba_DrawStem0(EnDekubaba* this, PlayState* play) { + f32 scale; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2445); - sp44 = this->unk230 * 0.01f; - Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y + (-6.0f * this->unk230), this->actor.home.pos.z, + scale = this->scaleFac * 0.01f; + Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y + (-6.0f * this->scaleFac), this->actor.home.pos.z, MTXMODE_NEW); - Matrix_RotateZYX(this->unk1CA_arr[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); - Matrix_Scale(sp44, sp44, sp44, MTXMODE_APPLY); + Matrix_RotateZYX(this->stemPartsRot[0], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2461); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001330); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaStem0DL); Actor_SetFocus(&this->actor, 0.0f); CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2468); } -void func_809E86B8(EnDekubaba* this, PlayState* play) { - MtxF spB0; - f32 temp_fs0; - f32 temp_fs0_2; +void EnDekubaba_DrawStem(EnDekubaba* this, PlayState* play) { + static Gfx* sStemDLists[] = { + gDekubabaStem0DL, + gDekubabaStem1DL, + gDekubabaStem2DL, + }; + MtxF mf; + f32 scale; + f32 dxz; f32 spA4; - s32 i__var_s2; - s32 sp9C; + s32 i; + s32 nStemParts; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2487); - if (this->unk1C0 == func_809E7BB0) { - sp9C = 2; + if (this->actionFunc == EnDekubaba_DieDropStick) { + nStemParts = 2; } else { - sp9C = 3; + nStemParts = 3; } - temp_fs0 = this->unk230 * 0.01f; + scale = this->scaleFac * 0.01f; Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Matrix_Scale(temp_fs0, temp_fs0, temp_fs0, MTXMODE_APPLY); - Matrix_Get(&spB0); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); + Matrix_Get(&mf); if (this->actor.colorFilterTimer != 0) { - spA4 = this->unk230 * 20.0f; - this->unk164.x = this->actor.world.pos.x; - this->unk164.y = this->actor.world.pos.y - spA4; - this->unk164.z = this->actor.world.pos.z; + spA4 = this->scaleFac * 20.0f; + this->unk_164.x = this->actor.world.pos.x; + this->unk_164.y = this->actor.world.pos.y - spA4; + this->unk_164.z = this->actor.world.pos.z; } - for (i__var_s2 = 0; i__var_s2 < sp9C; i__var_s2++) { - spB0.mf[3][1] += 20.0f * Math_SinS(this->unk1CA_arr[i__var_s2]) * this->unk230; - temp_fs0_2 = Math_CosS(this->unk1CA_arr[i__var_s2]) * 20.0f * this->unk230; - spB0.mf[3][0] -= temp_fs0_2 * Math_SinS(this->actor.shape.rot.y); - spB0.mf[3][2] -= temp_fs0_2 * Math_CosS(this->actor.shape.rot.y); - Matrix_Put(&spB0); - Matrix_RotateZYX(this->unk1CA_arr[i__var_s2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + for (i = 0; i < nStemParts; i++) { + mf.yw += 20.0f * Math_SinS(this->stemPartsRot[i]) * this->scaleFac; + dxz = Math_CosS(this->stemPartsRot[i]) * 20.0f * this->scaleFac; + mf.xw -= dxz * Math_SinS(this->actor.shape.rot.y); + mf.zw -= dxz * Math_CosS(this->actor.shape.rot.y); + Matrix_Put(&mf); + Matrix_RotateZYX(this->stemPartsRot[i], this->actor.shape.rot.y, 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2533); - gSPDisplayList(POLY_OPA_DISP++, D_809E902C[i__var_s2]); - Collider_UpdateSpheres(0x33 + (i__var_s2 * 2), &this->collider); - Collider_UpdateSpheres(0x34 + (i__var_s2 * 2), &this->collider); - if (i__var_s2 == 0) { - if (this->unk1C0 != func_809E7A88) { - this->actor.focus.pos.x = spB0.mf[3][0]; - this->actor.focus.pos.y = spB0.mf[3][1]; - this->actor.focus.pos.z = spB0.mf[3][2]; + gSPDisplayList(POLY_OPA_DISP++, sStemDLists[i]); + Collider_UpdateSpheres(51 + (i * 2), &this->collider); + Collider_UpdateSpheres(52 + (i * 2), &this->collider); + if (i == 0) { + if (this->actionFunc != EnDekubaba_Wobble) { + this->actor.focus.pos.x = mf.xw; + this->actor.focus.pos.y = mf.yw; + this->actor.focus.pos.z = mf.zw; } else { this->actor.focus.pos.x = this->actor.home.pos.x; - this->actor.focus.pos.y = this->actor.home.pos.y + (40.0f * this->unk230); + this->actor.focus.pos.y = this->actor.home.pos.y + (40.0f * this->scaleFac); this->actor.focus.pos.z = this->actor.home.pos.z; } } - if ((i__var_s2 < 2) && (this->actor.colorFilterTimer != 0)) { - this->unk14C[i__var_s2].x = spB0.mf[3][0]; - this->unk14C[i__var_s2].y = spB0.mf[3][1] - spA4; - this->unk14C[i__var_s2].z = spB0.mf[3][2]; + if ((i < 2) && (this->actor.colorFilterTimer != 0)) { + this->unk_14C[i].x = mf.xw; + this->unk_14C[i].y = mf.yw - spA4; + this->unk_14C[i].z = mf.zw; } } CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2569); } -void func_809E89E4(EnDekubaba* this, PlayState* play) { +void EnDekubaba_DrawStem2(EnDekubaba* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2579); - Matrix_RotateZYX(this->unk1CA_arr[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); + Matrix_RotateZYX(this->stemPartsRot[2], this->actor.shape.rot.y, 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2586); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); - Collider_UpdateSpheres(0x37, &this->collider); - Collider_UpdateSpheres(0x38, &this->collider); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaStem2DL); + Collider_UpdateSpheres(55, &this->collider); + Collider_UpdateSpheres(56, &this->collider); CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2596); } -void func_809E8AD8(EnDekubaba* this, PlayState* play) { - MtxF sp50; - f32 temp_fa0; +void EnDekubaba_DrawShadow(EnDekubaba* this, PlayState* play) { + MtxF mf; + f32 scale; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2692); Gfx_SetupDL_44Xlu(play->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 0, 0, 0, 255); - func_80038A28(this->unk234, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &sp50); - Matrix_Mult(&sp50, MTXMODE_NEW); - temp_fa0 = this->unk230 * 0.15f; - Matrix_Scale(temp_fa0, 1.0f, temp_fa0, MTXMODE_APPLY); + func_80038A28(this->floorPoly, this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, &mf); + Matrix_Mult(&mf, MTXMODE_NEW); + scale = this->scaleFac * 0.15f; + Matrix_Scale(scale, 1.0f, scale, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2710); gSPDisplayList(POLY_XLU_DISP++, gCircleShadowDL); CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2715); } -void func_809E8C0C(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { +void EnDekubaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnDekubaba* this = thisx; - if (arg1 == 1) { - Collider_UpdateSpheres(arg1, &this->collider); + if (limbIndex == DEKUBABA_HEAD_LIMB_ROOT) { + Collider_UpdateSpheres(limbIndex, &this->collider); } } void EnDekubaba_Draw(Actor* thisx, PlayState* play) { EnDekubaba* this = (EnDekubaba*)thisx; - f32 sp50; + f32 scale; OPEN_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2752); Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (this->unk1C0 != func_809E80D8) { - SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, func_809E8C0C, this); - if (this->unk1C0 == func_809E64F4) { - func_809E858C(this, play); + if (this->actionFunc != EnDekubaba_DekuStick) { + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, EnDekubaba_PostLimbDraw, + this); + if (this->actionFunc == EnDekubaba_WaitPlayerNear) { + EnDekubaba_DrawStem0(this, play); } else { - func_809E86B8(this, play); + EnDekubaba_DrawStem(this, play); } - sp50 = this->unk230 * 0.01f; + + scale = this->scaleFac * 0.01f; Matrix_Translate(this->actor.home.pos.x, this->actor.home.pos.y, this->actor.home.pos.z, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->actor.home.rot.y), MTXMODE_APPLY); - Matrix_Scale(sp50, sp50, sp50, MTXMODE_APPLY); + Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2780); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_0010F0); - if (this->unk1C0 == func_809E7BB0) { - func_809E89E4(this, play); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaBaseLeavesDL); + + if (this->actionFunc == EnDekubaba_DieDropStick) { + EnDekubaba_DrawStem2(this, play); } - if (this->unk234 != NULL) { - func_809E8AD8(this, play); + if (this->floorPoly != NULL) { + EnDekubaba_DrawShadow(this, play); } } else { - if ((this->unk1C6 >= 0x29) || (this->unk1C6 & 1)) { + if ((this->actionState > 40) || (this->actionState & 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_dekubaba.c", 2797); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_003070); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaDekuStickDL); } } CLOSE_DISPS(play->state.gfxCtx, "../z_en_dekubaba.c", 2804); 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 ca347698324..a622804e93c 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -4,23 +4,30 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_dekubaba/object_dekubaba.h" + +typedef enum EnDekubabaType { + EN_DEKUBABA_TYPE_0, + EN_DEKUBABA_TYPE_1 +} EnDekubabaType; + struct EnDekubaba; typedef struct EnDekubaba { /* 0x000 */ Actor actor; - /* 0x14C */ Vec3f unk14C[2]; - /* 0x164 */ Vec3f unk164; - /* 0x170 */ Vec3f unk170; + /* 0x14C */ Vec3f unk_14C[2]; // unused + /* 0x164 */ Vec3f unk_164; // unused + /* 0x170 */ Vec3f homePos; // unused /* 0x17C */ SkelAnime skelAnime; - /* 0x1C0 */ void (*unk1C0)(struct EnDekubaba*, struct PlayState*); - /* 0x1C4 */ char pad1C4[2]; - /* 0x1C6 */ s16 unk1C6; - /* 0x1C8 */ s16 unk1C8; - /* 0x1CA */ s16 unk1CA_arr[3]; - /* 0x1D0 */ Vec3s jointTable[8]; - /* 0x200 */ Vec3s morphTable[8]; - /* 0x230 */ f32 unk230; - /* 0x234 */ struct CollisionPoly* unk234; + /* 0x1C0 */ void (*actionFunc)(struct EnDekubaba*, struct PlayState*); + /* 0x1C4 */ char pad_1C4[2]; + /* 0x1C6 */ s16 actionState; + /* 0x1C8 */ s16 wobbleTarget; + /* 0x1CA */ s16 stemPartsRot[3]; + /* 0x1D0 */ Vec3s jointTable[DEKUBABA_HEAD_LIMB_MAX]; + /* 0x200 */ Vec3s morphTable[DEKUBABA_HEAD_LIMB_MAX]; + /* 0x230 */ f32 scaleFac; + /* 0x234 */ struct CollisionPoly* floorPoly; /* 0x238 */ ColliderJntSph collider; /* 0x258 */ ColliderJntSphElement colliderElements[7]; } EnDekubaba; // size = 0x418 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 bb8b5be2ae7..03ceac16073 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -106,8 +106,8 @@ void EnKarebaba_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 22.0f); - SkelAnime_Init(play, &this->skelAnime, &object_dekubaba_Skel_002A40, &object_dekubaba_Anim_0002B8, this->jointTable, - this->morphTable, 8); + SkelAnime_Init(play, &this->skelAnime, &gDekubabaHeadSkel, &gDekubabaChompAnim, this->jointTable, this->morphTable, + DEKUBABA_HEAD_LIMB_MAX); Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, &this->actor, &sBodyColliderInit); Collider_UpdateCylinder(&this->actor, &this->bodyCollider); @@ -156,8 +156,8 @@ void EnKarebaba_SetupIdle(EnKarebaba* this) { } void EnKarebaba_SetupAwaken(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 4.0f, 0.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), ANIMMODE_LOOP, -3.0f); + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, 4.0f, 0.0f, Animation_GetLastFrame(&gDekubabaChompAnim), + ANIMMODE_LOOP, -3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_DUMMY482); this->actionFunc = EnKarebaba_Awaken; } @@ -208,14 +208,14 @@ void EnKarebaba_SetupDeadItemDrop(EnKarebaba* this, PlayState* play) { } void EnKarebaba_SetupRetract(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, -3.0f, - Animation_GetLastFrame(&object_dekubaba_Anim_0002B8), 0.0f, ANIMMODE_ONCE, -3.0f); + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, -3.0f, Animation_GetLastFrame(&gDekubabaChompAnim), 0.0f, + ANIMMODE_ONCE, -3.0f); EnKarebaba_ResetCollider(this); this->actionFunc = EnKarebaba_Retract; } void EnKarebaba_SetupDead(EnKarebaba* this) { - Animation_Change(&this->skelAnime, &object_dekubaba_Anim_0002B8, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, 0.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); EnKarebaba_ResetCollider(this); this->actor.shape.rot.x = -0x4000; this->actor.params = 200; @@ -470,7 +470,7 @@ void EnKarebaba_DrawCenterShadow(EnKarebaba* this, PlayState* play) { void EnKarebaba_Draw(Actor* thisx, PlayState* play) { static Color_RGBA8 black = { 0, 0, 0, 0 }; - static Gfx* dLists[] = { object_dekubaba_DL_001330, object_dekubaba_DL_001628, object_dekubaba_DL_001828 }; + static Gfx* dLists[] = { gDekubabaStem0DL, gDekubabaStem1DL, gDekubabaStem2DL }; static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; EnKarebaba* this = (EnKarebaba*)thisx; s32 i; @@ -485,7 +485,7 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { if (this->actor.params > 40 || PARAMS_GET_U(this->actor.params, 0, 1)) { Matrix_Translate(0.0f, 0.0f, 200.0f, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1066); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_003070); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaDekuStickDL); } } else if (this->actionFunc != EnKarebaba_Dead) { func_80026230(play, &black, 1, 2); @@ -530,12 +530,12 @@ void EnKarebaba_Draw(Actor* thisx, PlayState* play) { Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_RotateY(BINANG_TO_RAD(this->actor.home.rot.y), MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1144); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_0010F0); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaBaseLeavesDL); if (this->actionFunc == EnKarebaba_Dying) { Matrix_RotateZYX(-0x4000, (s16)(this->actor.shape.rot.y - this->actor.home.rot.y), 0, MTXMODE_APPLY); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_en_karebaba.c", 1155); - gSPDisplayList(POLY_OPA_DISP++, object_dekubaba_DL_001828); + gSPDisplayList(POLY_OPA_DISP++, gDekubabaStem2DL); } func_80026608(play); diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h index 347cafa189d..54a5674db1b 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_dekubaba/object_dekubaba.h" + struct EnKarebaba; typedef void (*EnKarebabaActionFunc)(struct EnKarebaba*, struct PlayState*); @@ -12,8 +14,8 @@ typedef struct EnKarebaba { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; /* 0x0190 */ EnKarebabaActionFunc actionFunc; - /* 0x0194 */ Vec3s jointTable[8]; - /* 0x01C4 */ Vec3s morphTable[8]; + /* 0x0194 */ Vec3s jointTable[DEKUBABA_HEAD_LIMB_MAX]; + /* 0x01C4 */ Vec3s morphTable[DEKUBABA_HEAD_LIMB_MAX]; /* 0x01F4 */ struct CollisionPoly* boundFloor; /* 0x01F8 */ ColliderCylinder headCollider; /* 0x0244 */ ColliderCylinder bodyCollider; From ebce5c02861ea7533a8cb6daa93b24d692ffa77e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 9 Aug 2026 01:17:27 +0200 Subject: [PATCH 087/150] partial docs for BgSpot08Iceblock --- .../z_bg_spot08_iceblock.c | 314 +++++++++--------- .../z_bg_spot08_iceblock.h | 20 +- 2 files changed, 167 insertions(+), 167 deletions(-) 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 8b76c60cf8f..488b9dbba2d 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 @@ -6,7 +6,6 @@ #include "printf.h" #include "sys_math3d.h" #include "sys_matrix.h" -#include "translation.h" #include "z_lib.h" #include "play_state.h" #include "player.h" @@ -21,13 +20,13 @@ void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play); void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play); void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play); -void func_808B1388(BgSpot08Iceblock* this); -void func_808B13AC(BgSpot08Iceblock* this, PlayState* play); -void func_808B13FC(BgSpot08Iceblock* this); -void func_808B1420(BgSpot08Iceblock* this, PlayState* play); -void func_808B147C(BgSpot08Iceblock* this); -void func_808B14A0(BgSpot08Iceblock* this, PlayState* play); -void func_808B1574(BgSpot08Iceblock* this); +void BgSpot08Iceblock_SetupIcebergStatic(BgSpot08Iceblock* this); +void BgSpot08Iceblock_IcebergStatic(BgSpot08Iceblock* this, PlayState* play); +void BgSpot08Iceblock_SetupIcebergSpin(BgSpot08Iceblock* this); +void BgSpot08Iceblock_IcebergSpin(BgSpot08Iceblock* this, PlayState* play); +void BgSpot08Iceblock_SetupActionIcebergDuo(BgSpot08Iceblock* this); +void BgSpot08Iceblock_IcebergDuo(BgSpot08Iceblock* this, PlayState* play); +void BgSpot08Iceblock_SetupDoNothing(BgSpot08Iceblock* this); ActorProfile Bg_Spot08_Iceblock_Profile = { /**/ ACTOR_BG_SPOT08_ICEBLOCK, @@ -41,7 +40,7 @@ ActorProfile Bg_Spot08_Iceblock_Profile = { /**/ BgSpot08Iceblock_Draw, }; -static Vec3f D_808B16B0 = { 0.0f, 1.0f, 0.0f }; +static Vec3f sUpVec = { 0.0f, 1.0f, 0.0f }; static Vec3f D_808B16BC = { 0.0f, 0.0f, 0.0f }; static f32 D_808B16C8[3] = { 1.4285714e-8f, 5.714286e-9f, 1.4285715e-9f }; static f32 D_808B16D4[3] = { 0.96f, 0.96f, 0.98f }; @@ -53,18 +52,18 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDownward, 2200, ICHAIN_STOP), }; -void func_808B0960(BgSpot08Iceblock* this, void (*arg1)(BgSpot08Iceblock*, PlayState*)) { - this->unk164 = arg1; +void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, void (*actionFunc)(BgSpot08Iceblock*, PlayState*)) { + this->actionFunc = actionFunc; } -void func_808B0968(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* arg2, s32 arg3) { +void BgSpot08Iceblock_InitDynapoly(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* colHeaderSeg, + s32 transformFlags) { s32 pad; - CollisionHeader* sp30; + CollisionHeader* colHeader = NULL; - sp30 = NULL; - DynaPolyActor_Init(&this->dyna, arg3); - CollisionHeader_GetVirtual(arg2, &sp30); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp30); + DynaPolyActor_Init(&this->dyna, transformFlags); + CollisionHeader_GetVirtual(colHeaderSeg, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); #if DEBUG_FEATURES if (this->dyna.bgId == BG_ACTOR_MAX) { @@ -76,7 +75,7 @@ void func_808B0968(BgSpot08Iceblock* this, PlayState* play, CollisionHeader* arg #endif } -void func_808B09F0(BgSpot08Iceblock* this) { +void BgSpot08Iceblock_CheckParams(BgSpot08Iceblock* this) { switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case 0xFF: this->dyna.actor.params = 0x10; @@ -101,186 +100,186 @@ void func_808B09F0(BgSpot08Iceblock* this) { } } -void func_808B0A84(BgSpot08Iceblock* this) { - this->unk198 = (Math_SinS(this->unk18C) * 4.0f) + (Math_SinS(this->unk18E) * 3.0f); +void BgSpot08Iceblock_UpdateYOscillation(BgSpot08Iceblock* this) { + this->yOscillation = (Math_SinS(this->yOscillationPhase1) * 4.0f) + (Math_SinS(this->yOscillationPhase2) * 3.0f); } -void func_808B0AE0(BgSpot08Iceblock* this) { - f32 var_fv0; - f32 sp18; +void BgSpot08Iceblock_UpdateSinkHeight(BgSpot08Iceblock* this) { + f32 target; + f32 step; switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 4, 4)) { case 0: - sp18 = 0.15f; + step = 0.15f; break; case 0x10: - sp18 = 0.2f; + step = 0.2f; break; case 0x20: - sp18 = 0.4f; + step = 0.4f; break; } - if (DynaPolyActor_IsActorOnTop(&this->dyna) != 0) { - var_fv0 = -4.0f; + if (DynaPolyActor_IsActorOnTop(&this->dyna)) { + target = -4.0f; } else { - var_fv0 = 0.0f; + target = 0.0f; } - Math_StepToF(&this->unk194, var_fv0, sp18); + Math_StepToF(&this->sinkHeight, target, step); } -void func_808B0B8C(BgSpot08Iceblock* this) { - this->dyna.actor.world.pos.y = this->unk194 + this->unk198 + this->dyna.actor.home.pos.y; +void BgSpot08Iceblock_UpdatePosY(BgSpot08Iceblock* this) { + this->dyna.actor.world.pos.y = this->sinkHeight + this->yOscillation + this->dyna.actor.home.pos.y; } -void func_808B0BA8(Vec3f* arg0, Vec3f* arg1, f32 arg2) { - arg0->x = arg1->x * arg2; - arg0->y = arg1->y * arg2; - arg0->z = arg1->z * arg2; +void BgSpot08Iceblock_VecScale(Vec3f* dest, Vec3f* src, f32 fac) { + dest->x = src->x * fac; + dest->y = src->y * fac; + dest->z = src->z * fac; } -void func_808B0BD4(Vec3f* arg0, Vec3f* arg1, Vec3f* arg2) { - arg0->x = (arg1->y * arg2->z) - (arg1->z * arg2->y); - arg0->y = (arg1->z * arg2->x) - (arg1->x * arg2->z); - arg0->z = (arg1->x * arg2->y) - (arg1->y * arg2->x); +void BgSpot08Iceblock_VecCross(Vec3f* dest, Vec3f* a, Vec3f* b) { + dest->x = (a->y * b->z) - (a->z * b->y); + dest->y = (a->z * b->x) - (a->x * b->z); + dest->z = (a->x * b->y) - (a->y * b->x); } -s32 func_808B0C44(Vec3f* arg0, Vec3f* arg1) { - f32 temp_fv0; - f32 temp_fv1; +s32 BgSpot08Iceblock_VecNormalize(Vec3f* dest, Vec3f* src) { + f32 len; + f32 invLen; - temp_fv0 = Math3D_Vec3fMagnitude(arg1); - if (temp_fv0 < 0.001f) { - arg0->y = 0.0f; - arg0->x = 0.0f; - arg0->z = 1.0f; + len = Math3D_Vec3fMagnitude(src); + if (len < 0.001f) { + dest->y = 0.0f; + dest->x = 0.0f; + dest->z = 1.0f; return false; } else { - temp_fv1 = 1.0f / temp_fv0; - arg0->x = arg1->x * temp_fv1; - arg0->y = arg1->y * temp_fv1; - arg0->z = arg1->z * temp_fv1; + invLen = 1.0f / len; + dest->x = src->x * invLen; + dest->y = src->y * invLen; + dest->z = src->z * invLen; return true; } } -void func_808B0CE0(BgSpot08Iceblock* this, PlayState* play) { +void BgSpot08Iceblock_UpdateSwaying(BgSpot08Iceblock* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; Vec3f spD4; Vec3f spC8; Vec3f spBC; Vec3f spB0; - Vec3f spA4; + Vec3f randVec; Vec3f sp98; - Vec3f sp8C; + Vec3f swayAxis; f32 sp88; - s32 sp84; - MtxF sp44; + s32 physicsSet; + MtxF mf; f32 temp_fv0_2; f32 temp_fv1; switch (PARAMS_GET_U(this->dyna.actor.params, 0, 8)) { case 0x11: - sp84 = 0; + physicsSet = 0; break; case 1: - sp84 = 1; + physicsSet = 1; break; default: - sp84 = 2; + physicsSet = 2; break; } Math_Vec3f_Diff(&player->actor.world.pos, &this->dyna.actor.world.pos, &spC8); spC8.y -= 150.0f * this->dyna.actor.scale.y; sp88 = Math3D_Vec3fMagnitude(&spC8); - spA4.x = (Rand_ZeroOne() - 0.5f) * 0.0016f; - spA4.y = 0.0f; - spA4.z = (Rand_ZeroOne() - 0.5f) * 0.0016f; - spD4.x = this->unk168.x; + randVec.x = (Rand_ZeroOne() - 0.5f) * 0.0016f; + randVec.y = 0.0f; + randVec.z = (Rand_ZeroOne() - 0.5f) * 0.0016f; + spD4.x = this->unk_168.x; spD4.y = 0.0f; - spD4.z = this->unk168.z; - if ((DynaPolyActor_IsPlayerOnTop(&this->dyna) != 0) && (sp88 > 3.0f)) { + spD4.z = this->unk_168.z; + if (DynaPolyActor_IsPlayerOnTop(&this->dyna) && (sp88 > 3.0f)) { Math_Vec3f_Diff(&spC8, &spD4, &spBC); - func_808B0BA8(&spBC, &spBC, (D_808B16C8[sp84] * sp88) / this->dyna.actor.scale.x); + BgSpot08Iceblock_VecScale(&spBC, &spBC, (D_808B16C8[physicsSet] * sp88) / this->dyna.actor.scale.x); } else { spBC = D_808B16BC; } - func_808B0BA8(&spB0, &spD4, -0.01f); - Math_Vec3f_Sum(&this->unk174, &spBC, &this->unk174); - Math_Vec3f_Sum(&this->unk174, &spB0, &this->unk174); - Math_Vec3f_Sum(&this->unk174, &spA4, &this->unk174); - this->unk174.y = 0.0f; - Math_Vec3f_Sum(&this->unk168, &this->unk174, &sp98); - sp98.x *= D_808B16D4[sp84]; - sp98.z *= D_808B16D4[sp84]; - if (func_808B0C44(&this->unk168, &sp98)) { - temp_fv0_2 = Math3D_Dist1DSq(this->unk168.z, this->unk168.x); - if (D_808B16E0[sp84] < temp_fv0_2) { - temp_fv1 = D_808B16E0[sp84] / temp_fv0_2; - this->unk168.x *= temp_fv1; - this->unk168.y = D_808B16EC[sp84]; - this->unk168.z *= temp_fv1; + BgSpot08Iceblock_VecScale(&spB0, &spD4, -0.01f); + Math_Vec3f_Sum(&this->unk_174, &spBC, &this->unk_174); + Math_Vec3f_Sum(&this->unk_174, &spB0, &this->unk_174); + Math_Vec3f_Sum(&this->unk_174, &randVec, &this->unk_174); + this->unk_174.y = 0.0f; + Math_Vec3f_Sum(&this->unk_168, &this->unk_174, &sp98); + sp98.x *= D_808B16D4[physicsSet]; + sp98.z *= D_808B16D4[physicsSet]; + if (BgSpot08Iceblock_VecNormalize(&this->unk_168, &sp98)) { + temp_fv0_2 = Math3D_Dist1DSq(this->unk_168.z, this->unk_168.x); + if (D_808B16E0[physicsSet] < temp_fv0_2) { + temp_fv1 = D_808B16E0[physicsSet] / temp_fv0_2; + this->unk_168.x *= temp_fv1; + this->unk_168.y = D_808B16EC[physicsSet]; + this->unk_168.z *= temp_fv1; } - func_808B0BD4(&sp98, &D_808B16B0, &this->unk168); - if (func_808B0C44(&sp8C, &sp98)) { - this->unk180 = sp8C; + BgSpot08Iceblock_VecCross(&sp98, &sUpVec, &this->unk_168); + if (BgSpot08Iceblock_VecNormalize(&swayAxis, &sp98)) { + this->swayAxis = swayAxis; } } else { - this->unk168 = D_808B16B0; + this->unk_168 = sUpVec; } - Matrix_RotateAxis(Math_FAcosF(Math3D_Cos(&D_808B16B0, &this->unk168)), &this->unk180, MTXMODE_NEW); + Matrix_RotateAxis(Math_FAcosF(Math3D_Cos(&sUpVec, &this->unk_168)), &this->swayAxis, MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.shape.rot.y), MTXMODE_APPLY); - Matrix_Get(&sp44); - Matrix_MtxFToYXZRotS(&sp44, &this->dyna.actor.shape.rot, 0); + Matrix_Get(&mf); + Matrix_MtxFToYXZRotS(&mf, &this->dyna.actor.shape.rot, 0); } -void func_808B1054(BgSpot08Iceblock* this, PlayState* play) { +void BgSpot08Iceblock_SetupIcebergDuo(BgSpot08Iceblock* this, PlayState* play) { s32 pad[2]; - f32 sp44; - f32 temp_fv1; + f32 dx; + f32 dz; - sp44 = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; - temp_fv1 = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; + dx = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; + dz = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; 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, 0x123); - this->dyna.actor.world.pos.x += sp44; - this->dyna.actor.world.pos.z += temp_fv1; + this->dyna.actor.world.pos.x += dx; + this->dyna.actor.world.pos.z += dz; } else { - this->dyna.actor.world.pos.x -= sp44; - this->dyna.actor.world.pos.z -= temp_fv1; + this->dyna.actor.world.pos.x -= dx; + this->dyna.actor.world.pos.z -= dz; } - func_808B147C(this); + BgSpot08Iceblock_SetupActionIcebergDuo(this); } void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { s32 pad; - CollisionHeader* var_a2; - s32 temp_v0_2; + CollisionHeader* colHeader; + s32 behaviorType; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; PRINTF("(spot08 流氷)(arg_data 0x%04x)\n", this->dyna.actor.params); - func_808B09F0(this); + BgSpot08Iceblock_CheckParams(this); switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { case 0: - var_a2 = &gZorasFountainIcebergCol; + colHeader = &gZorasFountainIcebergCol; break; case 0x200: - var_a2 = &gZorasFountainIceRampCol; + colHeader = &gZorasFountainIceRampCol; break; } - temp_v0_2 = PARAMS_GET_U(this->dyna.actor.params, 0, 4); - if ((temp_v0_2 == 2) || (temp_v0_2 == 3)) { - func_808B0968(this, play, var_a2, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); + behaviorType = PARAMS_GET_U(this->dyna.actor.params, 0, 4); + if ((behaviorType == 2) || (behaviorType == 3)) { + BgSpot08Iceblock_InitDynapoly(this, play, colHeader, DYNA_TRANSFORM_POS | DYNA_TRANSFORM_ROT_Y); } else { - func_808B0968(this, play, var_a2, 0); + BgSpot08Iceblock_InitDynapoly(this, play, colHeader, 0); } if (LINK_AGE_IN_YEARS == YEARS_CHILD) { Actor_Kill(&this->dyna.actor); @@ -300,25 +299,26 @@ void BgSpot08Iceblock_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->dyna.actor, 0.05f); break; } - this->unk18C = (s16)(s32)(Rand_ZeroOne() * 65535.5f); - this->unk18E = (s16)(s32)(Rand_ZeroOne() * 65535.5f); - this->unk168.y = 1.0f; - this->unk180.x = 1.0f; + this->yOscillationPhase1 = TRUNCF_BINANG(Rand_ZeroOne() * 65535.5f); + this->yOscillationPhase2 = TRUNCF_BINANG(Rand_ZeroOne() * 65535.5f); + this->unk_168.y = 1.0f; + this->swayAxis.x = 1.0f; switch (PARAMS_GET_U(this->dyna.actor.params, 0, 4)) { case 0: case 1: - func_808B1388(this); + BgSpot08Iceblock_SetupIcebergStatic(this); break; case 2: - func_808B13FC(this); + BgSpot08Iceblock_SetupIcebergSpin(this); break; case 3: - func_808B1054(this, play); + BgSpot08Iceblock_SetupIcebergDuo(this, play); break; + case 4: - func_808B1574(this); + BgSpot08Iceblock_SetupDoNothing(this); break; default: @@ -332,87 +332,87 @@ void BgSpot08Iceblock_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_808B1388(BgSpot08Iceblock* this) { - func_808B0960(this, func_808B13AC); +void BgSpot08Iceblock_SetupIcebergStatic(BgSpot08Iceblock* this) { + BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_IcebergStatic); } -void func_808B13AC(BgSpot08Iceblock* this, PlayState* play) { - func_808B0A84(this); - func_808B0AE0(this); - func_808B0B8C(this); +void BgSpot08Iceblock_IcebergStatic(BgSpot08Iceblock* this, PlayState* play) { + BgSpot08Iceblock_UpdateYOscillation(this); + BgSpot08Iceblock_UpdateSinkHeight(this); + BgSpot08Iceblock_UpdatePosY(this); this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - func_808B0CE0(this, play); + BgSpot08Iceblock_UpdateSwaying(this, play); } -void func_808B13FC(BgSpot08Iceblock* this) { - func_808B0960(this, func_808B1420); +void BgSpot08Iceblock_SetupIcebergSpin(BgSpot08Iceblock* this) { + BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_IcebergSpin); } -void func_808B1420(BgSpot08Iceblock* this, PlayState* play) { - func_808B0A84(this); - func_808B0AE0(this); - func_808B0B8C(this); +void BgSpot08Iceblock_IcebergSpin(BgSpot08Iceblock* this, PlayState* play) { + BgSpot08Iceblock_UpdateYOscillation(this); + BgSpot08Iceblock_UpdateSinkHeight(this); + BgSpot08Iceblock_UpdatePosY(this); this->dyna.actor.world.rot.y += 0x190; this->dyna.actor.shape.rot.y = this->dyna.actor.world.rot.y; - func_808B0CE0(this, play); + BgSpot08Iceblock_UpdateSwaying(this, play); } -void func_808B147C(BgSpot08Iceblock* this) { - func_808B0960(this, func_808B14A0); +void BgSpot08Iceblock_SetupActionIcebergDuo(BgSpot08Iceblock* this) { + BgSpot08Iceblock_SetupAction(this, BgSpot08Iceblock_IcebergDuo); } -void func_808B14A0(BgSpot08Iceblock* this, PlayState* play) { - f32 temp_fa0; - f32 temp_fv1; +void BgSpot08Iceblock_IcebergDuo(BgSpot08Iceblock* this, PlayState* play) { + f32 dz; + f32 dx; - func_808B0A84(this); - func_808B0AE0(this); - func_808B0B8C(this); + BgSpot08Iceblock_UpdateYOscillation(this); + BgSpot08Iceblock_UpdateSinkHeight(this); + BgSpot08Iceblock_UpdatePosY(this); if (!PARAMS_GET_NOSHIFT(this->dyna.actor.params, 8, 1)) { this->dyna.actor.world.rot.y += 0x190; - temp_fv1 = Math_SinS(this->dyna.actor.world.rot.y) * 100.0f; - temp_fa0 = Math_CosS(this->dyna.actor.world.rot.y) * 100.0f; - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + temp_fv1; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + temp_fa0; + dx = Math_SinS(this->dyna.actor.world.rot.y) * 100.0f; + dz = Math_CosS(this->dyna.actor.world.rot.y) * 100.0f; + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + dx; + this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + dz; if (this->dyna.actor.child != NULL) { - this->dyna.actor.child->world.pos.x = this->dyna.actor.home.pos.x - temp_fv1; - this->dyna.actor.child->world.pos.z = this->dyna.actor.home.pos.z - temp_fa0; + this->dyna.actor.child->world.pos.x = this->dyna.actor.home.pos.x - dx; + this->dyna.actor.child->world.pos.z = this->dyna.actor.home.pos.z - dz; } } this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y; - func_808B0CE0(this, play); + BgSpot08Iceblock_UpdateSwaying(this, play); } -void func_808B1574(BgSpot08Iceblock* this) { - func_808B0960(this, NULL); +void BgSpot08Iceblock_SetupDoNothing(BgSpot08Iceblock* this) { + BgSpot08Iceblock_SetupAction(this, NULL); } void BgSpot08Iceblock_Update(Actor* thisx, PlayState* play) { BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; if (Rand_ZeroOne() < 0.05f) { - this->unk190 = Rand_S16Offset(0x12C, 0x64); - this->unk192 = Rand_S16Offset(0x320, 0x190); + this->yOscillationPulse1 = Rand_S16Offset(0x12C, 0x64); + this->yOscillationPulse2 = Rand_S16Offset(0x320, 0x190); } - this->unk18C += this->unk190; - this->unk18E += this->unk192; - if (this->unk164 != NULL) { - this->unk164(this, play); + this->yOscillationPhase1 += this->yOscillationPulse1; + this->yOscillationPhase2 += this->yOscillationPulse2; + if (this->actionFunc != NULL) { + this->actionFunc(this, play); } } void BgSpot08Iceblock_Draw(Actor* thisx, PlayState* play) { - Gfx* sp1C; + Gfx* dl; BgSpot08Iceblock* this = (BgSpot08Iceblock*)thisx; switch (PARAMS_GET_NOSHIFT(this->dyna.actor.params, 9, 1)) { case 0x0: - sp1C = gZorasFountainIcebergDL; + dl = gZorasFountainIcebergDL; break; case 0x200: - sp1C = gZorasFountainIceRampDL; + dl = gZorasFountainIceRampDL; break; } - Gfx_DrawDListOpa(play, sp1C); + Gfx_DrawDListOpa(play, dl); } diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h index fc7e0f7061d..c04398c3c06 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h @@ -8,16 +8,16 @@ struct BgSpot08Iceblock; typedef struct BgSpot08Iceblock { /* 0x000 */ DynaPolyActor dyna; - /* 0x164 */ void (*unk164)(struct BgSpot08Iceblock*, struct PlayState*); - /* 0x168 */ Vec3f unk168; - /* 0x174 */ Vec3f unk174; - /* 0x180 */ Vec3f unk180; - /* 0x18C */ s16 unk18C; - /* 0x18E */ s16 unk18E; - /* 0x190 */ s16 unk190; - /* 0x192 */ s16 unk192; - /* 0x194 */ f32 unk194; - /* 0x198 */ f32 unk198; + /* 0x164 */ void (*actionFunc)(struct BgSpot08Iceblock*, struct PlayState*); + /* 0x168 */ Vec3f unk_168; + /* 0x174 */ Vec3f unk_174; + /* 0x180 */ Vec3f swayAxis; + /* 0x18C */ s16 yOscillationPhase1; + /* 0x18E */ s16 yOscillationPhase2; + /* 0x190 */ s16 yOscillationPulse1; + /* 0x192 */ s16 yOscillationPulse2; + /* 0x194 */ f32 sinkHeight; + /* 0x198 */ f32 yOscillation; } BgSpot08Iceblock; // size = 0x19C #endif From e81e73ddd02ef5f251903156b7c4cdb24bd628c4 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 9 Aug 2026 09:46:29 +0200 Subject: [PATCH 088/150] doc EnFirefly --- assets/xml/objects/object_firefly.xml | 96 +-- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 8 +- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c | 3 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 715 ++++++++++-------- .../actors/ovl_En_Firefly/z_en_firefly.h | 30 +- 5 files changed, 455 insertions(+), 397 deletions(-) diff --git a/assets/xml/objects/object_firefly.xml b/assets/xml/objects/object_firefly.xml index 34c45196f9b..13010ab4b80 100644 --- a/assets/xml/objects/object_firefly.xml +++ b/assets/xml/objects/object_firefly.xml @@ -2,7 +2,7 @@ - + @@ -18,75 +18,75 @@ - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 efd4d0862dd..060b6706dbd 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 @@ -1,5 +1,6 @@ #include "z_bg_haka_huta.h" -#include "overlays/actors/ovl_En_Rd/z_en_rd.h" +#include "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h" +#include "src/overlays/actors/ovl_En_Rd/z_en_rd.h" #include "libc64/qrand.h" #include "ichain.h" @@ -124,17 +125,16 @@ void func_8087D2F0(BgHakaHuta* this, PlayState* play) { this->dyna.actor.world.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + (40.0f * Math_SinS(this->dyna.actor.shape.rot.y)), this->dyna.actor.world.pos.y - 10.0f, - this->dyna.actor.world.pos.z - (-25.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + (40.0f * Math_CosS(this->dyna.actor.shape.rot.y)), - 0, this->dyna.actor.shape.rot.y + 0x8000, 0, 2); + 0, this->dyna.actor.shape.rot.y + 0x8000, 0, EN_FIREFLY_TYPE_NORMAL); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, this->dyna.actor.world.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + (80.0f * Math_SinS(this->dyna.actor.shape.rot.y)), this->dyna.actor.world.pos.y - 10.0f, this->dyna.actor.world.pos.z - (-25.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + (80.0f * Math_CosS(this->dyna.actor.shape.rot.y)), - 0, this->dyna.actor.shape.rot.y, 0, 2); + 0, this->dyna.actor.shape.rot.y, 0, EN_FIREFLY_TYPE_NORMAL); } else if (this->unk16A == 1) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RD, this->dyna.actor.home.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + 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 a1b2e46f76d..3f3cdd2dd34 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 @@ -5,6 +5,7 @@ */ #include "z_bg_haka_tubo.h" +#include "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h" #include "libc64/qrand.h" #include "gfx.h" @@ -189,7 +190,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) { collectibleParams = -1; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y + 80.0f, this->dyna.actor.world.pos.z, 0, - this->dyna.actor.shape.rot.y, 0, 2); + this->dyna.actor.shape.rot.y, 0, EN_FIREFLY_TYPE_NORMAL); Sfx_PlaySfxCentered(NA_SE_SY_ERROR); } else { // Random rewards 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 ad5e3487935..ab083dccfc5 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -26,18 +26,29 @@ void EnFirefly_Destroy(Actor* thisx, PlayState* play); void EnFirefly_Update(Actor* thisx, PlayState* play2); void EnFirefly_DrawOpa(Actor* thisx, PlayState* play); -void func_80A13A08_Action(EnFirefly*, PlayState*); -void func_80A13C98_Action(EnFirefly*, PlayState*); -void func_80A13D68_Action(EnFirefly*, PlayState*); -void func_80A13DE4_Action(EnFirefly*, PlayState*); -void func_80A13FF4_Action(EnFirefly*, PlayState*); -void func_80A14088_Action(EnFirefly*, PlayState*); -void func_80A141F0_Action(EnFirefly*, PlayState*); -void func_80A14294_Action(EnFirefly*, PlayState*); -void func_80A142F4_Action_Perched_(EnFirefly*, PlayState*); -void func_80A143B4_Action_SwoopOnPlayer(EnFirefly*, PlayState*); +void EnFirefly_Idle(EnFirefly*, PlayState*); +void EnFirefly_Die(EnFirefly*, PlayState*); +void EnFirefly_Disappear(EnFirefly*, PlayState*); +void EnFirefly_Attack(EnFirefly*, PlayState*); +void EnFirefly_Stay(EnFirefly*, PlayState*); +void EnFirefly_FlyTowardsHome(EnFirefly*, PlayState*); +void EnFirefly_Stunned(EnFirefly*, PlayState*); +void EnFirefly_DieFrozen(EnFirefly*, PlayState*); +void EnFirefly_Perched(EnFirefly*, PlayState*); +void EnFirefly_AttackFromPerched(EnFirefly*, PlayState*); void EnFirefly_DrawXlu(Actor*, PlayState*); +typedef enum EnFireflyEffectsElementalType { + EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE, + EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE, + EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_ICE +} EnFireflyEffectsElementalType; + +typedef enum EnFireflyBodyElementalType { + EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL, + EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE +} EnFireflyBodyElementalType; + ActorProfile En_Firefly_Profile = { /**/ ACTOR_EN_FIREFLY, /**/ ACTORCAT_ENEMY, @@ -49,78 +60,102 @@ ActorProfile En_Firefly_Profile = { /**/ EnFirefly_Update, /**/ EnFirefly_DrawOpa, }; -static ColliderJntSphElementInit sJntSphElementsInit[1] = { + +static ColliderJntSphElementInit sJntSphElementsInit[] = { + { + { + ELEM_MATERIAL_UNK0, + { 0xFFCFFFFF, HIT_SPECIAL_EFFECT_FIRE, 0x08 }, + { 0xFFCFFFFF, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_ON | ATELEM_SFX_HARD, + ACELEM_ON, + OCELEM_ON, + }, + { KEESE_LIMB_ROOT_ROOT, { { 0, 1000, 0 }, 15 }, 100 }, + }, +}; + +static ColliderJntSphInit sJntSphInit = { { - { 0, { 0xFFCFFFFF, 1, 8 }, { 0xFFCFFFFF, 0, 0 }, 9, 1, 1 }, - { 1, { { 0, 0x3E8, 0 }, 0xF }, 0x64 }, + COL_MATERIAL_HIT3, + AT_ON | AT_TYPE_ENEMY, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_JNTSPH, }, + ARRAY_COUNT(sJntSphElementsInit), + sJntSphElementsInit, }; -static ColliderJntSphInit sJntSphInit = { { 3, 0x11, 9, 0x39, 0x10, 0 }, 1, sJntSphElementsInit }; + static CollisionCheckInfoInit sColChkInfoInit = { 1, 10, 10, 30 }; + +typedef enum EnFireflyDamageReaction { + EN_FIREFLY_DMG_REACT_NONE, + EN_FIREFLY_DMG_REACT_STUN, + EN_FIREFLY_DMG_REACT_DINS_FIRE, + EN_FIREFLY_DMG_REACT_ICE, + EN_FIREFLY_DMG_REACT_FIRE_ARROW = 0xF +} EnFireflyDamageReaction; + static DamageTable sDamageTable = { - /* Deku nut */ DMG_ENTRY(0, 0x1), - /* Deku stick */ DMG_ENTRY(2, 0x0), - /* Slingshot */ DMG_ENTRY(1, 0x0), - /* Explosive */ DMG_ENTRY(2, 0x0), - /* Boomerang */ DMG_ENTRY(1, 0x0), - /* Normal arrow */ DMG_ENTRY(2, 0x0), - /* Hammer swing */ DMG_ENTRY(2, 0x0), - /* Hookshot */ DMG_ENTRY(2, 0x0), - /* Kokiri sword */ DMG_ENTRY(1, 0x0), - /* Master sword */ DMG_ENTRY(2, 0x0), - /* Giant's Knife */ DMG_ENTRY(4, 0x0), - /* Fire arrow */ DMG_ENTRY(2, 0xF), - /* Ice arrow */ DMG_ENTRY(4, 0x3), - /* Light arrow */ DMG_ENTRY(2, 0x0), - /* Unk arrow 1 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 2 */ DMG_ENTRY(2, 0x0), - /* Unk arrow 3 */ DMG_ENTRY(2, 0x0), - /* Fire magic */ DMG_ENTRY(0, 0x2), - /* Ice magic */ DMG_ENTRY(4, 0x3), - /* Light magic */ DMG_ENTRY(0, 0x0), - /* Shield */ DMG_ENTRY(0, 0x0), - /* Mirror Ray */ DMG_ENTRY(0, 0x0), - /* Kokiri spin */ DMG_ENTRY(1, 0x0), - /* Giant spin */ DMG_ENTRY(4, 0x0), - /* Master spin */ DMG_ENTRY(2, 0x0), - /* Kokiri jump */ DMG_ENTRY(2, 0x0), - /* Giant jump */ DMG_ENTRY(8, 0x0), - /* Master jump */ DMG_ENTRY(4, 0x0), - /* Unknown 1 */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* Hammer jump */ DMG_ENTRY(4, 0x0), - /* Unknown 2 */ DMG_ENTRY(0, 0x0), + /* Deku nut */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_STUN), + /* Deku stick */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Slingshot */ DMG_ENTRY(1, EN_FIREFLY_DMG_REACT_NONE), + /* Explosive */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Boomerang */ DMG_ENTRY(1, EN_FIREFLY_DMG_REACT_NONE), + /* Normal arrow */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Hammer swing */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Hookshot */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Kokiri sword */ DMG_ENTRY(1, EN_FIREFLY_DMG_REACT_NONE), + /* Master sword */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Giant's Knife */ DMG_ENTRY(4, EN_FIREFLY_DMG_REACT_NONE), + /* Fire arrow */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_FIRE_ARROW), + /* Ice arrow */ DMG_ENTRY(4, EN_FIREFLY_DMG_REACT_ICE), + /* Light arrow */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Unk arrow 1 */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Unk arrow 2 */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Unk arrow 3 */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Fire magic */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_DINS_FIRE), + /* Ice magic */ DMG_ENTRY(4, EN_FIREFLY_DMG_REACT_ICE), + /* Light magic */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_NONE), + /* Shield */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_NONE), + /* Mirror Ray */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_NONE), + /* Kokiri spin */ DMG_ENTRY(1, EN_FIREFLY_DMG_REACT_NONE), + /* Giant spin */ DMG_ENTRY(4, EN_FIREFLY_DMG_REACT_NONE), + /* Master spin */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Kokiri jump */ DMG_ENTRY(2, EN_FIREFLY_DMG_REACT_NONE), + /* Giant jump */ DMG_ENTRY(8, EN_FIREFLY_DMG_REACT_NONE), + /* Master jump */ DMG_ENTRY(4, EN_FIREFLY_DMG_REACT_NONE), + /* Unknown 1 */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_NONE), + /* Unblockable */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_NONE), + /* Hammer jump */ DMG_ENTRY(4, EN_FIREFLY_DMG_REACT_NONE), + /* Unknown 2 */ DMG_ENTRY(0, EN_FIREFLY_DMG_REACT_NONE), }; -static InitChainEntry sInitChain[5] = { + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 5, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -500, ICHAIN_CONTINUE), ICHAIN_F32(minVelocityY, -4, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), ICHAIN_F32(lockOnArrowOffset, 4000, ICHAIN_STOP), }; -static Color_RGBA8 D_80A14FA0 = { 0xFF, 0xFF, 0x64, 0xFF }; -static Color_RGBA8 D_80A14FA4 = { 0xFF, 0x32, 0, 0 }; -static Color_RGBA8 D_80A14FA8 = { 0x64, 0xC8, 0xFF, 0xFF }; -static Color_RGBA8 D_80A14FAC = { 0, 0, 0xFF, 0 }; -static Vec3f D_80A14FB0 = { 0.0f, 0.5f, 0.0f }; -static Vec3f D_80A14FBC = { 0.0f, 0.5f, 0.0f }; -static Vec3f D_80A14FC8 = { 0.0f, 0.0f, 0.0f }; - -void func_80A13070_Unignite_(EnFirefly* this) { - this->actor.params += 2; - this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; - this->unk1B8 = 0; - this->unk1B9 = 0; + +void EnFirefly_SetElementNormal(EnFirefly* this) { + this->actor.params += 2; // EN_FIREFLY_TYPE_NORMAL, EN_FIREFLY_TYPE_NORMAL_PERCHED + this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE; + this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL; this->actor.naviEnemyId = NAVI_ENEMY_KEESE; } -void func_80A13098_Ignite_(EnFirefly* this) { - if (this->actor.params == 4) { - this->actor.params = 0; +void EnFirefly_SetElementFire(EnFirefly* this) { + if (this->actor.params == EN_FIREFLY_TYPE_ICE) { + this->actor.params = EN_FIREFLY_TYPE_FIRE; } else { - this->actor.params -= 2; + this->actor.params -= 2; // EN_FIREFLY_TYPE_FIRE, EN_FIREFLY_TYPE_FIRE_CAN_PERCH } - this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_FIRE; - this->unk1B8 = 1; - this->unk1B9 = 1; + this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_FIRE; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE; + this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE; this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; } @@ -129,7 +164,8 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { Actor_ProcessInitChain(&this->actor, sInitChain); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 25.0f); - SkelAnime_Init(play, &this->skelAnime, &gKeeseSkeleton, &gKeeseFlyAnim, this->jointTable, this->morphTable, 0x1C); + SkelAnime_Init(play, &this->skelAnime, &gKeeseSkel, &gKeeseFlyAnim, this->jointTable, this->morphTable, + KEESE_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); @@ -138,39 +174,39 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { thisx->draw = EnFirefly_DrawXlu; this->actor.params &= 0x7FFF; } - if (this->actor.params < 2) { - this->unk1B9 = 1; + if (this->actor.params <= EN_FIREFLY_TYPE_FIRE_CAN_PERCH) { // EN_FIREFLY_TYPE_FIRE0, EN_FIREFLY_TYPE_FIRE1 + this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE; } else { - this->unk1B9 = 0; + this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL; } - if (this->unk1B9 != 0) { - this->actionFunc = func_80A13A08_Action; - this->unk1BA_timer = Rand_S16Offset(20, 60); + if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + this->actionFunc = EnFirefly_Idle; + this->timer = Rand_S16Offset(20, 60); this->actor.shape.rot.x = 0x1554; - this->unk1B8 = 1; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE; this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; - this->unk310_homeY = this->actor.home.pos.y; + this->homeY = this->actor.home.pos.y; } else { - if (this->actor.params == 3) { - this->actionFunc = func_80A142F4_Action_Perched_; + if (this->actor.params == EN_FIREFLY_TYPE_NORMAL_PERCHED) { + this->actionFunc = EnFirefly_Perched; } else { - this->actionFunc = func_80A13A08_Action; + this->actionFunc = EnFirefly_Idle; } - if (this->actor.params == 4) { - this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_ICE; + if (this->actor.params == EN_FIREFLY_TYPE_ICE) { + this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_ICE; this->actor.naviEnemyId = NAVI_ENEMY_ICE_KEESE; } else { - this->collider.elements->base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; + this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; this->actor.naviEnemyId = NAVI_ENEMY_KEESE; } - this->unk310_homeY = this->actor.home.pos.y + 100.0f; - if (this->actor.params == 4) { - this->unk1B8 = 2; + this->homeY = this->actor.home.pos.y + 100.0f; + if (this->actor.params == EN_FIREFLY_TYPE_ICE) { + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_ICE; } else { - this->unk1B8 = 0; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE; } } - this->collider.elements->dim.worldSphere.radius = sJntSphInit.elements->dim.modelSphere.radius; + this->collider.elements[0].dim.worldSphere.radius = sJntSphInit.elements[0].dim.modelSphere.radius; } void EnFirefly_Destroy(Actor* thisx, PlayState* play) { @@ -179,127 +215,127 @@ void EnFirefly_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyJntSph(play, &this->collider); } -void func_80A132F4_Setup(EnFirefly* this) { - s32 var_v0; +void EnFirefly_SetupIdle(EnFirefly* this) { + s32 targetPitch; - this->unk1BA_timer = Rand_S16Offset(0x46, 0x64); + this->timer = Rand_S16Offset(70, 100); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); - if (this->unk310_homeY < this->actor.world.pos.y) { - var_v0 = 0xC00; + if (this->homeY < this->actor.world.pos.y) { + targetPitch = 0xC00; } else { - var_v0 = -0xC00; + targetPitch = -0xC00; } - this->unk1BC_targetRotX = var_v0 + 0x1554; + this->targetPitch = targetPitch + 0x1554; this->skelAnime.playSpeed = 1.0f; - this->actionFunc = func_80A13A08_Action; + this->actionFunc = EnFirefly_Idle; } -void func_80A133A0_Setup(EnFirefly* this) { - this->unk1BA_timer = 0x28; +void EnFirefly_SetupDie(EnFirefly* this) { + this->timer = 40; this->actor.velocity.y = 0.0f; Animation_Change(&this->skelAnime, &gKeeseFlyAnim, 0.5f, 0.0f, 0.0f, ANIMMODE_LOOP_INTERP, -3.0f); Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); - this->actionFunc = func_80A13C98_Action; + this->actionFunc = EnFirefly_Die; } -void func_80A13444_Setup(EnFirefly* this) { - this->unk1BA_timer = 0xF; - this->actionFunc = func_80A13D68_Action; +void EnFirefly_SetupDisappear(EnFirefly* this) { + this->timer = 15; + this->actionFunc = EnFirefly_Disappear; this->actor.speed = 0.0f; } -void func_80A13464_Setup(EnFirefly* this) { +void EnFirefly_SetupStay(EnFirefly* this) { this->actor.world.rot.x = 0x7000; - this->unk1BA_timer = 18; - this->actionFunc = func_80A13FF4_Action; + this->timer = 18; + this->actionFunc = EnFirefly_Stay; this->skelAnime.playSpeed = 1.0f; this->actor.speed = 2.5f; } -void func_80A1349C_Setup(EnFirefly* this) { - s32 var_v0; +void EnFirefly_SetupAttack(EnFirefly* this) { + s32 targetPitch; - this->unk1BA_timer = Rand_S16Offset(70, 100); + this->timer = Rand_S16Offset(70, 100); this->skelAnime.playSpeed = 1.0f; if (this->actor.yDistToPlayer > 0.0f) { - var_v0 = -0xC00; + targetPitch = -0xC00; } else { - var_v0 = 0xC00; + targetPitch = 0xC00; } - this->unk1BC_targetRotX = var_v0 + 0x1554; - this->actionFunc = func_80A13DE4_Action; + this->targetPitch = targetPitch + 0x1554; + this->actionFunc = EnFirefly_Attack; } -void func_80A1350C_Setup(EnFirefly* this) { - this->unk1BA_timer = 150; - this->unk1BC_targetRotX = 0x954; - this->actionFunc = func_80A14088_Action; +void EnFirefly_SetupFlyTowardsHome(EnFirefly* this) { + this->timer = 150; + this->targetPitch = 0x954; + this->actionFunc = EnFirefly_FlyTowardsHome; this->skelAnime.playSpeed = 1.0f; } -void func_80A13538_Setup(EnFirefly* this) { - this->unk1BA_timer = 80; +void EnFirefly_SetupStunned(EnFirefly* this) { + this->timer = 80; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 80); - this->unk1B8 = 0; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE; this->actor.velocity.y = 0.0f; this->skelAnime.playSpeed = 3.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); - this->actionFunc = func_80A141F0_Action; + this->actionFunc = EnFirefly_Stunned; } -void func_80A135A8_Setup(EnFirefly* this, PlayState* play) { - s32 var_s0; - Vec3f sp78; +void EnFirefly_SetupDieFrozen(EnFirefly* this, PlayState* play) { + s32 i; + Vec3f effPos; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; - this->unk1B8 = 0; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE; this->actor.speed = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 255, COLORFILTER_BUFFLAG_OPA, 255); Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_DEAD); - for (var_s0 = 0; var_s0 < 8; var_s0++) { - sp78.x = this->actor.world.pos.x + ((var_s0 & 1) ? 7.0f : -7.0f); - sp78.y = this->actor.world.pos.y + ((var_s0 & 2) ? 7.0f : -7.0f); - sp78.z = this->actor.world.pos.z + ((var_s0 & 4) ? 7.0f : -7.0f); - EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &sp78, 150, 150, 150, 250, 235, 245, 255, + for (i = 0; i < 8; i++) { + effPos.x = this->actor.world.pos.x + ((i & 1) ? 7.0f : -7.0f); + effPos.y = this->actor.world.pos.y + ((i & 2) ? 7.0f : -7.0f); + effPos.z = this->actor.world.pos.z + ((i & 4) ? 7.0f : -7.0f); + EffectSsEnIce_SpawnFlyingVec3f(play, &this->actor, &effPos, 150, 150, 150, 250, 235, 245, 255, (Rand_ZeroOne() * 0.15f) + 0.85f); } - this->actionFunc = func_80A14294_Action; + this->actionFunc = EnFirefly_DieFrozen; } -void func_80A13744_Setup_Perched_(EnFirefly* this) { - this->unk1BA_timer = 1; - this->actionFunc = func_80A142F4_Action_Perched_; +void EnFirefly_SetupPerched(EnFirefly* this) { + this->timer = 1; + this->actionFunc = EnFirefly_Perched; this->actor.speed = 0.0f; } -void func_80A13764_Setup_SwoopOnPlayer(EnFirefly* this) { +void EnFirefly_SetupAttackFromPerched(EnFirefly* this) { this->skelAnime.playSpeed = 3.0f; this->actor.shape.rot.x = 0x1554; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - this->unk1BA_timer = 50; + this->timer = 50; this->actor.speed = 3.0f; - this->actionFunc = func_80A143B4_Action_SwoopOnPlayer; + this->actionFunc = EnFirefly_AttackFromPerched; } -s32 func_80A1379C_HoneInOnHomeIfPlayerFar_(EnFirefly* this, PlayState* play) { +s32 EnFirefly_ApproachPerchSpot(EnFirefly* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 temp_fv0; - f32 temp_fv1; + f32 homeDist; + f32 speedFac; - if (this->actor.params != 3) { + if (this->actor.params != EN_FIREFLY_TYPE_NORMAL_PERCHED) { return false; } if (Actor_WorldDistXZToPoint(&player->actor, &this->actor.home.pos) > 300.0f) { - temp_fv0 = Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos); - if (temp_fv0 < 5.0f) { - func_80A13744_Setup_Perched_(this); + homeDist = Actor_WorldDistXYZToPoint(&this->actor, &this->actor.home.pos); + if (homeDist < 5.0f) { + EnFirefly_SetupPerched(this); } else { - temp_fv1 = temp_fv0 * 0.05f; - if (temp_fv1 < 1.0f) { - this->actor.speed *= temp_fv1; + speedFac = homeDist * 0.05f; + if (speedFac < 1.0f) { + this->actor.speed *= speedFac; } Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); @@ -312,7 +348,7 @@ s32 func_80A1379C_HoneInOnHomeIfPlayerFar_(EnFirefly* this, PlayState* play) { } } -s32 func_80A138B8_HoneInOnLitTorch(EnFirefly* this, PlayState* play) { +s32 EnFirefly_ApproachLitTorch(EnFirefly* this, PlayState* play) { Actor* iter; f32 closestLitTorchDist; f32 dist; @@ -337,7 +373,7 @@ s32 func_80A138B8_HoneInOnLitTorch(EnFirefly* this, PlayState* play) { torchFlamePos.y = closestLitTorch->world.pos.y + 52.0f + 15.0f; torchFlamePos.z = closestLitTorch->world.pos.z; if (Actor_WorldDistXYZToPoint(&this->actor, &torchFlamePos) < 15.0f) { - func_80A13098_Ignite_(this); + EnFirefly_SetElementFire(this); return true; } else { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, closestLitTorch), @@ -351,57 +387,56 @@ s32 func_80A138B8_HoneInOnLitTorch(EnFirefly* this, PlayState* play) { } } -void func_80A13A08_Action(EnFirefly* this, PlayState* play) { - s32 sp3C; - f32 temp_fv0; +void EnFirefly_Idle(EnFirefly* this, PlayState* play) { + s32 animLooped; + f32 f; SkelAnime_Update(&this->skelAnime); - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; + if (this->timer != 0) { + this->timer--; } - sp3C = Animation_OnFrame(&this->skelAnime, 0.0f); + animLooped = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; - if ((this->unk1B9 != 0) || (this->actor.params == 4) || - (!func_80A1379C_HoneInOnHomeIfPlayerFar_(this, play) && !func_80A138B8_HoneInOnLitTorch(this, play))) { - if (sp3C != 0) { - temp_fv0 = Rand_ZeroOne(); - if (temp_fv0 < 0.5f) { + if ((this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) || (this->actor.params == EN_FIREFLY_TYPE_ICE) || + (!EnFirefly_ApproachPerchSpot(this, play) && !EnFirefly_ApproachLitTorch(this, play))) { + if (animLooped) { + f = Rand_ZeroOne(); + if (f < 0.5f) { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); - } else if (temp_fv0 < 0.8f) { - f32 new_var = Rand_CenteredFloat(1536.0f); + } else if (f < 0.8f) { + f32 yawSpeed = Rand_CenteredFloat(1536.0f); - this->actor.shape.rot.y = (s16)(s32)(this->actor.shape.rot.y + new_var); + this->actor.shape.rot.y = TRUNCF_BINANG(this->actor.shape.rot.y + yawSpeed); } if (this->actor.world.pos.y < (this->actor.floorHeight + 20.0f)) { - this->unk1BC_targetRotX = 0x954; - } else if (this->unk310_homeY < this->actor.world.pos.y) { - this->unk1BC_targetRotX = 0x2154; + this->targetPitch = 0x954; + } else if (this->homeY < this->actor.world.pos.y) { + this->targetPitch = 0x2154; } else if (Rand_ZeroOne() > 0.35f) { - this->unk1BC_targetRotX = 0x954; + this->targetPitch = 0x954; } else { - this->unk1BC_targetRotX = 0x2154; + this->targetPitch = 0x2154; } } else { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk1BC_targetRotX = 0x954; - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || - (this->unk310_homeY < this->actor.world.pos.y)) { - this->unk1BC_targetRotX = 0x2154; + this->targetPitch = 0x954; + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->homeY < this->actor.world.pos.y)) { + this->targetPitch = 0x2154; } } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } - if ((this->unk1BA_timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != 2)) { - func_80A1349C_Setup(this); + if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { + EnFirefly_SetupAttack(this); } } -void func_80A13C98_Action(EnFirefly* this, PlayState* play) { - if (Animation_OnFrame(&this->skelAnime, 6.0f) != 0) { +void EnFirefly_Die(EnFirefly* this, PlayState* play) { + if (Animation_OnFrame(&this->skelAnime, 6.0f)) { this->skelAnime.playSpeed = 0.0f; } this->actor.colorFilterTimer = 40; @@ -412,103 +447,102 @@ void func_80A13C98_Action(EnFirefly* this, PlayState* play) { } else { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x6800, 0x200); this->actor.shape.rot.y -= 0x300; - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; + if (this->timer != 0) { + this->timer--; } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->unk1BA_timer == 0)) { - func_80A13444_Setup(this); + if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->timer == 0)) { + EnFirefly_SetupDisappear(this); } } } -void func_80A13D68_Action(EnFirefly* this, PlayState* play) { - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; +void EnFirefly_Disappear(EnFirefly* this, PlayState* play) { + if (this->timer != 0) { + this->timer--; } Math_StepToF(&this->actor.scale.x, 0.0f, 0.00034f); this->actor.scale.y = this->actor.scale.z = this->actor.scale.x; - if (this->unk1BA_timer == 0) { + if (this->timer == 0) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_14, false)); Actor_Kill(&this->actor); } } -void func_80A13DE4_Action(EnFirefly* this, PlayState* play) { - Actor* sp44; - Vec3f sp38; +void EnFirefly_Attack(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f playerPos; - sp44 = play->actorCtx.actorLists[2].head; SkelAnime_Update(&this->skelAnime); - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; + if (this->timer != 0) { + this->timer--; } Math_StepToF(&this->actor.speed, 4.0f, 0.5f); if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); - Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); - } else if (Actor_IsFacingPlayer(&this->actor, 0x2800) != 0) { - if (Animation_OnFrame(&this->skelAnime, 4.0f) != 0) { + Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); + } else if (Actor_IsFacingPlayer(&this->actor, 0x2800)) { + if (Animation_OnFrame(&this->skelAnime, 4.0f)) { this->skelAnime.playSpeed = 0.0f; this->skelAnime.curFrame = 4.0f; } Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300); - sp38.x = sp44->world.pos.x; - sp38.y = sp44->world.pos.y + 20.0f; - sp38.z = sp44->world.pos.z; + playerPos.x = player->actor.world.pos.x; + playerPos.y = player->actor.world.pos.y + 20.0f; + playerPos.z = player->actor.world.pos.z; Math_SmoothStepToS(&this->actor.shape.rot.x, - (s16)(Actor_WorldPitchTowardPoint(&this->actor, (Vec3f*)&sp38) + 0x1554), 2, 0x400, 0x100); + (s16)(Actor_WorldPitchTowardPoint(&this->actor, &playerPos) + 0x1554), 2, 0x400, 0x100); } else { this->skelAnime.playSpeed = 1.5f; if (this->actor.xzDistToPlayer > 80.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xC00, 0x300); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk1BC_targetRotX = 0x954; + this->targetPitch = 0x954; } - if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->unk310_homeY < this->actor.world.pos.y)) { - this->unk1BC_targetRotX = 0x2154; + if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->homeY < this->actor.world.pos.y)) { + this->targetPitch = 0x2154; } else { - this->unk1BC_targetRotX = 0x954; + this->targetPitch = 0x954; } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } - if ((this->unk1BA_timer == 0) || (Player_GetMask(play) == 2)) { - func_80A1350C_Setup(this); + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL)) { + EnFirefly_SetupFlyTowardsHome(this); } } -void func_80A13FF4_Action(EnFirefly* this, PlayState* play) { +void EnFirefly_Stay(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); Math_StepToF(&this->actor.velocity.y, 0.0f, 0.4f); - if (Math_StepToF(&this->actor.speed, 0.0f, 0.15f) != 0) { - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; + if (Math_StepToF(&this->actor.speed, 0.0f, 0.15f)) { + if (this->timer != 0) { + this->timer--; } - if (this->unk1BA_timer == 0) { - func_80A1350C_Setup(this); + if (this->timer == 0) { + EnFirefly_SetupFlyTowardsHome(this); } } } -void func_80A14088_Action(EnFirefly* this, PlayState* play) { +void EnFirefly_FlyTowardsHome(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; + if (this->timer != 0) { + this->timer--; } - if (((fabsf(this->actor.world.pos.y - this->unk310_homeY) < 10.0f) && + if (((fabsf(this->actor.world.pos.y - this->homeY) < 10.0f) && (Math_Vec3f_DistXZ(&this->actor.world.pos, &this->actor.home.pos) < 20.0f)) || - (this->unk1BA_timer == 0)) { - func_80A132F4_Setup(this); + (this->timer == 0)) { + EnFirefly_SetupIdle(this); } else { Math_StepToF(&this->actor.speed, 3.0f, 0.3f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - this->unk1BC_targetRotX = 0x954; - } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->unk310_homeY < this->actor.world.pos.y)) { - this->unk1BC_targetRotX = 0x2154; + this->targetPitch = 0x954; + } else if ((this->actor.bgCheckFlags & BGCHECKFLAG_CEILING) || (this->homeY < this->actor.world.pos.y)) { + this->targetPitch = 0x2154; } else { - this->unk1BC_targetRotX = 0x954; + this->targetPitch = 0x954; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); @@ -516,122 +550,125 @@ void func_80A14088_Action(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos), 0x300); } - Math_ScaledStepToS(&this->actor.shape.rot.x, this->unk1BC_targetRotX, 0x100); + Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } } -void func_80A141F0_Action(EnFirefly* this, PlayState* play) { +void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); Math_StepToF(&this->actor.speed, 0.0f, 0.5f); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1554, 0x100); - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; - } - if (this->unk1BA_timer == 0) { - if (this->unk1B9 != 0) { - this->unk1B8 = 1; - } else if (this->actor.params == 4) { - this->unk1B8 = 2; + if (this->timer != 0) { + this->timer--; + } + if (this->timer == 0) { + if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE; + } else if (this->actor.params == EN_FIREFLY_TYPE_ICE) { + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_ICE; } - func_80A132F4_Setup(this); + EnFirefly_SetupIdle(this); } } -void func_80A14294_Action(EnFirefly* this, PlayState* play) { +void EnFirefly_DieFrozen(EnFirefly* this, PlayState* play) { #if OOT_VERSION < NTSC_1_1 if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #else if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->actor.floorHeight == BGCHECK_Y_MIN)) { #endif this->actor.colorFilterTimer = 0; - func_80A13444_Setup(this); + EnFirefly_SetupDisappear(this); } else { - this->actor.colorFilterTimer = 0xFF; + this->actor.colorFilterTimer = 255; } } -void func_80A142F4_Action_Perched_(EnFirefly* this, PlayState* play) { +void EnFirefly_Perched(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x100); - if (this->unk1BA_timer != 0) { + if (this->timer != 0) { SkelAnime_Update(&this->skelAnime); - if (Animation_OnFrame(&this->skelAnime, 6.0f) != 0) { - this->unk1BA_timer--; + if (Animation_OnFrame(&this->skelAnime, 6.0f)) { + this->timer--; } } else if (Rand_ZeroOne() < 0.02f) { - this->unk1BA_timer = 1; + this->timer = 1; } if (this->actor.xzDistToPlayer < 120.0f) { - func_80A13764_Setup_SwoopOnPlayer(this); + EnFirefly_SetupAttackFromPerched(this); } } -void func_80A143B4_Action_SwoopOnPlayer(EnFirefly* this, PlayState* play) { - Player* temp_a2 = GET_PLAYER(play); - Vec3f sp28; +void EnFirefly_AttackFromPerched(EnFirefly* this, PlayState* play) { + Player* player = GET_PLAYER(play); + Vec3f playerPos; SkelAnime_Update(&this->skelAnime); - if (this->unk1BA_timer != 0) { - this->unk1BA_timer--; + if (this->timer != 0) { + this->timer--; } - if (this->unk1BA_timer < 40) { + if (this->timer < 40) { Math_ScaledStepToS(&this->actor.shape.rot.x, -0xAAC, 0x100); } else { - sp28.x = temp_a2->actor.world.pos.x; - sp28.y = temp_a2->actor.world.pos.y + 20.0f; - sp28.z = temp_a2->actor.world.pos.z; - Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &sp28) + 0x1554, 0x100); + playerPos.x = player->actor.world.pos.x; + playerPos.y = player->actor.world.pos.y + 20.0f; + playerPos.z = player->actor.world.pos.z; + Math_ScaledStepToS(&this->actor.shape.rot.x, Actor_WorldPitchTowardPoint(&this->actor, &playerPos) + 0x1554, + 0x100); Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0x300); } - if (this->unk1BA_timer == 0) { - func_80A132F4_Setup(this); + if (this->timer == 0) { + EnFirefly_SetupIdle(this); } } -void func_80A1448C_SpawnFireEffects(EnFirefly* this, PlayState* play) { +void EnFirefly_IceMelt(EnFirefly* this, PlayState* play) { s32 bodyPart; for (bodyPart = 0; bodyPart < EN_FIREFLY_BODY_PART_MAX; bodyPart++) { EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, 40, 0, 0, bodyPart); } - this->unk1B8 = 0; + this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE; } -void func_80A1450C_ReactToAC(EnFirefly* this, PlayState* play) { +void EnFirefly_CheckCollide(EnFirefly* this, PlayState* play) { if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - Actor_SetDropFlag(&this->actor, &this->collider.elements->base, true); - if ((this->actor.colChkInfo.damageReaction != 0) || (this->actor.colChkInfo.damage != 0)) { + Actor_SetDropFlag(&this->actor, &this->collider.elements[0].base, true); + if ((this->actor.colChkInfo.damageReaction != EN_FIREFLY_DMG_REACT_NONE) || + (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Enemy_StartFinishingBlow(play, &this->actor); this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; } - if (this->actor.colChkInfo.damageReaction == 2) { - if (this->actor.params == 4) { + if (this->actor.colChkInfo.damageReaction == EN_FIREFLY_DMG_REACT_DINS_FIRE) { + if (this->actor.params == EN_FIREFLY_TYPE_ICE) { this->actor.colChkInfo.health = 0; Enemy_StartFinishingBlow(play, &this->actor); - func_80A1448C_SpawnFireEffects(this, play); - func_80A133A0_Setup(this); - } else if (this->unk1B9 == 0) { - func_80A13098_Ignite_(this); - if (this->actionFunc == func_80A142F4_Action_Perched_) { - func_80A132F4_Setup(this); + EnFirefly_IceMelt(this, play); + EnFirefly_SetupDie(this); + } else if (this->bodyType == EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + EnFirefly_SetElementFire(this); + if (this->actionFunc == EnFirefly_Perched) { + EnFirefly_SetupIdle(this); } } - } else if (this->actor.colChkInfo.damageReaction == 3) { - if (this->actor.params == 4) { - func_80A133A0_Setup(this); + } else if (this->actor.colChkInfo.damageReaction == EN_FIREFLY_DMG_REACT_ICE) { + if (this->actor.params == EN_FIREFLY_TYPE_ICE) { + EnFirefly_SetupDie(this); } else { - func_80A135A8_Setup(this, play); + EnFirefly_SetupDieFrozen(this, play); } - } else if (this->actor.colChkInfo.damageReaction == 1) { - if (this->actionFunc != func_80A141F0_Action) { - func_80A13538_Setup(this); + } else if (this->actor.colChkInfo.damageReaction == EN_FIREFLY_DMG_REACT_STUN) { + if (this->actionFunc != EnFirefly_Stunned) { + EnFirefly_SetupStunned(this); } } else { - if ((this->actor.colChkInfo.damageReaction == 0xF) && (this->actor.params == 4)) { - func_80A1448C_SpawnFireEffects(this, play); + if ((this->actor.colChkInfo.damageReaction == EN_FIREFLY_DMG_REACT_FIRE_ARROW) && + (this->actor.params == EN_FIREFLY_TYPE_ICE)) { + EnFirefly_IceMelt(this, play); } - func_80A133A0_Setup(this); + EnFirefly_SetupDie(this); } } } @@ -640,25 +677,24 @@ void func_80A1450C_ReactToAC(EnFirefly* this, PlayState* play) { void EnFirefly_Update(Actor* thisx, PlayState* play2) { EnFirefly* this = (EnFirefly*)thisx; PlayState* play = play2; - f32 sp34; if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_ATTACK); - if (this->unk1B9 != 0) { - func_80A13070_Unignite_(this); + if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + EnFirefly_SetElementNormal(this); } - if (this->actionFunc != func_80A143B4_Action_SwoopOnPlayer) { - func_80A13464_Setup(this); + if (this->actionFunc != EnFirefly_AttackFromPerched) { + EnFirefly_SetupStay(this); } } - func_80A1450C_ReactToAC(this, play); + EnFirefly_CheckCollide(this, play); this->actionFunc(this, play); if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { - if ((this->actor.colChkInfo.health == 0) || ((this->actionFunc == func_80A141F0_Action))) { + if ((this->actor.colChkInfo.health == 0) || ((this->actionFunc == EnFirefly_Stunned))) { Actor_MoveXZGravity(&this->actor); } else { - if (this->actionFunc != func_80A13FF4_Action) { + if (this->actionFunc != EnFirefly_Stay) { this->actor.world.rot.x = 0x1554 - this->actor.shape.rot.x; } Actor_MoveXYZ(&this->actor); @@ -666,91 +702,102 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { } Actor_UpdateBgCheckInfo(play, &this->actor, 10.0f, 10.0f, 15.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_2); - this->collider.elements->dim.worldSphere.center.x = this->actor.world.pos.x; - this->collider.elements->dim.worldSphere.center.y = this->actor.world.pos.y + 10.0f; - this->collider.elements->dim.worldSphere.center.z = this->actor.world.pos.z; - if ((this->actionFunc == func_80A13DE4_Action) || (this->actionFunc == func_80A143B4_Action_SwoopOnPlayer)) { + this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x; + this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y + 10.0f; + this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z; + if ((this->actionFunc == EnFirefly_Attack) || (this->actionFunc == EnFirefly_AttackFromPerched)) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); } if (this->actor.colChkInfo.health != 0) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); this->actor.world.rot.y = this->actor.shape.rot.y; - if (Animation_OnFrame(&this->skelAnime, 5.0f) != 0) { + if (Animation_OnFrame(&this->skelAnime, 5.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_FLY); } } CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - sp34 = Math_SinS(this->actor.shape.rot.x); - this->actor.focus.pos.x = (Math_SinS(this->actor.shape.rot.y) * (10.0f * sp34)) + this->actor.world.pos.x; - this->actor.focus.pos.y = (Math_CosS(this->actor.shape.rot.x) * 10.0f) + this->actor.world.pos.y; - sp34 = Math_SinS(this->actor.shape.rot.x); - this->actor.focus.pos.z = (Math_CosS(this->actor.shape.rot.y) * (10.0f * sp34)) + this->actor.world.pos.z; + this->actor.focus.pos.x = + this->actor.world.pos.x + (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_SinS(this->actor.shape.rot.y)); + this->actor.focus.pos.y = this->actor.world.pos.y + (10.0f * Math_CosS(this->actor.shape.rot.x)); + this->actor.focus.pos.z = + this->actor.world.pos.z + (10.0f * Math_SinS(this->actor.shape.rot.x) * Math_CosS(this->actor.shape.rot.y)); } s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnFirefly* this = thisx; - if ((this->actor.draw == EnFirefly_DrawXlu) && (play->actorCtx.lensActive == 0)) { + + if ((this->actor.draw == EnFirefly_DrawXlu) && !play->actorCtx.lensActive) { *dList = NULL; - } else if (limbIndex == 1) { + } else if (limbIndex == KEESE_LIMB_ROOT_ROOT) { pos->y += 2300.0f; } return false; } void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { - Vec3f sp94; - Vec3f* var_a1; - Color_RGBA8* var_v1; - Color_RGBA8* var_v0; - MtxF sp48; + static Color_RGBA8 sFireEffPrimColor = { 255, 255, 100, 255 }; + static Color_RGBA8 sFireEffEnvColor = { 255, 50, 0, 0 }; + static Color_RGBA8 sIceEffPrimColor = { 100, 200, 255, 255 }; + static Color_RGBA8 sIceEffEnvColor = { 0, 0, 255, 0 }; + static Vec3f sEffVel = { 0.0f, 0.5f, 0.0f }; + static Vec3f sEffAccel = { 0.0f, 0.5f, 0.0f }; + static Vec3f D_80A14FC8 = { 0.0f, 0.0f, 0.0f }; + Vec3f effPos; + Vec3f* bodyPartPos; + Color_RGBA8* effEnvColor; + Color_RGBA8* effPrimColor; + MtxF mf; EnFirefly* this = thisx; - s16 var_t0; - s16 var_t1; + s16 effScaleStep; + s16 effLife; - if ((this->unk1B9 == 0) && (limbIndex == 0x1B)) { + if ((this->bodyType == EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) && (limbIndex == KEESE_LIMB_HEAD)) { gSPDisplayList((*gfx)++, gKeeseEyesDL); } else { - if (((this->unk1B8 == 1) || (this->unk1B8 == 2)) && ((limbIndex == 0xF) || (limbIndex == 0x15))) { - if (this->actionFunc != func_80A13D68_Action) { - Matrix_Get(&sp48); - sp94.x = (Rand_ZeroOne() * 5.0f) + sp48.xw; - sp94.y = (Rand_ZeroOne() * 5.0f) + sp48.yw; - sp94.z = (Rand_ZeroOne() * 5.0f) + sp48.zw; - var_t0 = -0x28; - var_t1 = 3; + if (((this->effectsElementalType == EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE) || + (this->effectsElementalType == EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_ICE)) && + ((limbIndex == KEESE_LIMB_LEFT_WING_END) || (limbIndex == KEESE_LIMB_RIGHT_WING_END_ROOT))) { + if (this->actionFunc != EnFirefly_Disappear) { + Matrix_Get(&mf); + effPos.x = (Rand_ZeroOne() * 5.0f) + mf.xw; + effPos.y = (Rand_ZeroOne() * 5.0f) + mf.yw; + effPos.z = (Rand_ZeroOne() * 5.0f) + mf.zw; + effScaleStep = -40; + effLife = 3; } else { - if (limbIndex == 0xF) { - sp94.x = (Math_SinS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer) + this->actor.world.pos.x; - sp94.z = (Math_CosS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer) + this->actor.world.pos.z; + if (limbIndex == 15) { + effPos.x = this->actor.world.pos.x + (Math_SinS(this->timer * 0x238C) * this->timer); + effPos.z = this->actor.world.pos.z + (Math_CosS(this->timer * 0x238C) * this->timer); } else { - sp94.x = this->actor.world.pos.x - (Math_SinS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer); - sp94.z = this->actor.world.pos.z - (Math_CosS(this->unk1BA_timer * 0x238C) * this->unk1BA_timer); + effPos.x = this->actor.world.pos.x - (Math_SinS(this->timer * 0x238C) * this->timer); + effPos.z = this->actor.world.pos.z - (Math_CosS(this->timer * 0x238C) * this->timer); } - var_t0 = -5; - var_t1 = 0xA; - sp94.y = this->actor.world.pos.y + ((0xF - this->unk1BA_timer) * 1.5f); + effScaleStep = -5; + effLife = 10; + effPos.y = this->actor.world.pos.y + ((15 - this->timer) * 1.5f); } - if (this->unk1B8 == 1) { - var_v0 = &D_80A14FA0; - var_v1 = &D_80A14FA4; + if (this->effectsElementalType == EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE) { + effPrimColor = &sFireEffPrimColor; + effEnvColor = &sFireEffEnvColor; } else { - var_v0 = &D_80A14FA8; - var_v1 = &D_80A14FAC; + effPrimColor = &sIceEffPrimColor; + effEnvColor = &sIceEffEnvColor; } - func_8002843C(play, &sp94, &D_80A14FB0, &D_80A14FBC, var_v0, var_v1, 250, var_t0, var_t1); + func_8002843C(play, &effPos, &sEffVel, &sEffAccel, effPrimColor, effEnvColor, 250, effScaleStep, effLife); } } - if ((limbIndex == 0xF) || (limbIndex == 0x15) || (limbIndex == 0xA)) { - if (limbIndex == 0xF) { - var_a1 = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LIMB_15]; - } else if (limbIndex == 0x15) { - var_a1 = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LIMB_21]; + if ((limbIndex == KEESE_LIMB_LEFT_WING_END) || (limbIndex == KEESE_LIMB_RIGHT_WING_END_ROOT) || + (limbIndex == KEESE_LIMB_BODY)) { + if (limbIndex == KEESE_LIMB_LEFT_WING_END) { + bodyPartPos = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LEFT_WING]; + } else if (limbIndex == KEESE_LIMB_RIGHT_WING_END_ROOT) { + bodyPartPos = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_RIGHT_WING]; } else { - var_a1 = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_LIMB_10]; + bodyPartPos = &this->bodyPartsPos[EN_FIREFLY_BODY_PART_BODY]; } - Matrix_MultVec3f(&D_80A14FC8, var_a1); - var_a1->y -= 5.0f; + Matrix_MultVec3f(&D_80A14FC8, bodyPartPos); + bodyPartPos->y -= 5.0f; } } @@ -759,7 +806,7 @@ void EnFirefly_DrawOpa(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 0x6C5); Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (this->unk1B9 != 0) { + if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); } else { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); @@ -774,7 +821,7 @@ void EnFirefly_DrawXlu(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1775); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (this->unk1B9 != 0) { + if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); } else { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 255); 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 bf99a120c8a..b8b8fa70088 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -4,12 +4,22 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_firefly/object_firefly.h" + +typedef enum EnFireflyType { + EN_FIREFLY_TYPE_FIRE, + EN_FIREFLY_TYPE_FIRE_CAN_PERCH, // Can perch when no longer on fire + EN_FIREFLY_TYPE_NORMAL, + EN_FIREFLY_TYPE_NORMAL_PERCHED, + EN_FIREFLY_TYPE_ICE +} EnFireflyType; + struct EnFirefly; typedef enum EnFireflyBodyPart { - /* 0 */ EN_FIREFLY_BODY_PART_LIMB_15, - /* 1 */ EN_FIREFLY_BODY_PART_LIMB_21, - /* 2 */ EN_FIREFLY_BODY_PART_LIMB_10, + /* 0 */ EN_FIREFLY_BODY_PART_LEFT_WING, + /* 1 */ EN_FIREFLY_BODY_PART_RIGHT_WING, + /* 2 */ EN_FIREFLY_BODY_PART_BODY, /* 3 */ EN_FIREFLY_BODY_PART_MAX } EnFireflyBodyPart; @@ -20,13 +30,13 @@ typedef struct EnFirefly { /* 0x14C */ Vec3f bodyPartsPos[EN_FIREFLY_BODY_PART_MAX]; /* 0x170 */ SkelAnime skelAnime; /* 0x1B4 */ EnFireflyActionFunc actionFunc; - /* 0x1B8 */ u8 unk1B8; - /* 0x1B9 */ u8 unk1B9; - /* 0x1BA */ s16 unk1BA_timer; - /* 0x1BC */ s16 unk1BC_targetRotX; - /* 0x1BE */ Vec3s jointTable[0x1C]; - /* 0x266 */ Vec3s morphTable[0x1C]; - /* 0x310 */ f32 unk310_homeY; + /* 0x1B8 */ u8 effectsElementalType; + /* 0x1B9 */ u8 bodyType; + /* 0x1BA */ s16 timer; + /* 0x1BC */ s16 targetPitch; + /* 0x1BE */ Vec3s jointTable[KEESE_LIMB_MAX]; + /* 0x266 */ Vec3s morphTable[KEESE_LIMB_MAX]; + /* 0x310 */ f32 homeY; /* 0x314 */ ColliderJntSph collider; /* 0x334 */ ColliderJntSphElement colliderElements[1]; } EnFirefly; // size = 0x0374 From cbb10c8f8b9919207568bf0c4e9fea9026c52d1b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 9 Aug 2026 09:50:41 +0200 Subject: [PATCH 089/150] bodyType -> bodyElementalType --- .../actors/ovl_En_Firefly/z_en_firefly.c | 25 ++++++++++--------- .../actors/ovl_En_Firefly/z_en_firefly.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) 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 ab083dccfc5..32ad890f3a3 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -143,7 +143,7 @@ void EnFirefly_SetElementNormal(EnFirefly* this) { this->actor.params += 2; // EN_FIREFLY_TYPE_NORMAL, EN_FIREFLY_TYPE_NORMAL_PERCHED this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_NONE; this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_NONE; - this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL; + this->bodyElementalType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL; this->actor.naviEnemyId = NAVI_ENEMY_KEESE; } @@ -155,7 +155,7 @@ void EnFirefly_SetElementFire(EnFirefly* this) { } this->collider.elements[0].base.atDmgInfo.hitSpecialEffect = HIT_SPECIAL_EFFECT_FIRE; this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE; - this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE; + this->bodyElementalType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE; this->actor.naviEnemyId = NAVI_ENEMY_FIRE_KEESE; } @@ -175,11 +175,11 @@ void EnFirefly_Init(Actor* thisx, PlayState* play) { this->actor.params &= 0x7FFF; } if (this->actor.params <= EN_FIREFLY_TYPE_FIRE_CAN_PERCH) { // EN_FIREFLY_TYPE_FIRE0, EN_FIREFLY_TYPE_FIRE1 - this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE; + this->bodyElementalType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_FIRE; } else { - this->bodyType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL; + this->bodyElementalType = EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL; } - if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + if (this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { this->actionFunc = EnFirefly_Idle; this->timer = Rand_S16Offset(20, 60); this->actor.shape.rot.x = 0x1554; @@ -397,7 +397,8 @@ void EnFirefly_Idle(EnFirefly* this, PlayState* play) { } animLooped = Animation_OnFrame(&this->skelAnime, 0.0f); this->actor.speed = (Rand_ZeroOne() * 1.5f) + 1.5f; - if ((this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) || (this->actor.params == EN_FIREFLY_TYPE_ICE) || + if ((this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) || + (this->actor.params == EN_FIREFLY_TYPE_ICE) || (!EnFirefly_ApproachPerchSpot(this, play) && !EnFirefly_ApproachLitTorch(this, play))) { if (animLooped) { f = Rand_ZeroOne(); @@ -562,7 +563,7 @@ void EnFirefly_Stunned(EnFirefly* this, PlayState* play) { this->timer--; } if (this->timer == 0) { - if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + if (this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE; } else if (this->actor.params == EN_FIREFLY_TYPE_ICE) { this->effectsElementalType = EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_ICE; @@ -647,7 +648,7 @@ void EnFirefly_CheckCollide(EnFirefly* this, PlayState* play) { Enemy_StartFinishingBlow(play, &this->actor); EnFirefly_IceMelt(this, play); EnFirefly_SetupDie(this); - } else if (this->bodyType == EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + } else if (this->bodyElementalType == EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { EnFirefly_SetElementFire(this); if (this->actionFunc == EnFirefly_Perched) { EnFirefly_SetupIdle(this); @@ -681,7 +682,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Actor_PlaySfx(&this->actor, NA_SE_EN_FFLY_ATTACK); - if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + if (this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { EnFirefly_SetElementNormal(this); } if (this->actionFunc != EnFirefly_AttackFromPerched) { @@ -752,7 +753,7 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* s16 effScaleStep; s16 effLife; - if ((this->bodyType == EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) && (limbIndex == KEESE_LIMB_HEAD)) { + if ((this->bodyElementalType == EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) && (limbIndex == KEESE_LIMB_HEAD)) { gSPDisplayList((*gfx)++, gKeeseEyesDL); } else { if (((this->effectsElementalType == EN_FIREFLY_EFFECTS_ELEMENTAL_TYPE_FIRE) || @@ -806,7 +807,7 @@ void EnFirefly_DrawOpa(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 0x6C5); Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + if (this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); } else { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); @@ -821,7 +822,7 @@ void EnFirefly_DrawXlu(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1775); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (this->bodyType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { + if (this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 0); } else { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 255); 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 b8b8fa70088..79204007dc5 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.h @@ -31,7 +31,7 @@ typedef struct EnFirefly { /* 0x170 */ SkelAnime skelAnime; /* 0x1B4 */ EnFireflyActionFunc actionFunc; /* 0x1B8 */ u8 effectsElementalType; - /* 0x1B9 */ u8 bodyType; + /* 0x1B9 */ u8 bodyElementalType; /* 0x1BA */ s16 timer; /* 0x1BC */ s16 targetPitch; /* 0x1BE */ Vec3s jointTable[KEESE_LIMB_MAX]; From c580d9164f6039f6b74a5caad0784461b7a6902e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 10 Aug 2026 21:46:28 +0200 Subject: [PATCH 090/150] some cleanup, mostly remaining unsymbolized segment addresses --- assets/xml/objects/object_ge1.xml | 3 +++ assets/xml/objects/object_gla.xml | 3 +++ assets/xml/objects/object_jj.xml | 3 +++ src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 6 +++--- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 14 +++++++++----- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 8 ++++---- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 6 +++++- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 6 +++++- 8 files changed, 35 insertions(+), 14 deletions(-) diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index e7db085698c..5491b8ce509 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -22,6 +22,9 @@ + + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index 0f03838fafa..4c4331795cf 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -54,6 +54,9 @@ + + + diff --git a/assets/xml/objects/object_jj.xml b/assets/xml/objects/object_jj.xml index abbed959f54..21c19012b92 100644 --- a/assets/xml/objects/object_jj.xml +++ b/assets/xml/objects/object_jj.xml @@ -56,6 +56,9 @@ + + + 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 105d4b3aa8b..297232c67a2 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -766,9 +766,9 @@ void DemoEc_GerudoPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 void DemoEc_DrawGerudo(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { - (UNK_PTR)0x06000708, - (UNK_PTR)0x06000F08, - (UNK_PTR)0x06001708, + object_ge1_000708_Tex, + object_ge1_000F08_Tex, + object_ge1_001708_Tex, }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; 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 1d9b863c35a..49a1ce6f712 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -70,7 +70,11 @@ static ColliderCylinderInit sCylinderInit = { static Gfx* D_80A3279C[3] = { object_ge1_009198_DL, object_ge1_009430_DL, object_ge1_009690_DL }; static Vec3f D_80A327A8 = { 600.0f, 700.0f, 0.0f }; -static s32 D_80A327B4[3] = { 0x06000708, 0x06000F08, 0x06001708 }; +static void* D_80A327B4[3] = { + object_ge1_000708_Tex, + object_ge1_000F08_Tex, + object_ge1_001708_Tex, +}; void EnGe1_Init(Actor* thisx, PlayState* play) { EnGe1* this = (EnGe1*)thisx; @@ -357,7 +361,7 @@ void func_80A314D0(EnGe1* this, PlayState* play) { } void func_80A31514(EnGe1* this, PlayState* play) { - if (gBitFlags[0x16] & gSaveContext.save.info.inventory.questItems) { + if (CHECK_QUEST_ITEM(QUEST_GERUDOS_CARD)) { func_80A30C70(this, play, 0x6014U, 100.0f, func_80A313E0); } else { func_80A30C70(this, play, 0x6013U, 100.0f, func_80A314D0); @@ -446,7 +450,7 @@ void func_80A31934(EnGe1* this, PlayState* play) { void func_80A3196C(EnGe1* this, PlayState* play) { s32 var_a2; - if (Actor_HasParent(&this->actor, play) != 0) { + if (Actor_HasParent(&this->actor, play)) { this->unk2B4 = func_80A31934; if (this->unk2AC & 2) { SET_ITEMGETINF(ITEMGETINF_0F); @@ -695,14 +699,14 @@ void EnGe1_Update(Actor* thisx, PlayState* play) { } void func_80A323B0(EnGe1* this) { - if (SkelAnime_Update(&this->skelAnime) != 0) { + if (SkelAnime_Update(&this->skelAnime)) { Animation_PlayOnce(&this->skelAnime, this->unk2B0); } } void func_80A323EC(EnGe1* this) { if (!(this->unk2AC & 4)) { - if (SkelAnime_Update(&this->skelAnime) != 0) { + if (SkelAnime_Update(&this->skelAnime)) { this->unk2AC |= 4; } this->unk2AC |= 8; 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 8ca65cfcf10..e6ef092f275 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -87,10 +87,10 @@ static Vec3f D_80A3439C = { 0.0f, -0.025f, 0.0f }; static Color_RGBA8 D_80A343A8 = { 0xFF, 0xFF, 0xFF, 0 }; static Color_RGBA8 D_80A343AC = { 0xFF, 0x96, 0, 0 }; static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f }; -static s32 D_80A343BC[3] = { - 0x06004F78, - 0x06005578, - 0x06005BF8, +static void* D_80A343BC[3] = { + object_gla_004F78_Tex, + object_gla_005578_Tex, + object_gla_005BF8_Tex, }; void func_80A32BD0(EnGe2* this, s32 arg1) { diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index a99c03d4783..b8a69fdf33f 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -66,7 +66,11 @@ static void (*D_80A351BC[1])(EnGe3*, PlayState*) = { func_80A34A80 }; static AnimationHeader* D_80A351C0[1] = { &gGerudoRedStandAnim }; static u8 D_80A351C4[1] = { ANIMMODE_LOOP }; static Vec3f D_80A351C8 = { 600.0f, 700.0f, 0.0f }; -static s32 D_80A351D4[3] = { 0x06005FE8, 0x060065A8, 0x06006D28 }; +static void* D_80A351D4[3] = { + gGerudoRedEyeOpenTex, + gGerudoRedEyeHalfTex, + gGerudoRedEyeShutTex, +}; void func_80A34620(EnGe3* this, s32 arg1) { this->unk310 = D_80A351BC[arg1]; 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 7a5febc565e..2eb85eced4e 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -197,7 +197,11 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDownward, 1100, ICHAIN_STOP), }; static Vec3f D_80A88CF0 = { -1589.0f, 53.0f, -43.0f }; -static s32 D_80A88CFC[5] = { 0x06007698, 0x06007A98, 0x06007E98, 0, 0 }; +static void* D_80A88CFC[5] = { + object_jj_007698_Tex, + object_jj_007A98_Tex, + object_jj_007E98_Tex, +}; void func_80A87800(EnJj* this, void (*arg1)(EnJj*, PlayState*)) { this->unk2FC = arg1; From 9bf8b6b9b65458122b27fa449ee5dbba04a8fbc5 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 11 Aug 2026 07:53:20 +0200 Subject: [PATCH 091/150] more assets docs --- assets/xml/objects/object_ge1.xml | 148 +++++------ assets/xml/objects/object_gla.xml | 132 +++++----- assets/xml/objects/object_hata.xml | 88 +++---- assets/xml/objects/object_jj.xml | 132 +++++----- assets/xml/objects/object_nb.xml | 278 ++++++++++---------- src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 14 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 46 ++-- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 9 +- src/overlays/actors/ovl_En_Hata/z_en_hata.c | 8 +- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 15 +- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 68 ++--- 11 files changed, 468 insertions(+), 470 deletions(-) diff --git a/assets/xml/objects/object_ge1.xml b/assets/xml/objects/object_ge1.xml index 5491b8ce509..d43fcd99290 100644 --- a/assets/xml/objects/object_ge1.xml +++ b/assets/xml/objects/object_ge1.xml @@ -1,114 +1,114 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + - - - - - + + + + + diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index 4c4331795cf..866ab1cbc59 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -1,50 +1,50 @@ - - - - - - + + + + + + - + - + - + - + - + - + - + - + - + - - - - - - - - - - + + + + + + + + + + @@ -64,62 +64,62 @@ - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_hata.xml b/assets/xml/objects/object_hata.xml index 38ada492d3e..f44028dabc0 100644 --- a/assets/xml/objects/object_hata.xml +++ b/assets/xml/objects/object_hata.xml @@ -1,66 +1,66 @@ - - - - - - + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_jj.xml b/assets/xml/objects/object_jj.xml index 21c19012b92..68312f67967 100644 --- a/assets/xml/objects/object_jj.xml +++ b/assets/xml/objects/object_jj.xml @@ -1,93 +1,93 @@ - - - - + + + + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml index 8ac57553ba4..3b726293ae9 100644 --- a/assets/xml/objects/object_nb.xml +++ b/assets/xml/objects/object_nb.xml @@ -1,150 +1,150 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 297232c67a2..47a859d5bc4 100644 --- a/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -724,7 +724,7 @@ void DemoEc_DrawCarpenter(DemoEc* this, PlayState* play) { void DemoEc_InitGerudo(DemoEc* this, PlayState* play) { DemoEc_UseDrawObject(this, play); - DemoEc_InitSkelAnime(this, play, &object_ge1_000330_Skel); + DemoEc_InitSkelAnime(this, play, &gObjectGe1Skel); DemoEc_UseAnimationObject(this, play); DemoEc_ChangeAnimation(this, &gDemoEcGerudoAnim, 0, 0.0f, false); func_8096D5D4(this, play); @@ -743,11 +743,11 @@ void DemoEc_UpdateGerudo(DemoEc* this, PlayState* play) { Gfx* DemoEc_GetGerudoPostLimbDList(DemoEc* this) { switch (this->actor.params) { case 16: - return object_ge1_009198_DL; + return gObjectGe1HairStrandsDL; case 17: - return object_ge1_009430_DL; + return gObjectGe1HairFringeDL; case 18: - return object_ge1_009690_DL; + return gObjectGe1HairSpikyDL; default: PRINTF(VT_FGCOL(RED) T("かつらが無い!!!!!!!!!!!!!!!!\n", "No wig!!!!!!!!!!!!!!!!\n") VT_RST); return NULL; @@ -766,9 +766,9 @@ void DemoEc_GerudoPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 void DemoEc_DrawGerudo(DemoEc* this, PlayState* play) { static void* eyeTextures[] = { - object_ge1_000708_Tex, - object_ge1_000F08_Tex, - object_ge1_001708_Tex, + gObjectGe1EyeOpenTex, + gObjectGe1EyeHalfTex, + gObjectGe1EyeClosedTex, }; s32 eyeTexIndex = this->eyeTexIndex; void* eyeTexture = eyeTextures[eyeTexIndex]; 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 49a1ce6f712..ca7db7988be 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -68,12 +68,12 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -static Gfx* D_80A3279C[3] = { object_ge1_009198_DL, object_ge1_009430_DL, object_ge1_009690_DL }; +static Gfx* D_80A3279C[3] = { gObjectGe1HairStrandsDL, gObjectGe1HairFringeDL, gObjectGe1HairSpikyDL }; static Vec3f D_80A327A8 = { 600.0f, 700.0f, 0.0f }; static void* D_80A327B4[3] = { - object_ge1_000708_Tex, - object_ge1_000F08_Tex, - object_ge1_001708_Tex, + gObjectGe1EyeOpenTex, + gObjectGe1EyeHalfTex, + gObjectGe1EyeClosedTex, }; void EnGe1_Init(Actor* thisx, PlayState* play) { @@ -81,13 +81,13 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_ge1_000330_Skel, &object_ge1_000228_Anim, this->unk1DC, - this->unk23C, 16); - Animation_PlayOnce(&this->skelAnime, &object_ge1_000228_Anim); + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGe1Skel, &gObjectGe1ArmsCrossedAnim, this->unk1DC, this->unk23C, + 16); + Animation_PlayOnce(&this->skelAnime, &gObjectGe1ArmsCrossedAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->unk2B0 = &object_ge1_000228_Anim; + this->unk2B0 = &gObjectGe1ArmsCrossedAnim; this->unk2B8 = func_80A323B0; this->actor.attentionRangeType = ATTENTION_RANGE_6; Actor_SetScale(&this->actor, 0.01f); @@ -170,9 +170,9 @@ s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionF this->unk2B4 = arg4; this->unk2B8 = func_80A323EC; this->unk2AC &= ~4; - this->unk2B0 = &object_ge1_000228_Anim; - Animation_Change(&this->skelAnime, &object_ge1_000228_Anim, 1.0f, 0.0f, - Animation_GetLastFrame(&object_ge1_000228_Anim), ANIMMODE_ONCE, -8.0f); + this->unk2B0 = &gObjectGe1ArmsCrossedAnim; + Animation_Change(&this->skelAnime, &gObjectGe1ArmsCrossedAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gObjectGe1ArmsCrossedAnim), ANIMMODE_ONCE, -8.0f); return 1; } else { this->actor.textId = arg2; @@ -184,9 +184,9 @@ s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionF } void func_80A30D48(EnGe1* this) { - Animation_Change(&this->skelAnime, &object_ge1_000228_Anim, -1.0f, Animation_GetLastFrame(&object_ge1_000228_Anim), - 0.0f, ANIMMODE_ONCE, 8.0f); - this->unk2B0 = &object_ge1_000228_Anim; + Animation_Change(&this->skelAnime, &gObjectGe1ArmsCrossedAnim, -1.0f, + Animation_GetLastFrame(&gObjectGe1ArmsCrossedAnim), 0.0f, ANIMMODE_ONCE, 8.0f); + this->unk2B0 = &gObjectGe1ArmsCrossedAnim; this->unk2B8 = func_80A323B0; } @@ -313,9 +313,9 @@ void func_80A31234(EnGe1* this, PlayState* play) { void func_80A312E4(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk2B4 = func_80A31234; - Animation_Change(&this->skelAnime, &object_ge1_00A048_Anim, 1.0f, 0.0f, - Animation_GetLastFrame(&object_ge1_00A048_Anim), ANIMMODE_ONCE, -3.0f); - this->unk2B0 = &object_ge1_00A048_Anim; + Animation_Change(&this->skelAnime, &gObjectGe1ClapHandsAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gObjectGe1ClapHandsAnim), ANIMMODE_ONCE, -3.0f); + this->unk2B0 = &gObjectGe1ClapHandsAnim; this->unk2B8 = func_80A323EC; this->unk2AC &= 0xFFFB; } @@ -402,9 +402,9 @@ void func_80A316F4(EnGe1* this, PlayState* play) { this->unk2AC |= 1; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { this->unk2B4 = func_80A31644; - Animation_Change(&this->skelAnime, &object_ge1_00A048_Anim, 1.0f, 0.0f, - Animation_GetLastFrame(&object_ge1_00A048_Anim), ANIMMODE_ONCE, -3.0f); - this->unk2B0 = &object_ge1_00A048_Anim; + Animation_Change(&this->skelAnime, &gObjectGe1ClapHandsAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gObjectGe1ClapHandsAnim), ANIMMODE_ONCE, -3.0f); + this->unk2B0 = &gObjectGe1ClapHandsAnim; this->unk2B8 = func_80A323EC; this->unk2AC &= ~4; } @@ -434,9 +434,9 @@ void func_80A31880(EnGe1* this, PlayState* play) { } if (func_80A30C70(this, play, textId, 100.0f, func_80A3183C) != 0) { this->unk2B8 = func_80A323B0; - this->unk2B0 = &object_ge1_00A498_Anim; - Animation_Change(&this->skelAnime, &object_ge1_00A498_Anim, 1.0f, 0.0f, - Animation_GetLastFrame(&object_ge1_00A498_Anim), ANIMMODE_ONCE, -8.0f); + this->unk2B0 = &gObjectGe1ShooAwayAnim; + Animation_Change(&this->skelAnime, &gObjectGe1ShooAwayAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gObjectGe1ShooAwayAnim), ANIMMODE_ONCE, -8.0f); } } 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 e6ef092f275..a505c23f752 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -74,9 +74,8 @@ static void (*D_80A3433C[9])(EnGe2*, PlayState*) = { func_80A331A0, func_80A330CC, func_80A336C4, func_80A339EC, }; static AnimationHeader* D_80A34360[9] = { - &object_gla_009ED4_Anim, &object_gla_0098AC_Anim, &object_gla_0098AC_Anim, - &object_gla_0011F4_Anim, &object_gla_0098AC_Anim, &object_gla_008D60_Anim, - &object_gla_0098AC_Anim, &object_gla_0098AC_Anim, &object_gla_0098AC_Anim, + &gObjectGlaWalkAnim, &gObjectGlaIdleAnim, &gObjectGlaIdleAnim, &gObjectGlaFaintAnim, &gObjectGlaIdleAnim, + &gObjectGlaRunAnim, &gObjectGlaIdleAnim, &gObjectGlaIdleAnim, &gObjectGlaIdleAnim, }; static u8 D_80A34384[9] = { ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, @@ -105,8 +104,8 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &object_gla_008968_Skel, NULL, this->unk1DC, this->unk260, 22); - Animation_PlayLoop(&this->skelAnime, &object_gla_009ED4_Anim); + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGlaSkel, NULL, this->unk1DC, this->unk260, 22); + Animation_PlayLoop(&this->skelAnime, &gObjectGlaWalkAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; diff --git a/src/overlays/actors/ovl_En_Hata/z_en_hata.c b/src/overlays/actors/ovl_En_Hata/z_en_hata.c index d7f017d9d41..4ad313394fe 100644 --- a/src/overlays/actors/ovl_En_Hata/z_en_hata.c +++ b/src/overlays/actors/ovl_En_Hata/z_en_hata.c @@ -49,12 +49,12 @@ void EnHata_Init(Actor* thisx, PlayState* play) { f32 frameCount; colHeader = NULL; - frameCount = Animation_GetLastFrame(&object_hata_000444_Anim); + frameCount = Animation_GetLastFrame(&gObjectHataAnim); Actor_SetScale(&this->dyna.actor, 1.0f / 75.0f); - SkelAnime_Init(play, &this->skelAnime, &object_hata_002FD0_Skel, &object_hata_000444_Anim, NULL, NULL, 0); - Animation_Change(&this->skelAnime, &object_hata_000444_Anim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); + SkelAnime_Init(play, &this->skelAnime, &gObjectHataSkel, &gObjectHataAnim, NULL, NULL, 0); + Animation_Change(&this->skelAnime, &gObjectHataAnim, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_hata_0000C0_Col, &colHeader); + CollisionHeader_GetVirtual(&gObjectHataCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); this->dyna.actor.cullingVolumeScale = 500.0f; this->dyna.actor.cullingVolumeDownward = 550.0f; 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 2eb85eced4e..7469f260606 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -198,9 +198,9 @@ static InitChainEntry sInitChain[] = { }; static Vec3f D_80A88CF0 = { -1589.0f, 53.0f, -43.0f }; static void* D_80A88CFC[5] = { - object_jj_007698_Tex, - object_jj_007A98_Tex, - object_jj_007E98_Tex, + gObjectJjEyeOpenTex, + gObjectJjEyeHalfTex, + gObjectJjEyeClosedTex, }; void func_80A87800(EnJj* this, void (*arg1)(EnJj*, PlayState*)) { @@ -217,9 +217,8 @@ void EnJj_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); switch (this->dyna.actor.params) { case -1: - SkelAnime_InitFlex(play, &this->skelAnime, &object_jj_00B9A8_Skel, &object_jj_001F4C_Anim, this->unk1A8, - this->unk22C, 22); - Animation_PlayLoop(&this->skelAnime, &object_jj_001F4C_Anim); + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectJjSkel, &gObjectJjAnim, this->unk1A8, this->unk22C, 22); + Animation_PlayLoop(&this->skelAnime, &gObjectJjAnim); this->unk30A = 0; this->unk30E = 0; this->unk30F = 0; @@ -234,7 +233,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { &play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_jj_000A1C_Col, &sp4C); + CollisionHeader_GetVirtual(&gObjectJjBodyCol, &sp4C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); @@ -243,7 +242,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { case 0: DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_jj_001830_Col, &sp4C); + CollisionHeader_GetVirtual(&gObjectJjHeadCol, &sp4C); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->dyna.actor.update = func_80A87F44; 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 08126a82536..ced11fc10d8 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -119,9 +119,9 @@ static ColliderCylinderInitType1 sCylinderInit = { }; static UNK_PTR sEyeTextures[] = { - object_nb_00B428_Tex, - object_nb_00D0E8_Tex, - object_nb_00D4E8_Tex, + gNabooruEyeOpenTex, + gNabooruEyeHalfTex, + gNabooruEyeClosedTex, }; #if DEBUG_FEATURES @@ -358,7 +358,7 @@ void EnNb_SetCurrentAnim(EnNb* this, AnimationHeader* animation, u8 mode, f32 mo } void EnNb_SetChamberAnim(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &object_nb_009694_Anim, 0, 0, 0); + EnNb_SetCurrentAnim(this, &gNabooruHandsOnHipsLookDownAnim, 0, 0, 0); this->actor.shape.yOffset = -10000.0f; } @@ -420,7 +420,7 @@ void EnNb_SetupDefaultChamberIdle(EnNb* this) { } void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { - AnimationHeader* animation = &object_nb_00274C_Anim; + AnimationHeader* animation = &gNabooruRaiseArmsAnim; CsCmdActorCue* cue; if (play->csCtx.state != CS_STATE_IDLE) { @@ -434,7 +434,7 @@ void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { } void EnNb_SetupRaisedArmTransition(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &object_nb_002B4C_Anim; + AnimationHeader* animation = &gNabooruArmsRaisedAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -501,7 +501,7 @@ void func_80AB19FC(EnNb* this, PlayState* play) { } void EnNb_SetupLightArrowOrSealingCs(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &object_nb_000410_Anim, 2, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruJoinHandsAnim, 2, 0.0f, 0); this->action = NB_ACTION_7; this->actor.shape.shadowAlpha = 0; } @@ -620,7 +620,7 @@ void EnNb_DrawTransparency(EnNb* this, PlayState* play) { } void EnNb_InitKidnap(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &object_nb_001E7C_Anim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruPortalHandsOnGroundAnim, 0, 0.0f, 0); this->action = NB_KIDNAPPED; this->actor.shape.shadowAlpha = 0; SET_EVENTCHKINF(EVENTCHKINF_95); @@ -670,7 +670,7 @@ void EnNb_SetupCaptureCutsceneState(EnNb* this, PlayState* play) { } void EnNb_SetRaisedArmCaptureAnim(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &object_nb_001350_Anim; + AnimationHeader* animation = &gNabooruPortalArmRaisedAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -679,7 +679,7 @@ void EnNb_SetRaisedArmCaptureAnim(EnNb* this, s32 animFinished) { } void EnNb_SetupLookAroundInKidnap(EnNb* this) { - AnimationHeader* animation = &object_nb_001E7C_Anim; + AnimationHeader* animation = &gNabooruPortalHandsOnGroundAnim; Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, -8.0f); this->action = NB_KIDNAPPED_LOOK_AROUND; @@ -687,7 +687,7 @@ void EnNb_SetupLookAroundInKidnap(EnNb* this) { } void EnNb_SetupKidnap(EnNb* this) { - AnimationHeader* animation = &object_nb_001104_Anim; + AnimationHeader* animation = &gNabooruPortalRaiseArmAnim; Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_ONCE, -8.0f); this->action = NB_PORTAL_FALLTHROUGH; @@ -751,7 +751,7 @@ void EnNb_SuckedInByPortal(EnNb* this, PlayState* play) { } void EnNb_SetupConfrontation(EnNb* this, PlayState* play) { - AnimationHeader* animation = &object_nb_008BD0_Anim; + AnimationHeader* animation = &gNabooruFallOnAllFoursAnim; EnNb_SetCurrentAnim(this, animation, 0, 0.0f, 0); this->action = NB_IN_CONFRONTATION; @@ -810,7 +810,7 @@ void func_80AB26C8(EnNb* this) { void func_80AB26DC(EnNb* this, PlayState* play) { s32 pad; - AnimationHeader* animation = &object_nb_008BD0_Anim; + AnimationHeader* animation = &gNabooruFallOnAllFoursAnim; f32 frames = Animation_GetLastFrame(animation); EnNb_SetStartPosRotFromCue1(this, play, 1); @@ -821,7 +821,7 @@ void func_80AB26DC(EnNb* this, PlayState* play) { } void EnNb_SetupKneel(EnNb* this) { - AnimationHeader* animation = &object_nb_008BD0_Anim; + AnimationHeader* animation = &gNabooruFallOnAllFoursAnim; f32 frames = Animation_GetLastFrame(animation); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, 0.0f); @@ -831,7 +831,7 @@ void EnNb_SetupKneel(EnNb* this) { } void EnNb_CheckIfKneeling(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &object_nb_0046A8_Anim; + AnimationHeader* animation = &gNabooruOnAllFoursAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -841,7 +841,7 @@ void EnNb_CheckIfKneeling(EnNb* this, s32 animFinished) { } void EnNb_SetupLookRight(EnNb* this) { - AnimationHeader* animation = &object_nb_003954_Anim; + AnimationHeader* animation = &gNabooruOnAllFoursToKneelingAnim; f32 frames = Animation_GetLastFrame(animation); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); @@ -851,7 +851,7 @@ void EnNb_SetupLookRight(EnNb* this) { } void EnNb_CheckIfLookingRight(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &object_nb_004030_Anim; + AnimationHeader* animation = &gNabooruKneelingLookRightAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -861,7 +861,7 @@ void EnNb_CheckIfLookingRight(EnNb* this, s32 animFinished) { } void EnNb_SetupLookLeft(EnNb* this) { - AnimationHeader* animation = &object_nb_002DBC_Anim; + AnimationHeader* animation = &gNabooruKneelingLookRightToLeftAnim; f32 frames = Animation_GetLastFrame(animation); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); @@ -871,7 +871,7 @@ void EnNb_SetupLookLeft(EnNb* this) { } void EnNb_CheckIfLookLeft(EnNb* this, s32 animFinished) { - AnimationHeader* animation = &object_nb_0035A8_Anim; + AnimationHeader* animation = &gNabooruKneelingLookLeftAnim; if (animFinished) { Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, Animation_GetLastFrame(animation), ANIMMODE_LOOP, @@ -887,7 +887,7 @@ void EnNb_SetupDemo6KInConfrontation(EnNb* this, PlayState* play, s32 animFinish } void EnNb_SetupRun(EnNb* this) { - AnimationHeader* animation = &object_nb_006320_Anim; + AnimationHeader* animation = &gNabooruRunAndGetHitAnim; f32 frames = Animation_GetLastFrame(animation); Animation_Change(&this->skelAnime, animation, 1.0f, 0.0f, frames, ANIMMODE_ONCE, -8.0f); @@ -1020,8 +1020,8 @@ void func_80AB2E70(EnNb* this, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_nb_inConfrontion.c", 572); Gfx_SetupDL_25Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(object_nb_00D8E8_Tex)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(object_nb_00D8E8_Tex)); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideOpenTex)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gNabooruEyeWideOpenTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); SkelAnime_DrawFlexOpa(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, NULL, NULL, @@ -1034,7 +1034,7 @@ s32 func_80AB2FC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s EnNb* this = (EnNb*)thisx; if (limbIndex == 15) { - *dList = object_nb_013158_DL; + *dList = gNabooruHeadMouthOpenDL; } return 0; @@ -1061,7 +1061,7 @@ void func_80AB2FE4(EnNb* this, PlayState* play) { } void EnNb_SetupCreditsSpawn(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &object_nb_000BC0_Anim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruSittingAnim, 0, 0.0f, 0); this->action = NB_CREDITS_INIT; this->drawMode = NB_DRAW_NOTHING; this->actor.shape.shadowAlpha = 0; @@ -1097,13 +1097,13 @@ void EnNb_SetupCreditsSit(EnNb* this) { } void EnNb_SetupCreditsHeadTurn(EnNb* this) { - EnNb_SetCurrentAnim(this, &object_nb_005CA4_Anim, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruSittingToSittingLookRightAnim, 2, -8.0f, 0); this->action = NB_CREDITS_HEAD_TURN; } void EnNb_CheckIfLookingUp(EnNb* this, s32 animFinished) { if (animFinished) { - EnNb_SetCurrentAnim(this, &object_nb_005614_Anim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruSittingLookRightAnim, 0, 0.0f, 0); } } @@ -1168,13 +1168,13 @@ void EnNb_CrawlspaceSpawnCheck(EnNb* this, PlayState* play) { // looking into crawlspace if (!GET_EVENTCHKINF(EVENTCHKINF_94)) { - EnNb_SetCurrentAnim(this, &object_nb_006E78_Anim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruKneelingBackwardsAnim, 0, 0.0f, 0); this->action = NB_CROUCH_CRAWLSPACE; this->drawMode = NB_DRAW_DEFAULT; } else { s32 pad; - EnNb_SetCurrentAnim(this, &object_nb_004BB4_Anim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruHandsOnHipsAnim, 0, 0.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; this->actor.world.pos = this->finalPos; @@ -1246,7 +1246,7 @@ void func_80AB36DC(EnNb* this, PlayState* play) { void EnNb_CheckNoticed(EnNb* this, PlayState* play) { if (EnNb_GetNoticedStatus(this, play)) { - EnNb_SetCurrentAnim(this, &object_nb_004E60_Anim, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruHandsOnHipsToWalkAnim, 2, -8.0f, 0); this->action = NB_NOTICE_PLAYER; EnNb_SetNoticeSFX(this); } @@ -1254,7 +1254,7 @@ void EnNb_CheckNoticed(EnNb* this, PlayState* play) { void EnNb_SetupIdleCrawlspace(EnNb* this, s32 animFinished) { if (animFinished) { - EnNb_SetCurrentAnim(this, &object_nb_004BB4_Anim, 0, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruHandsOnHipsAnim, 0, -8.0f, 0); this->headTurnFlag = 1; this->actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY; this->action = NB_IDLE_CRAWLSPACE; @@ -1280,7 +1280,7 @@ void func_80AB3838(EnNb* this, PlayState* play) { } void EnNb_SetupPathMovement(EnNb* this, PlayState* play) { - EnNb_SetCurrentAnim(this, &object_nb_004E60_Anim, 2, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruHandsOnHipsToWalkAnim, 2, -8.0f, 0); SET_EVENTCHKINF(EVENTCHKINF_94); this->action = NB_IN_PATH; this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY); @@ -1347,10 +1347,10 @@ void func_80AB3A7C(EnNb* this, PlayState* play, s32 animFinished) { if ((u16)(kREG(17) + 0x19) > movementTimer) { if (animFinished) { - EnNb_SetCurrentAnim(this, &object_nb_009238_Anim, 0, 0.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruWalkAnim, 0, 0.0f, 0); } } else { - EnNb_SetCurrentAnim(this, &object_nb_004BB4_Anim, 0, -8.0f, 0); + EnNb_SetCurrentAnim(this, &gNabooruHandsOnHipsAnim, 0, -8.0f, 0); this->action = NB_IDLE_AFTER_TALK; } } @@ -1498,7 +1498,7 @@ void EnNb_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); EnNb_SetupCollider(thisx, play); - SkelAnime_InitFlex(play, &this->skelAnime, &object_nb_0181C8_Skel, NULL, this->jointTable, this->morphTable, 19); + SkelAnime_InitFlex(play, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, 19); switch (EnNb_GetType(this)) { case NB_TYPE_DEMO02: From 22673e02647edc3ea3f69e1ade418fd7aef3a44a Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 11 Aug 2026 08:21:10 +0200 Subject: [PATCH 092/150] doc object_skb --- assets/xml/objects/object_skb.xml | 136 +++++++++++----------- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 20 ++-- 2 files changed, 78 insertions(+), 78 deletions(-) diff --git a/assets/xml/objects/object_skb.xml b/assets/xml/objects/object_skb.xml index c7895a886cc..400feedf99e 100644 --- a/assets/xml/objects/object_skb.xml +++ b/assets/xml/objects/object_skb.xml @@ -1,111 +1,111 @@ - + - + - + - + - - - - - - - - - - + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 a5f9f5e1315..ca1568d4e63 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -182,7 +182,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(play, &this->skelAnime, &object_skb_0041F8_Skel, &object_skb_001854_Anim, this->jointTable, + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlAnim, this->jointTable, this->morphTable, 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->collider); @@ -230,7 +230,7 @@ void EnSkb_DecideNextAction(EnSkb* this) { } void EnSkb_SetupRiseFromGround(EnSkb* this) { - Animation_PlayOnceSetSpeed(&this->skelAnime, &object_skb_001854_Anim, 1.0f); + Animation_PlayOnceSetSpeed(&this->skelAnime, &gStalchildUncurlAnim, 1.0f); this->actionState = SKB_BEHAVIOR_BURIED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_APPEAR); @@ -254,7 +254,7 @@ void EnSkb_RiseFromGround(EnSkb* this, PlayState* play) { } void EnSkb_SetupDespawn(EnSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_001854_Anim, -1.0f, Animation_GetLastFrame(&object_skb_001854_Anim), + Animation_Change(&this->skelAnime, &gStalchildUncurlAnim, -1.0f, Animation_GetLastFrame(&gStalchildUncurlAnim), 0.0f, ANIMMODE_ONCE, -4.0f); this->actionState = SKB_BEHAVIOR_BURIED; this->setColliderAT = false; @@ -276,8 +276,8 @@ void EnSkb_Despawn(EnSkb* this, PlayState* play) { } void EnSkb_SetupWalkForward(EnSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_0047E0_Anim, 0.96000004f, 0.0f, - Animation_GetLastFrame(&object_skb_0047E0_Anim), ANIMMODE_LOOP, -4.0f); + Animation_Change(&this->skelAnime, &gStalchildWalkAnim, 0.96000004f, 0.0f, + Animation_GetLastFrame(&gStalchildWalkAnim), ANIMMODE_LOOP, -4.0f); this->actionState = SKB_BEHAVIOR_WALKING; this->headlessYawOffset = 0; this->actor.speed = this->actor.scale.y * 160.0f; @@ -315,8 +315,8 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { } void EnSkb_SetupAttack(EnSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_000460_Anim, 0.6f, 0.0f, - Animation_GetLastFrame(&object_skb_000460_Anim), ANIMMODE_ONCE_INTERP, 4.0f); + Animation_Change(&this->skelAnime, &gStalchildAttackAnim, 0.6f, 0.0f, + Animation_GetLastFrame(&gStalchildAttackAnim), ANIMMODE_ONCE_INTERP, 4.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_ATTACKING; this->actor.speed = 0.0f; @@ -343,7 +343,7 @@ void EnSkb_Attack(EnSkb* this, PlayState* play) { } void EnSkb_SetupRecoil(EnSkb* this) { - Animation_Change(&this->skelAnime, &object_skb_000460_Anim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, + Animation_Change(&this->skelAnime, &gStalchildAttackAnim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f, ANIMMODE_ONCE_INTERP, 0.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_RECOILING; @@ -388,7 +388,7 @@ void EnSkb_Stunned(EnSkb* this, PlayState* play) { } void EnSkb_SetupTakeDamage(EnSkb* this) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_skb_000D98_Anim, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDamagedAnim, -4.0f); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -4.0f; } @@ -422,7 +422,7 @@ void EnSkb_TakeDamage(EnSkb* this, PlayState* play) { } void EnSkb_SetupDeath(EnSkb* this, PlayState* play) { - Animation_MorphToPlayOnce(&this->skelAnime, &object_skb_0009DC_Anim, -4.0f); + Animation_MorphToPlayOnce(&this->skelAnime, &gStalchildDieAnim, -4.0f); this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.speed = -6.0f; From 6f8854bdb4ff027b05b57cd3cb7a78150d31b4e7 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 11 Aug 2026 08:29:01 +0200 Subject: [PATCH 093/150] format --- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 ca1568d4e63..f6a66ef324f 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -182,8 +182,8 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.mass = MASS_HEAVY; this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; - SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlAnim, this->jointTable, - this->morphTable, 20); + SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlAnim, this->jointTable, this->morphTable, + 20); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); @@ -315,8 +315,8 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { } void EnSkb_SetupAttack(EnSkb* this) { - Animation_Change(&this->skelAnime, &gStalchildAttackAnim, 0.6f, 0.0f, - Animation_GetLastFrame(&gStalchildAttackAnim), ANIMMODE_ONCE_INTERP, 4.0f); + Animation_Change(&this->skelAnime, &gStalchildAttackAnim, 0.6f, 0.0f, Animation_GetLastFrame(&gStalchildAttackAnim), + ANIMMODE_ONCE_INTERP, 4.0f); this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_ATTACKING; this->actor.speed = 0.0f; From 3121f639d230840c842965376e1f5e9b5dac7698 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Tue, 11 Aug 2026 12:59:09 +0200 Subject: [PATCH 094/150] BgHakaHuta docs --- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 192 +++++++++--------- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h | 10 +- 2 files changed, 102 insertions(+), 100 deletions(-) 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 060b6706dbd..b59640cc55a 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 @@ -22,11 +22,10 @@ void BgHakaHuta_Destroy(Actor* thisx, PlayState* play); void BgHakaHuta_Update(Actor* thisx, PlayState* play); void BgHakaHuta_Draw(Actor* thisx, PlayState* play); -void func_8087D0AC(BgHakaHuta* this, PlayState* play); -void func_8087D2F0(BgHakaHuta* this, PlayState* play); -void func_8087D5B8(BgHakaHuta* this, PlayState* play); -void func_8087D66C(BgHakaHuta* this, PlayState* play); -void func_8087D720(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_WaitSwitchFlag(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_OpenStartSlide(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_OpenSlide(BgHakaHuta* this, PlayState* play); +void BgHakaHuta_OpenFallOff(BgHakaHuta* this, PlayState* play); void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play); ActorProfile Bg_Haka_Huta_Profile = { @@ -40,30 +39,27 @@ ActorProfile Bg_Haka_Huta_Profile = { /**/ BgHakaHuta_Update, /**/ BgHakaHuta_Draw, }; + static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -static Vec3f D_8087D944 = { 0.0f, 0.0f, 0.0f }; -static Color_RGBA8 D_8087D950 = { 30, 20, 50, 255 }; -static Color_RGBA8 D_8087D954 = { 0, 0, 0, 255 }; void BgHakaHuta_Init(Actor* thisx, PlayState* play) { BgHakaHuta* this = (BgHakaHuta*)thisx; s32 pad; - CollisionHeader* sp24; + CollisionHeader* colHeader = NULL; - sp24 = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS); - CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &sp24); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp24); - this->unk16A = PARAMS_GET_U(thisx->params, 8, 8); - thisx->params &= 0xFF; + CollisionHeader_GetVirtual(&gBotwCoffinLidCol, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->hiddenContent = PARAMS_GET_U(thisx->params, 8, 8); + thisx->params = PARAMS_GET_U(thisx->params, 0, 8); if (Flags_GetSwitch(play, this->dyna.actor.params)) { - this->unk168 = -1; - this->actionFunc = func_8087D720; + this->timer = -1; + this->actionFunc = BgHakaHuta_OpenFallOff; } else { - this->actionFunc = func_8087D2F0; + this->actionFunc = BgHakaHuta_WaitSwitchFlag; } } @@ -73,54 +69,58 @@ void BgHakaHuta_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_8087D0AC(BgHakaHuta* this, PlayState* play) { - s32 var_s0; - f32 temp_fs1; - Vec3f sp94; - Vec3f sp88; - f32 var_fs0; - f32 v; +void BgHakaHuta_SpawnEffects(BgHakaHuta* this, PlayState* play) { + static Vec3f sEffAccel = { 0.0f, 0.0f, 0.0f }; + static Color_RGBA8 sEffPrimColor = { 30, 20, 50, 255 }; + static Color_RGBA8 sEffEnvColor = { 0, 0, 0, 255 }; + s32 i; + f32 dxMax; + Vec3f effPos; + Vec3f effVel; + f32 direction; + f32 dxMaxAbs; if (this->dyna.actor.world.rot.y == 0) { - var_fs0 = 1.0f; + direction = 1.0f; } else { - var_fs0 = -1.0f; + direction = -1.0f; } - sp88.x = -0.5f * var_fs0; - sp88.y = 0.0f; - sp88.z = 0.0f; - sp94.y = this->dyna.actor.world.pos.y; - sp94.z = this->dyna.actor.world.pos.z; - v = (50 - ((this->dyna.actor.world.pos.x - this->dyna.actor.home.pos.x) * var_fs0)); - temp_fs1 = v * var_fs0; - for (var_s0 = 0; var_s0 < 4; var_s0++) { - if (var_s0 == 2) { - sp94.z += 120.0f * var_fs0; + effVel.x = -0.5f * direction; + effVel.y = 0.0f; + effVel.z = 0.0f; + effPos.y = this->dyna.actor.world.pos.y; + effPos.z = this->dyna.actor.world.pos.z; + dxMaxAbs = 50 - ((this->dyna.actor.world.pos.x - this->dyna.actor.home.pos.x) * direction); + dxMax = dxMaxAbs * direction; + for (i = 0; i < 4; i++) { + if (i == 2) { + effPos.z += 120.0f * direction; } - sp94.x = this->dyna.actor.home.pos.x - (Rand_ZeroOne() * temp_fs1); - func_8002829C(play, &sp94, &sp88, &D_8087D944, &D_8087D950, &D_8087D954, (Rand_ZeroOne() * 10.0f) + 50.0f, 10); + effPos.x = this->dyna.actor.home.pos.x - (Rand_ZeroOne() * dxMax); + func_8002829C(play, &effPos, &effVel, &sEffAccel, &sEffPrimColor, &sEffEnvColor, + (Rand_ZeroOne() * 10.0f) + 50.0f, 10); } } -void BgHakaHuta_PlaySound(BgHakaHuta* this, PlayState* play, u16 arg2) { - Vec3f sp24; +void BgHakaHuta_PlaySound(BgHakaHuta* this, PlayState* play, u16 sfxId) { + Vec3f pos; if (this->dyna.actor.shape.rot.y == 0) { - sp24.z = this->dyna.actor.world.pos.z + 120.0f; + pos.z = this->dyna.actor.world.pos.z + 120.0f; } else { - sp24.z = this->dyna.actor.world.pos.z - 120.0f; + pos.z = this->dyna.actor.world.pos.z - 120.0f; } - sp24.x = this->dyna.actor.world.pos.x; - sp24.y = this->dyna.actor.world.pos.y; - SfxSource_PlaySfxAtFixedWorldPos(play, &sp24, 30, arg2); + pos.x = this->dyna.actor.world.pos.x; + pos.y = this->dyna.actor.world.pos.y; + SfxSource_PlaySfxAtFixedWorldPos(play, &pos, 30, sfxId); } -void func_8087D2F0(BgHakaHuta* this, PlayState* play) { +void BgHakaHuta_WaitSwitchFlag(BgHakaHuta* this, PlayState* play) { if (Flags_GetSwitch(play, this->dyna.actor.params) && !Player_InCsMode(play)) { - this->unk168 = 0x19; - this->actionFunc = func_8087D5B8; + this->timer = 25; + this->actionFunc = BgHakaHuta_OpenStartSlide; OnePointCutscene_Init(play, 6001, 999, &this->dyna.actor, CAM_ID_MAIN); - if (this->unk16A == 2) { + if (this->hiddenContent == BG_HAKA_HUTA_HIDDEN_CONTENT_KEESES) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_FIREFLY, this->dyna.actor.world.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + (40.0f * Math_SinS(this->dyna.actor.shape.rot.y)), @@ -135,7 +135,7 @@ void func_8087D2F0(BgHakaHuta* this, PlayState* play) { this->dyna.actor.world.pos.z - (-25.0f * Math_SinS(this->dyna.actor.shape.rot.y)) + (80.0f * Math_CosS(this->dyna.actor.shape.rot.y)), 0, this->dyna.actor.shape.rot.y, 0, EN_FIREFLY_TYPE_NORMAL); - } else if (this->unk16A == 1) { + } else if (this->hiddenContent == BG_HAKA_HUTA_HIDDEN_CONTENT_GIBDO) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_RD, this->dyna.actor.home.pos.x + (-25.0f * Math_CosS(this->dyna.actor.shape.rot.y)) + (100.0f * Math_SinS(this->dyna.actor.shape.rot.y)), @@ -147,79 +147,75 @@ void func_8087D2F0(BgHakaHuta* this, PlayState* play) { } } -void func_8087D5B8(BgHakaHuta* this, PlayState* play) { - f32 var_fv0; - s16 temp_v0; +void BgHakaHuta_OpenStartSlide(BgHakaHuta* this, PlayState* play) { + f32 dx; - temp_v0 = this->unk168; - if (temp_v0 != 0) { - this->unk168 = temp_v0 - 1; + if (this->timer != 0) { + this->timer--; } if (this->dyna.actor.world.rot.y == 0) { - var_fv0 = 4.0f; + dx = 4.0f; } else { - var_fv0 = -4.0f; + dx = -4.0f; } - Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + var_fv0, 2.0f); - if (this->unk168 == 0) { - this->unk168 = 0x25; + Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + dx, 2.0f); + if (this->timer == 0) { + this->timer = 37; BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_OPEN); - this->actionFunc = func_8087D66C; + this->actionFunc = BgHakaHuta_OpenSlide; } } -void func_8087D66C(BgHakaHuta* this, PlayState* play) { - f32 var_fv0; - s16 temp_v0; +void BgHakaHuta_OpenSlide(BgHakaHuta* this, PlayState* play) { + f32 dx; - temp_v0 = this->unk168; - if (temp_v0 != 0) { - this->unk168 = temp_v0 - 1; + if (this->timer != 0) { + this->timer--; } if (this->dyna.actor.world.rot.y == 0) { - var_fv0 = 24.0f; + dx = 24.0f; } else { - var_fv0 = -24.0f; + dx = -24.0f; } - if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + var_fv0, 0.5f)) { - func_8087D0AC(this, play); + if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x + dx, 0.5f)) { + BgHakaHuta_SpawnEffects(this, play); } - if (this->unk168 == 0) { + if (this->timer == 0) { BgHakaHuta_PlaySound(this, play, NA_SE_EV_COFFIN_CAP_BOUND); - this->actionFunc = func_8087D720; + this->actionFunc = BgHakaHuta_OpenFallOff; } } -void func_8087D720(BgHakaHuta* this, PlayState* play) { - static Vec3f D_8087D958 = { 30.0f, 0.0f, 0.0f }; - static Vec3f D_8087D964 = { 0.03258f, 0.3258f, -0.9449f }; - MtxF sp40; - Vec3f sp34; - s32 temp_v0; +void BgHakaHuta_OpenFallOff(BgHakaHuta* this, PlayState* play) { + static Vec3f sOffset = { 30.0f, 0.0f, 0.0f }; + static Vec3f sRotAxis = { 0.03258f, 0.3258f, -0.9449f }; + MtxF mf; + Vec3f posOffset; + s32 quakeIndex; - this->unk168 += 1; - if (this->unk168 == 6) { + this->timer++; + if (this->timer == 6) { this->actionFunc = BgHakaHuta_DoNothing; - temp_v0 = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_3); - Quake_SetSpeed(temp_v0, 0x7530); - Quake_SetPerturbations(temp_v0, 4, 0, 0, 0); - Quake_SetDuration(temp_v0, 2); - } else if (this->unk168 == 0) { - this->unk168 = 6; + quakeIndex = Quake_Request(play->cameraPtrs[play->activeCamId], QUAKE_TYPE_3); + Quake_SetSpeed(quakeIndex, 30000); + Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0); + Quake_SetDuration(quakeIndex, 2); + } else if (this->timer == 0) { + this->timer = 6; this->actionFunc = BgHakaHuta_DoNothing; } - D_8087D958.x = this->unk168 + 24.0f; - if (D_8087D958.x > 30.0f) { - D_8087D958.x = 30.0f; + sOffset.x = this->timer + 24.0f; + if (sOffset.x > 30.0f) { + sOffset.x = 30.0f; } Matrix_RotateY(BINANG_TO_RAD(this->dyna.actor.world.rot.y), MTXMODE_NEW); - Matrix_RotateAxis(this->unk168 * 0.16001178f, &D_8087D964, MTXMODE_APPLY); - Matrix_MultVec3f(&D_8087D958, &sp34); - this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + sp34.x; - this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + sp34.y; - this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + sp34.z; - Matrix_Get(&sp40); - Matrix_MtxFToYXZRotS(&sp40, &this->dyna.actor.shape.rot, 0); + Matrix_RotateAxis(this->timer * 0.16001178f, &sRotAxis, MTXMODE_APPLY); + Matrix_MultVec3f(&sOffset, &posOffset); + this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + posOffset.x; + this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + posOffset.y; + this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + posOffset.z; + Matrix_Get(&mf); + Matrix_MtxFToYXZRotS(&mf, &this->dyna.actor.shape.rot, 0); } void BgHakaHuta_DoNothing(BgHakaHuta* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h index 6cfea299dd9..51501c30484 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.h @@ -4,6 +4,12 @@ #include "ultra64.h" #include "actor.h" +typedef enum BgHakaHutaHiddenContent { + BG_HAKA_HUTA_HIDDEN_CONTENT_NONE, + BG_HAKA_HUTA_HIDDEN_CONTENT_GIBDO, + BG_HAKA_HUTA_HIDDEN_CONTENT_KEESES +} BgHakaHutaHiddenContent; + struct BgHakaHuta; typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, struct PlayState*); @@ -11,8 +17,8 @@ typedef void (*BgHakaHutaActionFunc)(struct BgHakaHuta*, struct PlayState*); typedef struct BgHakaHuta { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ BgHakaHutaActionFunc actionFunc; - /* 0x0168 */ s16 unk168; - /* 0x016A */ s16 unk16A; + /* 0x0168 */ s16 timer; + /* 0x016A */ s16 hiddenContent; } BgHakaHuta; // size = 0x016C #endif From a5d573e3afd1796962b90ab4aed52ca95fa6dacd Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 06:58:57 +0200 Subject: [PATCH 095/150] doc BgTokiHikari --- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.c | 133 ++++++++++-------- .../ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h | 9 +- 2 files changed, 79 insertions(+), 63 deletions(-) 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 8df36fa8296..b69bb2f4bb2 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 @@ -16,12 +16,12 @@ void BgTokiHikari_Destroy(Actor* thisx, PlayState* play); void BgTokiHikari_Update(Actor* thisx, PlayState* play); void BgTokiHikari_Draw(Actor* thisx, PlayState* play); -void func_808B9F98(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(Actor* thisx, PlayState* play); +void BgTokiHikari_WindowsAndLight_DoNothing(BgTokiHikari* this, PlayState* play); +void BgTokiHikari_WindowsAndLight_Draw(Actor* thisx, PlayState* play); +void BgTokiHikari_TriforceFlash_Wait(BgTokiHikari* this, PlayState* play); +void BgTokiHikari_TriforceFlash_Brighten(BgTokiHikari* this, PlayState* play); +void BgTokiHikari_TriforceFlash_FadeAway(BgTokiHikari* this, PlayState* play); +void BgTokiHikari_TriforceFlash_Draw(Actor* thisx, PlayState* play); ActorProfile Bg_Toki_Hikari_Profile = { /**/ ACTOR_BG_TOKI_HIKARI, @@ -40,23 +40,22 @@ static InitChainEntry sInitChain[] = { }; void BgTokiHikari_Init(Actor* thisx, PlayState* play) { - s16 temp_v0; BgTokiHikari* this = (BgTokiHikari*)thisx; - temp_v0 = this->actor.params; - switch (temp_v0) { /* irregular */ - case 0: + switch (this->actor.params) { + case BG_TOKI_HIKARI_TYPE_WINDOWS_AND_LIGHT: Actor_ProcessInitChain(&this->actor, sInitChain); - this->unk150 = func_808B9F98; - return; - case 1: + this->actionFunc = BgTokiHikari_WindowsAndLight_DoNothing; + break; + + case BG_TOKI_HIKARI_TYPE_TRIFORCE_FLASH: if (!GET_EVENTCHKINF(EVENTCHKINF_OPENED_DOOR_OF_TIME)) { - this->unk150 = func_808BA204; - this->unk14C = 0.0f; - return; + this->actionFunc = BgTokiHikari_TriforceFlash_Wait; + this->triforceFlashIntensity = 0.0f; + } else { + Actor_Kill(&this->actor); } - Actor_Kill(&this->actor); - return; + break; } } @@ -64,107 +63,119 @@ void BgTokiHikari_Destroy(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; } -void func_808B9F98(BgTokiHikari* this, PlayState* play) { +void BgTokiHikari_WindowsAndLight_DoNothing(BgTokiHikari* this, PlayState* play) { } void BgTokiHikari_Update(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; - this->unk150(this, play); + this->actionFunc(this, play); } void BgTokiHikari_Draw(Actor* thisx, PlayState* play) { switch (thisx->params) { - case 0: - func_808BA018(thisx, play); + case BG_TOKI_HIKARI_TYPE_WINDOWS_AND_LIGHT: + BgTokiHikari_WindowsAndLight_Draw(thisx, play); return; - case 1: - func_808BA2CC(thisx, play); + + case BG_TOKI_HIKARI_TYPE_TRIFORCE_FLASH: + BgTokiHikari_TriforceFlash_Draw(thisx, play); return; } } -void func_808BA018(Actor* thisx, PlayState* play) { - PlayState* play2 = (PlayState*)play; +void BgTokiHikari_WindowsAndLight_Draw(Actor* thisx, PlayState* play) { + PlayState* play2 = play; OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0xF6); + Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 252); - if (gSaveContext.save.linkAge == 0) { + + if (LINK_IS_ADULT) { gSPDisplayList(POLY_OPA_DISP++, object_toki_objects_DL_008190); } 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, 0U, play2->gameplayFrames & 0x7F, 0x40, 0x20)); - gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0U, play2->gameplayFrames & 0x7F, 0x40, 0x20)); + gSPSegment(POLY_XLU_DISP++, 8, Gfx_TexScroll(play->state.gfxCtx, 0, play2->gameplayFrames & 0x7F, 64, 32)); + gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, play2->gameplayFrames & 0x7F, 64, 32)); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 278); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_007EE0); } + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0x11C); } -void func_808BA204(BgTokiHikari* this, PlayState* play) { +void BgTokiHikari_TriforceFlash_Wait(BgTokiHikari* this, PlayState* play) { if (play->roomCtx.drawParams[1] != 0) { - this->unk150 = func_808BA22C; + this->actionFunc = BgTokiHikari_TriforceFlash_Brighten; } } -void func_808BA22C(BgTokiHikari* this, PlayState* play) { - f32 temp_fv0; - - temp_fv0 = this->unk14C; - if (temp_fv0 < 1.0f) { - this->unk14C = temp_fv0 + 0.05f; - return; +void BgTokiHikari_TriforceFlash_Brighten(BgTokiHikari* this, PlayState* play) { + if (this->triforceFlashIntensity < 1.0f) { + this->triforceFlashIntensity += 0.05f; + } else { + this->triforceFlashIntensity = 1.0f; + this->actionFunc = BgTokiHikari_TriforceFlash_FadeAway; } - this->unk14C = 1.0f; - this->unk150 = func_808BA274; } -void func_808BA274(BgTokiHikari* this, PlayState* play) { - if (this->unk14C > 0.2f) { - this->unk14C -= 0.025f; - return; +void BgTokiHikari_TriforceFlash_FadeAway(BgTokiHikari* this, PlayState* play) { + if (this->triforceFlashIntensity > 0.2f) { + this->triforceFlashIntensity -= 0.025f; + } else { + this->triforceFlashIntensity = 0.0f; + Actor_Kill(&this->actor); } - this->unk14C = 0.0f; - Actor_Kill(&this->actor); } -void func_808BA2CC(Actor* thisx, PlayState* play) { +void BgTokiHikari_TriforceFlash_Draw(Actor* thisx, PlayState* play) { BgTokiHikari* this = (BgTokiHikari*)thisx; s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0x15E); - Matrix_Translate(0.0f, 276.0f, 1122.0f, 0U); - Matrix_Scale(0.32f, 0.32f, this->unk14C * 7.0f, 1U); - Matrix_RotateZ(3.1415927f, 1U); + + Matrix_Translate(0.0f, 276.0f, 1122.0f, MTXMODE_NEW); + Matrix_Scale(0.32f, 0.32f, this->triforceFlashIntensity * 7.0f, MTXMODE_APPLY); + Matrix_RotateZ(M_PI, MTXMODE_APPLY); + Gfx_SetupDL_25Opa(play->state.gfxCtx); + Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, (u8)(this->unk14C * 255.0f), (u8)(155.0f * this->unk14C) + 100, - (u8)(this->unk14C * 255.0f), (u8)(this->unk14C * 255.0f)); - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk14C * 155.0f) + 100, (u8)(255.0f * this->unk14C), 0, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x80, (u8)(this->triforceFlashIntensity * 255.0f), + (u8)(155.0f * this->triforceFlashIntensity) + 100, (u8)(this->triforceFlashIntensity * 255.0f), + (u8)(this->triforceFlashIntensity * 255.0f)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->triforceFlashIntensity * 155.0f) + 100, + (u8)(255.0f * this->triforceFlashIntensity), 0, 128); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 382); gSPSegment(POLY_XLU_DISP++, 8, - Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (play->gameplayFrames & 0x7F) * -2, 0U, 0x20, 0x40, - 1, (play->gameplayFrames & 0x7F) * 4, 0U, 0x20, 0x40)); + Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (play->gameplayFrames & 0x7F) * -2, 0, 32, 64, 1, + (play->gameplayFrames & 0x7F) * 4, 0, 32, 64)); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_000880); Matrix_Pop(); + Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, (u8)(this->unk14C * 200.0f)); - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk14C * 255.0f), (u8)(this->unk14C * 255.0f), - (u8)(this->unk14C * 255.0f), (u8)(200.0f * this->unk14C)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, (u8)(this->triforceFlashIntensity * 200.0f)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->triforceFlashIntensity * 255.0f), + (u8)(this->triforceFlashIntensity * 255.0f), (u8)(this->triforceFlashIntensity * 255.0f), + (u8)(200.0f * this->triforceFlashIntensity)); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 415); gSPDisplayList(POLY_XLU_DISP++, object_toki_objects_DL_0009C0); Matrix_Pop(); + Matrix_Push(); gDPPipeSync(POLY_XLU_DISP++); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, (u8)(this->unk14C * 200.0f)); - gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->unk14C * 255.0f), (u8)(this->unk14C * 255.0f), - (u8)(this->unk14C * 255.0f), (u8)(200.0f * this->unk14C)); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, 0x00, 255, 255, 255, (u8)(this->triforceFlashIntensity * 200.0f)); + gDPSetEnvColor(POLY_XLU_DISP++, (u8)(this->triforceFlashIntensity * 255.0f), + (u8)(this->triforceFlashIntensity * 255.0f), (u8)(this->triforceFlashIntensity * 255.0f), + (u8)(200.0f * this->triforceFlashIntensity)); MATRIX_FINALIZE_AND_LOAD(POLY_XLU_DISP++, play->state.gfxCtx, "../z_bg_toki_hikari.c", 437); gSPDisplayList(POLY_XLU_DISP++, &object_toki_objects_DL_0009C0[10]); Matrix_Pop(); + CLOSE_DISPS(play->state.gfxCtx, "../z_bg_toki_hikari.c", 0x1BB); } diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h index 250e891629c..64d4448d981 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h @@ -4,12 +4,17 @@ #include "ultra64.h" #include "actor.h" +typedef enum BgTokiHikariType { + BG_TOKI_HIKARI_TYPE_WINDOWS_AND_LIGHT, + BG_TOKI_HIKARI_TYPE_TRIFORCE_FLASH +} BgTokiHikariType; + struct BgTokiHikari; typedef struct BgTokiHikari { /* 0x000 */ Actor actor; - /* 0x14C */ f32 unk14C; - /* 0x150 */ void (*unk150)(struct BgTokiHikari*, struct PlayState*); + /* 0x14C */ f32 triforceFlashIntensity; + /* 0x150 */ void (*actionFunc)(struct BgTokiHikari*, struct PlayState*); } BgTokiHikari; // size = 0x154 #endif From 6b450c2adc45172fdc143d607dd554eb16e32e61 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 14:37:07 +0200 Subject: [PATCH 096/150] z_en_jj_cutscene_data.inc.c --- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 126 +------------- .../ovl_En_Jj/z_en_jj_cutscene_data.inc.c | 158 ++++++++++++++++++ 2 files changed, 161 insertions(+), 123 deletions(-) create mode 100644 src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c 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 7469f260606..db23534b677 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -46,129 +46,9 @@ ActorProfile En_Jj_Profile = { static s32 sPad = 0; -static CutsceneData gJabuInhalingCs[0x2D4] = { - { 0x1A }, { 0x65D }, { 0xA }, { 4 }, { 0x50000 }, { 0xF00000 }, - { 0x40000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x6C4 }, { 0x34 }, - { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x300F0 }, { 0xFF0000 }, - { 0x40000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x6C4 }, { 0x34 }, - { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x600FF }, { 0x011D0000 }, - { 0x40000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x6C4 }, { 0x34 }, - { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x20011D }, { 0x012C0000 }, - { 0xC0000000 }, { -0x6C4 }, { 0x34 }, { -0x2C }, { -0x601 }, { 0x6D }, - { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, { 0x44 }, { 4 }, - { 0x10000 }, { 0xEA0000 }, { 0x40000000 }, { -0x681 }, { 0x34 }, { -0x2C }, - { -0x681 }, { 0x34 }, { -0x2C }, { 0x0F671408 }, { 0 }, { 1 }, - { 0x200EA }, { 0xF141F8 }, { 0 }, { -0x681 }, { 0x34 }, { -0x2C }, - { -0x643 }, { 0x82 }, { -0x2F }, { 0x410DB6DB }, { 0x41324925 }, { -0x3EF24925 }, - { 0x200F1 }, { 0x01184031 }, { 0 }, { -0x643 }, { 0x82 }, { -0x2F }, - { -0x225 }, { 0x82 }, { -0x34 }, { 0x41D83483 }, { 0 }, { -0x3E27CB7D }, - { 0x30118 }, { 0x012C0000 }, { 0 }, { -0x225 }, { 0x82 }, { -0x34 }, - { -0x225 }, { 0x82 }, { -0x34 }, { 0 }, { 0 }, { 0 }, - { 0x43 }, { 5 }, { 0x10000 }, { 0x5D0000 }, { 0 }, { 0 }, - { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, - { 0 }, { 0 }, { 0x3005D }, { 0x790000 }, { 0 }, { 0 }, - { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, - { 0 }, { 0 }, { 0x10079 }, { 0x920000 }, { 0 }, { 0 }, - { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, - { 0 }, { 0 }, { 0x20092 }, { 0xF10000 }, { 0 }, { 0 }, - { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, - { 0 }, { 0 }, { 0x100F1 }, { 0x01B90000 }, { 0 }, { 0 }, - { 0x33 }, { 0x7C }, { 0 }, { 0x33 }, { 0x7C }, { 0 }, - { 0 }, { 0 }, { 0x45 }, { 3 }, { 0x10000 }, { 0x5A0000 }, - { 0 }, { 0 }, { -0x21 }, { 9 }, { 0 }, { -0x21 }, - { 9 }, { 0 }, { 0 }, { 0 }, { 0x2005A }, { 0x014A0000 }, - { 0 }, { 0 }, { -0x21 }, { 9 }, { 0 }, { -0x3E }, - { 0x16 }, { 0 }, { 0xBDF77777 }, { 0 }, { 0x3014A }, { 0x017C0000 }, - { 0 }, { 0 }, { -0x3E }, { 0x16 }, { 0 }, { -0x3E }, - { 0x16 }, { 0 }, { 0 }, { 0 }, { 3 }, { 1 }, - { 0xC0447 }, { 0x04890000 }, { 0 }, { -0x2E }, { 0 }, { -0x30 }, - { -0x2E }, { 0 }, { -0x30 }, { 0 }, { 0 }, { 0 }, - { 0x2D }, { 1 }, { 0x90000 }, { 0xA000A }, { 0xA }, { 1 }, - { 0x35012C }, { 0x065D0000 }, { 0 }, { -0x65E }, { 0x34 }, { -0x34 }, - { -0x65E }, { 0x34 }, { -0x34 }, { 0 }, { 0 }, { 0 }, - { 1 }, { 0x10000 }, { 0x04430000 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, - { -0x28FEA4 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x28FE93 }, { 0 }, - { 0x4235998B }, { -0x0668FFA1 }, { -0x28FE82 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, - { -0x28FDDD }, { -0x01000000 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x288F9B }, { 1 }, - { 0x1003C }, { 0x047F0000 }, { 0 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE015C }, - { 0 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE016D }, { 0 }, { 0x4235998B }, - { -0x05FBFF05 }, { 0xDE017E }, { 0 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE0223 }, - { -0x01000000 }, { 0x4235998B }, { -0x05FBFF05 }, { 0xDE7065 }, { 1 }, { 0x1005A }, - { 0x015F0000 }, { 0 }, { 0x4235998B }, { -0x06A1FE82 }, { 0x01C70000 }, { 0 }, - { 0x4235998B }, { -0x06A1FE82 }, { 0x01C7AC34 }, { 0 }, { 0x4235998B }, { -0x06A1FE82 }, - { 0x01C74428 }, { 0 }, { 0x4235998B }, { -0x069DFE84 }, { 0x01C30000 }, { 0 }, - { 0x4203FFE5 }, { -0x069DFE84 }, { 0x01C3AC10 }, { 0 }, { 0x4203FFE5 }, { -0x069DFE84 }, - { 0x01C30000 }, { 0 }, { 0x4203FFE5 }, { -0x069DFE84 }, { 0x01C30000 }, { 0 }, - { 0x4203FFE5 }, { -0x069DFE84 }, { 0x01C30164 }, { -0x01000000 }, { 0x4203FFE5 }, { -0x069DFE84 }, - { 0x01C3AD78 }, { 1 }, { 0x100DC }, { 0x01880000 }, { 0 }, { 0x4235998B }, - { -0x0668FFA1 }, { -0x290000 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x2853CC }, - { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x28BBD8 }, { 0 }, { 0x4235998B }, - { -0x0668FFA1 }, { -0x290000 }, { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x2853F0 }, - { 0 }, { 0x4235998B }, { -0x0668FFA1 }, { -0x290000 }, { -0x01000000 }, { 0x4235998B }, - { -0x0668FFA1 }, { -0x290000 }, { 1 }, { 0x100F0 }, { 0x05330000 }, { 0 }, - { 0x42366658 }, { -0x0711FFBF }, { -0xF0000 }, { 0 }, { 0x42366658 }, { -0x0711FFBF }, - { -0xE53CC }, { 0 }, { 0x42366658 }, { -0x0711FFBF }, { -0xEBBD8 }, { 0 }, - { 0x42366658 }, { -0x0711FFBF }, { -0xF0000 }, { -0x01000000 }, { 0x42366658 }, { -0x0711FFBF }, - { -0xE53F0 }, { 1 }, { 0x10118 }, { 0x055B0000 }, { 0 }, { 0x42366658 }, - { -0x05FAFFA1 }, { -0x70000 }, { 0 }, { 0x42366658 }, { -0x05FAFFA1 }, { -0x653CC }, - { 0 }, { 0x42366658 }, { -0x05FAFFA1 }, { -0x6BBD8 }, { 0 }, { 0x42366658 }, - { -0x05FAFFA1 }, { -0x70000 }, { -0x01000000 }, { 0x42366658 }, { -0x05FAFFA1 }, { -0x653F0 }, - { 1 }, { 0x10136 }, { 0x058D0000 }, { 0 }, { 0x4235998B }, { -0x06B4FFAD }, - { -0x3B0000 }, { 0 }, { 0x4235998B }, { -0x06B4FFAD }, { -0x3A53CC }, { 0 }, - { 0x4235998B }, { -0x0670FF4F }, { -0x3ABBD8 }, { 0 }, { 0x4235998B }, { -0x05FCFF20 }, - { -0x3B0000 }, { 0 }, { 0x4235998B }, { -0x04DAFF4C }, { -0x3A53F0 }, { 0 }, - { 0x4235998B }, { -0x03B8FFB9 }, { -0x370000 }, { 0 }, { 0x4235998B }, { -0x03B8FFB9 }, - { -0x370000 }, { 0 }, { 0x4235998B }, { -0x03B8FFB9 }, { -0x36FE9C }, { -0x01000000 }, - { 0x4235998B }, { -0x03B8FFB9 }, { -0x365288 }, { 1 }, { 0x10163 }, { 0x05BA0000 }, - { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, { 0 }, { 0x42726667 }, - { -0x0725FF99 }, { 0x12AC34 }, { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x124428 }, - { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, { 0 }, { 0x42726667 }, - { -0x0725FF99 }, { 0x12AC10 }, { 0 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, - { -0x01000000 }, { 0x42726667 }, { -0x0725FF99 }, { 0x120000 }, { 2 }, { 0x10000 }, - { 0x04600000 }, { 0x1E }, { 0x4235998B }, { -0x06BB0005 }, { -0x2D0000 }, { 0x1E }, - { 0x4235998B }, { -0x06BB0005 }, { -0x2C53CC }, { 0x3E8 }, { 0x4235998B }, { -0x06BB0005 }, - { -0x2CBBD8 }, { 0x1E }, { 0x4235998B }, { -0x06BB0005 }, { -0x2D0000 }, { -0xFFFFE2 }, - { 0x4235998B }, { -0x06BB0005 }, { -0x2C53F0 }, { 2 }, { 0x1003C }, { 0x049C0000 }, - { 0x1E }, { 0x4235998B }, { -0x059FFF0F }, { 0x860000 }, { 0x1E }, { 0x4235998B }, - { -0x059FFF0F }, { 0x86AC34 }, { 0x3E8 }, { 0x4235998B }, { -0x059FFF0F }, { 0x864428 }, - { 0x1E }, { 0x4235998B }, { -0x059FFF0F }, { 0x860000 }, { -0xFFFFE2 }, { 0x4235998B }, - { -0x059FFF0F }, { 0x86AC10 }, { 2 }, { 0x1005A }, { 0x017C0000 }, { 0x1E }, - { 0x4235998B }, { -0x0649FEA4 }, { 0x01750000 }, { 0x1E }, { 0x4235998B }, { -0x0649FEA4 }, - { 0x0175AC34 }, { 0x32 }, { 0x4235998B }, { -0x0649FEA4 }, { 0x01754428 }, { 0x1E }, - { 0x420D9981 }, { -0x064DFEAE }, { 0x016F0000 }, { 0x1E }, { 0x4203FFE5 }, { -0x064DFEAE }, - { 0x016FAC10 }, { 0x1E }, { 0x4203FFE5 }, { -0x064DFEAE }, { 0x016F0000 }, { 0x1E }, - { 0x4203FFE5 }, { -0x064DFEAE }, { 0x016F0000 }, { 0x1E }, { 0x4203FFE5 }, { -0x064DFEAE }, - { 0x016F0164 }, { -0xFFFFE2 }, { 0x4203FFE5 }, { -0x064DFEAE }, { 0x016FAD78 }, { 2 }, - { 0x100DC }, { 0x01A50000 }, { 0x1E }, { 0x4235998B }, { -0x06BB0005 }, { -0x2D0000 }, - { 0x46 }, { 0x4235998B }, { -0x06BB0005 }, { -0x2C53CC }, { 5 }, { 0x4235998B }, - { -0x06BB0005 }, { -0x2CBBD8 }, { 6 }, { 0x42373325 }, { -0x0638FF6A }, { -0x920000 }, - { 0x1E }, { 0x4235998B }, { -0x05FAFF68 }, { -0x4A53F0 }, { 0x1E }, { 0x4235998B }, - { -0x05FAFF68 }, { -0x4B0000 }, { -0xFFFFE2 }, { 0x4235998B }, { -0x05FAFF68 }, { -0x4B0000 }, - { 2 }, { 0x100F0 }, { 0x05500000 }, { 0x1E }, { 0x42366658 }, { -0x06AFFFB6 }, - { -0x250000 }, { 0x1E }, { 0x42366658 }, { -0x06AFFFB6 }, { -0x2453CC }, { 0x3E8 }, - { 0x42366658 }, { -0x06AFFFB6 }, { -0x24BBD8 }, { 0x1E }, { 0x42366658 }, { -0x06AFFFB6 }, - { -0x250000 }, { -0xFFFFE2 }, { 0x42366658 }, { -0x06AFFFB6 }, { -0x2453F0 }, { 2 }, - { 0x10118 }, { 0x05780000 }, { 0x1E }, { 0x42366658 }, { -0x0652FF9D }, { -0x320000 }, - { 0x1E }, { 0x42366658 }, { -0x0652FF9D }, { -0x3153CC }, { 0x3E8 }, { 0x42366658 }, - { -0x0652FF9D }, { -0x31BBD8 }, { 0x1E }, { 0x42366658 }, { -0x0652FF9D }, { -0x320000 }, - { -0xFFFFE2 }, { 0x42366658 }, { -0x0652FF9D }, { -0x3153F0 }, { 2 }, { 0x10136 }, - { 0x05AA0000 }, { 0xB001E }, { 0x42B5FFCC }, { -0x0649FF73 }, { -0x3B0000 }, { 0x9000A }, - { 0x42B59966 }, { -0x063EFF8E }, { -0x3853CC }, { 0xFC000A }, { 0x42B4CC9A }, { -0x05F7FF40 }, - { -0x35BBD8 }, { 0xA }, { 0x42B53300 }, { -0x0592FF5C }, { -0x360000 }, { 0xCB000A }, - { 0x42B4CC9A }, { -0x0471FF89 }, { -0x2453F0 }, { 0x20000A }, { 0x42B4CC9A }, { -0x033FFFCE }, - { -0x330000 }, { 0x3E8 }, { 0x4235998B }, { -0x0343FFDD }, { -0x330000 }, { 0x1E }, - { 0x4235998B }, { -0x0343FFDD }, { -0x32FE9C }, { -0xFFFFE2 }, { 0x4235998B }, { -0x0343FFDD }, - { -0x325288 }, { 2 }, { 0x10163 }, { 0x05D70000 }, { 0x1E }, { 0x42726667 }, - { -0x06A9FF91 }, { -0x60000 }, { 0x1E }, { 0x42726667 }, { -0x06A9FF91 }, { -0x553CC }, - { 0xA }, { 0x42726667 }, { -0x06A9FF91 }, { -0x5BBD8 }, { 0xA }, { 0x42726667 }, - { -0x06B8FFAE }, { -0x2A0000 }, { 0x3E8 }, { 0x42726667 }, { -0x06B8FFAE }, { -0x2953F0 }, - { 0x1E }, { 0x42726667 }, { -0x06B8FFAE }, { -0x2A0000 }, { -0xFFFFE2 }, { 0x42726667 }, - { -0x06B8FFAE }, { -0x2A0000 }, { 0x2D }, { 1 }, { 0xB014F }, { 0x01560156 }, - { 0x3E8 }, { 1 }, { 0x180159 }, { 0x018B018B }, { 0x3E }, { 1 }, - { 0x10131 }, { 0x01EE0000 }, { 0 }, { -0x577 }, { 0x1C4 }, { -0x35 }, - { -0x577 }, { 0x1C4 }, { -0x35 }, { 0 }, { 0 }, { 0 }, - { -1 }, { 0 }, { 0 }, { 0 }, -}; +#include "z_en_jj_cutscene_data.inc.c" + +static s32 sPad2[2] = { 0 }; static ColliderCylinderInit sCylinderInit = { { diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c b/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c new file mode 100644 index 00000000000..e97636a5baa --- /dev/null +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj_cutscene_data.inc.c @@ -0,0 +1,158 @@ +#include "cutscene_commands.h" +#include "player.h" + +// clang-format off +static CutsceneData gJabuInhalingCs[] = { + CS_HEADER(26, 1629), + CS_PLAYER_CUE_LIST(4), + CS_PLAYER_CUE(PLAYER_CUEID_5, 0, 240, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_3, 240, 255, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_6, 255, 285, 0x0000, 0x4000, 0x0000, -1732, 52, -44, -1732, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_PLAYER_CUE(PLAYER_CUEID_32, 285, 300, 0x0000, 0xC000, 0x0000, -1732, 52, -44, -1537, 109, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_1_7, 4), + CS_ACTOR_CUE(0x0001, 0, 234, 0x0000, 0x4000, 0x0000, -1665, 52, -44, -1665, 52, -44, CS_FLOAT(0xF671408, 1.1393037e-29f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x1, 1e-45f)), + CS_ACTOR_CUE(0x0002, 234, 241, 0x41F8, 0x0000, 0x0000, -1665, 52, -44, -1603, 130, -47, CS_FLOAT(0x410DB6DB, 8.857142f), CS_FLOAT(0x41324925, 11.142858f), CS_FLOAT(0xC10DB6DB, -8.857142f)), + CS_ACTOR_CUE(0x0002, 241, 280, 0x4031, 0x0000, 0x0000, -1603, 130, -47, -549, 130, -52, CS_FLOAT(0x41D83483, 27.02564f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xC1D83483, -27.02564f)), + CS_ACTOR_CUE(0x0003, 280, 300, 0x0000, 0x0000, 0x0000, -549, 130, -52, -549, 130, -52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_2_4, 5), + CS_ACTOR_CUE(0x0001, 0, 93, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 93, 121, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0001, 121, 146, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 146, 241, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0001, 241, 441, 0x0000, 0x0000, 0x0000, 0, 51, 124, 0, 51, 124, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_2_5, 3), + CS_ACTOR_CUE(0x0001, 0, 90, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -33, 9, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0002, 90, 330, 0x0000, 0x0000, 0x0000, 0, -33, 9, 0, -62, 22, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0xBDF77777, -0.12083333f), CS_FLOAT(0x0, 0.0f)), + CS_ACTOR_CUE(0x0003, 330, 380, 0x0000, 0x0000, 0x0000, 0, -62, 22, 0, -62, 22, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_MISC_LIST(1), + CS_MISC(CS_MISC_STOP_CUTSCENE, 1095, 1161, 0x0000, 0x00000000, 0xFFFFFFD2, 0x00000000, 0xFFFFFFD0, 0xFFFFFFD2, 0x00000000, 0xFFFFFFD0, 0x00000000, 0x00000000, 0x00000000), + CS_TRANSITION(CS_TRANS_TRIGGER_INSTANCE, 0, 10), + CS_PLAYER_CUE_LIST(1), + CS_PLAYER_CUE(PLAYER_CUEID_53, 300, 1629, 0x0000, 0x0000, 0x0000, -1630, 52, -52, -1630, 52, -52, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_CAM_EYE_SPLINE(0, 1091), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x015C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x016D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x017E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0223), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x7065), + CS_CAM_EYE_SPLINE(60, 1151), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x015C), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x016D), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x017E), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x0223), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1532, 251, 222, 0x7065), + CS_CAM_EYE_SPLINE(90, 351), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1698, 382, 455, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1694, 380, 451, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4203FFE5, 32.999897f), -1694, 380, 451, 0xAD78), + CS_CAM_EYE_SPLINE(220, 392), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1641, 95, -41, 0x0000), + CS_CAM_EYE_SPLINE(240, 1331), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1810, 65, -15, 0xAC10), + CS_CAM_EYE_SPLINE(280, 1371), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42366658, 45.599945f), -1531, 95, -7, 0xAC10), + CS_CAM_EYE_SPLINE(310, 1421), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1717, 83, -59, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1717, 83, -59, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1649, 177, -59, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1533, 224, -59, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -1243, 180, -59, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x4235998B, 45.399944f), -953, 71, -55, 0xAD78), + CS_CAM_EYE_SPLINE(355, 1466), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 0, CS_FLOAT(0x42726667, 60.600002f), -1830, 103, 18, 0x0000), + CS_CAM_AT_SPLINE(0, 1120), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC10), + CS_CAM_AT_SPLINE(60, 1180), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1440, 241, 134, 0xAC10), + CS_CAM_AT_SPLINE(90, 380), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 50, CS_FLOAT(0x4235998B, 45.399944f), -1610, 348, 373, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x420D9981, 35.399906f), -1614, 338, 367, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4203FFE5, 32.999897f), -1614, 338, 367, 0xAD78), + CS_CAM_AT_SPLINE(220, 421), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 70, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 5, CS_FLOAT(0x4235998B, 45.399944f), -1724, -5, -45, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 6, CS_FLOAT(0x42373325, 45.799946f), -1593, 150, -146, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -1531, 152, -75, 0x0000), + CS_CAM_AT_SPLINE(240, 1360), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1712, 74, -37, 0xAC10), + CS_CAM_AT_SPLINE(280, 1400), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42366658, 45.599945f), -1619, 99, -50, 0xAC10), + CS_CAM_AT_SPLINE(310, 1450), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x0B, 30, CS_FLOAT(0x42B5FFCC, 90.9996f), -1610, 141, -59, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x09, 10, CS_FLOAT(0x42B59966, 90.79961f), -1599, 114, -57, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xFC, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -1528, 192, -54, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42B53300, 90.59961f), -1427, 164, -54, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0xCB, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -1138, 119, -37, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x20, 10, CS_FLOAT(0x42B4CC9A, 90.39961f), -832, 50, -51, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0x0164), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x4235998B, 45.399944f), -836, 35, -51, 0xAD78), + CS_CAM_AT_SPLINE(355, 1495), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0xAC34), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726667, 60.600002f), -1706, 111, -6, 0x4428), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 10, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 1000, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0xAC10), + CS_CAM_POINT(CS_CAM_CONTINUE, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), + CS_CAM_POINT(CS_CAM_STOP, 0x00, 30, CS_FLOAT(0x42726667, 60.600002f), -1721, 82, -42, 0x0000), + CS_TRANSITION(CS_TRANS_BLACK_FILL_IN, 335, 342), + CS_DESTINATION(CS_DEST_JABU_JABU, 345, 395), + CS_ACTOR_CUE_LIST(CS_CMD_ACTOR_CUE_8_0, 1), + CS_ACTOR_CUE(0x0001, 305, 494, 0x0000, 0x0000, 0x0000, -1399, 452, -53, -1399, 452, -53, CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f), CS_FLOAT(0x0, 0.0f)), + CS_END_OF_SCRIPT(), +}; +// clang-format on From f2f3632a234fd389ea061f34d8e7526370c89445 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 16:09:28 +0200 Subject: [PATCH 097/150] en_jj docs --- assets/xml/objects/object_jj.xml | 44 ++--- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 232 ++++++++++++------------ src/overlays/actors/ovl_En_Jj/z_en_jj.h | 32 ++-- 3 files changed, 162 insertions(+), 146 deletions(-) diff --git a/assets/xml/objects/object_jj.xml b/assets/xml/objects/object_jj.xml index 68312f67967..a0066afe8d3 100644 --- a/assets/xml/objects/object_jj.xml +++ b/assets/xml/objects/object_jj.xml @@ -66,28 +66,28 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + 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 db23534b677..cfb956b218f 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -5,7 +5,9 @@ */ #include "z_en_jj.h" +#include "src/overlays/actors/ovl_Eff_Dust/z_eff_dust.h" +#include "array_count.h" #include "gfx.h" #include "gfx_setupdl.h" #include "ichain.h" @@ -26,11 +28,16 @@ void EnJj_Destroy(Actor* thisx, PlayState* play); void EnJj_Update(Actor* thisx, PlayState* play); void EnJj_Draw(Actor* thisx, PlayState* play); -void func_80A87BEC(EnJj* this, PlayState* play); -void func_80A87C30(EnJj* this, PlayState* play); -void func_80A87CEC(EnJj* this, PlayState* play); -void func_80A87EF0(EnJj* this, PlayState* play); -void func_80A87F44(Actor* thisx, PlayState* play); +void EnJj_WaitPlayerNear(EnJj* this, PlayState* play); +void EnJj_WaitFishDrop(EnJj* this, PlayState* play); +void EnJj_TriggerInhalingCutscene(EnJj* this, PlayState* play); +void EnJj_InInhalingCutscene(EnJj* this, PlayState* play); +void EnJj_DoNothing(Actor* thisx, PlayState* play); + +#define EN_JJ_CS_STATE_FLAG_OPEN_MOUTH (1 << 0) +#define EN_JJ_CS_STATE_FLAG_BLINK_FLAG (1 << 1) +#define EN_JJ_CS_STATE_FLAG_KEEP_EFF_DUST (1 << 2) +#define EN_JJ_CS_STATE_FLAG_EFF_DUST_SPAWNED (1 << 3) ActorProfile En_Jj_Profile = { /**/ ACTOR_EN_JJ, @@ -76,65 +83,68 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeScale, 3300, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 1100, ICHAIN_STOP), }; -static Vec3f D_80A88CF0 = { -1589.0f, 53.0f, -43.0f }; -static void* D_80A88CFC[5] = { + +static Vec3f sJabuInhalingCsTriggerCenterPos = { -1589.0f, 53.0f, -43.0f }; + +static void* sEyeTextures[] = { gObjectJjEyeOpenTex, gObjectJjEyeHalfTex, gObjectJjEyeClosedTex, }; -void func_80A87800(EnJj* this, void (*arg1)(EnJj*, PlayState*)) { - this->unk2FC = arg1; +void EnJj_SetupAction(EnJj* this, void (*arg1)(EnJj*, PlayState*)) { + this->actionFunc = arg1; } void EnJj_Init(Actor* thisx, PlayState* play) { s32 pad; EnJj* this = (EnJj*)thisx; - CollisionHeader* sp4C; + CollisionHeader* colHeader = NULL; - sp4C = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); ActorShape_Init(&this->dyna.actor.shape, 0.0f, NULL, 0.0f); switch (this->dyna.actor.params) { - case -1: - SkelAnime_InitFlex(play, &this->skelAnime, &gObjectJjSkel, &gObjectJjAnim, this->unk1A8, this->unk22C, 22); + case EN_JJ_TYPE_MAIN: + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectJjSkel, &gObjectJjAnim, this->jointTable, + this->morphTable, OBJECT_JJ_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gObjectJjAnim); - this->unk30A = 0; - this->unk30E = 0; - this->unk30F = 0; - this->unk310 = 0; - this->unk311 = 0; + this->csStateFlags = 0; + this->eyeTexIndex = 0; + this->eyeTimer = 0; + this->eyeExtraBlinkAmount = 0; + this->nextEyeExtraBlinkAmount = 0; if (GET_EVENTCHKINF(EVENTCHKINF_OPENED_JABU_JABU)) { - func_80A87800(this, func_80A87BEC); + EnJj_SetupAction(this, EnJj_WaitPlayerNear); } else { - func_80A87800(this, func_80A87C30); + EnJj_SetupAction(this, EnJj_WaitFishDrop); } - this->unk300 = (EnJj*)Actor_SpawnAsChild( - &play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, this->dyna.actor.world.pos.x - 10.0f, - this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, this->dyna.actor.world.rot.y, 0, 0); + this->headCol = (EnJj*)Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EN_JJ, + this->dyna.actor.world.pos.x - 10.0f, + this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, 0, + this->dyna.actor.world.rot.y, 0, EN_JJ_TYPE_HEAD_COL); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gObjectJjBodyCol, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + CollisionHeader_GetVirtual(&gObjectJjBodyCol, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; return; - case 0: + case EN_JJ_TYPE_HEAD_COL: DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&gObjectJjHeadCol, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); + CollisionHeader_GetVirtual(&gObjectJjHeadCol, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); DynaPoly_DisableCeilingCollision(play, &play->colCtx.dyna, this->dyna.bgId); - this->dyna.actor.update = func_80A87F44; + this->dyna.actor.update = EnJj_DoNothing; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); return; - case 1: + case EN_JJ_TYPE_1: DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_jj_00BA8C_Col, &sp4C); - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp4C); - this->dyna.actor.update = func_80A87F44; + CollisionHeader_GetVirtual(&object_jj_00BA8C_Col, &colHeader); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); + this->dyna.actor.update = EnJj_DoNothing; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); return; @@ -145,151 +155,149 @@ void EnJj_Destroy(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; switch (this->dyna.actor.params) { - case -1: + case EN_JJ_TYPE_MAIN: DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); Collider_DestroyCylinder(play, &this->collider); - return; + break; - case 0: - case 1: + case EN_JJ_TYPE_HEAD_COL: + case EN_JJ_TYPE_1: DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); - return; + break; } } -void func_80A87B1C(EnJj* this) { - if (this->unk30F > 0) { - this->unk30F--; +void EnJj_UpdateEye(EnJj* this) { + if (this->eyeTimer > 0) { + this->eyeTimer--; } else { - this->unk30E++; - if (this->unk30E >= 3) { - this->unk30E = 0; - if (this->unk310 > 0) { - this->unk310--; + this->eyeTexIndex++; + if (this->eyeTexIndex >= ARRAY_COUNT(sEyeTextures)) { + this->eyeTexIndex = 0; + if (this->eyeExtraBlinkAmount > 0) { + this->eyeExtraBlinkAmount--; } else { - this->unk30F = Rand_S16Offset(0x14, 0x14); - this->unk310 = this->unk311; + this->eyeTimer = Rand_S16Offset(20, 20); + this->eyeExtraBlinkAmount = this->nextEyeExtraBlinkAmount; } } } } -void func_80A87B9C(EnJj* this, PlayState* play) { - EnJj* unk300; +void EnJj_OpenMouth(EnJj* this, PlayState* play) { + EnJj* headCol = this->headCol; - unk300 = this->unk300; - if (this->unk308 >= -0x1450) { - this->unk308 -= 0x66; - if (this->unk308 < -0xA28) { - DynaPoly_DisableCollision(play, &play->colCtx.dyna, unk300->dyna.bgId); + if (this->headRot >= -0x1450) { + this->headRot -= 0x66; + if (this->headRot < -0xA28) { + DynaPoly_DisableCollision(play, &play->colCtx.dyna, headCol->dyna.bgId); } } } -void func_80A87BEC(EnJj* this, PlayState* play) { +void EnJj_WaitPlayerNear(EnJj* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 300.0f) { - func_80A87800(this, func_80A87B9C); + EnJj_SetupAction(this, EnJj_OpenMouth); } } -void func_80A87C30(EnJj* this, PlayState* play) { +void EnJj_WaitFishDrop(EnJj* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && play->isPlayerDroppingFish(play)) { - this->unk30C = 0x64; - func_80A87800(this, func_80A87CEC); + if ((Math_Vec3f_DistXZ(&sJabuInhalingCsTriggerCenterPos, &player->actor.world.pos) < 300.0f) && + play->isPlayerDroppingFish(play)) { + this->timer = 100; + EnJj_SetupAction(this, EnJj_TriggerInhalingCutscene); } - this->collider.dim.pos.x = -0x4DD; - this->collider.dim.pos.y = 0x14; - this->collider.dim.pos.z = -0x30; + this->collider.dim.pos.x = -1245; + this->collider.dim.pos.y = 20; + this->collider.dim.pos.z = -48; CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -void func_80A87CEC(EnJj* this, PlayState* play) { - EnJj* temp_v1; - Actor* sp1C; +void EnJj_TriggerInhalingCutscene(EnJj* this, PlayState* play) { + EnJj* headCol = this->headCol; - temp_v1 = this->unk300; - if (this->unk30C > 0) { - this->unk30C--; - return; + if (this->timer > 0) { + this->timer--; + } else { + EnJj_SetupAction(this, EnJj_InInhalingCutscene); + play->csCtx.script = gJabuInhalingCs; + gSaveContext.cutsceneTrigger = 1; + DynaPoly_DisableCollision(play, &play->colCtx.dyna, headCol->dyna.bgId); + Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); + SET_EVENTCHKINF(EVENTCHKINF_OPENED_JABU_JABU); + Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } - func_80A87800(this, func_80A87EF0); - play->csCtx.script = gJabuInhalingCs; - gSaveContext.cutsceneTrigger = 1; - DynaPoly_DisableCollision(play, &play->colCtx.dyna, temp_v1->dyna.bgId); - Camera_SetFinishedFlag(play->cameraPtrs[play->activeCamId]); - SET_EVENTCHKINF(EVENTCHKINF_OPENED_JABU_JABU); - Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); } -void func_80A87D94(EnJj* this, PlayState* play) { +void EnJj_UpdateCutscene(EnJj* this, PlayState* play) { switch (play->csCtx.actorCues[2]->id) { case 1: - if (this->unk30A & 2) { - this->unk30E = 0; - this->unk30F = Rand_S16Offset(0x14, 0x14); - this->unk310 = 0; - this->unk311 = 0; - this->unk30A ^= 2; + if (this->csStateFlags & EN_JJ_CS_STATE_FLAG_BLINK_FLAG) { + this->eyeTexIndex = 0; + this->eyeTimer = Rand_S16Offset(20, 20); + this->eyeExtraBlinkAmount = 0; + this->nextEyeExtraBlinkAmount = 0; + this->csStateFlags ^= EN_JJ_CS_STATE_FLAG_BLINK_FLAG; } break; case 2: - this->unk30A |= 1; - if (!(this->unk30A & 8)) { - this->unk304 = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST, -1100.0f, - 105.0f, -27.0f, 0, 0, 0, 0); - this->unk30A |= 8; + this->csStateFlags |= EN_JJ_CS_STATE_FLAG_OPEN_MOUTH; + if (!(this->csStateFlags & EN_JJ_CS_STATE_FLAG_EFF_DUST_SPAWNED)) { + this->effDust = Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_EFF_DUST, -1100.0f, + 105.0f, -27.0f, 0, 0, 0, EFF_DUST_TYPE_0); + this->csStateFlags |= EN_JJ_CS_STATE_FLAG_EFF_DUST_SPAWNED; } break; case 3: - if (!(this->unk30A & 2)) { - this->unk30E = 0; - this->unk30F = 0; - this->unk310 = 1; - this->unk311 = 0; - this->unk30A |= 2; + if (!(this->csStateFlags & EN_JJ_CS_STATE_FLAG_BLINK_FLAG)) { + this->eyeTexIndex = 0; + this->eyeTimer = 0; + this->eyeExtraBlinkAmount = 1; + this->nextEyeExtraBlinkAmount = 0; + this->csStateFlags |= EN_JJ_CS_STATE_FLAG_BLINK_FLAG; } break; } - if (this->unk30A & 1) { + if (this->csStateFlags & EN_JJ_CS_STATE_FLAG_OPEN_MOUTH) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_JABJAB_BREATHE - SFX_FLAG); - if (this->unk308 >= -0x1450) { - this->unk308 -= 0x66; + if (this->headRot >= -0x1450) { + this->headRot -= 0x66; } } } -void func_80A87EF0(EnJj* this, PlayState* play) { - if (!(this->unk30A & 4)) { - this->unk30A |= 4; - if (this->unk304 != NULL) { - Actor_Kill(this->unk304); +void EnJj_InInhalingCutscene(EnJj* this, PlayState* play) { + if (!(this->csStateFlags & EN_JJ_CS_STATE_FLAG_KEEP_EFF_DUST)) { + this->csStateFlags |= EN_JJ_CS_STATE_FLAG_KEEP_EFF_DUST; + if (this->effDust != NULL) { + Actor_Kill(this->effDust); this->dyna.actor.child = NULL; } } } -void func_80A87F44(Actor* thisx, PlayState* play) { +void EnJj_DoNothing(Actor* thisx, PlayState* play) { } void EnJj_Update(Actor* thisx, PlayState* play) { EnJj* this = (EnJj*)thisx; if ((play->csCtx.state != CS_STATE_IDLE) && (play->csCtx.actorCues[2] != NULL)) { - func_80A87D94(this, play); + EnJj_UpdateCutscene(this, play); } else { - this->unk2FC(this, play); + this->actionFunc(this, play); if (this->skelAnime.curFrame == 41.0f) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_JABJAB_GROAN); } } - func_80A87B1C(this); + EnJj_UpdateEye(this); SkelAnime_Update(&this->skelAnime); Actor_SetScale(&this->dyna.actor, 0.087f); - this->skelAnime.jointTable[10].z = (s16)this->unk308; + this->skelAnime.jointTable[OBJECT_JJ_LIMB_HEAD].z = this->headRot; } void EnJj_Draw(Actor* thisx, PlayState* play) { @@ -300,8 +308,8 @@ void EnJj_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_37Opa(play->state.gfxCtx); Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A88CFC[this->unk30E])); - SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, (s32)this->skelAnime.dListCount, - NULL, NULL, this); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); + SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, + NULL, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_jj.c", 898); } 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 78d02cf69bd..985ab61afa3 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -4,24 +4,32 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_jj/object_jj.h" + +typedef enum EnJjType { + /* -1 */ EN_JJ_TYPE_MAIN = -1, + /* 0 */ EN_JJ_TYPE_HEAD_COL, + /* 1 */ EN_JJ_TYPE_1 +} EnJjType; + struct EnJj; typedef struct EnJj { /* 0x000 */ DynaPolyActor dyna; /* 0x164 */ SkelAnime skelAnime; - /* 0x1A8 */ Vec3s unk1A8[22]; - /* 0x22C */ Vec3s unk22C[22]; + /* 0x1A8 */ Vec3s jointTable[OBJECT_JJ_LIMB_MAX]; + /* 0x22C */ Vec3s morphTable[OBJECT_JJ_LIMB_MAX]; /* 0x2B0 */ ColliderCylinder collider; - /* 0x2FC */ void (*unk2FC)(struct EnJj*, struct PlayState*); - /* 0x300 */ struct EnJj* unk300; - /* 0x304 */ Actor* unk304; - /* 0x308 */ s16 unk308; - /* 0x30A */ u16 unk30A; - /* 0x30C */ s16 unk30C; - /* 0x30E */ u8 unk30E; - /* 0x30F */ u8 unk30F; - /* 0x310 */ u8 unk310; - /* 0x311 */ u8 unk311; + /* 0x2FC */ void (*actionFunc)(struct EnJj*, struct PlayState*); + /* 0x300 */ struct EnJj* headCol; + /* 0x304 */ Actor* effDust; + /* 0x308 */ s16 headRot; + /* 0x30A */ u16 csStateFlags; + /* 0x30C */ s16 timer; + /* 0x30E */ u8 eyeTexIndex; + /* 0x30F */ u8 eyeTimer; + /* 0x310 */ u8 eyeExtraBlinkAmount; + /* 0x311 */ u8 nextEyeExtraBlinkAmount; /* 0x312 */ char pad312[2]; } EnJj; // size = 0x314 From 04c0a4544c3aeffaff10ec9a632726f61c2e5c25 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 16:49:47 +0200 Subject: [PATCH 098/150] en_ge3 docs --- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 178 +++++++++++----------- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 16 +- 2 files changed, 98 insertions(+), 96 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index b8a69fdf33f..4e72cbd4c18 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -23,12 +23,15 @@ void EnGe3_Init(Actor* thisx, PlayState* play); void EnGe3_Destroy(Actor* thisx, PlayState* play); -void EnGe3_Update(Actor* thisx, PlayState* play); +void EnGe3_UpdateTalking(Actor* thisx, PlayState* play); void EnGe3_Draw(Actor* thisx, PlayState* play); -void func_80A34A80(EnGe3* this, PlayState* play); -void func_80A34B90(EnGe3* this, PlayState* play); -void func_80A34D68(Actor* thisx, PlayState* play); +void EnGe3_Idle(EnGe3* this, PlayState* play); +void EnGe3_StartTalk(EnGe3* this, PlayState* play); +void EnGe3_UpdateIdle(Actor* thisx, PlayState* play); + +#define EN_GE3_STATE_FLAG_NO_SKELANIME_UPDATE (1 << 1) +#define EN_GE3_STATE_FLAG_PLAYER_CS_ACTION_STARTED (1 << 2) ActorProfile En_Ge3_Profile = { /**/ ACTOR_EN_GE3, @@ -38,7 +41,7 @@ ActorProfile En_Ge3_Profile = { /**/ sizeof(EnGe3), /**/ EnGe3_Init, /**/ EnGe3_Destroy, - /**/ EnGe3_Update, + /**/ EnGe3_UpdateTalking, /**/ EnGe3_Draw, }; @@ -62,21 +65,15 @@ static ColliderCylinderInit sCylinderInit = { { 20, 50, 0, { 0, 0, 0 } }, }; -static void (*D_80A351BC[1])(EnGe3*, PlayState*) = { func_80A34A80 }; -static AnimationHeader* D_80A351C0[1] = { &gGerudoRedStandAnim }; -static u8 D_80A351C4[1] = { ANIMMODE_LOOP }; -static Vec3f D_80A351C8 = { 600.0f, 700.0f, 0.0f }; -static void* D_80A351D4[3] = { - gGerudoRedEyeOpenTex, - gGerudoRedEyeHalfTex, - gGerudoRedEyeShutTex, -}; +static void (*sActionFuncs[1])(EnGe3*, PlayState*) = { EnGe3_Idle }; +static AnimationHeader* sAnims[1] = { &gGerudoRedStandAnim }; +static u8 sAnimModes[1] = { ANIMMODE_LOOP }; -void func_80A34620(EnGe3* this, s32 arg1) { - this->unk310 = D_80A351BC[arg1]; - Animation_Change(&this->skelAnime, D_80A351C0[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A351C0[arg1]), - D_80A351C4[arg1], -8.0f); - this->unk30C &= ~2; +void EnGe3_SetupAction(EnGe3* this, s32 action) { + this->actionFunc = sActionFuncs[action]; + Animation_Change(&this->skelAnime, sAnims[action], 1.0f, 0.0f, Animation_GetLastFrame(sAnims[action]), + sAnimModes[action], -8.0f); + this->stateFlags &= ~EN_GE3_STATE_FLAG_NO_SKELANIME_UPDATE; } void EnGe3_Init(Actor* thisx, PlayState* play) { @@ -84,7 +81,7 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->unk1DC, this->unk26C, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, 24); Animation_PlayLoop(&this->skelAnime, &gGerudoRedStandAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -92,9 +89,9 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.01f); this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; - func_80A34620(this, 0); - this->unk310 = func_80A34B90; - this->unk30C = 0; + EnGe3_SetupAction(this, 0); + this->actionFunc = EnGe3_StartTalk; + this->stateFlags = 0; this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; @@ -106,152 +103,152 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void func_80A347F4(EnGe3* this, PlayState* play) { - s16 temp_v0; +void EnGe3_TrackPlayer(EnGe3* this, PlayState* play) { + s16 relYawTowardsPlayer; s32 pad; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (ABS(temp_v0) < 0x4001) { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (ABS(relYawTowardsPlayer) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_TrackPlayer(play, &this->actor, &this->unk300, &this->unk306, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - if (temp_v0 < 0) { - Math_SmoothStepToS(&this->unk300.y, -0x2000, 6, 0x1838, 0x100); + if (relYawTowardsPlayer < 0) { + Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100); } else { - Math_SmoothStepToS(&this->unk300.y, 0x2000, 6, 0x1838, 0x100); + Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 0x1838, 0x100); } - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xC, 0x3E8, 0x64); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 0x3E8, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; } } -void func_80A3490C(EnGe3* this, PlayState* play) { - s16 temp_v0; +void EnGe3_TrackPlayerIfNear(EnGe3* this, PlayState* play) { + s16 relYawTowardsPlayer; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(temp_v0) < 0x2301) && (this->actor.xzDistToPlayer < 100.0f)) { - Actor_TrackPlayer(play, &this->actor, &this->unk300, &this->unk306, this->actor.focus.pos); + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(relYawTowardsPlayer) <= 0x2300) && (this->actor.xzDistToPlayer < 100.0f)) { + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->unk300.x, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk300.y, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk306.x, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk306.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->torsoRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->torsoRot.y, 0, 6, 0x1838, 0x64); } } -void func_80A34A20(EnGe3* this, PlayState* play) { +void EnGe3_WaitTalkEnd(EnGe3* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - this->unk310 = func_80A34A80; - this->actor.update = func_80A34D68; + this->actionFunc = EnGe3_Idle; + this->actor.update = EnGe3_UpdateIdle; this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } - func_80A347F4(this, play); + EnGe3_TrackPlayer(this, play); } -void func_80A34A80(EnGe3* this, PlayState* play) { - func_80A3490C(this, play); +void EnGe3_Idle(EnGe3* this, PlayState* play) { + EnGe3_TrackPlayerIfNear(this, play); } -void func_80A34AA0(EnGe3* this, PlayState* play) { - if (Actor_HasParent(&this->actor, play) != 0) { +void EnGe3_GiveGerudosCard(EnGe3* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->unk310 = func_80A34A20; + this->actionFunc = EnGe3_WaitTalkEnd; } else { Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void func_80A34B00(EnGe3* this, PlayState* play) { +void EnGe3_Talking(EnGe3* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - this->unk310 = func_80A34AA0; + this->actionFunc = EnGe3_GiveGerudosCard; Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void func_80A34B90(EnGe3* this, PlayState* play) { +void EnGe3_StartTalk(EnGe3* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk310 = func_80A34B00; + this->actionFunc = EnGe3_Talking; } else { - if (!(this->unk30C & 4)) { + if (!(this->stateFlags & EN_GE3_STATE_FLAG_PLAYER_CS_ACTION_STARTED)) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_7); - this->unk30C |= 4; + this->stateFlags |= EN_GE3_STATE_FLAG_PLAYER_CS_ACTION_STARTED; } this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; Actor_OfferTalkExchange(&this->actor, play, 300.0f, 300.0f, EXCH_ITEM_NONE); } - func_80A3490C(this, play); + EnGe3_TrackPlayerIfNear(this, play); } -void func_80A34C40(EnGe3* this, PlayState* play) { +void EnGe3_UpdateImplPre(EnGe3* this, PlayState* play) { s32 pad[2]; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if (!(this->unk30C & 2) && SkelAnime_Update(&this->skelAnime)) { - this->unk30C |= 2; + if (!(this->stateFlags & EN_GE3_STATE_FLAG_NO_SKELANIME_UPDATE) && SkelAnime_Update(&this->skelAnime)) { + this->stateFlags |= EN_GE3_STATE_FLAG_NO_SKELANIME_UPDATE; } } -void func_80A34CE4(EnGe3* this, PlayState* play) { +void EnGe3_UpdateImplPost(EnGe3* this, PlayState* play) { Actor_MoveXZGravity(&this->actor); - if (DECR(this->unk2FE) == 0) { - this->unk2FE = Rand_S16Offset(0x3C, 0x3C); + if (DECR(this->eyeTimer) == 0) { + this->eyeTimer = Rand_S16Offset(60, 60); } - this->unk2FC = this->unk2FE; - if (this->unk2FC >= 3) { - this->unk2FC = 0; + this->eyeTexIndex = this->eyeTimer; + if (this->eyeTexIndex >= 3) { + this->eyeTexIndex = 0; } } -void func_80A34D68(Actor* thisx, PlayState* play) { +void EnGe3_UpdateIdle(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - func_80A34C40(this, play); - this->unk310(this, play); + EnGe3_UpdateImplPre(this, play); + this->actionFunc(this, play); if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk310 = func_80A34A20; - this->actor.update = EnGe3_Update; + this->actionFunc = EnGe3_WaitTalkEnd; + this->actor.update = EnGe3_UpdateTalking; } else { this->actor.textId = 0x6005; if (this->actor.xzDistToPlayer < 100.0f) { Actor_OfferTalk(&this->actor, play, 100.0f); } } - func_80A34CE4(this, play); + EnGe3_UpdateImplPost(this, play); } -void EnGe3_Update(Actor* thisx, PlayState* play) { +void EnGe3_UpdateTalking(Actor* thisx, PlayState* play) { EnGe3* this = (EnGe3*)thisx; - func_80A34C40(this, play); - this->unk310(this, play); - func_80A34CE4(this, play); + EnGe3_UpdateImplPre(this, play); + this->actionFunc(this, play); + EnGe3_UpdateImplPost(this, play); } -s32 func_80A34E58(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { +s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe3* this = thisx; - switch (arg1) { + switch (limbIndex) { case 5: case 0xB: case 0x10: - *arg2 = NULL; + *dList = NULL; return 0; case 6: - arg4->x += this->unk300.y; + rot->x += this->headRot.y; #if OOT_VERSION >= PAL_1_1 FALLTHROUGH; default: // This is a hack to fix a bug present before PAL 1.1, where the actor's clothes can change color // depending on what was drawn earlier in the frame. OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 547); - switch (arg1) { + switch (limbIndex) { case 3: break; @@ -279,24 +276,29 @@ s32 func_80A34E58(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg return 0; } -void func_80A35004(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { +void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGe3* this = thisx; - Vec3f sp18 = D_80A351C8; + Vec3f focusOffset = { 600.0f, 700.0f, 0.0f }; - if (arg1 == 6) { - Matrix_MultVec3f(&sp18, &this->actor.focus.pos); + if (limbIndex == 6) { + Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); } } void EnGe3_Draw(Actor* thisx, PlayState* play) { - s32 temp_a0; + static void* sEyeTextures[] = { + gGerudoRedEyeOpenTex, + gGerudoRedEyeHalfTex, + gGerudoRedEyeShutTex, + }; + s32 pad; EnGe3* this = (EnGe3*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 614); Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A351D4[this->unk2FC])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); func_8002EBCC(&this->actor, play, 0); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80A34E58, func_80A35004, this); + EnGe3_OverrideLimbDraw, EnGe3_PostLimbDraw, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 631); } diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index 8e141be4d06..cf587a9fd08 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -10,15 +10,15 @@ typedef struct EnGe3 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime skelAnime; - /* 0x1DC */ Vec3s unk1DC[24]; - /* 0x26C */ Vec3s unk26C[24]; - /* 0x2FC */ s16 unk2FC; - /* 0x2FE */ s16 unk2FE; - /* 0x300 */ Vec3s unk300; - /* 0x306 */ Vec3s unk306; - /* 0x30C */ u16 unk30C; + /* 0x1DC */ Vec3s jointTable[24]; + /* 0x26C */ Vec3s morphTable[24]; + /* 0x2FC */ s16 eyeTexIndex; + /* 0x2FE */ s16 eyeTimer; + /* 0x300 */ Vec3s headRot; + /* 0x306 */ Vec3s torsoRot; + /* 0x30C */ u16 stateFlags; /* 0x30E */ char pad30E[2]; - /* 0x310 */ void (*unk310)(struct EnGe3*, struct PlayState*); + /* 0x310 */ void (*actionFunc)(struct EnGe3*, struct PlayState*); } EnGe3; // size = 0x314 #endif From abac4365c0861d8461de4526861553baa087a939 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 18:45:59 +0200 Subject: [PATCH 099/150] en_ge2 docs --- assets/xml/objects/object_gla.xml | 38 +- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 562 ++++++++++++---------- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 40 +- 3 files changed, 343 insertions(+), 297 deletions(-) diff --git a/assets/xml/objects/object_gla.xml b/assets/xml/objects/object_gla.xml index 866ab1cbc59..e75e4fbe890 100644 --- a/assets/xml/objects/object_gla.xml +++ b/assets/xml/objects/object_gla.xml @@ -45,25 +45,25 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + 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 a505c23f752..e81324a9bcd 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -22,20 +22,25 @@ void EnGe2_Destroy(Actor* thisx, PlayState* play); void EnGe2_Update(Actor* thisx, PlayState* play); void EnGe2_Draw(Actor* thisx, PlayState* play); -s32 func_80A330A0(void); -void func_80A330CC(EnGe2* this, PlayState* play); -void func_80A331A0(EnGe2* this, PlayState* play); -void func_80A332D4(EnGe2* this, PlayState* play); -void func_80A3334C(EnGe2* this, PlayState* play); -void func_80A33444(EnGe2* this, PlayState* play); -void func_80A3354C(EnGe2* this, PlayState* play); -void func_80A33600(EnGe2* this, PlayState* play); -void func_80A336C4(EnGe2* this, PlayState* play); -void func_80A339EC(EnGe2* this, PlayState* play); -void func_80A33AFC(EnGe2* this, PlayState* play); -void func_80A33D10(Actor* thisx, PlayState* play); -void func_80A33DE0(Actor* thisx, PlayState* play); -void func_80A3402C(Actor* thisx, PlayState* play2); +s32 EnGe2_AreAllCarpentersRescued(void); +void EnGe2_PlayerCaught(EnGe2* this, PlayState* play); +void EnGe2_PlayerCaughtRun(EnGe2* this, PlayState* play); +void EnGe2_PlayerCaughtTurn(EnGe2* this, PlayState* play); +void EnGe2_Faint(EnGe2* this, PlayState* play); +void EnGe2_PatrolAlerted(EnGe2* this, PlayState* play); +void EnGe2_PatrolTurnAround(EnGe2* this, PlayState* play); +void EnGe2_PatrolWalk(EnGe2* this, PlayState* play); +void EnGe2_Static(EnGe2* this, PlayState* play); +void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play); +void EnGe2_WaitTalk(EnGe2* this, PlayState* play); +void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play); +void EnGe2_UpdateTalking(Actor* thisx, PlayState* play); +void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2); + +#define EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE (1 << 1) +#define EN_GE2_STATE_FLAG_2 (1 << 2) +#define EN_GE2_STATE_FLAG_PLAYER_CAUGHT (1 << 3) +#define EN_GE2_STATE_FLAG_4 (1 << 4) ActorProfile En_Ge2_Profile = { /**/ ACTOR_EN_GE2, @@ -69,34 +74,58 @@ static ColliderCylinderInit sCylinderInit = { { 20, 60, 0, { 0, 0, 0 } }, }; -static void (*D_80A3433C[9])(EnGe2*, PlayState*) = { - func_80A33600, func_80A3354C, func_80A33444, func_80A3334C, func_80A332D4, - func_80A331A0, func_80A330CC, func_80A336C4, func_80A339EC, +typedef enum EnGe2Action { + /* 0 */ EN_GE2_ACTION_PATROL_WALK, + /* 1 */ EN_GE2_ACTION_PATROL_TURN_AROUND, + /* 2 */ EN_GE2_ACTION_PATROL_ALERTED, + /* 3 */ EN_GE2_ACTION_FAINT, + /* 4 */ EN_GE2_ACTION_PLAYER_CAUGHT_TURN, + /* 5 */ EN_GE2_ACTION_PLAYER_CAUGHT_RUN, + /* 6 */ EN_GE2_ACTION_PLAYER_CAUGHT, + /* 7 */ EN_GE2_ACTION_STATIC, + /* 8 */ EN_GE2_ACTION_LOOK_AT_PLAYER, + /* 9 */ EN_GE2_ACTION_MAX +} EnGe2Action; + +static void (*sActionFuncs[EN_GE2_ACTION_MAX])(EnGe2*, PlayState*) = { + EnGe2_PatrolWalk, // EN_GE2_ACTION_PATROL_WALK + EnGe2_PatrolTurnAround, // EN_GE2_ACTION_PATROL_TURN_AROUND + EnGe2_PatrolAlerted, // EN_GE2_ACTION_PATROL_ALERTED + EnGe2_Faint, // EN_GE2_ACTION_FAINT + EnGe2_PlayerCaughtTurn, // EN_GE2_ACTION_PLAYER_CAUGHT_TURN + EnGe2_PlayerCaughtRun, // EN_GE2_ACTION_PLAYER_CAUGHT_RUN + EnGe2_PlayerCaught, // EN_GE2_ACTION_PLAYER_CAUGHT + EnGe2_Static, // EN_GE2_ACTION_STATIC + EnGe2_LookAtPlayer, // EN_GE2_ACTION_LOOK_AT_PLAYER }; -static AnimationHeader* D_80A34360[9] = { - &gObjectGlaWalkAnim, &gObjectGlaIdleAnim, &gObjectGlaIdleAnim, &gObjectGlaFaintAnim, &gObjectGlaIdleAnim, - &gObjectGlaRunAnim, &gObjectGlaIdleAnim, &gObjectGlaIdleAnim, &gObjectGlaIdleAnim, +static AnimationHeader* sAnims[EN_GE2_ACTION_MAX] = { + &gObjectGlaWalkAnim, // EN_GE2_ACTION_PATROL_WALK + &gObjectGlaIdleAnim, // EN_GE2_ACTION_PATROL_TURN_AROUND + &gObjectGlaIdleAnim, // EN_GE2_ACTION_PATROL_ALERTED + &gObjectGlaFaintAnim, // EN_GE2_ACTION_FAINT + &gObjectGlaIdleAnim, // EN_GE2_ACTION_PLAYER_CAUGHT_TURN + &gObjectGlaRunAnim, // EN_GE2_ACTION_PLAYER_CAUGHT_RUN + &gObjectGlaIdleAnim, // EN_GE2_ACTION_PLAYER_CAUGHT + &gObjectGlaIdleAnim, // EN_GE2_ACTION_STATIC + &gObjectGlaIdleAnim, // EN_GE2_ACTION_LOOK_AT_PLAYER }; -static u8 D_80A34384[9] = { - ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, - ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, -}; -static Vec3f D_80A34390 = { 0.0f, -0.05f, 0.0f }; -static Vec3f D_80A3439C = { 0.0f, -0.025f, 0.0f }; -static Color_RGBA8 D_80A343A8 = { 0xFF, 0xFF, 0xFF, 0 }; -static Color_RGBA8 D_80A343AC = { 0xFF, 0x96, 0, 0 }; -static Vec3f D_80A343B0 = { 600.0f, 700.0f, 0.0f }; -static void* D_80A343BC[3] = { - object_gla_004F78_Tex, - object_gla_005578_Tex, - object_gla_005BF8_Tex, +static u8 sAnimModes[EN_GE2_ACTION_MAX] = { + ANIMMODE_LOOP, // EN_GE2_ACTION_PATROL_WALK + ANIMMODE_ONCE, // EN_GE2_ACTION_PATROL_TURN_AROUND + ANIMMODE_LOOP, // EN_GE2_ACTION_PATROL_ALERTED + ANIMMODE_ONCE, // EN_GE2_ACTION_FAINT + ANIMMODE_LOOP, // EN_GE2_ACTION_PLAYER_CAUGHT_TURN + ANIMMODE_LOOP, // EN_GE2_ACTION_PLAYER_CAUGHT_RUN + ANIMMODE_LOOP, // EN_GE2_ACTION_PLAYER_CAUGHT + ANIMMODE_LOOP, // EN_GE2_ACTION_STATIC + ANIMMODE_ONCE, // EN_GE2_ACTION_LOOK_AT_PLAYER }; -void func_80A32BD0(EnGe2* this, s32 arg1) { - this->unk308 = D_80A3433C[arg1]; - Animation_Change(&this->skelAnime, D_80A34360[arg1], 1.0f, 0.0f, Animation_GetLastFrame(D_80A34360[arg1]), - D_80A34384[arg1], -8.0f); - this->unk2F4 &= ~2; +void EnGe2_SetupAction(EnGe2* this, s32 action) { + this->actionFunc = sActionFuncs[action]; + Animation_Change(&this->skelAnime, sAnims[action], 1.0f, 0.0f, Animation_GetLastFrame(sAnims[action]), + sAnimModes[action], -8.0f); + this->stateFlags &= ~EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE; } void EnGe2_Init(Actor* thisx, PlayState* play) { @@ -104,7 +133,8 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGlaSkel, NULL, this->unk1DC, this->unk260, 22); + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGlaSkel, NULL, this->jointTable, this->morphTable, + OBJECT_GLA_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gObjectGlaWalkAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); @@ -115,45 +145,45 @@ void EnGe2_Init(Actor* thisx, PlayState* play) { } else { this->actor.cullingVolumeDistance = 1200.0f; } - this->unk2FC = (this->actor.world.rot.z + 1) * 40.0f; + this->detectionYRange = (this->actor.world.rot.z + 1) * 40.0f; this->actor.world.rot.z = 0; this->actor.shape.rot.z = 0; switch (PARAMS_GET_S(thisx->params, 0, 8)) { - case 0: - func_80A32BD0(this, 0); - if (func_80A330A0() != 0) { - this->actor.update = func_80A33D10; + case EN_GE2_TYPE_PATROL: + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_WALK); + if (EnGe2_AreAllCarpentersRescued()) { + this->actor.update = EnGe2_UpdateFriendly; this->actor.attentionRangeType = ATTENTION_RANGE_6; } break; - case 1: - func_80A32BD0(this, 7); - if (func_80A330A0() != 0) { - this->actor.update = func_80A33D10; + case EN_GE2_TYPE_STATIC: + EnGe2_SetupAction(this, EN_GE2_ACTION_STATIC); + if (EnGe2_AreAllCarpentersRescued()) { + this->actor.update = EnGe2_UpdateFriendly; this->actor.attentionRangeType = ATTENTION_RANGE_6; } break; - case 2: - func_80A32BD0(this, 8); - this->actor.update = func_80A33DE0; - this->unk308 = func_80A33AFC; + case EN_GE2_TYPE_GERUDOS_CARD_GIVER: + EnGe2_SetupAction(this, EN_GE2_ACTION_LOOK_AT_PLAYER); + this->actor.update = EnGe2_UpdateTalking; + this->actionFunc = EnGe2_WaitTalk; this->actor.attentionRangeType = ATTENTION_RANGE_6; break; default: - ASSERT(0, "0", "../z_en_ge2.c", 0x1A2); + ASSERT(0, "0", "../z_en_ge2.c", 418); break; } - this->unk2F4 = 0; - this->unk304 = 0; - this->unk302 = 0; - this->unk306 = 0; + this->stateFlags = 0; + this->unk_304 = 0; + this->patrolTimer = 0; + this->playerNoise = 0; this->actor.minVelocityY = -4.0f; this->actor.gravity = -1.0f; - this->unk2F6 = this->actor.world.rot.y; - this->unk300 = PARAMS_GET_S(thisx->params, 8, 8) * 0xA; + this->targetYaw = this->actor.world.rot.y; + this->patrolTime = PARAMS_GET_S(thisx->params, 8, 8) * 10; } void EnGe2_Destroy(Actor* thisx, PlayState* play) { @@ -162,65 +192,65 @@ void EnGe2_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A32ECC(PlayState* play, EnGe2* this) { - f32 var_fv0; +s32 EnGe2_GetPlayerNoiseLevel(PlayState* play, EnGe2* this) { + f32 xzRangeFac; if (!IS_DAY) { - var_fv0 = 0.75f; + xzRangeFac = 0.75f; } else { - var_fv0 = 1.5f; + xzRangeFac = 1.5f; } - if ((250.0f * var_fv0) < this->actor.xzDistToPlayer) { + if ((250.0f * xzRangeFac) < this->actor.xzDistToPlayer) { return 0; } if (this->actor.xzDistToPlayer < 50.0f) { return 2; } - if (func_8002DDE4(play) != 0) { + if (func_8002DDE4(play)) { return 1; } return 0; } -s32 func_80A32F74(PlayState* play, EnGe2* this, Vec3f* arg2, s16 arg3, f32 arg4) { +s32 EnGe2_CanSeePlayer(PlayState* play, EnGe2* this, Vec3f* headPos, s16 yaw, f32 yRange) { Player* player = GET_PLAYER(play); - Vec3f sp38; - CollisionPoly* sp34; - f32 var_fv0; - s16 temp_v0; + Vec3f pos; + CollisionPoly* poly; + f32 xzRangeFac; + s16 relYawTowardsPlayer; if (!IS_DAY) { - var_fv0 = 0.75f; + xzRangeFac = 0.75f; } else { - var_fv0 = 1.5f; + xzRangeFac = 1.5f; } - if ((250.0f * var_fv0) < this->actor.xzDistToPlayer) { - return 0; + if ((250.0f * xzRangeFac) < this->actor.xzDistToPlayer) { + return false; } - if (arg4 < ABS(this->actor.yDistToPlayer)) { - return 0; + if (yRange < ABS(this->actor.yDistToPlayer)) { + return false; } - temp_v0 = this->actor.yawTowardsPlayer - arg3; - if (ABS(temp_v0) > 0x2000) { - return 0; + relYawTowardsPlayer = this->actor.yawTowardsPlayer - yaw; + if (ABS(relYawTowardsPlayer) > 0x2000) { + return false; } - if (BgCheck_AnyLineTest1(&play->colCtx, arg2, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &sp38, &sp34, 0)) { - return 0; + if (BgCheck_AnyLineTest1(&play->colCtx, headPos, &player->bodyPartsPos[PLAYER_BODYPART_HEAD], &pos, &poly, false)) { + return false; } - return 1; + return true; } -s32 func_80A330A0(void) { +s32 EnGe2_AreAllCarpentersRescued(void) { if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2()) { - return 1; + return true; } else { - return 0; + return false; } } -void func_80A330CC(EnGe2* this, PlayState* play) { - if (this->unk305 > 0) { - this->unk305--; +void EnGe2_PlayerCaught(EnGe2* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; } else { Horse_ResetHorseData(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { @@ -235,15 +265,15 @@ void func_80A330CC(EnGe2* this, PlayState* play) { } } -void func_80A331A0(EnGe2* this, PlayState* play) { +void EnGe2_PlayerCaughtRun(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.xzDistToPlayer < 50.0f) { - func_80A32BD0(this, 6); + EnGe2_SetupAction(this, EN_GE2_ACTION_PLAYER_CAUGHT); this->actor.speed = 0.0f; } - if (this->unk305 > 0) { - this->unk305--; + if (this->timer > 0) { + this->timer--; } else { Horse_ResetHorseData(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { @@ -258,301 +288,303 @@ void func_80A331A0(EnGe2* this, PlayState* play) { } } -void func_80A332D4(EnGe2* this, PlayState* play) { +void EnGe2_PlayerCaughtTurn(EnGe2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 2, 0x400, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; if (this->actor.world.rot.y == this->actor.yawTowardsPlayer) { - func_80A32BD0(this, 5); - this->unk305 = 0x32; + EnGe2_SetupAction(this, EN_GE2_ACTION_PLAYER_CAUGHT_RUN); + this->timer = 50; this->actor.speed = 4.0f; } } -void func_80A3334C(EnGe2* this, PlayState* play) { - s32 temp_v0; - Vec3f sp38; +void EnGe2_Faint(EnGe2* this, PlayState* play) { + static Vec3f sEffVel = { 0.0f, -0.05f, 0.0f }; + static Vec3f sEffAccel = { 0.0f, -0.025f, 0.0f }; + static Color_RGBA8 sEffPrimColor = { 255, 255, 255, 0 }; + static Color_RGBA8 sEffEnvColor = { 255, 150, 0, 0 }; + s32 angle; + Vec3f effPos; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - if (this->unk2F4 & 2) { - temp_v0 = play->state.frames * 0x2800; - sp38.x = this->actor.focus.pos.x + (Math_CosS(temp_v0) * 5.0f); - sp38.y = this->actor.focus.pos.y + 10.0f; - sp38.z = this->actor.focus.pos.z + (Math_SinS(temp_v0) * 5.0f); - EffectSsKiraKira_SpawnDispersed(play, &sp38, &D_80A34390, &D_80A3439C, &D_80A343A8, &D_80A343AC, 0x3E8, 0x10); + if (this->stateFlags & EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE) { + angle = play->state.frames * 0x2800; + effPos.x = this->actor.focus.pos.x + (Math_CosS(angle) * 5.0f); + effPos.y = this->actor.focus.pos.y + 10.0f; + effPos.z = this->actor.focus.pos.z + (Math_SinS(angle) * 5.0f); + EffectSsKiraKira_SpawnDispersed(play, &effPos, &sEffVel, &sEffAccel, &sEffPrimColor, &sEffEnvColor, 1000, 16); } } -void func_80A33444(EnGe2* this, PlayState* play) { - s32 temp_v0_2; +void EnGe2_PatrolAlerted(EnGe2* this, PlayState* play) { + s32 playerNoise; this->actor.speed = 0.0f; - if (this->unk2F4 & 0x10) { - this->unk2F4 &= ~0x10; + if (this->stateFlags & EN_GE2_STATE_FLAG_4) { + this->stateFlags &= ~EN_GE2_STATE_FLAG_4; } else { - temp_v0_2 = func_80A32ECC(play, this); - if (temp_v0_2 != 0) { - this->unk305 = 0x64; - this->unk2F8 = this->actor.yawTowardsPlayer; - if (this->unk306 < temp_v0_2) { - this->unk306 = temp_v0_2; + playerNoise = EnGe2_GetPlayerNoiseLevel(play, this); + if (playerNoise != 0) { + this->timer = 100; + this->patrolAlertedYaw = this->actor.yawTowardsPlayer; + if (this->playerNoise < playerNoise) { + this->playerNoise = playerNoise; } - } else if (this->actor.world.rot.y == this->unk2F8) { - this->unk306 = 0; - func_80A32BD0(this, 1); + } else if (this->actor.world.rot.y == this->patrolAlertedYaw) { + this->playerNoise = 0; + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_TURN_AROUND); return; } } - switch (this->unk306) { + switch (this->playerNoise) { case 1: - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F8, 2, 0x200, 0x100); + Math_SmoothStepToS(&this->actor.world.rot.y, this->patrolAlertedYaw, 2, 0x200, 0x100); break; case 2: - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F8, 2, 0x600, 0x180); + Math_SmoothStepToS(&this->actor.world.rot.y, this->patrolAlertedYaw, 2, 0x600, 0x180); break; } this->actor.shape.rot.y = this->actor.world.rot.y; } -void func_80A3354C(EnGe2* this, PlayState* play) { - s32 temp_v0; +void EnGe2_PatrolTurnAround(EnGe2* this, PlayState* play) { + s32 playerNoise; this->actor.speed = 0.0f; - temp_v0 = func_80A32ECC(play, this); - if (temp_v0 != 0) { - func_80A32BD0(this, 2); - this->unk305 = 0x64; - this->unk306 = temp_v0; - this->unk2F8 = this->actor.yawTowardsPlayer; - } else if (this->unk2F4 & 2) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F6, 2, 0x400, 0x200); + playerNoise = EnGe2_GetPlayerNoiseLevel(play, this); + if (playerNoise != 0) { + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_ALERTED); + this->timer = 100; + this->playerNoise = playerNoise; + this->patrolAlertedYaw = this->actor.yawTowardsPlayer; + } else if (this->stateFlags & EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetYaw, 2, 0x400, 0x200); this->actor.shape.rot.y = this->actor.world.rot.y; } - if (this->actor.shape.rot.y == this->unk2F6) { - func_80A32BD0(this, 0); + if (this->actor.shape.rot.y == this->targetYaw) { + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_WALK); } } -void func_80A33600(EnGe2* this, PlayState* play) { - u8 temp_v0; +void EnGe2_PatrolWalk(EnGe2* this, PlayState* play) { + u8 playerNoise; - temp_v0 = func_80A32ECC(play, this); - if (temp_v0 != 0) { + playerNoise = EnGe2_GetPlayerNoiseLevel(play, this); + if (playerNoise != 0) { this->actor.speed = 0.0f; - func_80A32BD0(this, 2); - this->unk305 = 0x64; - this->unk306 = temp_v0; - this->unk2F8 = this->actor.yawTowardsPlayer; - } else if (this->unk302 >= this->unk300) { - this->unk302 = 0; - this->unk2F6 += 0x8000; - func_80A32BD0(this, 1); + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_ALERTED); + this->timer = 100; + this->playerNoise = playerNoise; + this->patrolAlertedYaw = this->actor.yawTowardsPlayer; + } else if (this->patrolTimer >= this->patrolTime) { + this->patrolTimer = 0; + this->targetYaw += 0x8000; + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_TURN_AROUND); this->actor.speed = 0.0f; } else { - this->unk302 += 1; + this->patrolTimer++; this->actor.speed = 2.0f; } } -void func_80A336C4(EnGe2* this, PlayState* play) { - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk2F6, 2, 0x400, 0x200); +void EnGe2_Static(EnGe2* this, PlayState* play) { + Math_SmoothStepToS(&this->actor.world.rot.y, this->targetYaw, 2, 0x400, 0x200); } -void func_80A33704(EnGe2* this, PlayState* play) { - s16 temp_v0; +void EnGe2_TrackPlayer(EnGe2* this, PlayState* play) { + s16 relYawTowardsPlayer; s32 pad; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (ABS(temp_v0) <= 0x4000) { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (ABS(relYawTowardsPlayer) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_TrackPlayer(play, &this->actor, &this->unk2E8, &this->unk2EE, this->actor.focus.pos); - return; - } - if (temp_v0 < 0) { - Math_SmoothStepToS(&this->unk2E8.y, -0x2000, 6, 0x1838, 0x100); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->unk2E8.y, 0x2000, 6, 0x1838, 0x100); + if (relYawTowardsPlayer < 0) { + Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100); + } else { + Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 0x1838, 0x100); + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 0x3E8, 0x64); + this->actor.world.rot.y = this->actor.shape.rot.y; } - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xC, 0x3E8, 0x64); - this->actor.world.rot.y = this->actor.shape.rot.y; } -void func_80A3381C(EnGe2* this, PlayState* play) { - s16 temp_v0; +void EnGe2_TrackPlayerIfNear(EnGe2* this, PlayState* play) { + s16 relYawTowardsPlayer; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 200.0f)) { - Actor_TrackPlayer(play, &this->actor, &this->unk2E8, &this->unk2EE, this->actor.focus.pos); + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 200.0f)) { + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->unk2E8.x, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk2E8.y, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk2EE.x, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk2EE.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->torsoRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->torsoRot.y, 0, 6, 0x1838, 0x64); } } -void func_80A33930(EnGe2* this, PlayState* play) { +void EnGe2_WaitTalkEnd(EnGe2* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { switch (PARAMS_GET_S(this->actor.params, 0, 8)) { - case 0: - func_80A32BD0(this, 1); + case EN_GE2_TYPE_PATROL: + EnGe2_SetupAction(this, EN_GE2_ACTION_PATROL_TURN_AROUND); break; - case 1: - func_80A32BD0(this, 7); + case EN_GE2_TYPE_STATIC: + EnGe2_SetupAction(this, EN_GE2_ACTION_STATIC); break; - case 2: - this->unk308 = func_80A339EC; + case EN_GE2_TYPE_GERUDOS_CARD_GIVER: + this->actionFunc = EnGe2_LookAtPlayer; break; } - this->actor.update = func_80A33D10; + this->actor.update = EnGe2_UpdateFriendly; this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } - func_80A33704(this, play); + EnGe2_TrackPlayer(this, play); } -void func_80A339EC(EnGe2* this, PlayState* play) { - func_80A3381C(this, play); +void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) { + EnGe2_TrackPlayerIfNear(this, play); } -void func_80A33A0C(EnGe2* this, PlayState* play) { - if (Actor_HasParent(&this->actor, play) != 0) { +void EnGe2_GiveGerudosCard(EnGe2* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->unk308 = func_80A33930; + this->actionFunc = EnGe2_WaitTalkEnd; } else { Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void func_80A33A6C(EnGe2* this, PlayState* play) { +void EnGe2_Talking(EnGe2* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - this->unk308 = func_80A33A0C; + this->actionFunc = EnGe2_GiveGerudosCard; Actor_OfferGetItem(&this->actor, play, GI_GERUDOS_CARD, 10000.0f, 50.0f); } } -void func_80A33AFC(EnGe2* this, PlayState* play) { +void EnGe2_WaitTalk(EnGe2* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk308 = func_80A33A6C; + this->actionFunc = EnGe2_Talking; } else { this->actor.textId = 0x6004; this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; Actor_OfferTalkExchange(&this->actor, play, 300.0f, 300.0f, EXCH_ITEM_NONE); } - func_80A3381C(this, play); + EnGe2_TrackPlayerIfNear(this, play); } -void func_80A33B7C(EnGe2* this, PlayState* play) { - this->unk2F4 |= 8; +void EnGe2_SetupPlayerCaught(EnGe2* this, PlayState* play) { + this->stateFlags |= EN_GE2_STATE_FLAG_PLAYER_CAUGHT; this->actor.speed = 0.0f; - func_80A32BD0(this, 4); + EnGe2_SetupAction(this, EN_GE2_ACTION_PLAYER_CAUGHT_TURN); Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_95); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); Message_StartTextbox(play, 0x6000, &this->actor); } -void func_80A33BE8(EnGe2* this, PlayState* play) { +void EnGe2_UpdateImplPre(EnGe2* this, PlayState* play) { s32 pad[2]; Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - if (!(this->unk2F4 & 2) && SkelAnime_Update(&this->skelAnime)) { - this->unk2F4 |= 2; + if (!(this->stateFlags & EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE) && SkelAnime_Update(&this->skelAnime)) { + this->stateFlags |= EN_GE2_STATE_FLAG_NO_SKELANIME_UPDATE; } } -void func_80A33C8C(EnGe2* this, PlayState* play) { +void EnGe2_UpdateImplPost(EnGe2* this, PlayState* play) { Actor_MoveXZGravity(&this->actor); - if (DECR(this->unk2E6) == 0) { - this->unk2E6 = Rand_S16Offset(0x3C, 0x3C); + if (DECR(this->eyeTimer) == 0) { + this->eyeTimer = Rand_S16Offset(60, 60); } - this->unk2E4 = this->unk2E6; - if (this->unk2E4 >= 3) { - this->unk2E4 = 0; + this->eyeTexIndex = this->eyeTimer; + if (this->eyeTexIndex >= 3) { + this->eyeTexIndex = 0; } } -void func_80A33D10(Actor* thisx, PlayState* play) { +void EnGe2_UpdateFriendly(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - func_80A33BE8(this, play); - this->unk308(this, play); + EnGe2_UpdateImplPre(this, play); + this->actionFunc(this, play); if (Actor_TalkOfferAccepted(thisx, play)) { - if (PARAMS_GET_S(thisx->params, 0, 8) == 0) { + if (PARAMS_GET_S(thisx->params, 0, 8) == EN_GE2_TYPE_PATROL) { thisx->speed = 0.0f; - func_80A32BD0(this, 8); + EnGe2_SetupAction(this, EN_GE2_ACTION_LOOK_AT_PLAYER); } - this->unk308 = func_80A33930; - thisx->update = func_80A33DE0; + this->actionFunc = EnGe2_WaitTalkEnd; + thisx->update = EnGe2_UpdateTalking; } else { thisx->textId = 0x6005; if (thisx->xzDistToPlayer < 100.0f) { Actor_OfferTalk(thisx, play, 100.0f); } } - func_80A33C8C(this, play); + EnGe2_UpdateImplPost(this, play); } -void func_80A33DE0(Actor* thisx, PlayState* play) { +void EnGe2_UpdateTalking(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - this->unk2F4 |= 0x10; - func_80A33BE8(this, play); - this->unk308(this, play); - func_80A33C8C(this, play); + this->stateFlags |= EN_GE2_STATE_FLAG_4; + EnGe2_UpdateImplPre(this, play); + this->actionFunc(this, play); + EnGe2_UpdateImplPost(this, play); } void EnGe2_Update(Actor* thisx, PlayState* play) { EnGe2* this = (EnGe2*)thisx; - func_80A33BE8(this, play); - if ((this->unk2F4 & 4) || (this->unk2F4 & 8)) { - this->unk308(this, play); + EnGe2_UpdateImplPre(this, play); + if ((this->stateFlags & EN_GE2_STATE_FLAG_2) || (this->stateFlags & EN_GE2_STATE_FLAG_PLAYER_CAUGHT)) { + this->actionFunc(this, play); + } else if (this->collider.base.acFlags & AC_HIT) { + if ((this->collider.elem.acHitElem != NULL) && + (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { + //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the + //! colorfilter. + //! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144 + Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 400); + this->actor.update = EnGe2_UpdateStunned; + return; + } + EnGe2_SetupAction(this, EN_GE2_ACTION_FAINT); + this->timer = 100; + this->stateFlags |= EN_GE2_STATE_FLAG_2; + this->actor.speed = 0.0f; + Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); } else { - if (this->collider.base.acFlags & AC_HIT) { - if ((this->collider.elem.acHitElem != NULL) && - (this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT)) { - //! @bug duration parameter is larger than 255 which messes with the internal bitpacking of the - //! colorfilter. - //! Because of the duration being tracked as an unsigned byte it ends up being truncated to 144 - Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 400); - this->actor.update = func_80A3402C; - return; - } - func_80A32BD0(this, 3); - this->unk305 = 0x64; - this->unk2F4 |= 4; - this->actor.speed = 0.0f; - Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); - } else { - this->unk308(this, play); - if (func_80A32F74(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->unk2FC) != 0) { - PRINTF("\x1b[32m発見!!!!!!!!!!!!\n\x1b[m"); - func_80A33B7C(this, play); - } - if ((PARAMS_GET_S(this->actor.params, 0, 8) == 1) && (this->actor.xzDistToPlayer < 100.0f)) { - PRINTF("\x1b[32m発見!!!!!!!!!!!!\n\x1b[m"); - func_80A33B7C(this, play); - } + this->actionFunc(this, play); + if (EnGe2_CanSeePlayer(play, this, &this->actor.focus.pos, this->actor.shape.rot.y, this->detectionYRange)) { + PRINTF(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); + EnGe2_SetupPlayerCaught(this, play); + } + if ((PARAMS_GET_S(this->actor.params, 0, 8) == EN_GE2_TYPE_STATIC) && (this->actor.xzDistToPlayer < 100.0f)) { + PRINTF(VT_FGCOL(GREEN) "発見!!!!!!!!!!!!\n" VT_RST); + EnGe2_SetupPlayerCaught(this, play); } } - if (!(this->unk2F4 & 4) && - ((PARAMS_GET_S(this->actor.params, 0, 8) == 0) || (PARAMS_GET_S(this->actor.params, 0, 8) == 1))) { + if (!(this->stateFlags & EN_GE2_STATE_FLAG_2) && ((PARAMS_GET_S(this->actor.params, 0, 8) == EN_GE2_TYPE_PATROL) || + (PARAMS_GET_S(this->actor.params, 0, 8) == EN_GE2_TYPE_STATIC))) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } - func_80A33C8C(this, play); - if ((func_80A330A0() != 0) && !(this->unk2F4 & 4)) { - this->actor.update = func_80A33D10; + EnGe2_UpdateImplPost(this, play); + if (EnGe2_AreAllCarpentersRescued() && !(this->stateFlags & EN_GE2_STATE_FLAG_2)) { + this->actor.update = EnGe2_UpdateFriendly; this->actor.attentionRangeType = ATTENTION_RANGE_6; } } -void func_80A3402C(Actor* thisx, PlayState* play2) { +void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { PlayState* play = play2; EnGe2* this = (EnGe2*)thisx; @@ -560,18 +592,18 @@ void func_80A3402C(Actor* thisx, PlayState* play2) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); if ((this->collider.base.acFlags & AC_HIT) && - (((this->collider.elem.acHitElem == NULL)) || + ((this->collider.elem.acHitElem == NULL) || !(this->collider.elem.acHitElem->atDmgInfo.dmgFlags & DMG_HOOKSHOT))) { this->actor.colorFilterTimer = 0; - func_80A32BD0(this, 3); - this->unk305 = 0x64; - this->unk2F4 = (u16)(this->unk2F4 | 4); + EnGe2_SetupAction(this, EN_GE2_ACTION_FAINT); + this->timer = 100; + this->stateFlags |= EN_GE2_STATE_FLAG_2; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_VO_SK_CRASH); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); - if (func_80A330A0() != 0) { - this->actor.update = func_80A33D10; + if (EnGe2_AreAllCarpentersRescued()) { + this->actor.update = EnGe2_UpdateFriendly; this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.colorFilterTimer = 0; } else if (this->actor.colorFilterTimer == 0) { @@ -579,33 +611,39 @@ void func_80A3402C(Actor* thisx, PlayState* play2) { } } -s32 func_80A3415C(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { +s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe2* this = thisx; - if (arg1 == 3) { - arg4->x += this->unk2E8.y; - arg4->z += this->unk2E8.x; + if (limbIndex == OBJECT_GLA_LIMB_HEAD_ROOT) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; } - return 0; + return false; } -void func_80A341A0(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { +void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { + static Vec3f sFocusOffset = { 600.0f, 700.0f, 0.0f }; EnGe2* this = thisx; - if (arg1 == 6) { - Matrix_MultVec3f(&D_80A343B0, &this->actor.focus.pos); + if (limbIndex == OBJECT_GLA_LIMB_HEAD) { + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } } void EnGe2_Draw(Actor* thisx, PlayState* play) { + static void* sEyeTextures[] = { + gObjectGlaEyeOpenTex, + gObjectGlaEyeHalfTex, + gObjectGlaEyeClosedTex, + }; EnGe2* this = (EnGe2*)thisx; s32 pad; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1274); Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A343BC[this->unk2E4])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); func_8002EBCC(&this->actor, play, 0); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, - func_80A3415C, func_80A341A0, this); + EnGe2_OverrideLimbDraw, EnGe2_PostLimbDraw, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge2.c", 1291); } diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 2e2395874a0..6e05a9a3183 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -4,30 +4,38 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_gla/object_gla.h" + +typedef enum EnGe2Type { + /* 0 */ EN_GE2_TYPE_PATROL, + /* 1 */ EN_GE2_TYPE_STATIC, + /* 2 */ EN_GE2_TYPE_GERUDOS_CARD_GIVER // unused and possibly non functional +} EnGe2Type; + struct EnGe2; typedef struct EnGe2 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime skelAnime; - /* 0x1DC */ Vec3s unk1DC[22]; - /* 0x260 */ Vec3s unk260[22]; - /* 0x2E4 */ s16 unk2E4; - /* 0x2E6 */ s16 unk2E6; - /* 0x2E8 */ Vec3s unk2E8; - /* 0x2EE */ Vec3s unk2EE; - /* 0x2F4 */ u16 unk2F4; - /* 0x2F6 */ s16 unk2F6; - /* 0x2F8 */ s16 unk2F8; + /* 0x1DC */ Vec3s jointTable[OBJECT_GLA_LIMB_MAX]; + /* 0x260 */ Vec3s morphTable[OBJECT_GLA_LIMB_MAX]; + /* 0x2E4 */ s16 eyeTexIndex; + /* 0x2E6 */ s16 eyeTimer; + /* 0x2E8 */ Vec3s headRot; + /* 0x2EE */ Vec3s torsoRot; + /* 0x2F4 */ u16 stateFlags; + /* 0x2F6 */ s16 targetYaw; + /* 0x2F8 */ s16 patrolAlertedYaw; /* 0x2FA */ char pad2FA[2]; - /* 0x2FC */ f32 unk2FC; - /* 0x300 */ u16 unk300; - /* 0x302 */ u16 unk302; - /* 0x304 */ s8 unk304; - /* 0x305 */ u8 unk305; - /* 0x306 */ u8 unk306; + /* 0x2FC */ f32 detectionYRange; + /* 0x300 */ u16 patrolTime; + /* 0x302 */ u16 patrolTimer; + /* 0x304 */ s8 unk_304; // unused + /* 0x305 */ u8 timer; + /* 0x306 */ u8 playerNoise; /* 0x307 */ char pad307[1]; - /* 0x308 */ void (*unk308)(struct EnGe2*, struct PlayState*); + /* 0x308 */ void (*actionFunc)(struct EnGe2*, struct PlayState*); } EnGe2; // size = 0x30C #endif From 193ed2199b2d12787440c73c313e6203d8d2fc15 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 20:56:07 +0200 Subject: [PATCH 100/150] en_ge1 docs --- include/save.h | 6 +- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 584 +++++++++--------- src/overlays/actors/ovl_En_Ge1/z_en_ge1.h | 35 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 2 +- 4 files changed, 324 insertions(+), 303 deletions(-) diff --git a/include/save.h b/include/save.h index a9b79d94376..7ff99a2c34f 100644 --- a/include/save.h +++ b/include/save.h @@ -602,7 +602,7 @@ typedef enum LinkAge { #define EVENTCHKINF_5C 0x5C #define EVENTCHKINF_65 0x65 #define EVENTCHKINF_DRAINED_WELL 0x67 -#define EVENTCHKINF_68 0x68 +#define EVENTCHKINF_HORSEBACK_ARCHERY_EXPLAINED 0x68 #define EVENTCHKINF_RESTORED_LAKE_HYLIA 0x69 #define EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO 0x6A @@ -743,7 +743,7 @@ typedef enum LinkAge { #define ITEMGETINF_0C 0x0C #define ITEMGETINF_0D 0x0D #define ITEMGETINF_0E 0x0E -#define ITEMGETINF_0F 0x0F +#define ITEMGETINF_HORSEBACK_ARCHERY_QUIVER 0x0F #define ITEMGETINF_10 0x10 #define ITEMGETINF_BOWLING_BOMB_BAG 0x11 #define ITEMGETINF_BOWLING_HEART_PIECE 0x12 @@ -913,7 +913,7 @@ typedef enum LinkAge { #define INFTABLE_178 0x178 #define INFTABLE_17C 0x17C #define INFTABLE_17F 0x17F -#define INFTABLE_190 0x190 +#define INFTABLE_HORSEBACK_ARCHERY_GOT_HEART_PIECE 0x190 #define INFTABLE_191 0x191 #define INFTABLE_HAS_DEKU_STICK_UPGRADE 0x192 #define INFTABLE_HAS_DEKU_NUT_UPGRADE 0x193 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 ca7db7988be..33bc36ea3ef 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -23,18 +23,23 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play); void EnGe1_Update(Actor* thisx, PlayState* play); void EnGe1_Draw(Actor* thisx, PlayState* play); -s32 func_80A30DCC(void); -void func_80A30F48(EnGe1* this, PlayState* play); -void func_80A31094(EnGe1* this, PlayState* play); -void func_80A310C4(EnGe1* this, PlayState* play); -void func_80A3118C(EnGe1* this, PlayState* play); -void func_80A31514(EnGe1* this, PlayState* play); -void func_80A317C0(EnGe1* this, PlayState* play); -void func_80A31880(EnGe1* this, PlayState* play); -void func_80A31E2C(EnGe1* this, PlayState* play); -void func_80A31FE0(EnGe1* this, PlayState* play); -void func_80A323B0(EnGe1* this); -void func_80A323EC(EnGe1* this); +s32 EnGe1_AreAllCarpentersRescued(void); +void EnGe1_SentinelShortSighted(EnGe1* this, PlayState* play); +void EnGe1_OfferTalkGreet(EnGe1* this, PlayState* play); +void EnGe1_Sentinel(EnGe1* this, PlayState* play); +void EnGe1_OfferTalkGeneric(EnGe1* this, PlayState* play); +void EnGe1_GTGGatekeeper_OfferTalk(EnGe1* this, PlayState* play); +void EnGe1_WastelandGatekeeper_OfferTalk(EnGe1* this, PlayState* play); +void EnGe1_ChildEraWastelandGatekeeper_OfferTalk(EnGe1* this, PlayState* play); +void EnGe1_Archery_ChooseReward(EnGe1* this, PlayState* play); +void EnGe1_Archery_OfferTalk(EnGe1* this, PlayState* play); +void EnGe1_PlayAnimLoop(EnGe1* this); +void EnGe1_PlayAnimOnce(EnGe1* this); + +#define EN_GE1_STATE_FLAG_LOOK_AT_PLAYER (1 << 0) +#define EN_GE1_STATE_FLAG_ARCHERY_REWARD_IS_QUIVER (1 << 1) +#define EN_GE1_STATE_FLAG_ANIM_ENDED (1 << 2) +#define EN_GE1_STATE_FLAG_NO_FIDGET (1 << 3) ActorProfile En_Ge1_Profile = { /**/ ACTOR_EN_GE1, @@ -68,9 +73,15 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; -static Gfx* D_80A3279C[3] = { gObjectGe1HairStrandsDL, gObjectGe1HairFringeDL, gObjectGe1HairSpikyDL }; -static Vec3f D_80A327A8 = { 600.0f, 700.0f, 0.0f }; -static void* D_80A327B4[3] = { +static Gfx* sHairDLists[3] = { + gObjectGe1HairStrandsDL, + gObjectGe1HairFringeDL, + gObjectGe1HairSpikyDL, +}; + +static Vec3f sFocusOffset = { 600.0f, 700.0f, 0.0f }; + +static void* sEyeTextures[3] = { gObjectGe1EyeOpenTex, gObjectGe1EyeHalfTex, gObjectGe1EyeClosedTex, @@ -81,14 +92,14 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGe1Skel, &gObjectGe1ArmsCrossedAnim, this->unk1DC, this->unk23C, - 16); + SkelAnime_InitFlex(play, &this->skelAnime, &gObjectGe1Skel, &gObjectGe1ArmsCrossedAnim, this->jointTable, + this->morphTable, OBJECT_GE1_LIMB_MAX); Animation_PlayOnce(&this->skelAnime, &gObjectGe1ArmsCrossedAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->actor.colChkInfo.mass = MASS_IMMOVABLE; - this->unk2B0 = &gObjectGe1ArmsCrossedAnim; - this->unk2B8 = func_80A323B0; + this->curAnim = &gObjectGe1ArmsCrossedAnim; + this->playAnimFunc = EnGe1_PlayAnimLoop; this->actor.attentionRangeType = ATTENTION_RANGE_6; Actor_SetScale(&this->actor, 0.01f); if (play->sceneId == SCENE_GERUDO_VALLEY) { @@ -97,66 +108,66 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { this->actor.cullingVolumeDistance = 1200.0f; } switch (PARAMS_GET_U(this->actor.params, 0, 8)) { - case 0x0: - this->unk2AE = 2; - this->unk2B4 = func_80A31880; + case EN_GE1_TYPE_CHILD_ERA_WASTELAND_GATEKEEPER: + this->hairType = 2; + this->actionFunc = EnGe1_ChildEraWastelandGatekeeper_OfferTalk; break; - case 0x1: - this->unk2AE = 1; - if (func_80A30DCC() != 0) { - this->unk2B4 = func_80A317C0; + case EN_GE1_TYPE_WASTELAND_GATEKEEPER: + this->hairType = 1; + if (EnGe1_AreAllCarpentersRescued()) { + this->actionFunc = EnGe1_WastelandGatekeeper_OfferTalk; } else { - this->unk2B4 = func_80A30F48; + this->actionFunc = EnGe1_SentinelShortSighted; } break; - case 0x4: - this->unk2AE = 1; - if (func_80A30DCC() != 0) { - this->unk2B4 = func_80A31094; + case EN_GE1_TYPE_SENTINEL: + this->hairType = 1; + if (EnGe1_AreAllCarpentersRescued()) { + this->actionFunc = EnGe1_OfferTalkGreet; } else { - this->unk2B4 = func_80A310C4; + this->actionFunc = EnGe1_Sentinel; } break; - case 0x5: + case EN_GE1_TYPE_5: if (LINK_IS_ADULT) { - PRINTF("\x1b[36m谷底 ゲルド 撤退 \n\x1b[m"); + PRINTF(VT_FGCOL(CYAN) "谷底 ゲルド 撤退 \n" VT_RST); Actor_Kill(&this->actor); return; } - this->unk2AE = 0; - this->unk2B4 = func_80A3118C; + this->hairType = 0; + this->actionFunc = EnGe1_OfferTalkGeneric; break; - case 0x45: + case EN_GE1_TYPE_HORSEBACK_ARCHERY: if (INV_CONTENT(ITEM_BOW) == ITEM_NONE) { Actor_Kill(&this->actor); return; } this->actor.attentionRangeType = ATTENTION_RANGE_3; - this->unk2AE = 0; - PRINTF("\x1b[36mやぶさめ ゲルド EVENT_INF(0) = %x\n\x1b[m", gSaveContext.eventInf[0]); + this->hairType = 0; + PRINTF(VT_FGCOL(CYAN) "やぶさめ ゲルド EVENT_INF(0) = %x\n" VT_RST, gSaveContext.eventInf[0]); if (GET_EVENTINF(EVENTINF_HORSES_08)) { - this->unk2B4 = func_80A31E2C; - } else if (func_80A30DCC() != 0) { - this->unk2B4 = func_80A31FE0; + this->actionFunc = EnGe1_Archery_ChooseReward; + } else if (EnGe1_AreAllCarpentersRescued()) { + this->actionFunc = EnGe1_Archery_OfferTalk; } else { - this->unk2B4 = func_80A30F48; + this->actionFunc = EnGe1_SentinelShortSighted; } break; - case 0x46: - this->unk2AE = 1; - if (func_80A30DCC() != 0) { - this->unk2B4 = func_80A31514; + case EN_GE1_TYPE_GTG_GATEKEEPER: + this->hairType = 1; + if (EnGe1_AreAllCarpentersRescued()) { + this->actionFunc = EnGe1_GTGGatekeeper_OfferTalk; } else { - this->unk2B4 = func_80A30F48; + this->actionFunc = EnGe1_SentinelShortSighted; } break; } - this->unk2AC = 0; + this->stateFlags = 0; } void EnGe1_Destroy(Actor* thisx, PlayState* play) { @@ -165,44 +176,44 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -s32 func_80A30C70(EnGe1* this, PlayState* play, u16 arg2, f32 arg3, EnGe1ActionFunc arg4) { +s32 EnGe1_OfferTalk(EnGe1* this, PlayState* play, u16 textId, f32 range, EnGe1ActionFunc actionFunc) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk2B4 = arg4; - this->unk2B8 = func_80A323EC; - this->unk2AC &= ~4; - this->unk2B0 = &gObjectGe1ArmsCrossedAnim; + this->actionFunc = actionFunc; + this->playAnimFunc = EnGe1_PlayAnimOnce; + this->stateFlags &= ~EN_GE1_STATE_FLAG_ANIM_ENDED; + this->curAnim = &gObjectGe1ArmsCrossedAnim; Animation_Change(&this->skelAnime, &gObjectGe1ArmsCrossedAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGe1ArmsCrossedAnim), ANIMMODE_ONCE, -8.0f); - return 1; + return true; } else { - this->actor.textId = arg2; - if (this->actor.xzDistToPlayer < arg3) { - Actor_OfferTalk(&this->actor, play, arg3); + this->actor.textId = textId; + if (this->actor.xzDistToPlayer < range) { + Actor_OfferTalk(&this->actor, play, range); } - return 0; + return false; } } -void func_80A30D48(EnGe1* this) { +void EnGe1_ChangeAnimArmsCrossed(EnGe1* this) { Animation_Change(&this->skelAnime, &gObjectGe1ArmsCrossedAnim, -1.0f, Animation_GetLastFrame(&gObjectGe1ArmsCrossedAnim), 0.0f, ANIMMODE_ONCE, 8.0f); - this->unk2B0 = &gObjectGe1ArmsCrossedAnim; - this->unk2B8 = func_80A323B0; + this->curAnim = &gObjectGe1ArmsCrossedAnim; + this->playAnimFunc = EnGe1_PlayAnimLoop; } -s32 func_80A30DCC(void) { +s32 EnGe1_AreAllCarpentersRescued(void) { if (!(GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_0_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_1_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_2_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_3_RESCUED))) { - return 0; + return false; } else { - return 1; + return true; } } -void func_80A30E08(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; - if (this->unk2AF > 0) { - this->unk2AF--; +void EnGe1_PlayerCaught(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; + if (this->timer > 0) { + this->timer--; } else { Horse_ResetHorseData(play); if ((INV_CONTENT(ITEM_HOOKSHOT) == ITEM_NONE) || (INV_CONTENT(ITEM_LONGSHOT) == ITEM_NONE)) { @@ -217,311 +228,311 @@ void func_80A30E08(EnGe1* this, PlayState* play) { } } -void func_80A30EE8(EnGe1* this, PlayState* play) { - this->unk2AF = 0x1E; - this->unk2B4 = func_80A30E08; +void EnGe1_SetupPlayerCaught(EnGe1* this, PlayState* play) { + this->timer = 30; + this->actionFunc = EnGe1_PlayerCaught; Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_95); Sfx_PlaySfxCentered(NA_SE_SY_FOUND); - Message_StartTextbox(play, 0x6000U, &this->actor); + Message_StartTextbox(play, 0x6000, &this->actor); } -void func_80A30F48(EnGe1* this, PlayState* play) { - s16 temp_v0; +void EnGe1_SentinelShortSighted(EnGe1* this, PlayState* play) { + s16 relYawTowardsPlayer; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 100.0f)) { - func_80A30EE8(this, play); + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { + EnGe1_SetupPlayerCaught(this, play); } if (this->collider.base.acFlags & AC_HIT) { - func_80A30EE8(this, play); + EnGe1_SetupPlayerCaught(this, play); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void func_80A31000(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_WaitTalkEnd(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.textId) { case 0x6001: - this->unk2B4 = func_80A31094; + this->actionFunc = EnGe1_OfferTalkGreet; break; case 0x6019: case 0x601A: - this->unk2B4 = func_80A3118C; + this->actionFunc = EnGe1_OfferTalkGeneric; break; case 0x6018: - this->unk2B4 = func_80A317C0; + this->actionFunc = EnGe1_WastelandGatekeeper_OfferTalk; break; default: - this->unk2B4 = func_80A3118C; + this->actionFunc = EnGe1_OfferTalkGeneric; break; } } } -void func_80A31094(EnGe1* this, PlayState* play) { - func_80A30C70(this, play, 0x6001U, 100.0f, func_80A31000); +void EnGe1_OfferTalkGreet(EnGe1* this, PlayState* play) { + EnGe1_OfferTalk(this, play, 0x6001, 100.0f, EnGe1_WaitTalkEnd); } -void func_80A310C4(EnGe1* this, PlayState* play) { - s16 temp_v0; +void EnGe1_Sentinel(EnGe1* this, PlayState* play) { + s16 relYawTowardsPlayer; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(temp_v0) < 0x4301) && (this->actor.xzDistToPlayer < 400.0f))) { - func_80A30EE8(this, play); + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((this->actor.xzDistToPlayer < 50.0f) || + ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 400.0f))) { + EnGe1_SetupPlayerCaught(this, play); } if (this->collider.base.acFlags & AC_HIT) { - func_80A30EE8(this, play); + EnGe1_SetupPlayerCaught(this, play); } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); } -void func_80A3118C(EnGe1* this, PlayState* play) { +void EnGe1_OfferTalkGeneric(EnGe1* this, PlayState* play) { u16 textId; textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); if (textId == 0) { textId = 0x6019; } - func_80A30C70(this, play, textId, 100.0f, func_80A31000); + EnGe1_OfferTalk(this, play, textId, 100.0f, EnGe1_WaitTalkEnd); } -void func_80A311E0(EnGe1* this, PlayState* play) { - if (this->unk2AF > 0) { - this->unk2AF--; +void EnGe1_GTGDoorkeeper_WaitGateOpen(EnGe1* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; } else { - func_80A30D48(this); - this->unk2B4 = func_80A31094; + EnGe1_ChangeAnimArmsCrossed(this); + this->actionFunc = EnGe1_OfferTalkGreet; } - this->unk2AC |= 8; + this->stateFlags |= EN_GE1_STATE_FLAG_NO_FIDGET; } -void func_80A31234(EnGe1* this, PlayState* play) { - if (this->unk2AC & 4) { - this->unk2B4 = func_80A311E0; +void EnGe1_GTGGatekeeper_OpenGate(EnGe1* this, PlayState* play) { + if (this->stateFlags & EN_GE1_STATE_FLAG_ANIM_ENDED) { + this->actionFunc = EnGe1_GTGDoorkeeper_WaitGateOpen; Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); - this->unk2AF = 0x32; + this->timer = 50; Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { - Actor_PlaySfx(&this->actor, 0x184DU); + Actor_PlaySfx(&this->actor, NA_SE_IT_HAND_CLAP); } } -void func_80A312E4(EnGe1* this, PlayState* play) { +void EnGe1_GTGGatekeeper_WaitTalkEndOpenGate(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->unk2B4 = func_80A31234; + this->actionFunc = EnGe1_GTGGatekeeper_OpenGate; Animation_Change(&this->skelAnime, &gObjectGe1ClapHandsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGe1ClapHandsAnim), ANIMMODE_ONCE, -3.0f); - this->unk2B0 = &gObjectGe1ClapHandsAnim; - this->unk2B8 = func_80A323EC; - this->unk2AC &= 0xFFFB; + this->curAnim = &gObjectGe1ClapHandsAnim; + this->playAnimFunc = EnGe1_PlayAnimOnce; + this->stateFlags &= ~EN_GE1_STATE_FLAG_ANIM_ENDED; } } -void func_80A313A0(EnGe1* this, PlayState* play) { +void EnGe1_GTGGatekeeper_WaitTalkEnd(EnGe1* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - this->unk2B4 = func_80A31514; - func_80A30D48(this); + this->actionFunc = EnGe1_GTGGatekeeper_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A313E0(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_GTGGatekeeper_WaitAnswer(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); switch (play->msgCtx.choiceIndex) { case 0: if (gSaveContext.save.info.playerData.rupees < 10) { - Message_ContinueTextbox(play, 0x6016U); - this->unk2B4 = func_80A313A0; + Message_ContinueTextbox(play, 0x6016); + this->actionFunc = EnGe1_GTGGatekeeper_WaitTalkEnd; } else { Rupees_ChangeBy(-10); - Message_ContinueTextbox(play, 0x6015U); - this->unk2B4 = func_80A312E4; + Message_ContinueTextbox(play, 0x6015); + this->actionFunc = EnGe1_GTGGatekeeper_WaitTalkEndOpenGate; } break; case 1: - this->unk2B4 = func_80A31514; - func_80A30D48(this); + this->actionFunc = EnGe1_GTGGatekeeper_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); break; } } } -void func_80A314D0(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_GTGGatekeeper_TalkNoCard(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->unk2B4 = func_80A31514; - func_80A30D48(this); + this->actionFunc = EnGe1_GTGGatekeeper_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A31514(EnGe1* this, PlayState* play) { +void EnGe1_GTGGatekeeper_OfferTalk(EnGe1* this, PlayState* play) { if (CHECK_QUEST_ITEM(QUEST_GERUDOS_CARD)) { - func_80A30C70(this, play, 0x6014U, 100.0f, func_80A313E0); + EnGe1_OfferTalk(this, play, 0x6014, 100.0f, EnGe1_GTGGatekeeper_WaitAnswer); } else { - func_80A30C70(this, play, 0x6013U, 100.0f, func_80A314D0); + EnGe1_OfferTalk(this, play, 0x6013, 100.0f, EnGe1_GTGGatekeeper_TalkNoCard); } } -void func_80A3157C(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_WastelandGatekeeper_WaitTalkEnd(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk2B4 = func_80A317C0; - func_80A30D48(this); + this->actionFunc = EnGe1_WastelandGatekeeper_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A315F0(EnGe1* this, PlayState* play) { - if (this->unk2AF > 0) { - this->unk2AF--; +void EnGe1_WastelandGatekeeper_WaitGateOpen(EnGe1* this, PlayState* play) { + if (this->timer > 0) { + this->timer--; } else { - func_80A30D48(this); - this->unk2B4 = func_80A317C0; + EnGe1_ChangeAnimArmsCrossed(this); + this->actionFunc = EnGe1_WastelandGatekeeper_OfferTalk; } - this->unk2AC |= 8; + this->stateFlags |= EN_GE1_STATE_FLAG_NO_FIDGET; } -void func_80A31644(EnGe1* this, PlayState* play) { - if (this->unk2AC & 4) { - this->unk2B4 = func_80A315F0; +void EnGe1_WastelandGatekeeper_OpenGate(EnGe1* this, PlayState* play) { + if (this->stateFlags & EN_GE1_STATE_FLAG_ANIM_ENDED) { + this->actionFunc = EnGe1_WastelandGatekeeper_WaitGateOpen; Flags_SetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6)); - this->unk2AF = 0x32; + this->timer = 50; Message_CloseTextbox(play); } else if ((this->skelAnime.curFrame == 15.0f) || (this->skelAnime.curFrame == 19.0f)) { Actor_PlaySfx(&this->actor, NA_SE_IT_HAND_CLAP); } } -void func_80A316F4(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_WastelandGatekeeper_WaitTalkEndOpenGate(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { - this->unk2B4 = func_80A31644; + this->actionFunc = EnGe1_WastelandGatekeeper_OpenGate; Animation_Change(&this->skelAnime, &gObjectGe1ClapHandsAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGe1ClapHandsAnim), ANIMMODE_ONCE, -3.0f); - this->unk2B0 = &gObjectGe1ClapHandsAnim; - this->unk2B8 = func_80A323EC; - this->unk2AC &= ~4; + this->curAnim = &gObjectGe1ClapHandsAnim; + this->playAnimFunc = EnGe1_PlayAnimOnce; + this->stateFlags &= ~EN_GE1_STATE_FLAG_ANIM_ENDED; } } -void func_80A317C0(EnGe1* this, PlayState* play) { +void EnGe1_WastelandGatekeeper_OfferTalk(EnGe1* this, PlayState* play) { if (Flags_GetSwitch(play, PARAMS_GET_U(this->actor.params, 8, 6))) { - func_80A30C70(this, play, 0x6018U, 100.0f, func_80A3157C); + EnGe1_OfferTalk(this, play, 0x6018, 100.0f, EnGe1_WastelandGatekeeper_WaitTalkEnd); } else { - func_80A30C70(this, play, 0x6017U, 100.0f, func_80A316F4); + EnGe1_OfferTalk(this, play, 0x6017, 100.0f, EnGe1_WastelandGatekeeper_WaitTalkEndOpenGate); } } -void func_80A3183C(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_ChildEraWastelandGatekeeper_WaitTalkEnd(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->unk2B4 = func_80A31880; - func_80A30D48(this); + this->actionFunc = EnGe1_ChildEraWastelandGatekeeper_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A31880(EnGe1* this, PlayState* play) { +void EnGe1_ChildEraWastelandGatekeeper_OfferTalk(EnGe1* this, PlayState* play) { u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); if (textId == 0) { textId = 0x6069; } - if (func_80A30C70(this, play, textId, 100.0f, func_80A3183C) != 0) { - this->unk2B8 = func_80A323B0; - this->unk2B0 = &gObjectGe1ShooAwayAnim; + if (EnGe1_OfferTalk(this, play, textId, 100.0f, EnGe1_ChildEraWastelandGatekeeper_WaitTalkEnd)) { + this->playAnimFunc = EnGe1_PlayAnimLoop; + this->curAnim = &gObjectGe1ShooAwayAnim; Animation_Change(&this->skelAnime, &gObjectGe1ShooAwayAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gObjectGe1ShooAwayAnim), ANIMMODE_ONCE, -8.0f); } } -void func_80A31934(EnGe1* this, PlayState* play) { +void EnGe1_Archery_RewardWaitTalkEnd(EnGe1* this, PlayState* play) { if (Actor_TextboxIsClosing(&this->actor, play)) { - this->unk2B4 = func_80A31FE0; - func_80A30D48(this); + this->actionFunc = EnGe1_Archery_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A3196C(EnGe1* this, PlayState* play) { - s32 var_a2; +void EnGe1_Archery_GiveReward(EnGe1* this, PlayState* play) { + s32 giReward; if (Actor_HasParent(&this->actor, play)) { - this->unk2B4 = func_80A31934; - if (this->unk2AC & 2) { - SET_ITEMGETINF(ITEMGETINF_0F); - return; + this->actionFunc = EnGe1_Archery_RewardWaitTalkEnd; + if (this->stateFlags & EN_GE1_STATE_FLAG_ARCHERY_REWARD_IS_QUIVER) { + SET_ITEMGETINF(ITEMGETINF_HORSEBACK_ARCHERY_QUIVER); } else { - SET_INFTABLE(INFTABLE_190); + SET_INFTABLE(INFTABLE_HORSEBACK_ARCHERY_GOT_HEART_PIECE); } return; } - if (this->unk2AC & 2) { + if (this->stateFlags & EN_GE1_STATE_FLAG_ARCHERY_REWARD_IS_QUIVER) { switch (CUR_UPG_VALUE(UPG_QUIVER)) { case 1: - var_a2 = 0x30; + giReward = GI_QUIVER_40; break; case 2: - var_a2 = 0x31; + giReward = GI_QUIVER_50; break; } } else { - var_a2 = 0x3E; + giReward = GI_HEART_PIECE; } - //! @bug var_a2 may be used uninitialized - Actor_OfferGetItem(&this->actor, play, var_a2, 10000.0f, 50.0f); + //! @bug giReward may be used uninitialized + Actor_OfferGetItem(&this->actor, play, giReward, 10000.0f, 50.0f); } -void func_80A31A5C(EnGe1* this, PlayState* play) { - s32 var_a2; +void EnGe1_Archery_WaitTalkEndGiveReward(EnGe1* this, PlayState* play) { + s32 giReward; if (Actor_TextboxIsClosing(&this->actor, play)) { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - this->unk2B4 = func_80A3196C; + this->actionFunc = EnGe1_Archery_GiveReward; } - if (this->unk2AC & 2) { + if (this->stateFlags & EN_GE1_STATE_FLAG_ARCHERY_REWARD_IS_QUIVER) { switch (CUR_UPG_VALUE(UPG_QUIVER)) { case 1: - var_a2 = 0x30; + giReward = GI_QUIVER_40; break; case 2: - var_a2 = 0x31; + giReward = GI_QUIVER_50; break; } } else { - var_a2 = 0x3E; + giReward = GI_HEART_PIECE; } - //! @bug var_a2 may be used uninitialized - Actor_OfferGetItem(&this->actor, play, var_a2, 10000.0f, 50.0f); + //! @bug giReward may be used uninitialized + Actor_OfferGetItem(&this->actor, play, giReward, 10000.0f, 50.0f); } -void func_80A31B20(EnGe1* this, PlayState* play) { +void EnGe1_Archery_TalkGiveReward(EnGe1* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk2B4 = func_80A31A5C; + this->actionFunc = EnGe1_Archery_WaitTalkEndGiveReward; this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } else { Actor_OfferTalk(&this->actor, play, 200.0f); } } -void func_80A31B7C(EnGe1* this, PlayState* play) { +void EnGe1_Archery_NotEnoughRupeesWaitTalkEnd(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk2B4 = func_80A31FE0; - func_80A30D48(this); + this->actionFunc = EnGe1_Archery_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A31BDC(EnGe1* this, PlayState* play) { +void EnGe1_DoNothing(EnGe1* this, PlayState* play) { } -void func_80A31BE8(EnGe1* this, PlayState* play) { +void EnGe1_Archery_WaitAnswer(EnGe1* this, PlayState* play) { Player* player; - Actor* temp_v0_2; + Actor* epona; player = GET_PLAYER(play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { @@ -530,7 +541,7 @@ void func_80A31BE8(EnGe1* this, PlayState* play) { case 0: if (gSaveContext.save.info.playerData.rupees < 20) { Message_ContinueTextbox(play, 0x85); - this->unk2B4 = func_80A31B7C; + this->actionFunc = EnGe1_Archery_NotEnoughRupeesWaitTalkEnd; } else { Rupees_ChangeBy(-20); play->nextEntranceIndex = ENTR_GERUDOS_FORTRESS_0; @@ -538,137 +549,137 @@ void func_80A31BE8(EnGe1* this, PlayState* play) { play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_BLACK, TCS_FAST); play->transitionTrigger = TRANS_TRIGGER_START; SET_EVENTINF(EVENTINF_HORSES_08); - SET_EVENTCHKINF(EVENTCHKINF_68); + SET_EVENTCHKINF(EVENTCHKINF_HORSEBACK_ARCHERY_EXPLAINED); if (!(player->stateFlags1 & PLAYER_STATE1_23)) { Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); } else { - temp_v0_2 = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, 1U, 1200.0f); - player->actor.freezeTimer = 0x4B0; - if (temp_v0_2 != NULL) { - temp_v0_2->freezeTimer = 0x4B0; + epona = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); + player->actor.freezeTimer = 1200; + if (epona != NULL) { + epona->freezeTimer = 1200; } } - this->unk2B4 = func_80A31BDC; + this->actionFunc = EnGe1_DoNothing; } break; case 1: - this->unk2B4 = func_80A31FE0; + this->actionFunc = EnGe1_Archery_OfferTalk; Message_CloseTextbox(play); break; } } } -void func_80A31D88(EnGe1* this, PlayState* play) { +void EnGe1_Archery_AskToPlay(EnGe1* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_ContinueTextbox(play, 0x6041); - this->unk2B4 = func_80A31BE8; + this->actionFunc = EnGe1_Archery_WaitAnswer; } } -void func_80A31DE4(EnGe1* this, PlayState* play) { +void EnGe1_Archery_NoReward(EnGe1* this, PlayState* play) { if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk2B4 = func_80A31D88; - return; + this->actionFunc = EnGe1_Archery_AskToPlay; + } else { + Actor_OfferTalk(&this->actor, play, 300.0f); } - Actor_OfferTalk(&this->actor, play, 300.0f); } -void func_80A31E2C(EnGe1* this, PlayState* play) { +void EnGe1_Archery_ChooseReward(EnGe1* this, PlayState* play) { CLEAR_EVENTINF(EVENTINF_HORSES_08); #if DEBUG_FEATURES - LogUtils_LogThreadId("../z_en_ge1.c", 0x456); + LogUtils_LogThreadId("../z_en_ge1.c", 1110); PRINTF("z_common_data.yabusame_total = %d\n", gSaveContext.minigameScore); if (1) {} if (1) {} if (1) {} - LogUtils_LogThreadId("../z_en_ge1.c", 0x457); + LogUtils_LogThreadId("../z_en_ge1.c", 1111); // With the current `SaveContext` struct definition, the expression in the debug string is an out-of-bounds read, // see the other occurrence of this for more details. - PRINTF("z_common_data.memory.information.room_inf[127][ 0 ] = %d\n", gSaveContext.save.info.highScores[0]); + PRINTF("z_common_data.memory.information.room_inf[127][ 0 ] = %d\n", HIGH_SCORE(HS_HBA)); #endif this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; - if (gSaveContext.save.info.highScores[0] < gSaveContext.minigameScore) { - gSaveContext.save.info.highScores[0] = gSaveContext.minigameScore; + if (HIGH_SCORE(HS_HBA) < gSaveContext.minigameScore) { + HIGH_SCORE(HS_HBA) = gSaveContext.minigameScore; } if (gSaveContext.minigameScore < 1000) { this->actor.textId = 0x6045; - this->unk2B4 = func_80A31DE4; - } else if (!GET_INFTABLE(INFTABLE_190)) { + this->actionFunc = EnGe1_Archery_NoReward; + } else if (!GET_INFTABLE(INFTABLE_HORSEBACK_ARCHERY_GOT_HEART_PIECE)) { this->actor.textId = 0x6046; - this->unk2B4 = func_80A31B20; - this->unk2AC &= ~2; + this->actionFunc = EnGe1_Archery_TalkGiveReward; + this->stateFlags &= ~EN_GE1_STATE_FLAG_ARCHERY_REWARD_IS_QUIVER; } else if (gSaveContext.minigameScore < 1500) { this->actor.textId = 0x6047; - this->unk2B4 = func_80A31DE4; - } else if (GET_ITEMGETINF(ITEMGETINF_0F)) { + this->actionFunc = EnGe1_Archery_NoReward; + } else if (GET_ITEMGETINF(ITEMGETINF_HORSEBACK_ARCHERY_QUIVER)) { this->actor.textId = 0x6047; - this->unk2B4 = func_80A31DE4; + this->actionFunc = EnGe1_Archery_NoReward; } else { this->actor.textId = 0x6044; - this->unk2B4 = func_80A31B20; - this->unk2AC |= 2; + this->actionFunc = EnGe1_Archery_TalkGiveReward; + this->stateFlags |= EN_GE1_STATE_FLAG_ARCHERY_REWARD_IS_QUIVER; } } -void func_80A31F9C(EnGe1* this, PlayState* play) { - this->unk2AC |= 1; +void EnGe1_Archery_NoHorseWaitTalkEnd(EnGe1* this, PlayState* play) { + this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; if (Actor_TextboxIsClosing(&this->actor, play)) { - this->unk2B4 = func_80A31FE0; - func_80A30D48(this); + this->actionFunc = EnGe1_Archery_OfferTalk; + EnGe1_ChangeAnimArmsCrossed(this); } } -void func_80A31FE0(EnGe1* this, PlayState* play) { +void EnGe1_Archery_OfferTalk(EnGe1* this, PlayState* play) { Player* player = GET_PLAYER(play); - u16 var_a2; + u16 textId; if (!(player->stateFlags1 & PLAYER_STATE1_23)) { - func_80A30C70(this, play, 0x603FU, 100.0f, func_80A31F9C); + EnGe1_OfferTalk(this, play, 0x603F, 100.0f, EnGe1_Archery_NoHorseWaitTalkEnd); } else { - if (GET_EVENTCHKINF(EVENTCHKINF_68)) { - if (GET_INFTABLE(INFTABLE_190)) { - var_a2 = 0x6042; + if (GET_EVENTCHKINF(EVENTCHKINF_HORSEBACK_ARCHERY_EXPLAINED)) { + if (GET_INFTABLE(INFTABLE_HORSEBACK_ARCHERY_GOT_HEART_PIECE)) { + textId = 0x6042; } else { - var_a2 = 0x6043; + textId = 0x6043; } } else { - var_a2 = 0x6040; + textId = 0x6040; } - func_80A30C70(this, play, var_a2, 200.0f, func_80A31D88); + EnGe1_OfferTalk(this, play, textId, 200.0f, EnGe1_Archery_AskToPlay); } } -void func_80A32078(EnGe1* this, PlayState* play) { +void EnGe1_TrackPlayer(EnGe1* this, PlayState* play) { s32 pad; - s16 temp_v0; + s16 relYawTowardsPlayer; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (ABS(temp_v0) <= 0x4000) { + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if (ABS(relYawTowardsPlayer) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; - Actor_TrackPlayer(play, &this->actor, &this->unk29C, &this->unk2A2, this->actor.focus.pos); + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - if (temp_v0 < 0) { - Math_SmoothStepToS(&this->unk29C.y, -0x2000, 6, 0x1838, 0x100); + if (relYawTowardsPlayer < 0) { + Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100); } else { - Math_SmoothStepToS(&this->unk29C.y, 0x2000, 6, 0x1838, 0x100); + Math_SmoothStepToS(&this->headRot.y, 0x2000, 6, 0x1838, 0x100); } - Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xC, 0x3E8, 0x64); + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 12, 0x3E8, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; } } -void func_80A32190(EnGe1* this, PlayState* play) { - s16 temp_v0; +void EnGe1_TrackPlayerIfNear(EnGe1* this, PlayState* play) { + s16 relYawTowardsPlayer; - temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if ((ABS(temp_v0) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { - Actor_TrackPlayer(play, &this->actor, &this->unk29C, &this->unk2A2, this->actor.focus.pos); + relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { + Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { - Math_SmoothStepToS(&this->unk29C.x, 0, 6, 0x1838, 0x64); - Math_SmoothStepToS(&this->unk29C.y, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64); + Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64); } } @@ -680,67 +691,66 @@ void EnGe1_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2); - this->unk2B8(this); - this->unk2B4(this, play); - if (this->unk2AC & 1) { - func_80A32078(this, play); - this->unk2AC &= ~1; + this->playAnimFunc(this); + this->actionFunc(this, play); + if (this->stateFlags & EN_GE1_STATE_FLAG_LOOK_AT_PLAYER) { + EnGe1_TrackPlayer(this, play); + this->stateFlags &= ~EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; } else { - func_80A32190(this, play); + EnGe1_TrackPlayerIfNear(this, play); } - this->unk2A2.x = this->unk2A2.y = this->unk2A2.z = 0; - if (DECR(this->unk2AA) == 0) { - this->unk2AA = Rand_S16Offset(0x3C, 0x3C); + this->torsoRot.x = this->torsoRot.y = this->torsoRot.z = 0; + if (DECR(this->eyeTimer) == 0) { + this->eyeTimer = Rand_S16Offset(60, 60); } - this->unk2A8 = this->unk2AA; - if (this->unk2A8 >= 3) { - this->unk2A8 = 0; + this->eyeTexIndex = this->eyeTimer; + if (this->eyeTexIndex >= 3) { + this->eyeTexIndex = 0; } } -void func_80A323B0(EnGe1* this) { +void EnGe1_PlayAnimLoop(EnGe1* this) { if (SkelAnime_Update(&this->skelAnime)) { - Animation_PlayOnce(&this->skelAnime, this->unk2B0); + Animation_PlayOnce(&this->skelAnime, this->curAnim); } } -void func_80A323EC(EnGe1* this) { - if (!(this->unk2AC & 4)) { +void EnGe1_PlayAnimOnce(EnGe1* this) { + if (!(this->stateFlags & EN_GE1_STATE_FLAG_ANIM_ENDED)) { if (SkelAnime_Update(&this->skelAnime)) { - this->unk2AC |= 4; + this->stateFlags |= EN_GE1_STATE_FLAG_ANIM_ENDED; } - this->unk2AC |= 8; + this->stateFlags |= EN_GE1_STATE_FLAG_NO_FIDGET; } } -s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { +s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnGe1* this = thisx; s32 pad; - if (arg1 == 15) { - arg4->x += this->unk29C.y; - arg4->z += this->unk29C.x; + if (limbIndex == OBJECT_GE1_LIMB_HEAD) { + rot->x += this->headRot.y; + rot->z += this->headRot.x; } - if (this->unk2AC & 8) { - this->unk2AC &= ~8; - return 0; + if (this->stateFlags & EN_GE1_STATE_FLAG_NO_FIDGET) { + this->stateFlags &= ~EN_GE1_STATE_FLAG_NO_FIDGET; + return false; } - if ((arg1 == 8) || (arg1 == 10) || (arg1 == 13)) { - arg4->y += - (Math_SinS((s16)(play->state.frames * ((arg1 * FIDGET_FREQ_LIMB) + FIDGET_FREQ_Y))) * FIDGET_AMPLITUDE); - arg4->z += - (Math_CosS((s16)(play->state.frames * ((arg1 * FIDGET_FREQ_LIMB) + FIDGET_FREQ_Z))) * FIDGET_AMPLITUDE); + if ((limbIndex == OBJECT_GE1_LIMB_TORSO) || (limbIndex == OBJECT_GE1_LIMB_LEFT_FOREARM) || + (limbIndex == OBJECT_GE1_LIMB_RIGHT_FOREARM)) { + rot->y += Math_SinS(play->state.frames * ((limbIndex * FIDGET_FREQ_LIMB) + FIDGET_FREQ_Y)) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(play->state.frames * ((limbIndex * FIDGET_FREQ_LIMB) + FIDGET_FREQ_Z)) * FIDGET_AMPLITUDE; } - return 0; + return false; } -void EnGe1_PostLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { +void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnGe1* this = thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1419); - if (arg1 == 15) { - gSPDisplayList(POLY_OPA_DISP++, D_80A3279C[this->unk2AE]); - Matrix_MultVec3f(&D_80A327A8, &this->actor.focus.pos); + if (limbIndex == OBJECT_GE1_LIMB_HEAD) { + gSPDisplayList(POLY_OPA_DISP++, sHairDLists[this->hairType]); + Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1427); } @@ -751,7 +761,7 @@ void EnGe1_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1442); Gfx_SetupDL_37Opa(play->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80A327B4[this->unk2A8])); + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, EnGe1_OverrideLimbDraw, EnGe1_PostLimbDraw, this); CLOSE_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1459); 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 5a813d84c4d..fcd13f9c8c4 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.h @@ -4,6 +4,17 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_ge1/object_ge1.h" + +typedef enum EnGe1Type { + /* 0 */ EN_GE1_TYPE_CHILD_ERA_WASTELAND_GATEKEEPER, + /* 1 */ EN_GE1_TYPE_WASTELAND_GATEKEEPER, + /* 4 */ EN_GE1_TYPE_SENTINEL = 4, + /* 5 */ EN_GE1_TYPE_5, + /* 69 */ EN_GE1_TYPE_HORSEBACK_ARCHERY = 69, + /* 70 */ EN_GE1_TYPE_GTG_GATEKEEPER +} EnGe1Type; + struct EnGe1; typedef void (*EnGe1ActionFunc)(struct EnGe1*, struct PlayState*); @@ -12,18 +23,18 @@ typedef struct EnGe1 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime skelAnime; - /* 0x1DC */ Vec3s unk1DC[16]; - /* 0x23C */ Vec3s unk23C[16]; - /* 0x29C */ Vec3s unk29C; - /* 0x2A2 */ Vec3s unk2A2; - /* 0x2A8 */ s16 unk2A8; - /* 0x2AA */ s16 unk2AA; - /* 0x2AC */ u16 unk2AC; - /* 0x2AE */ u8 unk2AE; - /* 0x2AF */ u8 unk2AF; - /* 0x2B0 */ AnimationHeader* unk2B0; - /* 0x2B4 */ EnGe1ActionFunc unk2B4; - /* 0x2B8 */ void (*unk2B8)(struct EnGe1*); + /* 0x1DC */ Vec3s jointTable[OBJECT_GE1_LIMB_MAX]; + /* 0x23C */ Vec3s morphTable[OBJECT_GE1_LIMB_MAX]; + /* 0x29C */ Vec3s headRot; + /* 0x2A2 */ Vec3s torsoRot; + /* 0x2A8 */ s16 eyeTexIndex; + /* 0x2AA */ s16 eyeTimer; + /* 0x2AC */ u16 stateFlags; + /* 0x2AE */ u8 hairType; + /* 0x2AF */ u8 timer; + /* 0x2B0 */ AnimationHeader* curAnim; + /* 0x2B4 */ EnGe1ActionFunc actionFunc; + /* 0x2B8 */ void (*playAnimFunc)(struct EnGe1*); } EnGe1; // size = 0x2BC #endif 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 d0d41423099..1d491850193 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2544,7 +2544,7 @@ void EnHorse_UpdateHorsebackArchery(EnHorse* this, PlayState* play) { if (play->interfaceCtx.hbaAmmo != 0) { if (!(this->hbaFlags & 2)) { - if (GET_INFTABLE(INFTABLE_190)) { + if (GET_INFTABLE(INFTABLE_HORSEBACK_ARCHERY_GOT_HEART_PIECE)) { if ((s32)gSaveContext.minigameScore >= 1500) { this->hbaFlags |= 4; } From 6bef9dadff0fe9489c7192692d15eed41790f749 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Wed, 12 Aug 2026 21:40:57 +0200 Subject: [PATCH 101/150] split docker instructions from readme and update Dockerfile --- Dockerfile | 28 +++++++++++++--------------- README.md | 32 +------------------------------- docker-compose.yml | 11 ----------- docs/building/docker.md | 29 +++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 57 deletions(-) delete mode 100644 docker-compose.yml create mode 100644 docs/building/docker.md diff --git a/Dockerfile b/Dockerfile index 711cd918f09..a948d9b45bc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,23 @@ -FROM ubuntu:22.04 as build +FROM ubuntu:24.04 ENV TZ=UTC +ENV LANG=C.UTF-8 +ENV N64_GCCPREFIX=/opt/libdragon -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \ - apt-get update && \ - apt-get install -y \ - binutils-mips-linux-gnu \ +ADD https://github.com/DragonMinded/libdragon/releases/download/toolchain-continuous-prerelease/gcc-toolchain-mips64-x86_64.deb gcc-toolchain-mips64-x86_64.deb + +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +RUN apt-get update +RUN apt-get install -y \ build-essential \ python3 \ python3-pip \ git \ curl \ - clang-tidy \ - clang-format \ - && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* - -RUN python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein "mapfile-parser>=1.2.1,<2.0.0" "rabbitizer>=1.0.0,<2.0.0" -RUN python3 -m pip install --upgrade attrs pycparser - -ENV LANG C.UTF-8 + clang-tidy-14 \ + clang-format-14 +RUN apt-get install -y ./gcc-toolchain-mips64-x86_64.deb +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* RUN mkdir /oot WORKDIR /oot diff --git a/README.md b/README.md index 428c74eb9dd..0564d5917a5 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ For Windows 10 or 11, install WSL and a distribution by following this [WSL Installation Guide](https://learn.microsoft.com/en-us/windows/wsl/install). We recommend using Debian or Ubuntu Linux distributions. -For older versions of Windows, install a Linux VM or refer to [Docker](#Docker) instructions. +For older versions of Windows, install a Linux VM or refer to [Docker](docs/building/docker.md) instructions. ### macOS @@ -185,36 +185,6 @@ md5sum: WARNING: 1 computed checksum did NOT match This means that the built ROM isn't the same as the base one, so something went wrong or some part of the code doesn't match. -### Docker - -#### 1. Setup requirements - -To use Docker, you'll need either Docker Desktop or Docker Toolbox installed and setup based on your system. - -On Ubuntu, Docker and required tools can be installed with: `sudo apt install docker.io docker-compose docker-buildx` - -You'll also need to prepare a local version of the project with a copied base ROM (see steps [2](#2-clone-the-repository) and [3](#3-prepare-a-base-rom) of the Linux instructions). - -#### 2. Create the Docker image - -From inside your local project, run the following command: - -```bash -docker build . -t oot -``` - -#### 3. Start the container - -To start the container, you can mount your local filesystem into the Docker container and run an interactive bash session. - -```bash -docker run -it --rm --mount type=bind,source="$(pwd)",destination=/oot oot /bin/bash -``` - -#### 4. Setup and Build the ROM - -Once inside the container, you can follow steps [4](#4-setup-the-rom-and-build-process) and [5](#5-build-the-rom) of the Linux instructions to setup and build the ROM, or run any other command you need. - ## Changing build options By default, if you don't specify a version to build with `VERSION=` in the make commands, the `gc-eu-mq-dbg` version is used. diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index a6cdbbdf8e7..00000000000 --- a/docker-compose.yml +++ /dev/null @@ -1,11 +0,0 @@ -version: "3" -services: - oot: - volumes: - - oot-sync:/oot:nocopy - image: "oot:latest" - tty: true - -volumes: - oot-sync: - external: true diff --git a/docs/building/docker.md b/docs/building/docker.md new file mode 100644 index 00000000000..1bac008fbcf --- /dev/null +++ b/docs/building/docker.md @@ -0,0 +1,29 @@ +# Building with Docker + +## 1. Setup requirements + +To use Docker, you'll need either Docker Desktop or Docker Toolbox installed and setup based on your system. + +On Ubuntu, Docker and required tools can be installed with: `sudo apt install docker.io docker-compose docker-buildx` + +You'll also need to prepare a local version of the project with a copied base ROM (see steps [2](/README.md#2-clone-the-repository) and [3](/README.md#3-prepare-a-base-rom) of the Linux instructions). + +## 2. Create the Docker image + +From inside your local project, run the following command: + +```bash +docker build . -t oot +``` + +## 3. Start the container + +To start the container, you can mount your local filesystem into the Docker container and run an interactive bash session. + +```bash +docker run -it --rm --mount type=bind,source="$(pwd)",destination=/oot oot /bin/bash +``` + +## 4. Setup and Build the ROM + +Once inside the container, you can follow steps [4](/README.md#4-setup-the-rom-and-build-process) and [5](/README.md#5-build-the-rom) of the Linux instructions to setup and build the ROM, or run any other command you need. From e26bb37e1612f09c0e31868802e19117fcf04103 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 17:09:59 +0200 Subject: [PATCH 102/150] EnFish actionFunc typedef --- src/overlays/actors/ovl_En_Fish/z_en_fish.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 b1a1b127beb..016ce1fa383 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.h +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.h @@ -12,6 +12,8 @@ typedef enum EnFishType { struct EnFish; +typedef void (*EnFishActionFunc)(struct EnFish*, struct PlayState*); + typedef struct EnFish { /* 0x000 */ Actor actor; /* 0x14C */ ColliderJntSph collider; @@ -19,7 +21,7 @@ typedef struct EnFish { /* 0x1AC */ SkelAnime skelAnime; /* 0x1F0 */ Vec3s jointTable[7]; /* 0x21A */ Vec3s morphTable[7]; - /* 0x244 */ void (*actionFunc)(struct EnFish*, struct PlayState*); + /* 0x244 */ EnFishActionFunc actionFunc; /* 0x248 */ s16 timer; /* 0x24A */ s16 reappearTimer; /* 0x24C */ s16 phase1; From 7ec6cedd488cd7a3609ff877dc8df22daef3d6d5 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 17:14:14 +0200 Subject: [PATCH 103/150] EnFish move variable assigns into decls --- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 36 +++++++-------------- 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index e241830e0c8..239df8eeb02 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -103,11 +103,9 @@ static EnFishSpeedParams sStaySpeedParams = { 0.0f, 0.04f, 0.09f }; static EnFishSpeedParams sMoveSpeedParams = { 0.5f, 0.1f, 0.15f }; f32 EnFish_DistXZSq(Vec3f* posA, Vec3f* posB) { - f32 dz; - f32 dx; + f32 dx = posA->x - posB->x; + f32 dz = posA->z - posB->z; - dx = posA->x - posB->x; - dz = posA->z - posB->z; return SQ(dx) + SQ(dz); } @@ -153,9 +151,8 @@ void EnFish_JabuCutscene_Clear(EnFish* this) { void EnFish_Init(Actor* thisx, PlayState* play) { EnFish* this = (EnFish*)thisx; - s16 type; + s16 type = this->actor.params; - type = this->actor.params; Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gFishSkel, &gFishInWaterAnim, this->jointTable, this->morphTable, 7); Collider_InitJntSph(play, &this->collider); @@ -188,10 +185,9 @@ void EnFish_UpdateBobbingUpDown(EnFish* this) { s32 EnFish_IsInRangeForCatch(EnFish* this, PlayState* play) { s32 pad; - Player* player; + Player* player = GET_PLAYER(play); Vec3f playerPos; - player = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 32.0f) { // Add a slight offset towards the fish to the player position. playerPos.x = (Math_SinS(this->actor.yawTowardsPlayer + 0x8000) * 16.0f) + player->actor.world.pos.x; @@ -333,13 +329,12 @@ void EnFish_Normal_SetupFollowPlayer(EnFish* this) { void EnFish_Normal_FollowPlayer(EnFish* this, PlayState* play) { s32 pad; - Player* player; + Player* player = GET_PLAYER(play); s32 pad2; Vec3f playerPos; s16 yaw; s16 angle; - player = GET_PLAYER(play); EnFish_UpdateBobbingUpDown(this); Math_SmoothStepToF(&this->actor.speed, 1.8f, 0.1f, 0.5f, 0.0f); if (EnFish_DistXZSq(&this->actor.world.pos, &this->actor.home.pos) > SQ(80.0f)) { @@ -434,9 +429,8 @@ void EnFish_Dropped_SetupFlapOnGround(EnFish* this) { void EnFish_Dropped_FlapOnGround(EnFish* this, PlayState* play) { s16 targetRotX; s16 pad; - s16 frames; + s16 frames = play->state.frames; - frames = play->state.frames; Math_SmoothStepToF(&this->actor.speed, Rand_ZeroOne() * 0.2f, 0.1f, 0.1f, 0.0f); targetRotX = (s16)(s32)((s16)((((frames >> 5) & 2) | ((frames >> 2) & 1)) * 0x800) * 0.3f); if (frames & 4) { @@ -515,13 +509,12 @@ void EnFish_TinyPond_SetupSwim(EnFish* this) { void EnFish_TinyPond_Swim(EnFish* this, PlayState* play) { s32 pad2; - u32 frames; + u32 frames = play->gameplayFrames; EnFishSpeedParams* speedParams; s32 pad3; f32 animPlaySpeedBoost; s32 pad; - frames = play->gameplayFrames; if (this->actor.xzDistToPlayer < 60.0f) { if (this->timer < 12) { speedParams = &sMoveSpeedParams; @@ -558,11 +551,9 @@ void EnFish_TinyPond_Swim(EnFish* this, PlayState* play) { } void EnFish_JabuCutscene_CueFlapOnGround(EnFish* this, PlayState* play) { - f32 sp24; - f32 sp20; + f32 sp24 = Math_SinS(this->phase1); + f32 sp20 = Math_SinS(this->phase2); - sp24 = Math_SinS(this->phase1); - sp20 = Math_SinS(this->phase2); sJabuCutsceneOffsetY += sJabuCutsceneOffsetYSpeed; if (sJabuCutsceneOffsetY <= 1.0f) { sJabuCutsceneOffsetY = 1.0f; @@ -581,11 +572,9 @@ void EnFish_JabuCutscene_CueFlapOnGround(EnFish* this, PlayState* play) { void EnFish_JabuCutscene_CueFly(EnFish* this, PlayState* play) { s32 pad; - f32 sp28; - f32 sp24; + f32 sp28= Math_SinS(this->phase1); + f32 sp24= Math_SinS(this->phase2); - sp28 = Math_SinS(this->phase1); - sp24 = Math_SinS(this->phase2); this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.z += 0x64; Math_StepToF(&sJabuCutsceneOffsetY, 0.0f, 1.0f); @@ -596,7 +585,7 @@ void EnFish_JabuCutscene_CueFly(EnFish* this, PlayState* play) { void EnFish_JabuCutscene_Update(EnFish* this, PlayState* play) { f32 factor; s32 pad; - CsCmdActorCue* cue; + CsCmdActorCue* cue = play->csCtx.actorCues[1]; Vec3f startPos; Vec3f endPos; s32 pad2; @@ -605,7 +594,6 @@ void EnFish_JabuCutscene_Update(EnFish* this, PlayState* play) { if (play) {} if (play) {} - cue = play->csCtx.actorCues[1]; if (cue == NULL) { if (1) {} PRINTF("Warning : dousa 3 消滅 が呼ばれずにデモが終了した(%s %d)(arg_data 0x%04x)\n", "../z_en_sakana.c", 1169, From e2d48980f4e5573aaede06dceebc63d30c7d1efd Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 17:25:04 +0200 Subject: [PATCH 104/150] BgDyYoseizo small cleanup --- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 26 +++++++------------ .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.h | 2 +- 2 files changed, 10 insertions(+), 18 deletions(-) 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 fa4956159c8..bd3f215143f 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 @@ -413,9 +413,8 @@ void BgDyYoseizo_Revisit_Appear(BgDyYoseizo* this, PlayState* play) { } void BgDyYoseizo_Revisit_FinishAppear(BgDyYoseizo* this, PlayState* play) { - f32 animPrevFrame; + f32 animPrevFrame = this->skelAnime.curFrame; - animPrevFrame = this->skelAnime.curFrame; #if OOT_VERSION >= NTSC_1_1 Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_1); #endif @@ -482,13 +481,11 @@ void BgDyYoseizo_Revisit_SetupRefillPlayerEnergy(BgDyYoseizo* this, PlayState* p } void BgDyYoseizo_Revisit_RefillPlayerEnergy(BgDyYoseizo* this, PlayState* play) { - Player* player; - f32 animPrevFrame; + Player* player = GET_PLAYER(play); + f32 animPrevFrame = this->skelAnime.curFrame; s16 beamType; Vec3f beamPos; - player = GET_PLAYER(play); - animPrevFrame = this->skelAnime.curFrame; if (this->hasSwitchedAnim) { this->yVelocityPhase = this->skelAnime.curFrame * 1300.0f; if ((this->curAnimLastFrame * 1300.0f) <= this->yVelocityPhase) { @@ -645,9 +642,8 @@ void BgDyYoseizo_Reward_WaitCutscene(BgDyYoseizo* this, PlayState* play) { } void BgDyYoseizo_Reward_Appear(BgDyYoseizo* this, PlayState* play) { - f32 animPrevFrame; + f32 animPrevFrame = this->skelAnime.curFrame; - animPrevFrame = this->skelAnime.curFrame; if (!this->isDoneAppearing) { Math_ApproachF(&this->actor.world.pos.y, this->aboveFountainY, this->yApproachFraction, 100.0f); Math_ApproachF(&this->scale, 0.035f, this->scaleApproachFraction, 0.005f); @@ -700,14 +696,12 @@ void BgDyYoseizo_Reward_Appear(BgDyYoseizo* this, PlayState* play) { } void BgDyYoseizo_Reward_GiveReward(BgDyYoseizo* this, PlayState* play) { - f32 animPrevFrame; - Player* player; + f32 animPrevFrame = this->skelAnime.curFrame; + Player* player = GET_PLAYER(play); s16 n; s16 demoEffectParams; Vec3f itemPos; - animPrevFrame = this->skelAnime.curFrame; - player = GET_PLAYER(play); if (this->hasSwitchedAnim) { this->yVelocityPhase = this->skelAnime.curFrame * 1400.0f; if (this->yVelocityPhase >= (this->curAnimLastFrame * 1400.0f)) { @@ -901,7 +895,7 @@ void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) { } s32 BgDyYoseizo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - BgDyYoseizo* this = thisx; + BgDyYoseizo* this = (BgDyYoseizo*)thisx; if (limbIndex == 8) { rot->x += this->torsoRot.y; @@ -1013,13 +1007,11 @@ void BgDyYoseizo_UpdateEffects(BgDyYoseizo* this, PlayState* play) { } void BgDyYoseizo_DrawEffects(BgDyYoseizo* this, PlayState* play) { - GraphicsContext* gfxCtx; + GraphicsContext* gfxCtx = play->state.gfxCtx; s16 i; BgDyYoseizoEffect* effect; - u8 materialFlag; + u8 materialFlag = 0; - gfxCtx = play->state.gfxCtx; - materialFlag = 0; effect = this->effects; OPEN_DISPS(gfxCtx, "../z_bg_dy_yoseizo.c", 1767); Gfx_SetupDL_25Xlu(play->state.gfxCtx); 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 fc587a4d27b..0fd44a67181 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 @@ -29,7 +29,7 @@ typedef void (*BgDyYoseizoActionFunc)(struct BgDyYoseizo*, struct PlayState*); typedef struct BgDyYoseizo { /* 0x0000 */ Actor actor; - /* 0x014C */ void (*actionFunc)(struct BgDyYoseizo*, struct PlayState*); + /* 0x014C */ BgDyYoseizoActionFunc actionFunc; /* 0x0150 */ SkelAnime skelAnime; /* 0x0194 */ Vec3s jointTable[28]; /* 0x023C */ Vec3s morphTable[28]; From b6a773f930181be190a375e99cf1fb8882c0a231 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 17:40:02 +0200 Subject: [PATCH 105/150] EnBili cleanup --- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 38 ++++++++++----------- src/overlays/actors/ovl_En_Bili/z_en_bili.h | 4 ++- 2 files changed, 21 insertions(+), 21 deletions(-) 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 975deafbce5..ec927b17757 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -265,9 +265,8 @@ void EnBili_SetupFrozen(EnBili* this, PlayState* play) { void EnBili_UpdateTentaclesTexIndex(EnBili* this) { s16 n; - s16 animCurFrame; + s16 animCurFrame = this->skelAnime.curFrame; - animCurFrame = this->skelAnime.curFrame; if (this->actionFunc == EnBili_Electrify) { n = 3 - animCurFrame; this->tentaclesTexIndex = (ABS(n) + 5) % 8; @@ -293,12 +292,11 @@ void EnBili_UpdateTentaclesTexIndex(EnBili* this) { } void EnBili_UpdateMovement(EnBili* this) { - f32 playerY; + f32 playerY = this->actor.world.pos.y + this->actor.yDistToPlayer; f32 floorY; f32 targetY; f32 targetYOffset; - playerY = this->actor.world.pos.y + this->actor.yDistToPlayer; if (this->actionFunc == EnBili_FleePlayer) { targetYOffset = 100.0f; } else { @@ -348,7 +346,7 @@ void EnBili_Electrify(EnBili* this, PlayState* play) { s32 i; for (i = 0; i < 4; i++) { - if (!((s32)(this->timer + (i << 1)) % 4)) { + if (!((this->timer + (i << 1)) % 4)) { effYaw = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; effPos.x = Rand_CenteredFloat(5.0f) + this->actor.world.pos.x; effPos.y = (Rand_ZeroOne() * 5.0f) + this->actor.world.pos.y + 2.5f; @@ -595,27 +593,27 @@ void EnBili_GetHoodLimbScale(EnBili* this, f32 frame, Vec3f* scale) { f32 f; if (this->actionFunc == EnBili_Electrify) { - scale->y = 1.0f - (sinf(0.5236092f * frame) * 0.26f); + scale->y = 1.0f - (sinf((M_PI * 0.16667f) * frame) * 0.26f); } else if (this->actionFunc == EnBili_AscendAway) { if (frame <= 8.0f) { - scale->y = (cosf(0.3926991f * frame) * 0.15f) + 0.85f; + scale->y = (cosf((M_PI / 8) * frame) * 0.15f) + 0.85f; } else if (frame <= 18.0f) { - f = cosf((frame - 8.0f) * 0.31415927f); + f = cosf((frame - 8.0f) * (M_PI / 10)); scale->y = 1.0f - (0.3f * f); scale->x = (0.2f * f) + 0.8f; } else { - f = cosf((frame - 18.0f) * 0.071314156f); + f = cosf((frame - 18.0f) * (M_PI * 0.0227f)); scale->y = (0.31f * f) + 1.0f; scale->x = 1.0f - (0.4f * f); } scale->z = scale->x; } else if (this->actionFunc == EnBili_Stunned) { - f = sinf(this->timer * 0.31415927f) * 0.08f; + f = sinf(this->timer * (M_PI / 10)) * 0.08f; scale->x -= f; scale->y += f; scale->z -= f; } else { - scale->y = (cosf(0.3926991f * frame) * 0.13f) + 0.87f; + scale->y = (cosf((M_PI / 8) * frame) * 0.13f) + 0.87f; } } @@ -623,27 +621,27 @@ void EnBili_GetCoreLimbScale(EnBili* this, f32 frame, Vec3f* scale) { f32 f; if (this->actionFunc == EnBili_Electrify) { - scale->y = (sinf(0.5236092f * frame) * 0.2f) + 1.0f; + scale->y = (sinf((M_PI * 0.16667f) * frame) * 0.2f) + 1.0f; } else if (this->actionFunc == EnBili_AscendAway) { if (frame <= 8.0f) { - scale->x = 1.125f - (cosf(0.3926991f * frame) * 0.125f); + scale->x = 1.125f - (cosf((M_PI / 8) * frame) * 0.125f); } else if (frame <= 18.0f) { - f = cosf((frame - 8.0f) * 0.31415927f); + f = cosf((frame - 8.0f) * (M_PI / 10)); scale->x = (0.275f * f) + 0.975f; scale->y = 1.25f - (0.25f * f); } else { - f = cosf((frame - 18.0f) * 0.071314156f); + f = cosf((frame - 18.0f) * (M_PI * 0.0227f)); scale->x = 1.0f - (0.3f * f); scale->y = (0.48f * f) + 1.0f; } scale->z = scale->x; } else if (this->actionFunc == EnBili_Stunned) { - f = sinf(this->timer * 0.31415927f) * 0.08f; + f = sinf(this->timer * (M_PI / 10)) * 0.08f; scale->x += f; scale->y -= f; scale->z += f; } else { - scale->y = 1.1f - (cosf(0.3926991f * frame) * 0.1f); + scale->y = 1.1f - (cosf((M_PI / 8) * frame) * 0.1f); } } @@ -652,15 +650,15 @@ void EnBili_GetTentaclesLimbScale(EnBili* this, f32 frame, Vec3f* scale) { if (this->actionFunc == EnBili_AscendAway) { if (frame <= 8.0f) { - f = cosf(0.3926991f * frame); + f = cosf((M_PI / 8) * frame); scale->x = 1.125f - (0.125f * f); scale->y = (0.3f * f) + 0.7f; } else if (frame <= 18.0f) { - f = cosf((frame - 8.0f) * 0.31415927f); + f = cosf((frame - 8.0f) * (M_PI / 10)); scale->x = (0.325f * f) + 0.925f; scale->y = 0.95f - (0.55f * f); } else { - f = cosf((frame - 18.0f) * 0.071314156f); + f = cosf((frame - 18.0f) * (M_PI * 0.0227f)); scale->x = 1.0f - (0.4f * f); scale->y = (0.52f * f) + 1.0f; } 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 ae2d507dcd3..0c4d304e23f 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.h +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.h @@ -14,10 +14,12 @@ typedef enum EnBiliType { struct EnBili; +typedef void (*EnBiliActionFunc)(struct EnBili*, struct PlayState*); + typedef struct EnBili { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ void (*actionFunc)(struct EnBili*, struct PlayState*); + /* 0x190 */ EnBiliActionFunc actionFunc; /* 0x194 */ u8 tentaclesTexIndex; /* 0x195 */ u8 playFlySfx; /* 0x196 */ s16 timer; From 460d44bcb44a94d5b4282fff44be1e524e8c5515 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 17:54:32 +0200 Subject: [PATCH 106/150] EnVali cleanup --- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 25 +++++++++++---------- src/overlays/actors/ovl_En_Vali/z_en_vali.h | 4 +++- 2 files changed, 16 insertions(+), 13 deletions(-) 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 47acd3b61ac..7df92b37e0b 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -175,6 +175,7 @@ void EnVali_Init(Actor* thisx, PlayState* play) { void EnVali_Destroy(Actor* thisx, PlayState* play) { EnVali* this = (EnVali*)thisx; + Collider_DestroyQuad(play, &this->leftTentacleCollider); Collider_DestroyQuad(play, &this->rightTentacleCollider); Collider_DestroyCylinder(play, &this->collider); @@ -586,19 +587,19 @@ void EnVali_GetHoodScale(EnVali* this, f32 frame, Vec3f* scale) { if (n >= 10) { n -= 10; } - scale->y -= 0.2f * sinf(n * 0.31415927f); + scale->y -= 0.2f * sinf(n * (M_PI / 10)); } else if (this->actionFunc == EnVali_Damaged) { - f = sinf(0.31415927f * frame); + f = sinf((M_PI / 10) * frame); scale->y -= 0.24f * f; scale->x -= 0.13f * f; scale->z = scale->x; } else if (this->actionFunc == EnVali_Recover) { - f = cosf(0.06283186f * frame); + f = cosf((M_PI / 50) * frame); scale->y -= 0.24f * f; scale->x -= 0.13f * f; scale->z = scale->x; } else if (this->actionFunc == EnVali_Stunned) { - f = sinf(this->timer * 0.31415927f) * 0.08f; + f = sinf(this->timer * (M_PI / 10)) * 0.08f; scale->x += f; scale->y -= f; scale->z += f; @@ -606,7 +607,7 @@ void EnVali_GetHoodScale(EnVali* this, f32 frame, Vec3f* scale) { if (frame >= 40.0f) { frame -= 40.0f; } - scale->y -= 0.2f * sinf(0.07853982f * frame); + scale->y -= 0.2f * sinf((M_PI / 40) * frame); } } @@ -619,19 +620,19 @@ void EnVali_GetCoreScale(EnVali* this, f32 frame, Vec3f* scale) { if (n >= 0xA) { n -= 0xA; } - scale->y -= 0.13f * sinf(n * 0.31415927f); + scale->y -= 0.13f * sinf(n * (M_PI / 10)); } else if (this->actionFunc == EnVali_Damaged) { - f = sinf(0.31415927f * frame); + f = sinf((M_PI / 10) * frame); scale->y -= 0.18f * f; scale->x -= 0.1f * f; scale->z = scale->x; } else if (this->actionFunc == EnVali_Recover) { - f = cosf(0.06283186f * frame); + f = cosf((M_PI / 50) * frame); scale->y -= 0.18f * f; scale->x -= 0.1f * f; scale->z = scale->x; } else if (this->actionFunc == EnVali_Stunned) { - f = sinf(this->timer * 0.31415927f) * 0.08f; + f = sinf(this->timer * (M_PI / 10)) * 0.08f; scale->x -= f; scale->y += f; scale->z -= f; @@ -639,7 +640,7 @@ void EnVali_GetCoreScale(EnVali* this, f32 frame, Vec3f* scale) { if (frame >= 40.0f) { frame -= 40.0f; } - scale->y -= 0.13f * sinf(0.07853982f * frame); + scale->y -= 0.13f * sinf((M_PI / 40) * frame); } } @@ -655,9 +656,9 @@ s32 EnVali_UpdateTentaclesLengthFactor(EnVali* this, f32 frame) { target = 1.5f; } } else if (this->actionFunc == EnVali_Damaged) { - target = 1.0f - (sinf(0.31415927f * frame) * 0.35f); + target = 1.0f - (sinf((M_PI / 10) * frame) * 0.35f); } else if (this->actionFunc == EnVali_Recover) { - target = 1.0f - (cosf(0.06283186f * frame) * 0.35f); + target = 1.0f - (cosf((M_PI / 50) * frame) * 0.35f); } else if ((this->actionFunc == EnVali_Electrify) || (this->actionFunc == EnVali_Frozen)) { target = this->tentaclesLengthFactor; } else { 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 11283789e1b..3d61f0bb72b 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.h +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.h @@ -8,10 +8,12 @@ struct EnVali; +typedef void (*EnValiActionFunc)(struct EnVali*, struct PlayState*); + typedef struct EnVali { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ void (*actionFunc)(struct EnVali*, struct PlayState*); + /* 0x190 */ EnValiActionFunc actionFunc; /* 0x194 */ u8 electrifyTimer; /* 0x195 */ u8 spinTimer; /* 0x196 */ s16 timer; From e1580345f457a319dd94cd4719d5516fc59cd4c7 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:02:32 +0200 Subject: [PATCH 107/150] add FbFilterType enum --- include/vis.h | 11 +++++++++++ src/code/game.c | 10 ++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/vis.h b/include/vis.h index 3aa3691eca5..50a902e0040 100644 --- a/include/vis.h +++ b/include/vis.h @@ -4,6 +4,17 @@ #include "ultra64.h" #include "color.h" +typedef enum FbFilterType { + /* 0 */ FB_FILTER_TYPE_NONE, + /* 1 */ FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_FB, + /* 2 */ FB_FILTER_TYPE_VISCVG_TYPE_FADE_AND_MODULATE_FB, + /* 3 */ FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_COLOR, + /* 4 */ FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR, + /* 5 */ FB_FILTER_TYPE_VISZBUFFER_AS_IA16, + /* 6 */ FB_FILTER_TYPE_VISZBUFFER_AS_RGBA16, + /* 7 */ FB_FILTER_TYPE_VISMONO +} FbFilterType; + /** * Meaning of color1 and color2: * - VisCvg: see VisCvgType for color1. color2 unused diff --git a/src/code/game.c b/src/code/game.c index 5f43ead3eee..e24d51f3ca0 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -61,15 +61,17 @@ void GameState_FaultPrint(void) { void GameState_SetFBFilter(Gfx** gfx) { Gfx* gfxP = *gfx; - if ((R_FB_FILTER_TYPE > 0) && (R_FB_FILTER_TYPE < 5)) { + if ((R_FB_FILTER_TYPE >= FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_FB) && + (R_FB_FILTER_TYPE <= FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR)) { sGameStateVisCvg.params.type = R_FB_FILTER_TYPE; sGameStateVisCvg.params.color1.r = R_FB_FILTER_COLOR1(0); sGameStateVisCvg.params.color1.g = R_FB_FILTER_COLOR1(1); sGameStateVisCvg.params.color1.b = R_FB_FILTER_COLOR1(2); sGameStateVisCvg.params.color1.a = R_FB_FILTER_A; VisCvg_Draw(&sGameStateVisCvg, &gfxP); - } else if ((R_FB_FILTER_TYPE == 5) || (R_FB_FILTER_TYPE == 6)) { - sGameStateVisZBuffer.params.type = (R_FB_FILTER_TYPE == 6); + } else if ((R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISZBUFFER_AS_IA16) || + (R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISZBUFFER_AS_RGBA16)) { + sGameStateVisZBuffer.params.type = (R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISZBUFFER_AS_RGBA16); sGameStateVisZBuffer.params.color1.r = R_FB_FILTER_COLOR1(0); sGameStateVisZBuffer.params.color1.g = R_FB_FILTER_COLOR1(1); sGameStateVisZBuffer.params.color1.b = R_FB_FILTER_COLOR1(2); @@ -79,7 +81,7 @@ void GameState_SetFBFilter(Gfx** gfx) { sGameStateVisZBuffer.params.color2.b = R_FB_FILTER_COLOR2(2); sGameStateVisZBuffer.params.color2.a = R_FB_FILTER_A; VisZBuffer_Draw(&sGameStateVisZBuffer, &gfxP); - } else if (R_FB_FILTER_TYPE == 7) { + } else if (R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISMONO) { sGameStateVisMono.params.type = 0; sGameStateVisMono.params.color1.r = R_FB_FILTER_COLOR1(0); sGameStateVisMono.params.color1.g = R_FB_FILTER_COLOR1(1); From ecd0e4788111fb4b4770b2cb7d5cce9e178b023d Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:04:58 +0200 Subject: [PATCH 108/150] format and bss --- src/code/z_play.c | 2 +- src/overlays/actors/ovl_En_Fish/z_en_fish.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/code/z_play.c b/src/code/z_play.c index 7ac82e385fc..72677ae74e1 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -47,7 +47,7 @@ #include "save.h" #include "vis.h" -#pragma increment_block_number "gc-eu:221 gc-eu-mq:221 gc-jp:221 gc-jp-ce:221 gc-jp-mq:221 gc-us:221 gc-us-mq:221" \ +#pragma increment_block_number "gc-eu:218 gc-eu-mq:218 gc-jp:218 gc-jp-ce:218 gc-jp-mq:218 gc-us:218 gc-us-mq:221" \ "ique-cn:221 ntsc-1.0:221 ntsc-1.1:221 ntsc-1.2:221 pal-1.0:221 pal-1.1:221" TransitionTile gTransitionTile; diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 239df8eeb02..46377e3f6a3 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -572,8 +572,8 @@ void EnFish_JabuCutscene_CueFlapOnGround(EnFish* this, PlayState* play) { void EnFish_JabuCutscene_CueFly(EnFish* this, PlayState* play) { s32 pad; - f32 sp28= Math_SinS(this->phase1); - f32 sp24= Math_SinS(this->phase2); + f32 sp28 = Math_SinS(this->phase1); + f32 sp24 = Math_SinS(this->phase2); this->actor.shape.rot.x -= 0x1F4; this->actor.shape.rot.z += 0x64; From 35c2910e18568456fe6ef9ace0fe28cd5fece577 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:18:43 +0200 Subject: [PATCH 109/150] bss --- src/code/z_play.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/code/z_play.c b/src/code/z_play.c index 72677ae74e1..ad0023e2db0 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -47,8 +47,8 @@ #include "save.h" #include "vis.h" -#pragma increment_block_number "gc-eu:218 gc-eu-mq:218 gc-jp:218 gc-jp-ce:218 gc-jp-mq:218 gc-us:218 gc-us-mq:221" \ - "ique-cn:221 ntsc-1.0:221 ntsc-1.1:221 ntsc-1.2:221 pal-1.0:221 pal-1.1:221" +#pragma increment_block_number "gc-eu:218 gc-eu-mq:218 gc-jp:218 gc-jp-ce:218 gc-jp-mq:218 gc-us:218 gc-us-mq:218" \ + "ique-cn:218 ntsc-1.0:218 ntsc-1.1:218 ntsc-1.2:218 pal-1.0:218 pal-1.1:218" TransitionTile gTransitionTile; s32 gTransitionTileState; From a5f594d46c4ab2c6390781a859b7cd08dae71fd3 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:18:59 +0200 Subject: [PATCH 110/150] EnDekubabaActionFunc --- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 a622804e93c..be99d233ed3 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -13,13 +13,15 @@ typedef enum EnDekubabaType { struct EnDekubaba; +typedef void (*EnDekubabaActionFunc)(struct EnDekubaba*, struct PlayState*); + typedef struct EnDekubaba { /* 0x000 */ Actor actor; /* 0x14C */ Vec3f unk_14C[2]; // unused /* 0x164 */ Vec3f unk_164; // unused /* 0x170 */ Vec3f homePos; // unused /* 0x17C */ SkelAnime skelAnime; - /* 0x1C0 */ void (*actionFunc)(struct EnDekubaba*, struct PlayState*); + /* 0x1C0 */ EnDekubabaActionFunc actionFunc; /* 0x1C4 */ char pad_1C4[2]; /* 0x1C6 */ s16 actionState; /* 0x1C8 */ s16 wobbleTarget; From 748e8e742932acdd6d446691cc237c2103b8ee86 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:20:38 +0200 Subject: [PATCH 111/150] EnWfActionFunc --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 2 +- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) 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 0d156f101f5..d508a6041f1 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -247,7 +247,7 @@ static void* sWolfosGrayEyeTextures[4] = { gWolfosGrayEyeOpenTex, gWolfosGrayEye static void* sWolfosWhiteEyeTextures[4] = { gWolfosWhiteEyeOpenTex, gWolfosWhiteEyeHalfTex, gWolfosWhiteEyeClosedTex, gWolfosWhiteEyeHalfTex }; -void EnWf_SetupAction(EnWf* this, void (*actionFunc)(EnWf*, PlayState*)) { +void EnWf_SetupAction(EnWf* this, EnWfActionFunc actionFunc) { this->actionFunc = actionFunc; } 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 010f2025c35..15c13baeb0d 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -8,6 +8,8 @@ struct EnWf; +typedef void (*EnWfActionFunc)(struct EnWf*, struct PlayState*); + typedef struct EnWf { /* 0x000 */ Actor actor; /* 0x14C */ Vec3s bodyPartsPos[10]; @@ -16,7 +18,7 @@ typedef struct EnWf { /* 0x250 */ Vec3s morphTable[WOLFOS_LIMB_MAX]; /* 0x2D4 */ s32 action; /* 0x2D8 */ char pad_2D8[4]; - /* 0x2DC */ void (*actionFunc)(struct EnWf*, struct PlayState*); + /* 0x2DC */ EnWfActionFunc actionFunc; /* 0x2E0 */ s16 unk_2E0; /* 0x2E2 */ s16 idleTimer; /* 0x2E4 */ s16 onFireTimer; From 1a3e783c827328524b19eeff97ed5508309a55c9 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:26:19 +0200 Subject: [PATCH 112/150] EnWf cleanup --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 65 +++++++++++-------------- 1 file changed, 29 insertions(+), 36 deletions(-) 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 d508a6041f1..b71ddf10e38 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -239,13 +239,6 @@ static InitChainEntry sInitChain[2] = { ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3000, ICHAIN_STOP), }; -static Vec3f D_80B37AD0 = { 0.0f, 0.5f, 0.0f }; -static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; -static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; -static void* sWolfosGrayEyeTextures[4] = { gWolfosGrayEyeOpenTex, gWolfosGrayEyeHalfTex, gWolfosGrayEyeClosedTex, - gWolfosGrayEyeHalfTex }; -static void* sWolfosWhiteEyeTextures[4] = { gWolfosWhiteEyeOpenTex, gWolfosWhiteEyeHalfTex, gWolfosWhiteEyeClosedTex, - gWolfosWhiteEyeHalfTex }; void EnWf_SetupAction(EnWf* this, EnWfActionFunc actionFunc) { this->actionFunc = actionFunc; @@ -322,13 +315,11 @@ void EnWf_Destroy(Actor* thisx, PlayState* play) { * @return true if an action was picked */ s32 EnWf_PickAction(PlayState* play, EnWf* this, s16 mustPick) { - Player* player; + Player* player = GET_PLAYER(play); s32 pad; s16 absRelWallYaw; s16 absRelYawTowardsPlayer; - player = GET_PLAYER(play); - absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; if (absRelWallYaw < 0) { absRelWallYaw *= -1; @@ -462,11 +453,10 @@ void EnWf_SetupIdle(EnWf* this) { } void EnWf_Idle(EnWf* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); s32 pad; s16 yaw; - player = GET_PLAYER(play); SkelAnime_Update(&this->skelAnime); if (this->idleTimer != 0) { yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->headRot; @@ -533,17 +523,15 @@ void EnWf_RunToAttack(EnWf* this, PlayState* play) { s32 prevFrame; s32 beforeCurFrame; s32 pad; - f32 sp50_real; + f32 sp50_real = 0.0f; s32 pad2; - Player* player; + Player* player = GET_PLAYER(play); s32 pad3; s16 temp_v1_real; s16 var_v0_real; f32 absPlaySpeed; s32 pad4; - sp50_real = 0.0f; - player = GET_PLAYER(play); if (!EnWf_ReactToProjectile(play, this)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x2EE, 0); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -674,15 +662,13 @@ void EnWf_SetupCirclePlayer(EnWf* this) { void EnWf_CirclePlayer(EnWf* this, PlayState* play) { s16 sp56_real; s32 new_var; - f32 extraRadius; + f32 extraRadius = 0.0f; s32 prevFrame; s32 beforeCurFrame; s32 absPlaySpeed; - Player* player; + Player* player = GET_PLAYER(play); s16 yawWallRelToTarget; - extraRadius = 0.0f; - player = GET_PLAYER(play); Math_SmoothStepToS(&this->actor.shape.rot.y, (s16)(this->actor.yawTowardsPlayer + this->circlePlayerDirection), 1, 0xFA0, 1); if (!EnWf_ReactToProjectile(play, this) && !EnWf_PickAction(play, this, false)) { @@ -815,9 +801,8 @@ void EnWf_Attack(EnWf* this, PlayState* play) { } void EnWf_SetupAttackBouncedOff(EnWf* this) { - f32 animEndFrame; + f32 animEndFrame = 1.0f; - animEndFrame = 1.0f; if ((s32)this->skelAnime.curFrame >= 16) { animEndFrame = 15.0f; } @@ -1013,9 +998,8 @@ void EnWf_BackflipForward(EnWf* this, PlayState* play) { } void EnWf_SetupBlock(EnWf* this) { - f32 animEndFrame; + f32 animEndFrame = (f32)Animation_GetLastFrame(&gWolfosBlockAnim); - animEndFrame = (f32)Animation_GetLastFrame(&gWolfosBlockAnim); if (this->attackState != 0) { this->attackState = -1; } @@ -1027,13 +1011,12 @@ void EnWf_SetupBlock(EnWf* this) { } void EnWf_Block(EnWf* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); s32 pad; s16 pad2; s16 yawDiff; s16 relYawTowardsPlayer; - player = GET_PLAYER(play); if (this->timer != 0) { this->timer -= 1; } else { @@ -1108,18 +1091,16 @@ void EnWf_SetupShortCirclePlayer(EnWf* this, PlayState* play) { void EnWf_ShortCirclePlayer(EnWf* this, PlayState* play) { Player* player2; - Player* player; + Player* player = GET_PLAYER(play); s32 prevFrame; s32 beforeCurFrame; s32 new_var; - f32 extraRadius; + f32 extraRadius = 0.0f; s32 absPlaySpeed; s16 yawWallRelToTarget; s16 behindPlayerYawAbs; s16 behindPlayerYaw; - player = GET_PLAYER(play); - extraRadius = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + this->circlePlayerDirection, 1, 0xBB8, 1); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) || @@ -1231,9 +1212,8 @@ void EnWf_Die(EnWf* this, PlayState* play) { } else { s32 i; Vec3f pos; - Vec3f velAccel; + Vec3f velAccel = { 0.0f, 0.5f, 0.0f }; - velAccel = D_80B37AD0; this->timer--; for (i = ((s32)this->skelAnime.animLength - this->timer) >> 1; i >= 0; i--) { pos.x = this->actor.world.pos.x + Rand_CenteredFloat(60.0f); @@ -1350,7 +1330,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) { } s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnWf* this = thisx; + EnWf* this = (EnWf*)thisx; if ((limbIndex == WOLFOS_LIMB_HEAD) || (limbIndex == WOLFOS_LIMB_EYES)) { rot->y -= this->headRot; @@ -1359,7 +1339,9 @@ s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnWf* this = thisx; + static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; + static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; + EnWf* this = (EnWf*)thisx; s32 bodyPartIndex; Vec3f tailColliderPos; Vec3f bodyPartPos; @@ -1416,6 +1398,18 @@ void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, } void EnWf_Draw(Actor* thisx, PlayState* play) { + static void* sWolfosGrayEyeTextures[4] = { + gWolfosGrayEyeOpenTex, + gWolfosGrayEyeHalfTex, + gWolfosGrayEyeClosedTex, + gWolfosGrayEyeHalfTex, + }; + static void* sWolfosWhiteEyeTextures[4] = { + gWolfosWhiteEyeOpenTex, + gWolfosWhiteEyeHalfTex, + gWolfosWhiteEyeClosedTex, + gWolfosWhiteEyeHalfTex, + }; EnWf* this = (EnWf*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_wf.c", 2157); @@ -1448,11 +1442,10 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { * @return true if an action was picked */ s32 EnWf_ReactToProjectile(PlayState* play, EnWf* this) { - Actor* projectile; + Actor* projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); s16 relYawTowardsProjectile; f32 projectileDist; - projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectile != NULL) { relYawTowardsProjectile = Actor_WorldYawTowardActor(&this->actor, projectile) - this->actor.shape.rot.y; this->actor.world.rot.y = (u16)(s16)(this->actor.shape.rot.y + 0); From 40bcddb78bff16df4f85c1708ec25b144b6d6151 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:28:39 +0200 Subject: [PATCH 113/150] EnDekubaba cleanup --- src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 bee913e5878..79f7567bf05 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -461,14 +461,12 @@ void EnDekubaba_WaitPlayerNear(EnDekubaba* this, PlayState* play) { } void EnDekubaba_ExitGround(EnDekubaba* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); f32 dxz; f32 dy; f32 dx; f32 dz; - player = GET_PLAYER(play); - if (this->actionState != 0) { this->actionState--; } @@ -678,9 +676,8 @@ void EnDekubaba_Attack(EnDekubaba* this, PlayState* play) { } void EnDekubaba_PrepareAttack(EnDekubaba* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); - player = GET_PLAYER(play); if (this->actionState != 0) { this->actionState--; } @@ -1144,7 +1141,7 @@ void EnDekubaba_DrawShadow(EnDekubaba* this, PlayState* play) { } void EnDekubaba_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnDekubaba* this = thisx; + EnDekubaba* this = (EnDekubaba*)thisx; if (limbIndex == DEKUBABA_HEAD_LIMB_ROOT) { Collider_UpdateSpheres(limbIndex, &this->collider); From 07bdb1e124a29ef63d1d2c6a03c18772b93088ae Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:38:12 +0200 Subject: [PATCH 114/150] EnZf cleanup --- src/overlays/actors/ovl_En_Zf/z_en_zf.c | 82 +++++++++---------------- src/overlays/actors/ovl_En_Zf/z_en_zf.h | 4 +- 2 files changed, 32 insertions(+), 54 deletions(-) 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 158d3d757f5..d68d0eaf92b 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -258,7 +258,7 @@ static Gfx D_80B4A2F8[] = { }; static s32 D_80B4AB30; -void EnZf_SetupAction(EnZf* this, void (*actionFunc)(EnZf*, PlayState*)) { +void EnZf_SetupAction(EnZf* this, EnZfActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -349,11 +349,10 @@ s16 EnZf_TestNoFloorAheadShape(EnZf* this, PlayState* play, f32 distance) { void EnZf_Init(Actor* thisx, PlayState* play) { f32 yDiff; s32 pad; - Player* player; + Player* player = GET_PLAYER(play); EffectBlureInit1 swordBlure; EnZf* this = (EnZf*)thisx; - player = GET_PLAYER(play); Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.attentionRangeType = ATTENTION_RANGE_3; this->switchFlag = PARAMS_GET_S(thisx->params, 8, 8); @@ -549,12 +548,10 @@ s16 EnZf_FindPlatformWithoutPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallback } s32 EnZf_FindPlatformCloseToPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallbackPlatform, PlayState* play) { - Vec3f* temp_s0; f32 platformDistToPlayer; f32 closestPlatformToPlayerDist; f32 secondClosestPlatformToPlayerDist; f32 maxPlatformDist; - s16 temp_fp; s16 i; s16 closestPlatformToPlayer; s16 secondClosestPlatformToPlayer; @@ -608,10 +605,9 @@ s32 EnZf_FindPlatformCloseToPlayer(Vec3f* thisPos, s16 curPlatform, s16 fallback s32 EnZf_CanAttack(PlayState* play, EnZf* this) { s32 pad; - Player* player; + Player* player = GET_PLAYER(play); Actor* playerFocusActor; - player = GET_PLAYER(play); if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { if (player->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { return false; @@ -641,11 +637,11 @@ s32 EnZf_CanAttack(PlayState* play, EnZf* this) { } void EnZf_PickAction(EnZf* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 absRelYawTowardsPlayer; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = ABS(relYawTowardsPlayer); - if (relYawTowardsPlayer >= 0x1B58) { + absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; + absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); + if (absRelYawTowardsPlayer >= 0x1B58) { EnZf_SetupCirclePlayerIfFloor(this, play); } else if ((this->actor.xzDistToPlayer <= 100.0f) && ((play->gameplayFrames % 8) != 0) && EnZf_CanAttack(play, this)) { @@ -763,12 +759,11 @@ void EnZf_SetupIdle(EnZf* this) { } void EnZf_Idle(EnZf* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); s32 pad; s16 absYawTowardsPlayerRelToHead; s16 absYawDiffWithPlayer; - player = GET_PLAYER(play); absYawTowardsPlayerRelToHead = this->actor.yawTowardsPlayer - this->headRot - this->actor.shape.rot.y; absYawTowardsPlayerRelToHead = ABS(absYawTowardsPlayerRelToHead); SkelAnime_Update(&this->skelAnime); @@ -840,16 +835,12 @@ void EnZf_MainWalk(EnZf* this, PlayState* play) { s32 beforeCurFrame; s32 pad1; s16 absYawDiff; - s16 playerPlatform; - f32 maxTargetPlatformDistForJump; - f32 extraDistFromPlayer; - Player* player; + s16 playerPlatform = -1; + f32 maxTargetPlatformDistForJump = 350.0f; + f32 extraDistFromPlayer = 0.0f; + Player* player = GET_PLAYER(play); f32 absPlaySpeed; - playerPlatform = -1; - maxTargetPlatformDistForJump = 350.0f; - extraDistFromPlayer = 0.0f; - player = GET_PLAYER(play); if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { playerPlatform = EnZf_FindPlatform(&player->actor.world.pos, -1); this->curPlatform = EnZf_FindPlatform(&this->actor.world.pos, playerPlatform); @@ -1029,10 +1020,9 @@ void EnZf_TurnTowardsPlayer(EnZf* this, PlayState* play) { s32 pad; s16 relYawTowardsPlayer; s16 yawSpeed; - Player* player; + Player* player = GET_PLAYER(play); f32 animPlaySpeed; - player = GET_PLAYER(play); if (!EnZf_ReactToProjectile(play, this) && !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this))) { relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -1103,12 +1093,10 @@ void EnZf_Sidestep(EnZf* this, PlayState* play) { s32 prevFrame; s32 pad; f32 absPlaySpeed; - Player* player; - f32 sp3C; + Player* player = GET_PLAYER(play); + f32 sp3C = 0.0f; s16 var_v0_3_real; - player = GET_PLAYER(play); - sp3C = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (!EnZf_ReactToProjectile(play, this) && !((this->actor.params == ENZF_TYPE_DINOLFOS) && EnZf_DinolfosPickAction(play, this))) { @@ -1214,11 +1202,10 @@ void EnZf_SetupAttack(EnZf* this) { } void EnZf_Attack(EnZf* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); s16 absYawDiffWithPlayer; s16 absRelYawTowardsPlayer; - player = GET_PLAYER(play); this->actor.speed = 0.0f; if ((s32)this->skelAnime.curFrame == 10) { Actor_PlaySfx(&this->actor, NA_SE_EN_RIZA_ATTACK); @@ -1378,11 +1365,9 @@ void EnZf_Stunned(EnZf* this, PlayState* play) { } void EnZf_Paired_SetupJumpAwayStartTurnAround(EnZf* this, PlayState* play) { - f32 animMorphFrames; - f32 animEndFrame; + f32 animMorphFrames = 0.0f; + f32 animEndFrame = Animation_GetLastFrame(&gZfRunAwayTurnAroundAnim); - animMorphFrames = 0.0f; - animEndFrame = Animation_GetLastFrame(&gZfRunAwayTurnAroundAnim); if (this->action <= ENZF_ACTION_DAMAGED) { animMorphFrames = -4.0f; } @@ -1398,9 +1383,8 @@ void EnZf_Paired_SetupJumpAwayStartTurnAround(EnZf* this, PlayState* play) { } void EnZf_Paired_JumpAwayStartTurnAround(EnZf* this, PlayState* play) { - s16 yaw; + s16 yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]) + 0x8000; - yaw = Actor_WorldYawTowardPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]) + 0x8000; Math_SmoothStepToS(&this->actor.world.rot.y, yaw, 1, 0x3E8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -1426,9 +1410,8 @@ void EnZf_Paired_SetupIdleHop(EnZf* this) { void EnZf_Paired_IdleHop(EnZf* this, PlayState* play) { f32 animEndFrame; - f32 minPlayerDist; + f32 minPlayerDist = 400.0f; - minPlayerDist = 400.0f; Math_SmoothStepToF(&this->actor.speed, 0.0f, 1.0f, 0.5f, 0.0f); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer + 0x8000, 1, 0xFA0, 0); if (this->actor.world.pos.y >= 420.0f) { @@ -1492,8 +1475,8 @@ void EnZf_Paired_SetupJumpAway(EnZf* this, PlayState* play) { void EnZf_Paired_JumpAway(EnZf* this, PlayState* play) { f32 distToTargetPlatform; - f32 animPlaySpeed; - f32 var_fs0; + f32 animPlaySpeed = 1.0f; + f32 var_fs0 = 550.0f; f32 candidateDistance; s32 pad; f32 candidateSpeed; @@ -1503,8 +1486,6 @@ void EnZf_Paired_JumpAway(EnZf* this, PlayState* play) { s32 floorAheadFlags; s32 i; - animPlaySpeed = 1.0f; - var_fs0 = 550.0f; distToTargetPlatform = Actor_WorldDistXZToPoint(&this->actor, &sDCPlatformPositions[this->targetPlatform]); prevActionState = this->actionState; if ((play->gameplayFrames & 0x5F) == 0) { @@ -1608,9 +1589,8 @@ void EnZf_Paired_SetupEngageCombat(EnZf* this, PlayState* play) { } void EnZf_Paired_EngageCombat(EnZf* this, PlayState* play) { - s16 yawTowardsPlayer; + s16 yawTowardsPlayer = this->actor.yawTowardsPlayer; - yawTowardsPlayer = this->actor.yawTowardsPlayer; if (this->skelAnime.curFrame >= 26.0f) { Math_SmoothStepToS(&this->actor.shape.rot.y, yawTowardsPlayer, 1, 0x1770, 0); } @@ -1769,15 +1749,13 @@ void EnZf_SetupCirclePlayerIfFloor(EnZf* this, PlayState* play) { void EnZf_CirclePlayer(EnZf* this, PlayState* play) { s16 playerYaw; s16 yaw; - Player* player; + Player* player = GET_PLAYER(play); s32 prevFrame; s32 beforeCurFrame; s32 pad; - f32 extraRadius; + f32 extraRadius = 0.0f; f32 absPlaySpeed; - player = GET_PLAYER(play); - extraRadius = 0.0f; Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 1); playerYaw = player->actor.shape.rot.y; if (ENZF_IS_TYPE_PAIRED(this->actor.params)) { @@ -2109,7 +2087,7 @@ void EnZf_Update(Actor* thisx, PlayState* play) { } s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - EnZf* this = thisx; + EnZf* this = (EnZf*)thisx; switch (limbIndex) { case ZF_LIMB_HEAD_ROOT: @@ -2134,10 +2112,9 @@ s32 EnZf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnZf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { Vec3f sp54; Vec3f sp48; - s32 bodyPartIndex; - EnZf* this = thisx; + s32 bodyPartIndex = -1; + EnZf* this = (EnZf*)thisx; - bodyPartIndex = -1; if (limbIndex == ZF_LIMB_RIGHT_HAND_AND_SWORD) { Matrix_MultVec3f(&D_80B4A2BC, &this->swordCollider.dim.quad[1]); Matrix_MultVec3f(&D_80B4A2C8, &this->swordCollider.dim.quad[0]); @@ -2257,12 +2234,11 @@ void EnZf_SetupCirclePlayer(EnZf* this, f32 speed) { * @return true if an action was picked */ s32 EnZf_ReactToProjectile(PlayState* play, EnZf* this) { - Actor* projectile; + Actor* projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); s16 relYawTowardsProjectile; s16 noFloorAheadFlags; s16 directionFlags; - projectile = Actor_GetProjectileActor(play, &this->actor, 600.0f); if (projectile != NULL) { relYawTowardsProjectile = Actor_WorldYawTowardActor(&this->actor, projectile) - (s16)(this->actor.shape.rot.y + 0); 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 692825531ef..4915466e28a 100644 --- a/src/overlays/actors/ovl_En_Zf/z_en_zf.h +++ b/src/overlays/actors/ovl_En_Zf/z_en_zf.h @@ -17,6 +17,8 @@ typedef enum EnZfType { struct EnZf; +typedef void (*EnZfActionFunc)(struct EnZf*, struct PlayState*); + typedef struct EnZf { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; @@ -25,7 +27,7 @@ typedef struct EnZf { /* 0x3DC */ s32 action; /* 0x3E0 */ s32 unk_3E0; // unused /* 0x3E4 */ s32 actionState; - /* 0x3E8 */ void (*actionFunc)(struct EnZf*, struct PlayState*); + /* 0x3E8 */ EnZfActionFunc actionFunc; /* 0x3EC */ s16 headRot; /* 0x3EE */ s16 headRotStep; /* 0x3F0 */ s32 timer; From 54ae8262843ace0af4544c67569fdbe0d3aaeb3b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:42:32 +0200 Subject: [PATCH 115/150] EnTp cleanup --- src/overlays/actors/ovl_En_Tp/z_en_tp.c | 20 +++++++------------- src/overlays/actors/ovl_En_Tp/z_en_tp.h | 4 +++- 2 files changed, 10 insertions(+), 14 deletions(-) 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 fd4839d0791..f43b251c991 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -139,7 +139,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(lockOnArrowOffset, 10, ICHAIN_STOP), }; -void EnTp_SetupAction(EnTp* this, void (*actionFunc)(EnTp*, PlayState*)) { +void EnTp_SetupAction(EnTp* this, EnTpActionFunc actionFunc) { this->actionFunc = actionFunc; } @@ -248,9 +248,8 @@ void EnTp_Head_SetupAttack(EnTp* this) { } void EnTp_Head_Attack(EnTp* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); - player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 30.0f, 1.0f, 0.5f, 0.0f); SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EN_TAIL_FLY - SFX_FLAG); if (this->collider.base.atFlags & AT_HIT) { @@ -370,9 +369,8 @@ void EnTp_Head_SetupHover(EnTp* this) { void EnTp_Head_Hover(EnTp* this, PlayState* play) { s32 pad; - Player* player; + Player* player = GET_PLAYER(play); - player = GET_PLAYER(play); Math_SmoothStepToF(&this->actor.speed, 2.5f, 0.1f, 0.2f, 0.0f); // bodyElemDist_ is always 0 here Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->bodyElemDist, 1.0f, @@ -416,10 +414,9 @@ void EnTp_Head_SetupWaitPlayerAndRise(EnTp* this) { } void EnTp_Head_WaitPlayerAndRise(EnTp* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); s16 sp32; - player = GET_PLAYER(play); this->timer2--; if (this->actor.xzDistToPlayer < 200.0f) { if (this->collider.base.atFlags & AT_HIT) { @@ -474,11 +471,10 @@ void EnTp_Head_SinkIntoGroundAndReappear(EnTp* this, PlayState* play) { static Color_RGBA8 sBubbleEnvColor = { 150, 150, 150, 0 }; Vec3f bubbleVel; Vec3f bubblePos; - s32 isInsideGround; + s32 isInsideGround = false; EnTp* child; s16 new_var; //! FAKE - isInsideGround = false; this->timer2--; // timer is initialized to 0, // so this runs due to the pos.y check once the actor is deep enough under ground (see other "plunge" branch below) @@ -625,18 +621,16 @@ void EnTp_CheckCollide(EnTp* this, PlayState* play) { } void EnTp_Update(Actor* thisx, PlayState* play) { - Player* player; + EnTp* this = (EnTp*)thisx; s32 pad; Vec3f sparkVel = { 0.0f, 0.0f, 0.0f }; Vec3f sparkAccel = { 0.0f, -0.6f, 0.0f }; Vec3f sparkPos; Color_RGBA8 sparkPrimColor = { 0, 0, 255, 255 }; Color_RGBA8 sparkEnvColor = { 0, 0, 0, 0 }; - EnTp* this = (EnTp*)thisx; + Player* player = GET_PLAYER(play); s16 v; - player = GET_PLAYER(play); - if (player->stateFlags1 & PLAYER_STATE1_26) { this->unk_158 = ENTP_DMG_REACT_NO_EFFECT; } 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 642a2c0864e..0a89ee45c0d 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.h +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.h @@ -14,11 +14,13 @@ typedef enum EnTpType { struct EnTp; +typedef void (*EnTpActionFunc)(struct EnTp*, struct PlayState*); + typedef struct EnTp { /* 0x000 */ Actor actor; /* 0x14C */ s32 action; /* 0x150 */ s32 modeVar; - /* 0x154 */ void (*actionFunc)(struct EnTp*, struct PlayState*); + /* 0x154 */ EnTpActionFunc actionFunc; /* 0x158 */ u8 unk_158; /* 0x159 */ char pad_159[1]; /* 0x15A */ s16 timer; From 3e47017793c2d629b11d9b775239d70183c7af64 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:46:49 +0200 Subject: [PATCH 116/150] cleanup --- .../actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c | 2 +- .../actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h | 4 +++- src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h | 4 +++- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 4 +++- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 6 ++++-- src/overlays/actors/ovl_En_Jj/z_en_jj.h | 6 ++++-- 6 files changed, 18 insertions(+), 8 deletions(-) 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 488b9dbba2d..c8a9be4eb75 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 @@ -52,7 +52,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(cullingVolumeDownward, 2200, ICHAIN_STOP), }; -void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, void (*actionFunc)(BgSpot08Iceblock*, PlayState*)) { +void BgSpot08Iceblock_SetupAction(BgSpot08Iceblock* this, BgSpot08IceblockActionFunc actionFunc) { this->actionFunc = actionFunc; } diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h index c04398c3c06..68da72ac519 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.h @@ -6,9 +6,11 @@ struct BgSpot08Iceblock; +typedef void (*BgSpot08IceblockActionFunc)(struct BgSpot08Iceblock*, struct PlayState*); + typedef struct BgSpot08Iceblock { /* 0x000 */ DynaPolyActor dyna; - /* 0x164 */ void (*actionFunc)(struct BgSpot08Iceblock*, struct PlayState*); + /* 0x164 */ BgSpot08IceblockActionFunc actionFunc; /* 0x168 */ Vec3f unk_168; /* 0x174 */ Vec3f unk_174; /* 0x180 */ Vec3f swayAxis; diff --git a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h index 64d4448d981..9021f947f7a 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h +++ b/src/overlays/actors/ovl_Bg_Toki_Hikari/z_bg_toki_hikari.h @@ -11,10 +11,12 @@ typedef enum BgTokiHikariType { struct BgTokiHikari; +typedef void (*BgTokiHikariActionFunc)(struct BgTokiHikari*, struct PlayState*); + typedef struct BgTokiHikari { /* 0x000 */ Actor actor; /* 0x14C */ f32 triforceFlashIntensity; - /* 0x150 */ void (*actionFunc)(struct BgTokiHikari*, struct PlayState*); + /* 0x150 */ BgTokiHikariActionFunc actionFunc; } BgTokiHikari; // size = 0x154 #endif diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 6e05a9a3183..62588013766 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -14,6 +14,8 @@ typedef enum EnGe2Type { struct EnGe2; +typedef void (*EnGe2ActionFunc)(struct EnGe2*, struct PlayState*); + typedef struct EnGe2 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; @@ -35,7 +37,7 @@ typedef struct EnGe2 { /* 0x305 */ u8 timer; /* 0x306 */ u8 playerNoise; /* 0x307 */ char pad307[1]; - /* 0x308 */ void (*actionFunc)(struct EnGe2*, struct PlayState*); + /* 0x308 */ EnGe2ActionFunc actionFunc; } EnGe2; // size = 0x30C #endif diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index cf587a9fd08..d46017ac190 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -6,6 +6,8 @@ struct EnGe3; +typedef void (*EnGe3ActionFunc)(struct EnGe3*, struct PlayState*); + typedef struct EnGe3 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; @@ -17,8 +19,8 @@ typedef struct EnGe3 { /* 0x300 */ Vec3s headRot; /* 0x306 */ Vec3s torsoRot; /* 0x30C */ u16 stateFlags; - /* 0x30E */ char pad30E[2]; - /* 0x310 */ void (*actionFunc)(struct EnGe3*, struct PlayState*); + /* 0x30E */ char pad_30E[2]; + /* 0x310 */ EnGe3ActionFunc actionFunc; } EnGe3; // size = 0x314 #endif 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 985ab61afa3..6af4ad4bcc6 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -14,13 +14,15 @@ typedef enum EnJjType { struct EnJj; +typedef void (*EnJjActionFunc)(struct EnJj*, struct PlayState*); + typedef struct EnJj { /* 0x000 */ DynaPolyActor dyna; /* 0x164 */ SkelAnime skelAnime; /* 0x1A8 */ Vec3s jointTable[OBJECT_JJ_LIMB_MAX]; /* 0x22C */ Vec3s morphTable[OBJECT_JJ_LIMB_MAX]; /* 0x2B0 */ ColliderCylinder collider; - /* 0x2FC */ void (*actionFunc)(struct EnJj*, struct PlayState*); + /* 0x2FC */ EnJjActionFunc actionFunc; /* 0x300 */ struct EnJj* headCol; /* 0x304 */ Actor* effDust; /* 0x308 */ s16 headRot; @@ -30,7 +32,7 @@ typedef struct EnJj { /* 0x30F */ u8 eyeTimer; /* 0x310 */ u8 eyeExtraBlinkAmount; /* 0x311 */ u8 nextEyeExtraBlinkAmount; - /* 0x312 */ char pad312[2]; + /* 0x312 */ char pad_312[2]; } EnJj; // size = 0x314 #endif From a093030a2c9fef8adb5cbe5a483521e5fae84802 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:52:08 +0200 Subject: [PATCH 117/150] cleanup --- .../ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c | 6 ++---- src/overlays/actors/ovl_En_Ge2/z_en_ge2.c | 10 ++++------ src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 4 ++-- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 10 ++++------ 4 files changed, 12 insertions(+), 18 deletions(-) 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 c8a9be4eb75..cb3c08eb03d 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 @@ -239,11 +239,9 @@ void BgSpot08Iceblock_UpdateSwaying(BgSpot08Iceblock* this, PlayState* play) { void BgSpot08Iceblock_SetupIcebergDuo(BgSpot08Iceblock* this, PlayState* play) { s32 pad[2]; - f32 dx; - f32 dz; + f32 dx = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; + f32 dz = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; - dx = Math_SinS(this->dyna.actor.home.rot.y) * 100.0f; - dz = Math_CosS(this->dyna.actor.home.rot.y) * 100.0f; 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, 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 e81324a9bcd..26c7343a022 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -393,10 +393,9 @@ void EnGe2_Static(EnGe2* this, PlayState* play) { } void EnGe2_TrackPlayer(EnGe2* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s32 pad; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(relYawTowardsPlayer) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -413,9 +412,8 @@ void EnGe2_TrackPlayer(EnGe2* this, PlayState* play) { } void EnGe2_TrackPlayerIfNear(EnGe2* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 200.0f)) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { @@ -612,7 +610,7 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) { } s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnGe2* this = thisx; + EnGe2* this = (EnGe2*)thisx; if (limbIndex == OBJECT_GLA_LIMB_HEAD_ROOT) { rot->x += this->headRot.y; @@ -623,7 +621,7 @@ s32 EnGe2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p void EnGe2_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { static Vec3f sFocusOffset = { 600.0f, 700.0f, 0.0f }; - EnGe2* this = thisx; + EnGe2* this = (EnGe2*)thisx; if (limbIndex == OBJECT_GLA_LIMB_HEAD) { Matrix_MultVec3f(&sFocusOffset, &this->actor.focus.pos); diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 62588013766..9aa45de4434 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -29,14 +29,14 @@ typedef struct EnGe2 { /* 0x2F4 */ u16 stateFlags; /* 0x2F6 */ s16 targetYaw; /* 0x2F8 */ s16 patrolAlertedYaw; - /* 0x2FA */ char pad2FA[2]; + /* 0x2FA */ char pad_2FA[2]; /* 0x2FC */ f32 detectionYRange; /* 0x300 */ u16 patrolTime; /* 0x302 */ u16 patrolTimer; /* 0x304 */ s8 unk_304; // unused /* 0x305 */ u8 timer; /* 0x306 */ u8 playerNoise; - /* 0x307 */ char pad307[1]; + /* 0x307 */ char pad_307[1]; /* 0x308 */ EnGe2ActionFunc actionFunc; } EnGe2; // size = 0x30C diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 4e72cbd4c18..a5ebbf94775 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -104,10 +104,9 @@ void EnGe3_Destroy(Actor* thisx, PlayState* play) { } void EnGe3_TrackPlayer(EnGe3* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s32 pad; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(relYawTowardsPlayer) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -124,9 +123,8 @@ void EnGe3_TrackPlayer(EnGe3* this, PlayState* play) { } void EnGe3_TrackPlayerIfNear(EnGe3* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(relYawTowardsPlayer) <= 0x2300) && (this->actor.xzDistToPlayer < 100.0f)) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { @@ -231,7 +229,7 @@ void EnGe3_UpdateTalking(Actor* thisx, PlayState* play) { } s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnGe3* this = thisx; + EnGe3* this = (EnGe3*)thisx; switch (limbIndex) { case 5: @@ -277,7 +275,7 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p } void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnGe3* this = thisx; + EnGe3* this = (EnGe3*)thisx; Vec3f focusOffset = { 600.0f, 700.0f, 0.0f }; if (limbIndex == 6) { From 9fb5881589675d797703e710d20deb379e16d222 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 18:56:14 +0200 Subject: [PATCH 118/150] cleanup EnFirefly --- src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) 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 32ad890f3a3..fa61d2368bd 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -349,15 +349,12 @@ s32 EnFirefly_ApproachPerchSpot(EnFirefly* this, PlayState* play) { } s32 EnFirefly_ApproachLitTorch(EnFirefly* this, PlayState* play) { - Actor* iter; - f32 closestLitTorchDist; + Actor* iter = play->actorCtx.actorLists[ACTORCAT_PROP].head; + Actor* closestLitTorch = NULL; + f32 closestLitTorchDist = 35000.0f; f32 dist; - Actor* closestLitTorch; Vec3f torchFlamePos; - iter = play->actorCtx.actorLists[ACTORCAT_PROP].head; - closestLitTorch = NULL; - closestLitTorchDist = 35000.0f; while (iter != NULL) { if ((iter->id == ACTOR_OBJ_SYOKUDAI) && (((ObjSyokudai*)iter)->litTimer != 0)) { dist = Actor_WorldDistXYZToActor(&this->actor, iter); @@ -726,7 +723,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { s32 EnFirefly_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - EnFirefly* this = thisx; + EnFirefly* this = (EnFirefly*)thisx; if ((this->actor.draw == EnFirefly_DrawXlu) && !play->actorCtx.lensActive) { *dList = NULL; @@ -749,7 +746,7 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Color_RGBA8* effEnvColor; Color_RGBA8* effPrimColor; MtxF mf; - EnFirefly* this = thisx; + EnFirefly* this = (EnFirefly*)thisx; s16 effScaleStep; s16 effLife; From 98ea1c6583d6e1fb074cf57a4c3fd6fc8245e427 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 19:01:15 +0200 Subject: [PATCH 119/150] bowling things cleanup --- src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c | 3 +-- src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 1fee0dfa891..8d49d1ecdc4 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -61,9 +61,8 @@ static s16 sWallRots[4] = { void BgBowlWall_Init(Actor* thisx, PlayState* play) { BgBowlWall* this = (BgBowlWall*)thisx; s32 pad1[2]; - CollisionHeader* colHeader; + CollisionHeader* colHeader = NULL; - colHeader = NULL; DynaPolyActor_Init(&this->dyna, 0); if (this->dyna.actor.params == BG_BOWL_WALL_TYPE_FIRST_WALL) { CollisionHeader_GetVirtual(&gBowlingFirstWallCol, &colHeader); 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 f2b3cb1f4ce..2b602047294 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 @@ -148,9 +148,8 @@ void EnBomBowlMan_SetupWakingUpTalking(EnBomBowlMan* this, PlayState* play) { } void EnBomBowlMan_WakingUpTalking(EnBomBowlMan* this, PlayState* play) { - f32 prevFrame; + f32 prevFrame = this->skelAnime.curFrame; - prevFrame = this->skelAnime.curFrame; SkelAnime_Update(&this->skelAnime); if (prevFrame == 30.0f) { this->waitMessageState = TEXT_STATE_EVENT; @@ -493,7 +492,7 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) { } s32 EnBomBowlMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnBomBowlMan* this = thisx; + EnBomBowlMan* this = (EnBomBowlMan*)thisx; if (limbIndex == BOWLING_GIRL_LIMB_HEAD) { rot->x += this->headRot.y; From f0cdc81aa7e6f24487e162fd88f08c18e3263132 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 19:04:28 +0200 Subject: [PATCH 120/150] cleanup --- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 ++-- src/overlays/actors/ovl_En_Tr/z_en_tr.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 33bc36ea3ef..28f7b406327 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -725,7 +725,7 @@ void EnGe1_PlayAnimOnce(EnGe1* this) { } s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { - EnGe1* this = thisx; + EnGe1* this = (EnGe1*)thisx; s32 pad; if (limbIndex == OBJECT_GE1_LIMB_HEAD) { @@ -745,7 +745,7 @@ s32 EnGe1_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p } void EnGe1_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - EnGe1* this = thisx; + EnGe1* this = (EnGe1*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_ge1.c", 1419); if (limbIndex == OBJECT_GE1_LIMB_HEAD) { diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index 83ec7ce83a7..2bc88ae6be0 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -415,7 +415,7 @@ void EnTr_Update(Actor* thisx, PlayState* play) { s32 EnTr_OverrideLimbDraw(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg4, void* thisx) { Vec3f sp34; Vec3f sp28; - EnTr* this = thisx; + EnTr* this = (EnTr*)thisx; Actor* sp20; sp34 = D_80B243DC; From 1a4d96464da935ac3dc1d670f5b60c90f7c1d52f Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 19:05:08 +0200 Subject: [PATCH 121/150] biri cleanup --- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 ec927b17757..bdd99bbf3b8 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -668,7 +668,7 @@ void EnBili_GetTentaclesLimbScale(EnBili* this, f32 frame, Vec3f* scale) { s32 EnBili_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - EnBili* this = thisx; + EnBili* this = (EnBili*)thisx; Vec3f scale = { 1.0f, 1.0f, 1.0f }; f32 animCurFrame = this->skelAnime.curFrame; From 2f505862ab09c4f13b3215a8c7a92e99427b97b9 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 16 Aug 2026 19:05:19 +0200 Subject: [PATCH 122/150] bari cleanup --- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 7df92b37e0b..875755b65b6 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -674,7 +674,7 @@ s32 EnVali_UpdateTentaclesLengthFactor(EnVali* this, f32 frame) { s32 EnVali_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { - EnVali* this = thisx; + EnVali* this = (EnVali*)thisx; f32 animCurFrame; if ((limbIndex == BARI_LIMB_NUCLEUS) || (limbIndex == BARI_LIMB_HOOD) || (limbIndex == BARI_LIMB_CORE)) { @@ -695,7 +695,7 @@ void EnVali_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot static Vec3f D_80B2897C = { -1000.0f, 0.0f, 0.0f }; Vec3f tentacleTipPos; Vec3f tentacleBasePos; - EnVali* this = thisx; + EnVali* this = (EnVali*)thisx; if (this->actionFunc == EnVali_Spin) { switch (limbIndex) { From c5b061bda31f872737ee0ff7c785d6598f68d53f Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 16:37:39 +0200 Subject: [PATCH 123/150] biri: merge var ini with decl --- src/overlays/actors/ovl_En_Bili/z_en_bili.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 bdd99bbf3b8..aadba0eb83c 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -370,11 +370,9 @@ void EnBili_Electrify(EnBili* this, PlayState* play) { } void EnBili_AscendAway(EnBili* this, PlayState* play) { - s32 animFinished; - f32 animCurFrame; + s32 animFinished = SkelAnime_Update(&this->skelAnime); + f32 animCurFrame = this->skelAnime.curFrame; - animFinished = SkelAnime_Update(&this->skelAnime); - animCurFrame = this->skelAnime.curFrame; if (Animation_OnFrame(&this->skelAnime, 9.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EN_BIRI_JUMP); } From 58203a8c6c11ac44d2adac948041a20ca0b1b07a Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 16:49:16 +0200 Subject: [PATCH 124/150] bari cleanup --- src/overlays/actors/ovl_En_Vali/z_en_vali.c | 55 ++++++--------------- 1 file changed, 14 insertions(+), 41 deletions(-) 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 875755b65b6..290ace14425 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -196,48 +196,22 @@ void EnVali_SetupAppear(EnVali* this) { } void EnVali_SetupSpin(EnVali* this) { - Vec3f sp84; - Vec3f sp78; - Vec3f sp6C; - Vec3f sp60; - Vec3f sp54; - Vec3f sp48; - Vec3f sp3C; - f32 temp_fv0; - f32 temp_fv1; - s32 pad[6]; - Animation_MorphToLoop(&this->skelAnime, &gBariAttackAnim, -3.0f); - sp3C = this->actor.world.pos; - this->rightTentacleCollider.dim.quad[1] = sp3C; - sp48 = sp3C; - this->rightTentacleCollider.dim.quad[0] = sp48; - sp54 = sp48; - this->leftTentacleCollider.dim.quad[1] = sp54; - sp60 = sp54; - this->leftTentacleCollider.dim.quad[0] = sp60; - sp6C = sp60; - this->rightTentacleCollider.dim.quad[3] = sp6C; - sp78 = sp6C; - this->rightTentacleCollider.dim.quad[2] = sp78; - sp84 = sp78; - this->leftTentacleCollider.dim.quad[3] = sp84; - temp_fv1 = this->actor.world.pos.y; - temp_fv0 = temp_fv1 - 10.0f; - this->leftTentacleCollider.dim.quad[2] = sp84; - this->leftTentacleCollider.dim.quad[2].y = temp_fv0; - this->leftTentacleCollider.dim.quad[3].y = temp_fv0; - this->rightTentacleCollider.dim.quad[2].y = temp_fv0; - this->rightTentacleCollider.dim.quad[3].y = temp_fv0; - this->leftTentacleCollider.dim.quad[0].y = temp_fv0; - this->leftTentacleCollider.dim.quad[1].y = temp_fv0; - this->rightTentacleCollider.dim.quad[0].y = temp_fv0; - this->rightTentacleCollider.dim.quad[1].y = temp_fv0; + this->leftTentacleCollider.dim.quad[2] = this->leftTentacleCollider.dim.quad[3] = + this->rightTentacleCollider.dim.quad[2] = this->rightTentacleCollider.dim.quad[3] = + this->leftTentacleCollider.dim.quad[0] = this->leftTentacleCollider.dim.quad[1] = + this->rightTentacleCollider.dim.quad[0] = this->rightTentacleCollider.dim.quad[1] = + this->actor.world.pos; + this->leftTentacleCollider.dim.quad[2].y = this->leftTentacleCollider.dim.quad[3].y = + this->rightTentacleCollider.dim.quad[2].y = this->rightTentacleCollider.dim.quad[3].y = + this->leftTentacleCollider.dim.quad[0].y = this->leftTentacleCollider.dim.quad[1].y = + this->rightTentacleCollider.dim.quad[0].y = this->rightTentacleCollider.dim.quad[1].y = + this->actor.world.pos.y - 10.0f; this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; this->collider.base.acFlags |= AC_ON; this->spinTimer = 0; this->actionFunc = EnVali_Spin; - this->spinHeight = temp_fv1; + this->spinHeight = this->actor.world.pos.y; } void EnVali_SetupElectrify(EnVali* this) { @@ -506,11 +480,10 @@ void EnVali_Bury(EnVali* this, PlayState* play) { } void EnVali_CheckCollide(EnVali* this, PlayState* play) { - if ((this->collider.base.acFlags & AC_HIT)) { + if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - if (((Actor_SetDropFlag(&this->actor, &this->collider.elem, true), - (this->actor.colChkInfo.damageReaction != EN_VALI_DMG_REACT_NONE)) || - (this->actor.colChkInfo.damage != 0))) { + Actor_SetDropFlag(&this->actor, &this->collider.elem, true); + if ((this->actor.colChkInfo.damageReaction != EN_VALI_DMG_REACT_NONE) || (this->actor.colChkInfo.damage != 0)) { if (Actor_ApplyDamage(&this->actor) == 0) { Actor_PlaySfx(&this->actor, NA_SE_EN_BARI_DEAD); Enemy_StartFinishingBlow(play, &this->actor); From 905523ccf6676f34015353975eff2b0c79a13d80 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 16:53:02 +0200 Subject: [PATCH 125/150] bgdyyoseizo comment on D_80875440 --- src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 1 + 1 file changed, 1 insertion(+) 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 bd3f215143f..ed834a22036 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 @@ -73,6 +73,7 @@ typedef enum BgDyYoseizoRewardMagic { BG_DY_YOSEIZO_REWARD_MAGIC_DOUBLE_DEFENSE } BgDyYoseizoRewardMagic; +// This unused data is probably { GI_FARORES_WIND, GI_NAYRUS_LOVE, GI_DINS_FIRE } static s32 D_80875440[3] = { 0x5D, 0x5E, 0x5C }; ActorProfile Bg_Dy_Yoseizo_Profile = { From d255b3687e996faff95efabed95d1f655172e79e Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 17:01:05 +0200 Subject: [PATCH 126/150] dekubaba: more cleanup --- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 42 +++++++++---------- .../actors/ovl_En_Dekubaba/z_en_dekubaba.h | 4 +- 2 files changed, 23 insertions(+), 23 deletions(-) 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 79f7567bf05..90db291f26f 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -156,7 +156,7 @@ typedef enum EnDekubabaDamageReaction { EN_DEKUBABA_DMG_REACT_SWORD } EnDekubabaDamageReaction; -static DamageTable D_809E8FE0 = { +static DamageTable sDamageTableNormal = { /* Deku nut */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_STUN), /* Deku stick */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), /* Slingshot */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_NONE), @@ -191,7 +191,7 @@ static DamageTable D_809E8FE0 = { /* Unknown 2 */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_NONE), }; -static DamageTable D_809E9000 = { +static DamageTable sDamageTableBig = { /* Deku nut */ DMG_ENTRY(0, EN_DEKUBABA_DMG_REACT_STUN), /* Deku stick */ DMG_ENTRY(2, EN_DEKUBABA_DMG_REACT_NONE), /* Slingshot */ DMG_ENTRY(1, EN_DEKUBABA_DMG_REACT_NONE), @@ -240,28 +240,28 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { DEKUBABA_HEAD_LIMB_MAX); Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); - if (this->actor.params == EN_DEKUBABA_TYPE_1) { + if (this->actor.params == EN_DEKUBABA_TYPE_BIG) { this->scaleFac = 2.50f; for (i = 0; i < sJntSphInit.count; i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius = sJntSphElementsInit[i].dim.modelSphere.radius * 2.5f; } if (!LINK_IS_ADULT) { - D_809E9000.table[27] = 4; + sDamageTableBig.table[27] = 4; } - CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E9000, &sColChkInfoInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableBig, &sColChkInfoInit); this->actor.colChkInfo.health = 4; this->actor.naviEnemyId = NAVI_ENEMY_BIG_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_2; - } else { + } else { // EN_DEKUBABA_TYPE_NORMAL this->scaleFac = 1.0f; for (i = 0; i < sJntSphInit.count; i++) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } if (!LINK_IS_ADULT) { - D_809E8FE0.table[27] = 4; + sDamageTableNormal.table[27] = 4; } - CollisionCheck_SetInfo(&this->actor.colChkInfo, &D_809E8FE0, &sColChkInfoInit); + CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableNormal, &sColChkInfoInit); this->actor.naviEnemyId = NAVI_ENEMY_DEKU_BABA; this->actor.attentionRangeType = ATTENTION_RANGE_1; } @@ -280,7 +280,7 @@ void EnDekubaba_Destroy(Actor* thisx, PlayState* play) { void EnDekubaba_DisableStemColliderAC(EnDekubaba* this) { s32 i; - for (i = 1; i < 7; i++) { + for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].base.acElemFlags &= ~ACELEM_ON; } } @@ -297,7 +297,7 @@ void EnDekubaba_SetupWaitPlayerNear(EnDekubaba* this) { this->collider.base.colMaterial = COL_MATERIAL_HARD; this->collider.base.acFlags |= AC_HARD; this->actionState = 45; - for (i = 1; i < 7; i++) { + for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { elem = &this->collider.elements[i]; elem->dim.worldSphere.center.x = this->actor.world.pos.x; elem->dim.worldSphere.center.y = (s16)this->actor.world.pos.y - 7; @@ -312,7 +312,7 @@ void EnDekubaba_SetupExitGround(EnDekubaba* this) { Animation_Change(&this->skelAnime, &gDekubabaChompAnim, Animation_GetLastFrame(&gDekubabaChompAnim) * 0.06666667f, 0.0f, Animation_GetLastFrame(&gDekubabaChompAnim), ANIMMODE_ONCE, 0.0f); this->actionState = 15; - for (i = 2; i < 7; i++) { + for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].base.ocElemFlags |= OCELEM_ON; } this->collider.base.colMaterial = COL_MATERIAL_HIT6; @@ -327,7 +327,7 @@ void EnDekubaba_SetupEnterGround(EnDekubaba* this) { Animation_Change(&this->skelAnime, &gDekubabaChompAnim, -1.5f, Animation_GetLastFrame(&gDekubabaChompAnim), 0.0f, ANIMMODE_ONCE, -3.0f); this->actionState = 15; - for (i = 2; i < 7; i++) { + for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].base.ocElemFlags &= ~OCELEM_ON; } this->actionFunc = EnDekubaba_EnterGround; @@ -406,7 +406,7 @@ void EnDekubaba_SetupDie(EnDekubaba* this) { void EnDekubaba_SetupVulnerable(EnDekubaba* this) { s32 i; - for (i = 1; i < 7; i++) { + for (i = 1; i < ARRAY_COUNT(this->colliderElements); i++) { this->collider.elements[i].base.acElemFlags |= ACELEM_ON; } if (this->actionState == EN_DEKUBABA_ATTACKED_TYPE_WEAKENED) { @@ -589,7 +589,7 @@ void EnDekubaba_ChompAir(EnDekubaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - if (this->actor.params == EN_DEKUBABA_TYPE_1) { + if (this->actor.params == EN_DEKUBABA_TYPE_BIG) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_MOUTH); @@ -635,7 +635,7 @@ void EnDekubaba_Attack(EnDekubaba* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (this->actionState == 0) { if (Animation_OnFrame(&this->skelAnime, 1.0f)) { - if (this->actor.params == EN_DEKUBABA_TYPE_1) { + if (this->actor.params == EN_DEKUBABA_TYPE_BIG) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_ATTACK); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_ATTACK); @@ -665,7 +665,7 @@ void EnDekubaba_Attack(EnDekubaba* this, PlayState* play) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 15, 0x71C); } if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { - if (this->actor.params == EN_DEKUBABA_TYPE_1) { + if (this->actor.params == EN_DEKUBABA_TYPE_BIG) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_MOUTH); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_MOUTH); @@ -901,10 +901,10 @@ void EnDekubaba_Die(EnDekubaba* this, PlayState* play) { func_800286CC(play, &this->actor.home.pos, &sZeroVec, &sZeroVec, this->scaleFac * 500.0f, this->scaleFac * 100.0f); if (this->actor.dropFlag == 0) { - Item_DropCollectible(play, &this->actor.world.pos, 0xC); - if (this->actor.params == EN_DEKUBABA_TYPE_1) { - Item_DropCollectible(play, &this->actor.world.pos, 0xC); - Item_DropCollectible(play, &this->actor.world.pos, 0xC); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); + if (this->actor.params == EN_DEKUBABA_TYPE_BIG) { + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_NUTS); } } else { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, @@ -999,7 +999,7 @@ void EnDekubaba_CheckCollide(EnDekubaba* this, PlayState* play) { } } else { Enemy_StartFinishingBlow(play, &this->actor); - if (this->actor.params == EN_DEKUBABA_TYPE_1) { + if (this->actor.params == EN_DEKUBABA_TYPE_BIG) { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_DEAD); } else { Actor_PlaySfx(&this->actor, NA_SE_EN_DEKU_JR_DEAD); 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 be99d233ed3..bec8ae11f8d 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.h @@ -7,8 +7,8 @@ #include "assets/objects/object_dekubaba/object_dekubaba.h" typedef enum EnDekubabaType { - EN_DEKUBABA_TYPE_0, - EN_DEKUBABA_TYPE_1 + EN_DEKUBABA_TYPE_NORMAL, + EN_DEKUBABA_TYPE_BIG } EnDekubabaType; struct EnDekubaba; From 0452b58284555d8acd2f1c76c533dfe377dba631 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 17:02:25 +0200 Subject: [PATCH 127/150] keese cleanup --- src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fa61d2368bd..f7ec75f2af2 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -802,7 +802,7 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* void EnFirefly_DrawOpa(Actor* thisx, PlayState* play) { EnFirefly* this = (EnFirefly*)thisx; - OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 0x6C5); + OPEN_DISPS(play->state.gfxCtx, "../z_en_firefly.c", 1733); Gfx_SetupDL_25Opa(play->state.gfxCtx); if (this->bodyElementalType != EN_FIREFLY_BODY_ELEMENTAL_TYPE_NORMAL) { gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); From 0f838b9b54075db95c3bb6db63ae1210f8c36ae4 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 17:17:31 +0200 Subject: [PATCH 128/150] use ITEM00_ enum in Item_DropCollectible --- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 2 +- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 4 ++-- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index ac3482c92ee..7f741f59ba2 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -498,7 +498,7 @@ void EnDns_PostBurrow(EnDns* this, PlayState* play) { sp38.y = this->unk2C4; sp38.z = this->actor.world.pos.z; for (var_s0 = 0; var_s0 < 3; var_s0++) { - Item_DropCollectible(play, &sp38, 3); + Item_DropCollectible(play, &sp38, ITEM00_RECOVERY_HEART); } } Actor_Kill(&this->actor); 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 f9c6aa4583d..f00f9a073f2 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -144,9 +144,9 @@ void func_80A9B07C(EnKusa* this, PlayState* play) { break; case ENKUSA_TYPE_1: if (Rand_ZeroOne() < 0.5f) { - Item_DropCollectible(play, &this->actor.world.pos, 0x10); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SEEDS); } else { - Item_DropCollectible(play, &this->actor.world.pos, 3); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RECOVERY_HEART); } break; } 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 f6a66ef324f..49c5d80e221 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -442,11 +442,11 @@ void EnSkb_Death(EnSkb* this, PlayState* play) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, COLLECTIBLE_DROP_RANDOM_PARAMS(COLLECTIBLE_DROP_TABLE_1, false)); } else if (this->actor.scale.x <= 0.015f) { - Item_DropCollectible(play, &this->actor.world.pos, 1); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_BLUE); } else { - Item_DropCollectible(play, &this->actor.world.pos, 2); - Item_DropCollectible(play, &this->actor.world.pos, 2); - Item_DropCollectible(play, &this->actor.world.pos, 2); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); + Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); } this->breakFlags |= 8; Actor_Kill(&this->actor); From 12473c96d75ea6e3ecadfd2623fc69b1480418c3 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 17:44:55 +0200 Subject: [PATCH 129/150] dekubaba more cleanup --- .../actors/ovl_En_Dekubaba/z_en_dekubaba.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 90db291f26f..aafc09a00c1 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -247,7 +247,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { sJntSphElementsInit[i].dim.modelSphere.radius * 2.5f; } if (!LINK_IS_ADULT) { - sDamageTableBig.table[27] = 4; + sDamageTableBig.table[27] = DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_NONE); } CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableBig, &sColChkInfoInit); this->actor.colChkInfo.health = 4; @@ -259,7 +259,7 @@ void EnDekubaba_Init(Actor* thisx, PlayState* play) { this->collider.elements[i].dim.worldSphere.radius = this->collider.elements[i].dim.modelSphere.radius; } if (!LINK_IS_ADULT) { - sDamageTableNormal.table[27] = 4; + sDamageTableNormal.table[27] = DMG_ENTRY(4, EN_DEKUBABA_DMG_REACT_NONE); } CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTableNormal, &sColChkInfoInit); this->actor.naviEnemyId = NAVI_ENEMY_DEKU_BABA; @@ -309,7 +309,7 @@ void EnDekubaba_SetupWaitPlayerNear(EnDekubaba* this) { void EnDekubaba_SetupExitGround(EnDekubaba* this) { s32 i; - Animation_Change(&this->skelAnime, &gDekubabaChompAnim, Animation_GetLastFrame(&gDekubabaChompAnim) * 0.06666667f, + Animation_Change(&this->skelAnime, &gDekubabaChompAnim, Animation_GetLastFrame(&gDekubabaChompAnim) * (1.0f / 15), 0.0f, Animation_GetLastFrame(&gDekubabaChompAnim), ANIMMODE_ONCE, 0.0f); this->actionState = 15; for (i = 2; i < ARRAY_COUNT(this->colliderElements); i++) { @@ -476,7 +476,7 @@ void EnDekubaba_ExitGround(EnDekubaba* this, PlayState* play) { this->scaleFac * 0.01f * (0.5f + (((15 - this->actionState) * 0.5f) / 15.0f)); Math_ScaledStepToS(&this->actor.shape.rot.x, 0x1800, 0x800); - dy = (sinf(CLAMP_MAX(((15 - this->actionState)) * 0.06666667014f, 0.7f) * 3.1415927f) * 32.0f) + 14.0f; + dy = (sinf(CLAMP_MAX(((15 - this->actionState)) * (1.0f / 15), 0.7f) * M_PI) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { dxz = 0.0f; @@ -534,7 +534,7 @@ void EnDekubaba_EnterGround(EnDekubaba* this, PlayState* play) { } SkelAnime_Update(&this->skelAnime); this->actor.scale.x = this->actor.scale.y = this->actor.scale.z = - this->scaleFac * 0.01f * (0.5f + (this->actionState * 0.033333335f)); + this->scaleFac * 0.01f * (0.5f + (this->actionState * (1.0f / 30))); Math_ScaledStepToS(&this->actor.shape.rot.x, -0x4000, 0x300); dy = (sinf(CLAMP_MAX(this->actionState * 0.033f, 0.7f) * M_PI) * 32.0f) + 14.0f; if (this->actor.shape.rot.x < -0x38E3) { @@ -930,7 +930,7 @@ void EnDekubaba_DekuStick(EnDekubaba* this, PlayState* play) { } void EnDekubaba_CheckCollide(EnDekubaba* this, PlayState* play) { - f32 new_var2; + f32 scale; s32 newHealth; s32 i; @@ -974,9 +974,9 @@ void EnDekubaba_CheckCollide(EnDekubaba* this, PlayState* play) { this->actor.colChkInfo.health = newHealth; } if (this->actor.colChkInfo.damageReaction == EN_DEKUBABA_DMG_REACT_FIRE) { - new_var2 = this->scaleFac * 70.0f; + scale = this->scaleFac * 70.0f; for (i = 0; i < 4; i++) { - EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, new_var2, 0, 0, i); + EffectSsEnFire_SpawnVec3f(play, &this->actor, &this->actor.world.pos, scale, 0, 0, i); } } } else { From 24601dd7d613ba3ed1bb44d0cdea3d33965aff32 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sat, 29 Aug 2026 21:55:01 +0200 Subject: [PATCH 130/150] gfxP --- include/vis.h | 6 +++--- src/code/game.c | 12 ++++++------ src/code/z_viscvg.c | 6 +++--- src/code/z_vismono.c | 6 +++--- src/code/z_viszbuffer.c | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/vis.h b/include/vis.h index 50a902e0040..be57ad6e397 100644 --- a/include/vis.h +++ b/include/vis.h @@ -52,14 +52,14 @@ typedef struct VisZBuffer { void VisCvg_Init(VisCvg* this); void VisCvg_Destroy(VisCvg* this); -void VisCvg_Draw(VisCvg* this, Gfx** gfxp); +void VisCvg_Draw(VisCvg* this, Gfx** gfxP); void VisMono_Init(VisMono* this); void VisMono_Destroy(VisMono* this); -void VisMono_Draw(VisMono* this, Gfx** gfxp); +void VisMono_Draw(VisMono* this, Gfx** gfxP); void VisZBuffer_Init(VisZBuffer* this); void VisZBuffer_Destroy(VisZBuffer* this); -void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp); +void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxP); #endif diff --git a/src/code/game.c b/src/code/game.c index e24d51f3ca0..9b04a4ad944 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -58,8 +58,8 @@ void GameState_FaultPrint(void) { } #endif -void GameState_SetFBFilter(Gfx** gfx) { - Gfx* gfxP = *gfx; +void GameState_SetFBFilter(Gfx** gfxP) { + Gfx* gfx = *gfxP; if ((R_FB_FILTER_TYPE >= FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_FB) && (R_FB_FILTER_TYPE <= FB_FILTER_TYPE_VISCVG_TYPE_MODULATE_FB_ADDITIVE_COLOR)) { @@ -68,7 +68,7 @@ void GameState_SetFBFilter(Gfx** gfx) { sGameStateVisCvg.params.color1.g = R_FB_FILTER_COLOR1(1); sGameStateVisCvg.params.color1.b = R_FB_FILTER_COLOR1(2); sGameStateVisCvg.params.color1.a = R_FB_FILTER_A; - VisCvg_Draw(&sGameStateVisCvg, &gfxP); + VisCvg_Draw(&sGameStateVisCvg, &gfx); } else if ((R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISZBUFFER_AS_IA16) || (R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISZBUFFER_AS_RGBA16)) { sGameStateVisZBuffer.params.type = (R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISZBUFFER_AS_RGBA16); @@ -80,7 +80,7 @@ void GameState_SetFBFilter(Gfx** gfx) { sGameStateVisZBuffer.params.color2.g = R_FB_FILTER_COLOR2(1); sGameStateVisZBuffer.params.color2.b = R_FB_FILTER_COLOR2(2); sGameStateVisZBuffer.params.color2.a = R_FB_FILTER_A; - VisZBuffer_Draw(&sGameStateVisZBuffer, &gfxP); + VisZBuffer_Draw(&sGameStateVisZBuffer, &gfx); } else if (R_FB_FILTER_TYPE == FB_FILTER_TYPE_VISMONO) { sGameStateVisMono.params.type = 0; sGameStateVisMono.params.color1.r = R_FB_FILTER_COLOR1(0); @@ -91,9 +91,9 @@ void GameState_SetFBFilter(Gfx** gfx) { sGameStateVisMono.params.color2.g = R_FB_FILTER_COLOR2(1); sGameStateVisMono.params.color2.b = R_FB_FILTER_COLOR2(2); sGameStateVisMono.params.color2.a = R_FB_FILTER_A; - VisMono_Draw(&sGameStateVisMono, &gfxP); + VisMono_Draw(&sGameStateVisMono, &gfx); } - *gfx = gfxP; + *gfxP = gfx; } void func_800C4344(GameState* gameState) { diff --git a/src/code/z_viscvg.c b/src/code/z_viscvg.c index f86417c90b2..236c0c052f2 100644 --- a/src/code/z_viscvg.c +++ b/src/code/z_viscvg.c @@ -71,8 +71,8 @@ void VisCvg_Init(VisCvg* this) { void VisCvg_Destroy(VisCvg* this) { } -void VisCvg_Draw(VisCvg* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; +void VisCvg_Draw(VisCvg* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; gDPPipeSync(gfx++); // Set full dz, see comment in PreRender_FetchFbufCoverage for details. @@ -104,5 +104,5 @@ void VisCvg_Draw(VisCvg* this, Gfx** gfxp) { } gDPPipeSync(gfx++); - *gfxp = gfx; + *gfxP = gfx; } diff --git a/src/code/z_vismono.c b/src/code/z_vismono.c index ffe1fe7111b..bd7950781fe 100644 --- a/src/code/z_vismono.c +++ b/src/code/z_vismono.c @@ -143,8 +143,8 @@ Gfx* VisMono_DesaturateDList(VisMono* this, Gfx* gfx) { return gfx; } -void VisMono_Draw(VisMono* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; +void VisMono_Draw(VisMono* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; u16* tlut; Gfx* dList; Gfx* dListEnd; @@ -186,7 +186,7 @@ void VisMono_Draw(VisMono* this, Gfx** gfxp) { gDPPipeSync(gfx++); - *gfxp = gfx; + *gfxP = gfx; } void VisMono_DrawOld(VisMono* this) { diff --git a/src/code/z_viszbuffer.c b/src/code/z_viszbuffer.c index e19f44f3845..fa37f14402c 100644 --- a/src/code/z_viszbuffer.c +++ b/src/code/z_viszbuffer.c @@ -63,8 +63,8 @@ void VisZBuffer_Init(VisZBuffer* this) { void VisZBuffer_Destroy(VisZBuffer* this) { } -void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp) { - Gfx* gfx = *gfxp; +void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxP) { + Gfx* gfx = *gfxP; s32 pad; u16* tex = D_0E000000; s32 fmt = this->params.type == 0 ? G_IM_FMT_IA : G_IM_FMT_RGBA; @@ -96,5 +96,5 @@ void VisZBuffer_Draw(VisZBuffer* this, Gfx** gfxp) { } gDPPipeSync(gfx++); - *gfxp = gfx; + *gfxP = gfx; } From 576ce35627c257fa3e0c7bcffd8cfc48d36952f8 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 31 Aug 2026 21:52:35 +0200 Subject: [PATCH 131/150] regconvert regs --- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 39 +++++++++---------- .../actors/ovl_En_Changer/z_en_changer.c | 2 +- 2 files changed, 20 insertions(+), 21 deletions(-) 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 43ff20ec191..1b05c4df27b 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -58,15 +58,15 @@ void DemoExt_Init(Actor* thisx, PlayState* play) { this->texScrollStep[1] = 40; this->texScrollStep[2] = 5; this->texScrollStep[3] = 30; - this->unk170 = gRegEditor->data[0xA3C] + 0xFF; - this->unk174 = gRegEditor->data[0xA40] + 0xFF; - this->unk178.x = gRegEditor->data[0xA33] + 400.0f; - this->unk178.y = gRegEditor->data[0xA34] + 100.0f; - this->unk178.z = gRegEditor->data[0xA35] + 400.0f; + this->unk170 = kREG(28) + 0xFF; + this->unk174 = kREG(32) + 0xFF; + this->unk178.x = kREG(19) + 400.0f; + this->unk178.y = kREG(20) + 100.0f; + this->unk178.z = kREG(21) + 400.0f; } void func_80977450(DemoExt* this) { - if (this->unk16C <= (gRegEditor->data[0xA43] + 40.0f - 15.0f)) { + if (this->unk16C <= (kREG(35) + 40.0f - 15.0f)) { SFX_PLAY_AT_POS(&this->actor.projectedPos, NA_SE_EV_FANTOM_WARP_L - SFX_FLAG); } } @@ -109,7 +109,7 @@ void func_80977590(DemoExt* this) { void func_809775A4(DemoExt* this) { this->unk16C += 1.0f; - if ((gRegEditor->data[0xA43] + 40.0f) <= this->unk16C) { + if ((kREG(35) + 40.0f) <= this->unk16C) { Actor_Kill(&this->actor); } } @@ -154,7 +154,7 @@ void func_809776D0(DemoExt* this) { for (var_v0 = 3; var_v0 != 0; var_v0--) { texScrollPos[var_v0] += texScrollStep[var_v0]; } - this->unk168 += (s16)(gRegEditor->data[0xA42] + 0x3E8); + this->unk168 += (s16)(kREG(34) + 0x3E8); } void func_8097771C(DemoExt* this) { @@ -162,15 +162,15 @@ void func_8097771C(DemoExt* this) { f32 var_fv0; temp_v0 = &this->unk178; - var_fv0 = ((gRegEditor->data[0xA43] + 40.0f) - this->unk16C) / (gRegEditor->data[0xA43] + 40.0f); + var_fv0 = ((kREG(35) + 40.0f) - this->unk16C) / (kREG(35) + 40.0f); if (var_fv0 < 0.0f) { var_fv0 = 0.0f; } - this->unk170 = (s32)((u32)(gRegEditor->data[0xA3C] + 0xFF) * var_fv0); - this->unk174 = (s32)((u32)(gRegEditor->data[0xA40] + 0xFF) * var_fv0); - temp_v0->x = (gRegEditor->data[0xA33] + 400.0f) * var_fv0; - temp_v0->y = (gRegEditor->data[0xA34] + 100.0f) * var_fv0; - temp_v0->z = (gRegEditor->data[0xA35] + 400.0f) * var_fv0; + this->unk170 = (s32)((u32)(kREG(28) + 0xFF) * var_fv0); + this->unk174 = (s32)((u32)(kREG(32) + 0xFF) * var_fv0); + temp_v0->x = (kREG(19) + 400.0f) * var_fv0; + temp_v0->y = (kREG(20) + 100.0f) * var_fv0; + temp_v0->z = (kREG(21) + 400.0f) * var_fv0; } void func_80977854(DemoExt* this, PlayState* play) { @@ -217,15 +217,14 @@ void func_80977950(DemoExt* this, PlayState* play) { OPEN_DISPS(gfxCtx, "../z_demo_ext.c", 460); Matrix_Push(); Matrix_Scale(temp_v0->x, temp_v0->y, temp_v0->z, MTXMODE_APPLY); - Matrix_RotateZYX(gRegEditor->data[0xA30] + 0x4000, this->unk168, gRegEditor->data[0xA32], MTXMODE_APPLY); - Matrix_Translate(gRegEditor->data[0xA36], gRegEditor->data[0xA37], gRegEditor->data[0xA38], MTXMODE_APPLY); + Matrix_RotateZYX(kREG(16) + 0x4000, this->unk168, kREG(18), MTXMODE_APPLY); + Matrix_Translate(kREG(22), kREG(23), kREG(24), MTXMODE_APPLY); MATRIX_TO_MTX(mtx, "../z_demo_ext.c", 476); Matrix_Pop(); Gfx_SetupDL_25Xlu(gfxCtx); - gDPSetPrimColor(POLY_XLU_DISP++, 0x00, gRegEditor->data[0xA41] + 0x80, gRegEditor->data[0xA39] + 0x8C, - gRegEditor->data[0xA3A] + 0x50, gRegEditor->data[0xA3B] + 0x8C, this->unk170); - gDPSetEnvColor(POLY_XLU_DISP++, gRegEditor->data[0xA3D] + 0x5A, gRegEditor->data[0xA3E] + 0x32, - gRegEditor->data[0xA3F] + 0x5F, this->unk174); + gDPSetPrimColor(POLY_XLU_DISP++, 0x00, kREG(33) + 0x80, kREG(25) + 0x8C, kREG(26) + 0x50, kREG(27) + 0x8C, + this->unk170); + gDPSetEnvColor(POLY_XLU_DISP++, kREG(29) + 0x5A, kREG(30) + 0x32, kREG(31) + 0x5F, this->unk174); gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(gfxCtx, 0, texScrollPos[0], texScrollPos[1], 64, 64, 1, texScrollPos[2], texScrollPos[3], 64, 64)); 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 0b6b284d6ba..15f1445223d 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -225,7 +225,7 @@ void EnChanger_Update(Actor* thisx, PlayState* play) { if (this->unk166 != 0) { this->unk166--; } - if (DEBUG_FEATURES && gRegEditor->data[0x960] != 0) { + if (DEBUG_FEATURES && BREG(0) != 0) { DebugDisplay_AddObject(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, this->actor.world.rot.x, this->actor.world.rot.y, this->actor.world.rot.z, 1.0f, 1.0f, 1.0f, 255, 0, 255, 255, 4, play->state.gfxCtx); From fce92175d9610044ff8af12800ae23c0d3181614 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 31 Aug 2026 21:57:55 +0200 Subject: [PATCH 132/150] vt codes --- src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 4 +-- .../actors/ovl_En_Changer/z_en_changer.c | 30 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) 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 1b05c4df27b..494efdd18db 100644 --- a/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -194,7 +194,7 @@ void DemoExt_Update(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->unk14C < 0) || (this->unk14C >= ARRAY_COUNT(sUpdateFuncs)) || (sUpdateFuncs[this->unk14C] == NULL)) { - PRINTF("\x1b[31mメインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n\x1b[m"); + PRINTF(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } sUpdateFuncs[this->unk14C](this, play); @@ -238,7 +238,7 @@ void DemoExt_Draw(Actor* thisx, PlayState* play) { DemoExt* this = (DemoExt*)thisx; if ((this->unk150 < 0) || (this->unk150 >= ARRAY_COUNT(sDrawFuncs)) || (sDrawFuncs[this->unk150] == NULL)) { - PRINTF("\x1b[31m描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n\x1b[m"); + PRINTF(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST); return; } sDrawFuncs[this->unk150](this, play); 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 15f1445223d..55998a3af65 100644 --- a/src/overlays/actors/ovl_En_Changer/z_en_changer.c +++ b/src/overlays/actors/ovl_En_Changer/z_en_changer.c @@ -67,10 +67,10 @@ void EnChanger_Init(Actor* thisx, PlayState* play2) { this->unk168 = 1; } PRINTF("\n\n"); - PRINTF("\x1b[32m☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n\x1b[m", play->roomCtx.curRoom.num); - PRINTF("\x1b[32m☆☆☆☆☆ ビットは? \t %x\n\x1b[m", play->actorCtx.flags.chest); - PRINTF("\x1b[32m☆☆☆☆☆ セーブBITは? %x\n\x1b[m", sTreasureFlags[temp_v1_curRoomIndex]); - PRINTF("\x1b[32m☆☆☆☆☆ もう、ゾンビ?\t %d\n\x1b[m", this->unk168); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 宝発生(部屋はどれ?) %d\n" VT_RST, play->roomCtx.curRoom.num); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ ビットは? \t %x\n" VT_RST, play->actorCtx.flags.chest); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ セーブBITは? %x\n" VT_RST, sTreasureFlags[temp_v1_curRoomIndex]); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ もう、ゾンビ?\t %d\n" VT_RST, this->unk168); PRINTF("\n\n"); temp_v1_curRoomIndex = temp_v1_curRoomIndex * 2; if (play->roomCtx.curRoom.num >= 6) { @@ -87,7 +87,7 @@ void EnChanger_Init(Actor* thisx, PlayState* play2) { new_var_someParams = ((gSaveContext.save.info.itemGetInf[1] & 0x800) ? 0xB : 0xC) & 0xFF; Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_ETCETERA, 20.0f, 20.0f, -2500.0f, 0, 0, 0, ((sTreasureFlags[5] & 0x1F) << 8) + new_var_someParams); - PRINTF("\x1b[33m☆☆☆☆☆ 中央宝発生(GREAT) ☆☆☆☆☆ %x\n\x1b[m", sp6A_finalChestParams); + PRINTF(VT_FGCOL(YELLOW) "☆☆☆☆☆ 中央宝発生(GREAT) ☆☆☆☆☆ %x\n" VT_RST, sp6A_finalChestParams); this->unk14C = func_809D2F74; return; } @@ -117,10 +117,10 @@ void EnChanger_Init(Actor* thisx, PlayState* play2) { sLeftChestPositions[play->roomCtx.curRoom.num].y, sLeftChestPositions[play->roomCtx.curRoom.num].z, 0, -0x3FFF, 0, sp6E_leftChestParams); if (this->unk150 != NULL) { - PRINTF("\x1b[35m☆☆☆☆☆ 左宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n\x1b[m", sp6E_leftChestParams); - PRINTF("\x1b[35m☆☆☆☆☆ 部屋番号は? %x\n\x1b[m", play->roomCtx.curRoom.num); - PRINTF("\x1b[35m☆☆☆☆☆ ビットはなぁに? %x\n\x1b[m", this->unk15E_r); - PRINTF("\x1b[35m☆☆☆☆☆ すけすけ君? %x\n\x1b[m", sp66_rightChestThing); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 左宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n" VT_RST, sp6E_leftChestParams); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 部屋番号は? %x\n" VT_RST, play->roomCtx.curRoom.num); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ ビットはなぁに? %x\n" VT_RST, this->unk15E_r); + PRINTF(VT_FGCOL(MAGENTA) "☆☆☆☆☆ すけすけ君? %x\n" VT_RST, sp66_rightChestThing); PRINTF("\n\n"); if (this->unk168 != 0) { Flags_SetTreasure(play, this->unk15C_l & 0x1F); @@ -136,10 +136,10 @@ void EnChanger_Init(Actor* thisx, PlayState* play2) { sRightChestPositions[play->roomCtx.curRoom.num].y, sRightChestPositions[play->roomCtx.curRoom.num].z, 0, 0x3FFF, 0, sp6C_rightChestParams); if (this->unk154 != NULL) { - PRINTF("\x1b[36m☆☆☆☆☆ 右宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n\x1b[m", sp6C_rightChestParams); - PRINTF("\x1b[36m☆☆☆☆☆ 部屋番号は? %d\n\x1b[m", play->roomCtx.curRoom.num); - PRINTF("\x1b[36m☆☆☆☆☆ ビットはなぁに? %x\n\x1b[m", this->unk15C_l); - PRINTF("\x1b[36m☆☆☆☆☆ すけすけ君? %x\n\x1b[m", sp64_leftChestThing); + PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ 右宝発生(ナニがはいってるの?) ☆☆☆☆☆ %x\n" VT_RST, sp6C_rightChestParams); + PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ 部屋番号は? %d\n" VT_RST, play->roomCtx.curRoom.num); + PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ ビットはなぁに? %x\n" VT_RST, this->unk15C_l); + PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ すけすけ君? %x\n" VT_RST, sp64_leftChestThing); PRINTF("\n\n"); if (this->unk168 != 0) { Flags_SetTreasure(play, this->unk15E_r & 0x1F); @@ -187,7 +187,7 @@ void func_809D2D70(EnChanger* this, PlayState* play) { Flags_SetSwitch(play, 0x32); } else { temp_s0 = (s16)(this->unk162 - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST; - PRINTF("\x1b[32m☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n\x1b[m", temp_s0); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 右宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, pos.x, pos.y, pos.z, 0, 0, 0, temp_s0); } break; @@ -200,7 +200,7 @@ void func_809D2D70(EnChanger* this, PlayState* play) { Flags_SetSwitch(play, 0x32); } else { temp_s0 = (s16)(this->unk160 - GI_RUPEE_GREEN_LOSE) + EXITEM_GREEN_RUPEE_CHEST; - PRINTF("\x1b[32m☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n\x1b[m", temp_s0); + PRINTF(VT_FGCOL(GREEN) "☆☆☆☆☆ 左宝開く ☆☆☆☆☆ %d\n" VT_RST, temp_s0); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_EX_ITEM, pos.x, pos.y, pos.z, 0, 0, 0, temp_s0); } break; From 571e5d1e42681843c5574e74a0d794fe07aeeeeb Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 31 Aug 2026 21:58:07 +0200 Subject: [PATCH 133/150] vt codes in EnDns --- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 7f741f59ba2..497612b3309 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -170,14 +170,14 @@ void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; if (DNS_GET_TYPE(&this->actor) < 0) { - PRINTF("\x1b[31m引数エラー(売りナッツ)[ arg_data = %d ]\x1b[m\n", this->actor.params); + PRINTF(VT_FGCOL(RED) "引数エラー(売りナッツ)[ arg_data = %d ]" VT_RST "\n", this->actor.params); Actor_Kill(&this->actor); return; } if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == 5)) { this->actor.params = DNS_TYPE_DEKU_SEEDS_30; } - PRINTF("\x1b[32m◆◆◆ 売りナッツ『%s』 ◆◆◆\x1b[m\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); + PRINTF(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); Actor_ProcessInitChain(&this->actor, sInitChain); SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, this->unk1FC, 0x12); From 33872fd079b28684f72aa602684dfe75540626af Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Fri, 18 Sep 2026 06:13:08 +0200 Subject: [PATCH 134/150] bss --- src/code/z_demo.c | 6 +++--- src/code/z_play.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/code/z_demo.c b/src/code/z_demo.c index c92da904175..c058dcca2ca 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,5 +1,5 @@ -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ique-cn:0" \ - "ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" +#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" #include "cutscene.h" @@ -165,7 +165,7 @@ u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ique-cn:128 ntsc-1.0:0 ntsc-1.1:0 ntsc-1.2:0 pal-1.0:0 pal-1.1:0" + "ique-cn:128 ntsc-1.0:128 ntsc-1.1:128 ntsc-1.2:128 pal-1.0:128 pal-1.1:128" // Cam ID to return to when a scripted cutscene is finished s16 sReturnToCamId; diff --git a/src/code/z_play.c b/src/code/z_play.c index 42bf337c95f..ed8ed1b444d 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -81,7 +81,7 @@ #include #pragma increment_block_number "gc-eu:171 gc-eu-mq:171 gc-jp:171 gc-jp-ce:171 gc-jp-mq:171 gc-us:171 gc-us-mq:171" \ - "ique-cn:171 ntsc-1.0:50 ntsc-1.1:50 ntsc-1.2:50 pal-1.0:50 pal-1.1:50" + "ique-cn:171 ntsc-1.0:145 ntsc-1.1:145 ntsc-1.2:145 pal-1.0:145 pal-1.1:145" TransitionTile gTransitionTile; s32 gTransitionTileState; From 0455f64b01d0f4a51df25a67344a4865e82a6e50 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 24 Sep 2026 08:04:19 +0200 Subject: [PATCH 135/150] UNUSED fixup --- src/libleo/api/cacreateleomanager.c | 5 +++-- src/libleo/api/cjcreateleomanager.c | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libleo/api/cacreateleomanager.c b/src/libleo/api/cacreateleomanager.c index b492c275b3f..ce17f460fca 100644 --- a/src/libleo/api/cacreateleomanager.c +++ b/src/libleo/api/cacreateleomanager.c @@ -1,14 +1,15 @@ #include "ultra64.h" #include "ultra64/asm.h" #include "ultra64/leo_internal.h" +#include "attributes.h" s32 LeoCACreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; - OSPiHandle* leoDiskHandle; + UNUSED OSPiHandle* leoDiskHandle; volatile LEOCmdInquiry cmdBlockInq; UNUSED volatile LEOCmd cmdBlockID; UNUSED LEODiskID thisID; - u32 stat; + UNUSED u32 stat; u32 data; if (__leoActive) { diff --git a/src/libleo/api/cjcreateleomanager.c b/src/libleo/api/cjcreateleomanager.c index e58d90f769e..59701597c42 100644 --- a/src/libleo/api/cjcreateleomanager.c +++ b/src/libleo/api/cjcreateleomanager.c @@ -1,14 +1,15 @@ #include "ultra64.h" #include "ultra64/asm.h" #include "ultra64/leo_internal.h" +#include "attributes.h" s32 LeoCJCreateLeoManager(s32 comPri, s32 intPri, void** cmdBuf, s32 cmdMsgCnt) { OSPiHandle* driveRomHandle; - OSPiHandle* leoDiskHandle; + UNUSED OSPiHandle* leoDiskHandle; volatile LEOCmdInquiry cmdBlockInq; UNUSED volatile LEOCmd cmdBlockID; UNUSED LEODiskID thisID; - u32 stat; + UNUSED u32 stat; u32 data; if (__leoActive) { From 401ac240caac239f81be30a8b642233c0be3aa71 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 27 Sep 2026 07:58:14 +0200 Subject: [PATCH 136/150] enwf review --- src/overlays/actors/ovl_En_Wf/z_en_wf.c | 81 ++++++++++--------------- src/overlays/actors/ovl_En_Wf/z_en_wf.h | 2 - 2 files changed, 32 insertions(+), 51 deletions(-) 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 114712433a0..268f4400295 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -183,8 +183,8 @@ static ColliderCylinderInit sTailCylinderInit = { typedef enum EnWfDamageReaction { ENWF_DMG_REACT_NONE, ENWF_DMG_REACT_STUN, - ENWF_DMG_REACT_6 = 6, - ENWF_DMG_REACT_D = 0xD, + ENWF_DMG_REACT_ICE_MAGIC = 6, + ENWF_DMG_REACT_LIGHT_MAGIC = 0xD, ENWF_DMG_REACT_FIRE, ENWF_DMG_REACT_F } EnWfDamageReaction; @@ -208,8 +208,8 @@ static DamageTable sDamageTable = { /* Unk arrow 2 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), /* Unk arrow 3 */ DMG_ENTRY(2, ENWF_DMG_REACT_NONE), /* Fire magic */ DMG_ENTRY(4, ENWF_DMG_REACT_FIRE), - /* Ice magic */ DMG_ENTRY(0, ENWF_DMG_REACT_6), - /* Light magic */ DMG_ENTRY(3, ENWF_DMG_REACT_D), + /* Ice magic */ DMG_ENTRY(0, ENWF_DMG_REACT_ICE_MAGIC), + /* Light magic */ DMG_ENTRY(3, ENWF_DMG_REACT_LIGHT_MAGIC), /* Shield */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), /* Mirror Ray */ DMG_ENTRY(0, ENWF_DMG_REACT_NONE), /* Kokiri spin */ DMG_ENTRY(1, ENWF_DMG_REACT_NONE), @@ -322,20 +322,16 @@ s32 EnWf_PickAction(PlayState* play, EnWf* this, s16 mustPick) { s16 absRelYawTowardsPlayer; absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; - if (absRelWallYaw < 0) { - absRelWallYaw *= -1; - } + absRelWallYaw = ABS(absRelWallYaw); absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (absRelYawTowardsPlayer < 0) { - absRelYawTowardsPlayer *= -1; - } + absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { EnWf_SetupBlock(this); return true; } - if (play->gameplayFrames & 1) { + if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlock(this); return true; } @@ -350,7 +346,7 @@ s32 EnWf_PickAction(PlayState* play, EnWf* this, s16 mustPick) { } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { EnWf_SetupBlock(this); return true; - } else if ((this->actor.xzDistToPlayer < 80.0f) && (play->gameplayFrames & 1)) { + } else if ((this->actor.xzDistToPlayer < 80.0f) && ((play->gameplayFrames % 2) != 0)) { EnWf_SetupBlock(this); return true; } else { @@ -391,7 +387,7 @@ s32 EnWf_PickAction(PlayState* play, EnWf* this, s16 mustPick) { yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - (((play->gameplayFrames & 7) != 0) || (ABS(yawDiff) < 0x38E0))) { + (((play->gameplayFrames % 8) != 0) || (ABS(yawDiff) < 0x38E0))) { EnWf_SetupAttack(this); return true; } else { @@ -468,9 +464,7 @@ void EnWf_Idle(EnWf* this, PlayState* play) { this->idleTimer = 0; } yaw = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (yaw < 0) { - yaw *= -1; - } + yaw = ABS(yaw); if (!EnWf_ReactToProjectile(play, this)) { // unk_2E0 is always 0 if (this->unk_2E0 != 0) { @@ -484,9 +478,7 @@ void EnWf_Idle(EnWf* this, PlayState* play) { return; } yaw = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (yaw < 0) { - yaw *= -1; - } + yaw = ABS(yaw); if ((this->actor.xzDistToPlayer < 80.0f) && (player->meleeWeaponState != 0) && (yaw >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnWf_SetupCirclePlayer(this); @@ -548,9 +540,7 @@ void EnWf_RunToAttack(EnWf* this, PlayState* play) { } this->skelAnime.playSpeed = this->actor.speed * 0.175f; var_v0_real = player->actor.shape.rot.y - this->actor.shape.rot.y; - if (var_v0_real < 0) { - var_v0_real *= -1; - } + var_v0_real = ABS(var_v0_real); if ((this->actor.xzDistToPlayer < (150.0f + sp50_real)) && (player->meleeWeaponState != 0) && (var_v0_real >= 0x1F40)) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; @@ -821,12 +811,8 @@ void EnWf_AttackBouncedOff(EnWf* this, PlayState* play) { absYawDiffWithPlayer = player->actor.shape.rot.y - this->actor.shape.rot.y; absRelYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - if (absYawDiffWithPlayer < 0) { - absYawDiffWithPlayer *= -1; - } - if (absRelYawTowardsPlayer < 0) { - absRelYawTowardsPlayer *= -1; - } + absYawDiffWithPlayer = ABS(absYawDiffWithPlayer); + absRelYawTowardsPlayer = ABS(absRelYawTowardsPlayer); if (SkelAnime_Update(&this->skelAnime)) { if (!Actor_IsFacingPlayer(&this->actor, 0x1554)) { EnWf_SetupIdle(this); @@ -871,7 +857,7 @@ void EnWf_BackflipBackward(EnWf* this, PlayState* play) { if (!Actor_OtherIsLockedOn(play, &this->actor) && (this->actor.xzDistToPlayer < 170.0f) && (this->actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { EnWf_SetupRunToAttack(this, play); - } else if (play->gameplayFrames & 1) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupShortCirclePlayer(this, play); } else { EnWf_SetupIdle(this); @@ -942,15 +928,13 @@ void EnWf_Damaged(EnWf* this, PlayState* play) { if (!EnWf_PickAction(play, this, false) && SkelAnime_Update(&this->skelAnime) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { absRelWallYaw = this->actor.wallYaw - this->actor.shape.rot.y; - if (absRelWallYaw < 0) { - absRelWallYaw *= -1; - } + absRelWallYaw = ABS(absRelWallYaw); if ((this->actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS(absRelWallYaw) < 0x2EE0) && (this->actor.xzDistToPlayer < 120.0f)) { EnWf_SetupBackflipForward(this); } else if (!EnWf_ReactToProjectile(play, this)) { if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - ((play->gameplayFrames & 7) != 0)) { + ((play->gameplayFrames % 8) != 0)) { EnWf_SetupAttack(this); } else if (Rand_ZeroOne() > 0.5f) { EnWf_SetupIdle(this); @@ -999,7 +983,7 @@ void EnWf_BackflipForward(EnWf* this, PlayState* play) { } void EnWf_SetupBlock(EnWf* this) { - f32 animEndFrame = (f32)Animation_GetLastFrame(&gWolfosBlockAnim); + f32 animEndFrame = Animation_GetLastFrame(&gWolfosBlockAnim); if (this->attackState != 0) { this->attackState = -1; @@ -1030,7 +1014,7 @@ void EnWf_Block(EnWf* this, PlayState* play) { if (func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { EnWf_SetupBlock(this); - } else if (play->gameplayFrames & 1) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlock(this); } else { EnWf_SetupBackflipBackward(this); @@ -1038,7 +1022,7 @@ void EnWf_Block(EnWf* this, PlayState* play) { } else { yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; if (!Actor_OtherIsLockedOn(play, &this->actor) && - ((play->gameplayFrames & 1) || (ABS(yawDiff) < 0x38E0))) { + (((play->gameplayFrames % 2) != 0) || (ABS(yawDiff) < 0x38E0))) { EnWf_SetupAttack(this); } else { EnWf_SetupCirclePlayer(this); @@ -1051,7 +1035,7 @@ void EnWf_Block(EnWf* this, PlayState* play) { func_800354B4(play, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { EnWf_SetupBlock(this); - } else if (play->gameplayFrames & 1) { + } else if ((play->gameplayFrames % 2) != 0) { EnWf_SetupBlock(this); } else { EnWf_SetupBackflipBackward(this); @@ -1150,9 +1134,7 @@ void EnWf_ShortCirclePlayer(EnWf* this, PlayState* play) { //! behindPlayerYawAbs is typically exactly -0x8000 when locking on the actor. //! Note the same problem of storing absolute angles into s16 variables happens elsewhere in this file, but //! problematic -0x8000 happens rarely in those other spots. - if (behindPlayerYawAbs < 0) { - behindPlayerYawAbs *= -1; - } + behindPlayerYawAbs = ABS(behindPlayerYawAbs); if (behindPlayerYawAbs >= 0x3A98) { EnWf_SetupIdle(this); this->timer = (Rand_ZeroOne() * 3.0f) + 1.0f; @@ -1161,7 +1143,7 @@ void EnWf_ShortCirclePlayer(EnWf* this, PlayState* play) { behindPlayerYaw = player2->actor.shape.rot.y - this->actor.yawTowardsPlayer; this->actor.world.rot.y = this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer <= 80.0f) && !Actor_OtherIsLockedOn(play, &this->actor) && - (((play->gameplayFrames & 3) == 0) || (ABS(behindPlayerYaw) < 0x38E0))) { + (((play->gameplayFrames % 4) == 0) || (ABS(behindPlayerYaw) < 0x38E0))) { EnWf_SetupAttack(this); } else { EnWf_SetupRunToAttack(this, play); @@ -1254,7 +1236,7 @@ void EnWf_CheckCollide(EnWf* this, PlayState* play) { } this->bodyCollider.base.acFlags &= ~AC_HIT; this->tailCollider.base.acFlags &= ~AC_HIT; - if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_6) { + if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_ICE_MAGIC) { this->lastDamageReaction = this->actor.colChkInfo.damageReaction; Actor_SetDropFlag(&this->actor, &this->bodyCollider.elem, true); #if OOT_VERSION >= PAL_1_0 @@ -1288,7 +1270,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) { STACK_PAD(s32); EnWf_CheckCollide(this, play); - if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_6) { + if (this->actor.colChkInfo.damageReaction != ENWF_DMG_REACT_ICE_MAGIC) { Actor_MoveXZGravity(&this->actor); Actor_UpdateBgCheckInfo(play, &this->actor, 32.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | @@ -1322,8 +1304,8 @@ void EnWf_Update(Actor* thisx, PlayState* play) { this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 25.0f; if (this->eyeIndex == 0) { - if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames & 3) == 0) && (this->actor.colorFilterTimer == 0)) { - this->eyeIndex += 1; + if ((Rand_ZeroOne() < 0.2f) && ((play->gameplayFrames % 4) == 0) && (this->actor.colorFilterTimer == 0)) { + this->eyeIndex++; } } else { this->eyeIndex = (this->eyeIndex + 1) & 3; @@ -1340,7 +1322,7 @@ s32 EnWf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po } void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { - static Vec3f D_80B37ADC = { 1200.0f, 0.0f, 0.0f }; + static Vec3f sTailColliderOffset = { 1200.0f, 0.0f, 0.0f }; static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; EnWf* this = (EnWf*)thisx; s32 bodyPartIndex; @@ -1350,7 +1332,7 @@ void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, bodyPartIndex = -1; Collider_UpdateSpheres(limbIndex, &this->attackAndBlockCollider); if (limbIndex == WOLFOS_LIMB_TAIL) { - Matrix_MultVec3f(&D_80B37ADC, &tailColliderPos); + Matrix_MultVec3f(&sTailColliderOffset, &tailColliderPos); this->tailCollider.dim.pos.x = tailColliderPos.x; this->tailCollider.dim.pos.y = tailColliderPos.y; this->tailCollider.dim.pos.z = tailColliderPos.z; @@ -1379,7 +1361,8 @@ void EnWf_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, bodyPartIndex = 6; break; case 37: - //! @bug 37 is not a valid limb index + //! @bug 37 is not a valid limb index. + //! This means bodyPartsPos[7] stays 0,0,0 and a flame is drawn at 0,0,0 when the wolfos is on fire. bodyPartIndex = 7; break; case WOLFOS_LIMB_RIGHT_ANKLE: @@ -1427,7 +1410,7 @@ void EnWf_Draw(Actor* thisx, PlayState* play) { this->actor.colorFilterTimer++; if (1) {} this->onFireTimer -= 1; - if ((this->onFireTimer & 3) == 0) { + if ((this->onFireTimer % 4) == 0) { s32 bodyPartIndex = this->onFireTimer >> 2; EffectSsEnFire_SpawnVec3s(play, &this->actor, &this->bodyPartsPos[bodyPartIndex], 75, 0, 0, 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 15c13baeb0d..bf09771ba2d 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.h +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.h @@ -23,7 +23,6 @@ typedef struct EnWf { /* 0x2E2 */ s16 idleTimer; /* 0x2E4 */ s16 onFireTimer; /* 0x2E6 */ u8 lastDamageReaction; - /* 0x2E7 */ char pad_2E7[1]; /* 0x2E8 */ s32 timer; /* 0x2EC */ f32 circlePlayerExtraSpeed; /* 0x2F0 */ char pad_2F0[4]; @@ -34,7 +33,6 @@ typedef struct EnWf { /* 0x2FE */ s16 circlePlayerDirection; /* 0x300 */ s16 unk_300; /* 0x302 */ u8 eyeIndex; - /* 0x303 */ char pad_303[1]; /* 0x304 */ ColliderJntSph attackAndBlockCollider; /* 0x324 */ ColliderJntSphElement attackAndBlockColliderElements[4]; /* 0x424 */ ColliderCylinder bodyCollider; From 1eaef45efb5dfd47fa79cec912e7c22f873c5b47 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 1 Oct 2026 09:39:46 +0200 Subject: [PATCH 137/150] EnGe1 review --- src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 61 ++++++++++++----------- 1 file changed, 32 insertions(+), 29 deletions(-) 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 1fc648fc7bc..b06768b2ecd 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -14,6 +14,7 @@ #include "play_state.h" #include "player.h" #include "save.h" +#include "translation.h" #include "assets/objects/object_ge1/object_ge1.h" @@ -74,6 +75,12 @@ static ColliderCylinderInit sCylinderInit = { { 20, 40, 0, { 0, 0, 0 } }, }; +typedef enum EnGe1HairType { + EN_GE1_HAIR_TYPE_STRANDS, + EN_GE1_HAIR_TYPE_FRINGE, + EN_GE1_HAIR_TYPE_SPIKY +} EnGe1HairType; + static Gfx* sHairDLists[3] = { gObjectGe1HairStrandsDL, gObjectGe1HairFringeDL, @@ -108,14 +115,15 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { } else { this->actor.cullingVolumeDistance = 1200.0f; } + switch (PARAMS_GET_U(this->actor.params, 0, 8)) { case EN_GE1_TYPE_CHILD_ERA_WASTELAND_GATEKEEPER: - this->hairType = 2; + this->hairType = EN_GE1_HAIR_TYPE_SPIKY; this->actionFunc = EnGe1_ChildEraWastelandGatekeeper_OfferTalk; break; case EN_GE1_TYPE_WASTELAND_GATEKEEPER: - this->hairType = 1; + this->hairType = EN_GE1_HAIR_TYPE_FRINGE; if (EnGe1_AreAllCarpentersRescued()) { this->actionFunc = EnGe1_WastelandGatekeeper_OfferTalk; } else { @@ -124,7 +132,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { break; case EN_GE1_TYPE_SENTINEL: - this->hairType = 1; + this->hairType = EN_GE1_HAIR_TYPE_FRINGE; if (EnGe1_AreAllCarpentersRescued()) { this->actionFunc = EnGe1_OfferTalkGreet; } else { @@ -134,11 +142,11 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { case EN_GE1_TYPE_5: if (LINK_IS_ADULT) { - PRINTF(VT_FGCOL(CYAN) "谷底 ゲルド 撤退 \n" VT_RST); + PRINTF(VT_FGCOL(CYAN) T("谷底 ゲルド 撤退 \n", "Retreat from the Gerudo canyon floor \n") VT_RST); Actor_Kill(&this->actor); return; } - this->hairType = 0; + this->hairType = EN_GE1_HAIR_TYPE_STRANDS; this->actionFunc = EnGe1_OfferTalkGeneric; break; @@ -148,8 +156,10 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { return; } this->actor.attentionRangeType = ATTENTION_RANGE_3; - this->hairType = 0; - PRINTF(VT_FGCOL(CYAN) "やぶさめ ゲルド EVENT_INF(0) = %x\n" VT_RST, gSaveContext.eventInf[0]); + this->hairType = EN_GE1_HAIR_TYPE_STRANDS; + PRINTF(VT_FGCOL(CYAN) + T("やぶさめ ゲルド EVENT_INF(0) = %x\n", "Gerudo horseback archery EVENT_INF(0) = %x\n") VT_RST, + gSaveContext.eventInf[0]); if (GET_EVENTINF(EVENTINF_HORSES_08)) { this->actionFunc = EnGe1_Archery_ChooseReward; } else if (EnGe1_AreAllCarpentersRescued()) { @@ -160,7 +170,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) { break; case EN_GE1_TYPE_GTG_GATEKEEPER: - this->hairType = 1; + this->hairType = EN_GE1_HAIR_TYPE_FRINGE; if (EnGe1_AreAllCarpentersRescued()) { this->actionFunc = EnGe1_GTGGatekeeper_OfferTalk; } else { @@ -238,9 +248,8 @@ void EnGe1_SetupPlayerCaught(EnGe1* this, PlayState* play) { } void EnGe1_SentinelShortSighted(EnGe1* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { EnGe1_SetupPlayerCaught(this, play); } @@ -252,6 +261,7 @@ void EnGe1_SentinelShortSighted(EnGe1* this, PlayState* play) { void EnGe1_WaitTalkEnd(EnGe1* this, PlayState* play) { this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; + if (Actor_TextboxIsClosing(&this->actor, play)) { switch (this->actor.textId) { case 0x6001: @@ -279,9 +289,8 @@ void EnGe1_OfferTalkGreet(EnGe1* this, PlayState* play) { } void EnGe1_Sentinel(EnGe1* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((this->actor.xzDistToPlayer < 50.0f) || ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 400.0f))) { EnGe1_SetupPlayerCaught(this, play); @@ -293,9 +302,8 @@ void EnGe1_Sentinel(EnGe1* this, PlayState* play) { } void EnGe1_OfferTalkGeneric(EnGe1* this, PlayState* play) { - u16 textId; + u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); - textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_GERUDO_WHITE); if (textId == 0) { textId = 0x6019; } @@ -367,6 +375,7 @@ void EnGe1_GTGGatekeeper_WaitAnswer(EnGe1* this, PlayState* play) { void EnGe1_GTGGatekeeper_TalkNoCard(EnGe1* this, PlayState* play) { this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_GTGGatekeeper_OfferTalk; EnGe1_ChangeAnimArmsCrossed(this); @@ -433,6 +442,7 @@ void EnGe1_WastelandGatekeeper_OfferTalk(EnGe1* this, PlayState* play) { void EnGe1_ChildEraWastelandGatekeeper_WaitTalkEnd(EnGe1* this, PlayState* play) { this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_ChildEraWastelandGatekeeper_OfferTalk; EnGe1_ChangeAnimArmsCrossed(this); @@ -532,10 +542,9 @@ void EnGe1_DoNothing(EnGe1* this, PlayState* play) { } void EnGe1_Archery_WaitAnswer(EnGe1* this, PlayState* play) { - Player* player; + Player* player = GET_PLAYER(play); Actor* epona; - player = GET_PLAYER(play); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { this->actor.flags &= ~ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; switch (play->msgCtx.choiceIndex) { @@ -589,17 +598,12 @@ void EnGe1_Archery_NoReward(EnGe1* this, PlayState* play) { void EnGe1_Archery_ChooseReward(EnGe1* this, PlayState* play) { CLEAR_EVENTINF(EVENTINF_HORSES_08); -#if DEBUG_FEATURES - LogUtils_LogThreadId("../z_en_ge1.c", 1110); - PRINTF("z_common_data.yabusame_total = %d\n", gSaveContext.minigameScore); - if (1) {} - if (1) {} - if (1) {} - LogUtils_LogThreadId("../z_en_ge1.c", 1111); + + LOG_NUM("z_common_data.yabusame_total", gSaveContext.minigameScore, "../z_en_ge1.c", 1110); // With the current `SaveContext` struct definition, the expression in the debug string is an out-of-bounds read, // see the other occurrence of this for more details. - PRINTF("z_common_data.memory.information.room_inf[127][ 0 ] = %d\n", HIGH_SCORE(HS_HBA)); -#endif + LOG_NUM("z_common_data.memory.information.room_inf[127][ 0 ]", HIGH_SCORE(HS_HBA), "../z_en_ge1.c", 1111); + this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; if (HIGH_SCORE(HS_HBA) < gSaveContext.minigameScore) { HIGH_SCORE(HS_HBA) = gSaveContext.minigameScore; @@ -626,6 +630,7 @@ void EnGe1_Archery_ChooseReward(EnGe1* this, PlayState* play) { void EnGe1_Archery_NoHorseWaitTalkEnd(EnGe1* this, PlayState* play) { this->stateFlags |= EN_GE1_STATE_FLAG_LOOK_AT_PLAYER; + if (Actor_TextboxIsClosing(&this->actor, play)) { this->actionFunc = EnGe1_Archery_OfferTalk; EnGe1_ChangeAnimArmsCrossed(this); @@ -654,9 +659,8 @@ void EnGe1_Archery_OfferTalk(EnGe1* this, PlayState* play) { void EnGe1_TrackPlayer(EnGe1* this, PlayState* play) { STACK_PAD(s32); - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS(relYawTowardsPlayer) <= 0x4000) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -673,9 +677,8 @@ void EnGe1_TrackPlayer(EnGe1* this, PlayState* play) { } void EnGe1_TrackPlayerIfNear(EnGe1* this, PlayState* play) { - s16 relYawTowardsPlayer; + s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((ABS(relYawTowardsPlayer) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) { Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos); } else { From 30b9e6cbf96eddb9ad0e82a86cb300488a902b31 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Thu, 1 Oct 2026 09:46:29 +0200 Subject: [PATCH 138/150] ge2 review --- src/overlays/actors/ovl_En_Ge2/z_en_ge2.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h index 9aa45de4434..67f24cb6088 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.h @@ -29,14 +29,12 @@ typedef struct EnGe2 { /* 0x2F4 */ u16 stateFlags; /* 0x2F6 */ s16 targetYaw; /* 0x2F8 */ s16 patrolAlertedYaw; - /* 0x2FA */ char pad_2FA[2]; /* 0x2FC */ f32 detectionYRange; /* 0x300 */ u16 patrolTime; /* 0x302 */ u16 patrolTimer; /* 0x304 */ s8 unk_304; // unused /* 0x305 */ u8 timer; /* 0x306 */ u8 playerNoise; - /* 0x307 */ char pad_307[1]; /* 0x308 */ EnGe2ActionFunc actionFunc; } EnGe2; // size = 0x30C From 20a5fbac3672c9f5be4eed3f3f398a3465384319 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 11 Oct 2026 15:10:01 +0200 Subject: [PATCH 139/150] nb review --- assets/xml/objects/object_nb.xml | 38 +++++++++++----------- src/overlays/actors/ovl_En_Nb/z_en_nb.c | 43 +++++-------------------- src/overlays/actors/ovl_En_Nb/z_en_nb.h | 6 ++-- 3 files changed, 31 insertions(+), 56 deletions(-) diff --git a/assets/xml/objects/object_nb.xml b/assets/xml/objects/object_nb.xml index 3b726293ae9..9c0239aafb6 100644 --- a/assets/xml/objects/object_nb.xml +++ b/assets/xml/objects/object_nb.xml @@ -127,24 +127,24 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + 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 c2d177465ff..fd1aa75fa90 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -73,34 +73,6 @@ void EnNb_Destroy(Actor* thisx, PlayState* play); void EnNb_Update(Actor* thisx, PlayState* play); void EnNb_Draw(Actor* thisx, PlayState* play); -/* -extern FlexSkeletonHeader D_060181C8; -extern AnimationHeader D_06004BB4; // standing up hands on hips -extern AnimationHeader D_06006E78; -extern AnimationHeader D_06004E60; // getting up from crawlspace -extern AnimationHeader D_06004BB4; -extern AnimationHeader D_06009238; -extern AnimationHeader D_06009694; // hands on hips standing -extern AnimationHeader D_0600274C; // raising both arms up transition (giving medallion to link ?) -extern AnimationHeader D_06002B4C; // raising both arms up stable (giving medallion to link ?) -extern AnimationHeader D_06000410; // clasping hands together -extern AnimationHeader D_06001E7C; // looking around ? -extern AnimationHeader D_06001350; // i think this is the animation where she is in the purple thing -extern AnimationHeader D_06001104; // transition to raising arm up in purple portal -extern AnimationHeader D_06008BD0; // falls to the ground -extern AnimationHeader D_060046A8; // looking in crawlspace ? -extern AnimationHeader D_06003954; // on ground getting up ?? -extern AnimationHeader D_06004030; // looking behind her to the right -extern AnimationHeader D_06002DBC; // freaking out -extern AnimationHeader D_060035A8; // looking behind her -extern AnimationHeader D_06006320; // sees unk from behind, turns and runs -extern AnimationHeader D_06000BC0; // crossed legs -extern AnimationHeader D_06005CA4; // crossed legs, turns head and looks behind to the right -extern AnimationHeader D_06005614; // crossed legs, looking behind to the right -extern Gfx D_06013158[]; -extern UNK_TYPE D_0600D8E8; -*/ - static ColliderCylinderInitType1 sCylinderInit = { { COL_MATERIAL_HIT0, @@ -120,7 +92,7 @@ static ColliderCylinderInitType1 sCylinderInit = { { 25, 80, 0, { 0, 0, 0 } }, }; -static UNK_PTR sEyeTextures[] = { +static void* sEyeTextures[] = { gNabooruEyeOpenTex, gNabooruEyeHalfTex, gNabooruEyeClosedTex, @@ -1035,7 +1007,7 @@ void func_80AB2E70(EnNb* this, PlayState* play) { s32 func_80AB2FC0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { UNUSED EnNb* this = (EnNb*)thisx; - if (limbIndex == 15) { + if (limbIndex == NABOORU_LIMB_HEAD) { *dList = gNabooruHeadMouthOpenDL; } @@ -1077,7 +1049,7 @@ void EnNb_SetAlphaInCredits(EnNb* this) { if ((kREG(17) + 10.0f) <= this->alphaTimer) { this->alpha = 255; - this->actor.shape.shadowAlpha = 0xFF; + this->actor.shape.shadowAlpha = 255; } else { alpha = (*alphaTimer / (kREG(17) + 10.0f)) * 255.0f; this->alpha = alpha; @@ -1500,7 +1472,8 @@ void EnNb_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); EnNb_SetupCollider(thisx, play); - SkelAnime_InitFlex(play, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, 19); + SkelAnime_InitFlex(play, &this->skelAnime, &gNabooruSkel, NULL, this->jointTable, this->morphTable, + NABOORU_LIMB_MAX); switch (EnNb_GetType(this)) { case NB_TYPE_DEMO02: @@ -1530,13 +1503,13 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po s32 ret = false; if (this->headTurnFlag != 0) { - if (limbIndex == 8) { + if (limbIndex == NABOORU_LIMB_TORSO) { STACK_PAD(s32); rot->x += interactInfo->torsoRot.y; rot->y -= interactInfo->torsoRot.x; ret = false; - } else if (limbIndex == 15) { + } else if (limbIndex == NABOORU_LIMB_HEAD) { rot->x += interactInfo->headRot.y; rot->z += interactInfo->headRot.x; ret = false; @@ -1549,7 +1522,7 @@ s32 EnNb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po void EnNb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnNb* this = (EnNb*)thisx; - if (limbIndex == 15) { + if (limbIndex == NABOORU_LIMB_HEAD) { Vec3f vec1 = { 0.0f, 10.0f, 0.0f }; Vec3f vec2; 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 f9e8f5d26ac..b5dce53cfcf 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.h +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_nb/object_nb.h" + struct EnNb; typedef void (*EnNbActionFunc)(struct EnNb*, struct PlayState*); @@ -12,8 +14,8 @@ typedef void (*EnNbDrawFunc)(struct EnNb*, struct PlayState*); typedef struct EnNb { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ Vec3s jointTable[19]; - /* 0x0202 */ Vec3s morphTable[19]; + /* 0x0190 */ Vec3s jointTable[NABOORU_LIMB_MAX]; + /* 0x0202 */ Vec3s morphTable[NABOORU_LIMB_MAX]; /* 0x0274 */ s16 eyeIdx; /* 0x0276 */ s16 blinkTimer; /* 0x0278 */ s32 action; From 84b13f10aa0cba2c43429ec406c854e90c31f4d0 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 11 Oct 2026 15:34:11 +0200 Subject: [PATCH 140/150] EnSkb review --- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 123 ++++++++++------------ src/overlays/actors/ovl_En_Skb/z_en_skb.h | 11 +- 2 files changed, 64 insertions(+), 70 deletions(-) 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 19f4d27cb0b..da3ef053519 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -67,7 +67,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_NONE, OCELEM_NONE, }, - { 15, { { 0, 0, 0 }, 10 }, 100 }, + { STALCHILD_LIMB_RIGHT_HAND, { { 0, 0, 0 }, 10 }, 100 }, }, { { @@ -78,7 +78,7 @@ static ColliderJntSphElementInit sJntSphElementsInit[] = { ACELEM_ON | ACELEM_HOOKABLE, OCELEM_ON, }, - { 1, { { 0, 0, 0 }, 20 }, 100 }, + { STALCHILD_LIMB_ROOT, { { 0, 0, 0 }, 20 }, 100 }, }, }; @@ -142,37 +142,33 @@ ActorProfile En_Skb_Profile = { /**/ EnSkb_Draw, }; -static Vec3f D_80AFE0B8 = { 0.0f, 8.0f, 0.0f }; -static Vec3f D_80AFE0C4 = { 0.0f, -1.5f, 0.0f }; -static InitChainEntry sInitChain[] = { - ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), - ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), -}; - -void func_80AFC9A0(EnSkb* this, void (*arg1)(EnSkb*, PlayState*)) { - this->unk284 = arg1; +void EnSkb_SetupAction(EnSkb* this, EnSkbActionFunc actionFunc) { + this->actionFunc = actionFunc; } -void func_80AFC9A8(PlayState* play, EnSkb* this, Vec3f* arg2) { - Vec3f sp5C; - Vec3f sp50; - Vec3f sp44; - f32 temp_fa0; +void EnSkb_SpawnDigEffects(PlayState* play, EnSkb* this, Vec3f* pos) { + Vec3f effPos; + Vec3f effVel = { 0.0f, 8.0f, 0.0f }; + Vec3f effAccel = { 0.0f, -1.5f, 0.0f }; + f32 angle; STACK_PAD(s32); - sp50 = D_80AFE0B8; - sp44 = D_80AFE0C4; - temp_fa0 = (Rand_ZeroOne() - 0.5f) * 6.28f; - sp5C.y = this->actor.floorHeight; - sp5C.x = (Math_SinF(temp_fa0) * 15.0f) + arg2->x; - sp5C.z = (Math_CosF(temp_fa0) * 15.0f) + arg2->z; - sp44.x = Rand_CenteredFloat(1.0f); - sp44.z = Rand_CenteredFloat(1.0f); - sp50.y += (Rand_ZeroOne() - 0.5f) * 4.0f; - EffectSsHahen_Spawn(play, &sp5C, &sp50, &sp44, 2, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, -1, 10, NULL); - func_80033480(play, &sp5C, 10.0f, 1, 0x96, 0, 1U); + angle = (Rand_ZeroOne() - 0.5f) * 6.28f; + effPos.y = this->actor.floorHeight; + effPos.x = (Math_SinF(angle) * 15.0f) + pos->x; + effPos.z = (Math_CosF(angle) * 15.0f) + pos->z; + effAccel.x = Rand_CenteredFloat(1.0f); + effAccel.z = Rand_CenteredFloat(1.0f); + effVel.y += (Rand_ZeroOne() - 0.5f) * 4.0f; + EffectSsHahen_Spawn(play, &effPos, &effVel, &effAccel, 2, ((Rand_ZeroOne() * 5.0f) + 12.0f) * 0.8f, -1, 10, NULL); + func_80033480(play, &effPos, 10.0f, 1, 150, 0, 1); } +static InitChainEntry sInitChain[] = { + ICHAIN_F32(lockOnArrowOffset, 2000, ICHAIN_CONTINUE), + ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), +}; + void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; @@ -184,7 +180,7 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { this->actor.colChkInfo.health = 2; this->actor.shape.yOffset = -8000.0f; SkelAnime_Init(play, &this->skelAnime, &gStalchildSkel, &gStalchildUncurlAnim, this->jointTable, this->morphTable, - 20); + STALCHILD_LIMB_MAX); this->actor.naviEnemyId = NAVI_ENEMY_STALCHILD; Collider_InitJntSph(play, &this->collider); Collider_SetJntSph(play, &this->collider, &this->actor, &sJntSphInit, this->colliderElements); @@ -198,21 +194,15 @@ void EnSkb_Init(Actor* thisx, PlayState* play) { EnSkb_SetupRiseFromGround(this); } -typedef struct UnkActor { - Actor actor; - char pad14C[6]; - s16 unk152; -} UnkActor; - void EnSkb_Destroy(Actor* thisx, PlayState* play) { - UnkActor* temp_v1; + EnEncount1* temp_v1; EnSkb* this = (EnSkb*)thisx; if ((this->actor.parent != NULL)) { - temp_v1 = (UnkActor*)this->actor.parent; + temp_v1 = (EnEncount1*)this->actor.parent; if ((temp_v1->actor.update != NULL)) { - if (temp_v1->unk152 > 0) { - temp_v1->unk152 -= 1; + if (temp_v1->curNumSpawn > 0) { + temp_v1->curNumSpawn -= 1; } } } @@ -235,7 +225,7 @@ void EnSkb_SetupRiseFromGround(EnSkb* this) { this->actionState = SKB_BEHAVIOR_BURIED; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; Actor_PlaySfx(&this->actor, NA_SE_EN_RIVA_APPEAR); - func_80AFC9A0(this, EnSkb_RiseFromGround); + EnSkb_SetupAction(this, EnSkb_RiseFromGround); } void EnSkb_RiseFromGround(EnSkb* this, PlayState* play) { @@ -247,7 +237,7 @@ void EnSkb_RiseFromGround(EnSkb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 800.0f, 0.0f); Math_SmoothStepToF(&this->actor.shape.shadowScale, 25.0f, 1.0f, 2.5f, 0.0f); if (play->gameplayFrames & 1) { - func_80AFC9A8(play, this, &this->actor.world.pos); + EnSkb_SpawnDigEffects(play, this, &this->actor.world.pos); } if (SkelAnime_Update(&this->skelAnime) && (this->actor.shape.yOffset == 0.0f)) { EnSkb_DecideNextAction(this); @@ -262,13 +252,13 @@ void EnSkb_SetupDespawn(EnSkb* this) { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->actor.speed = 0.0f; Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - func_80AFC9A0(this, EnSkb_Despawn); + EnSkb_SetupAction(this, EnSkb_Despawn); } void EnSkb_Despawn(EnSkb* this, PlayState* play) { if ((Math_SmoothStepToF(&this->actor.shape.yOffset, -8000.0f, 1.0f, 500.0f, 0.0f) != 0.0f) && (play->gameplayFrames & 1)) { - func_80AFC9A8(play, this, &this->actor.world.pos); + EnSkb_SpawnDigEffects(play, this, &this->actor.world.pos); } Math_SmoothStepToF(&this->actor.shape.shadowScale, 0.0f, 1.0f, 2.5f, 0.0f); if (SkelAnime_Update(&this->skelAnime)) { @@ -282,16 +272,15 @@ void EnSkb_SetupWalkForward(EnSkb* this) { this->actionState = SKB_BEHAVIOR_WALKING; this->headlessYawOffset = 0; this->actor.speed = this->actor.scale.y * 160.0f; - func_80AFC9A0(this, EnSkb_WalkForward); + EnSkb_SetupAction(this, EnSkb_WalkForward); } void EnSkb_WalkForward(EnSkb* this, PlayState* play) { s32 temp_ft2_sp34; f32 var_fv1_2; s32 temp_ft4; - Actor* sp28; + Player* player = GET_PLAYER(play); - sp28 = play->actorCtx.actorLists[2].head; if ((this->breakFlags != 0) && !(play->gameplayFrames & 0xF)) { this->headlessYawOffset = (s16)(s32)Rand_CenteredFloat(50000.0f); } @@ -307,7 +296,7 @@ void EnSkb_WalkForward(EnSkb* this, PlayState* play) { ((temp_ft4 < 0x10) && (((s32)var_fv1_2 + temp_ft2_sp34) >= 0xF)))) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_WALK); } - if ((Math_Vec3f_DistXZ(&this->actor.home.pos, &sp28->world.pos) > 800.0f) || IS_DAY) { + if ((Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 800.0f) || IS_DAY) { EnSkb_SetupDespawn(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x11C7) && (this->actor.xzDistToPlayer < (60.0f + (this->actor.params * 6.0f)))) { @@ -321,7 +310,7 @@ void EnSkb_SetupAttack(EnSkb* this) { this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_ATTACKING; this->actor.speed = 0.0f; - func_80AFC9A0(this, EnSkb_Attack); + EnSkb_SetupAction(this, EnSkb_Attack); } void EnSkb_Attack(EnSkb* this, PlayState* play) { @@ -349,7 +338,7 @@ void EnSkb_SetupRecoil(EnSkb* this) { this->collider.base.atFlags &= ~AT_BOUNCED; this->actionState = SKB_BEHAVIOR_RECOILING; this->setColliderAT = false; - func_80AFC9A0(this, EnSkb_Recoil); + EnSkb_SetupAction(this, EnSkb_Recoil); } void EnSkb_Recoil(EnSkb* this, PlayState* play) { @@ -365,7 +354,7 @@ void func_80AFD540(EnSkb* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_GOMA_JR_FREEZE); this->setColliderAT = false; this->actionState = SKB_BEHAVIOR_STUNNED; - func_80AFC9A0(this, EnSkb_Stunned); + EnSkb_SetupAction(this, EnSkb_Stunned); } void EnSkb_Stunned(EnSkb* this, PlayState* play) { @@ -396,7 +385,7 @@ void EnSkb_SetupTakeDamage(EnSkb* this) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->actionState = SKB_BEHAVIOR_DAMAGED; - func_80AFC9A0(this, EnSkb_TakeDamage); + EnSkb_SetupAction(this, EnSkb_TakeDamage); } void EnSkb_TakeDamage(EnSkb* this, PlayState* play) { @@ -433,7 +422,7 @@ void EnSkb_SetupDeath(EnSkb* this, PlayState* play) { BodyBreak_Alloc(&this->bodyBreak, 18, play); this->breakFlags |= 4; EffectSsDeadSound_SpawnStationary(play, &this->actor.projectedPos, NA_SE_EN_STALKID_DEAD, 1, 1, 40); - func_80AFC9A0(this, EnSkb_Death); + EnSkb_SetupAction(this, EnSkb_Death); } void EnSkb_Death(EnSkb* this, PlayState* play) { @@ -524,7 +513,7 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 15.0f, 30.0f, 60.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2 | UPDBGCHECKINFO_FLAG_3 | UPDBGCHECKINFO_FLAG_4); - this->unk284(this, play); + this->actionFunc(this, play); this->actor.focus.pos = this->actor.world.pos; this->actor.focus.pos.y += 3000.0f * this->actor.scale.y; if (this->setColliderAT) { @@ -537,35 +526,36 @@ void EnSkb_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } -s32 func_80AFDD30(PlayState* play, s32 arg1, Gfx** arg2, Vec3f* arg3, Vec3s* arg5, void* thisx) { +s32 EnSkb_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { EnSkb* this = thisx; - PlayState* arg0 = play; + PlayState* play2 = play; s32 temp_v0; - if (arg1 == 11) { + if (limbIndex == STALCHILD_LIMB_HEAD) { if (!(this->breakFlags & 2)) { // head limb, head is still attached - OPEN_DISPS(arg0->state.gfxCtx, "../z_en_skb.c", 972); - temp_v0 = (s16)(ABS((s16)(Math_SinS(arg0->gameplayFrames * 0x1770) * 95.0f)) + 0xA0) & 0xFF; + OPEN_DISPS(play2->state.gfxCtx, "../z_en_skb.c", 972); + temp_v0 = (s16)(ABS((s16)(Math_SinS(play2->gameplayFrames * 0x1770) * 95.0f)) + 0xA0); gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, temp_v0, temp_v0, temp_v0, 255); - CLOSE_DISPS(arg0->state.gfxCtx, "../z_en_skb.c", 978); + CLOSE_DISPS(play2->state.gfxCtx, "../z_en_skb.c", 978); } else { - *arg2 = NULL; + *dList = NULL; } - } else if ((arg1 == 12) && (this->breakFlags & 2)) { // jaw limb, don't draw if headless - *arg2 = NULL; + } else if ((limbIndex == STALCHILD_LIMB_JAW) && (this->breakFlags & 2)) { // jaw limb, don't draw if headless + *dList = NULL; } return 0; } -void func_80AFDF24(PlayState* arg0, s32 arg1, Gfx** arg2, Vec3s* arg3, void* thisx) { +void EnSkb_PostLimbDraw(PlayState* arg0, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { EnSkb* this = thisx; - Collider_UpdateSpheres(arg1, &this->collider); + Collider_UpdateSpheres(limbIndex, &this->collider); if ((this->breakFlags ^ 1) == 0) { - BodyBreak_SetInfo(&this->bodyBreak, arg1, 11, 12, 18, arg2, BODYBREAK_OBJECT_SLOT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, STALCHILD_LIMB_HEAD, STALCHILD_LIMB_JAW, 18, dList, + BODYBREAK_OBJECT_SLOT_DEFAULT); } else if ((this->breakFlags ^ (this->breakFlags | 4)) == 0) { - BodyBreak_SetInfo(&this->bodyBreak, arg1, 0, 18, 18, arg2, BODYBREAK_OBJECT_SLOT_DEFAULT); + BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 0, 18, 18, dList, BODYBREAK_OBJECT_SLOT_DEFAULT); } } @@ -573,5 +563,6 @@ void EnSkb_Draw(Actor* thisx, PlayState* play) { EnSkb* this = (EnSkb*)thisx; Gfx_SetupDL_25Opa(play->state.gfxCtx); - SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, func_80AFDD30, func_80AFDF24, this); + SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnSkb_OverrideLimbDraw, + EnSkb_PostLimbDraw, this); } diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.h b/src/overlays/actors/ovl_En_Skb/z_en_skb.h index c767aa65b9b..bd46a416a0c 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.h +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.h @@ -4,20 +4,23 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_skb/object_skb.h" + struct EnSkb; +typedef void (*EnSkbActionFunc)(struct EnSkb*, struct PlayState*); + typedef struct EnSkb { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ Vec3s jointTable[20]; - /* 0x208 */ Vec3s morphTable[20]; + /* 0x190 */ Vec3s jointTable[STALCHILD_LIMB_MAX]; + /* 0x208 */ Vec3s morphTable[STALCHILD_LIMB_MAX]; /* 0x280 */ u8 actionState; /* 0x281 */ u8 setColliderAT; /* 0x282 */ u8 lastDamageReaction; /* 0x283 */ u8 breakFlags; - /* 0x284 */ void (*unk284)(struct EnSkb*, struct PlayState*); + /* 0x284 */ EnSkbActionFunc actionFunc; /* 0x288 */ s16 headlessYawOffset; - /* 0x28A */ char pad28A[2]; /* 0x28C */ BodyBreak bodyBreak; /* 0x2A4 */ ColliderJntSph collider; /* 0x2C4 */ ColliderJntSphElement colliderElements[2]; From 965e6baa23273fce207c8d7a3c1da93053372a63 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 11 Oct 2026 16:01:13 +0200 Subject: [PATCH 141/150] BgHakaTrap review --- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c | 234 ++++++++++-------- .../actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.h | 8 +- 2 files changed, 133 insertions(+), 109 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index 3d7af206c4f..927a6e2d01d 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -94,7 +94,14 @@ static ColliderCylinderInit sCylinderInit = { static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { { - { 0, { 0, 0, 0 }, { 0x20000, 0, 0 }, 0, 1, 0 }, + { + ELEM_MATERIAL_UNK0, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0x00020000, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_ON, + OCELEM_NONE, + }, { { { 1800.0f, 1200.0f, 0.0f }, @@ -104,7 +111,14 @@ static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { }, }, { - { 0, { 0, 0, 0 }, { 0x20000, 0, 0 }, 0, 1, 0 }, + { + ELEM_MATERIAL_UNK0, + { 0x00000000, HIT_SPECIAL_EFFECT_NONE, 0x00 }, + { 0x00020000, HIT_BACKLASH_NONE, 0x00 }, + ATELEM_NONE, + ACELEM_ON, + OCELEM_NONE, + }, { { { 1800.0f, 1200.0f, 0.0f }, { -1800.0f, 0.0f, 0.0f }, @@ -113,7 +127,19 @@ static ColliderTrisElementInit sSpikedWallTrisElementsInit[2] = { }, }; -static ColliderTrisInit sSpikedWallTrisInit = { { 0xA, 0, 9, 0, 0x20, 2 }, 2, sSpikedWallTrisElementsInit }; +static ColliderTrisInit sSpikedWallTrisInit = { + { + COL_MATERIAL_NONE, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_NONE, + OC2_TYPE_2, + COLSHAPE_TRIS, + }, + ARRAY_COUNT(sSpikedWallTrisElementsInit), + sSpikedWallTrisElementsInit, +}; + static CollisionCheckInfoInit sColChkInfoInit = { 0, 80, 100, MASS_IMMOVABLE }; static InitChainEntry sInitChain[] = { @@ -125,39 +151,38 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { s32* spikedCrusherFlipPtr; BgHakaTrap* this = (BgHakaTrap*)thisx; - CollisionHeader* sp2C; + CollisionHeader* colHeader = NULL; - sp2C = NULL; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->dyna.actor.params &= 0xFF; spikedCrusherFlipPtr = &sSpikedCrusherFlip; if (this->dyna.actor.params != BG_HAKA_TRAP_FAN_BLADE) { - Collider_InitCylinder(play, &this->unk178); - Collider_SetCylinder(play, &this->unk178, &this->dyna.actor, &sCylinderInit); + Collider_InitCylinder(play, &this->colliderCylinder); + Collider_SetCylinder(play, &this->colliderCylinder, &this->dyna.actor, &sCylinderInit); if ((this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE) || (this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE_FAST)) { - this->unk168 = 0x14; + this->timer = 20; do { } while (0); - this->unk178.dim.yShift = 0xA; + this->colliderCylinder.dim.yShift = 10; this->dyna.actor.velocity.y = 0.1f; if (this->dyna.actor.params == BG_HAKA_TRAP_GUILLOTINE_FAST) { this->dyna.actor.params = BG_HAKA_TRAP_GUILLOTINE; this->isGuillotineFast = true; } - this->actionFunc = &BgHakaTrap_Guillotine_Fall; + this->actionFunc = BgHakaTrap_Guillotine_Fall; } else { DynaPolyActor_Init((DynaPolyActor*)this, DYNA_TRANSFORM_POS); this->dyna.actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; if (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_CRUSHER) { - CollisionHeader_GetVirtual(&gShadowTempleSpikedCrusherCol, &sp2C); - this->unk168 = 0x1E; + CollisionHeader_GetVirtual(&gShadowTempleSpikedCrusherCol, &colHeader); + this->timer = 30; if (*spikedCrusherFlipPtr) { - this->actionFunc = &BgHakaTrap_SpikedCrusher_Lift; + this->actionFunc = BgHakaTrap_SpikedCrusher_Lift; sSpikedCrusherFlip = false; } else { sSpikedCrusherFlip = true; - this->actionFunc = &BgHakaTrap_SpikedCrusher_Fall; + this->actionFunc = BgHakaTrap_SpikedCrusher_Fall; this->dyna.actor.velocity.y = 0.5f; } // Assign the minimum height of the crusher. The crusher intentionally clips through the floor by 25 @@ -166,11 +191,11 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { // Assigns the height the crusher rises on first "tug". The final -25 offset is missing in other // calculations of this variable. this->spikedCrusherStepY = this->dyna.actor.floorHeight + 50.0f - 25.0f; - this->unk178.dim.radius = 0xA; - this->unk178.dim.height = 0x28; + this->colliderCylinder.dim.radius = 0xA; + this->colliderCylinder.dim.height = 0x28; } else { if (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) { - CollisionHeader_GetVirtual(&gShadowTempleSpikedWallEastCol, &sp2C); + CollisionHeader_GetVirtual(&gShadowTempleSpikedWallEastCol, &colHeader); // Shift the home position toward the center of the room. This will become the target position that // triggers the crush. this->dyna.actor.home.pos.x -= 200.0f; @@ -178,22 +203,23 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) { // Shift the home position toward the center of the room. This will become the target position that // triggers the crush. this->dyna.actor.home.pos.x += 200.0f; - CollisionHeader_GetVirtual(&gShadowTempleSpikedWallWestCol, &sp2C); + CollisionHeader_GetVirtual(&gShadowTempleSpikedWallWestCol, &colHeader); } - Collider_InitTris(play, &this->unk1C4); - Collider_SetTris(play, &this->unk1C4, &this->dyna.actor, &sSpikedWallTrisInit, this->unk1E4); - this->unk178.dim.radius = 0x12; - this->unk178.dim.height = 0x73; - this->unk178.elem.atElemFlags &= ~ATELEM_SFX_NORMAL; - this->unk178.elem.atElemFlags |= 0x10; - this->actionFunc = &BgHakaTrap_SpikedWall_CloseIn; + Collider_InitTris(play, &this->spikedWallCollider); + Collider_SetTris(play, &this->spikedWallCollider, &this->dyna.actor, &sSpikedWallTrisInit, + this->spikedWallColliderElements); + this->colliderCylinder.dim.radius = 18; + this->colliderCylinder.dim.height = 115; + this->colliderCylinder.elem.atElemFlags &= ~ATELEM_SFX_NORMAL; + this->colliderCylinder.elem.atElemFlags |= ATELEM_SFX_WOOD; + this->actionFunc = BgHakaTrap_SpikedWall_CloseIn; } - this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, sp2C); + this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); } } else { // Initialize HAKA_TRAP_FAN_BLADE - this->unk168 = 0x28; - this->actionFunc = &BgHakaTrap_FanBlade_Idle; + this->timer = 40; + this->actionFunc = BgHakaTrap_FanBlade_Idle; this->dyna.actor.cullingVolumeScale = 500.0f; } CollisionCheck_SetInfo(&this->dyna.actor.colChkInfo, NULL, &sColChkInfoInit); @@ -207,10 +233,10 @@ void BgHakaTrap_Destroy(Actor* thisx, PlayState* play) { DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); if ((this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) || (this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_WEST)) { - Collider_DestroyTris(play, &this->unk1C4); + Collider_DestroyTris(play, &this->spikedWallCollider); } } - Collider_DestroyCylinder(play, &this->unk178); + Collider_DestroyCylinder(play, &this->colliderCylinder); } Audio_StopSfxByPos(&this->chainLiftSfxPos); } @@ -232,8 +258,8 @@ void BgHakaTrap_UpdateBodyColliderPos(BgHakaTrap* this, PlayState* play) { colOff.x = -CLAMP(colOff.x, -162.0f, 162.0f); colOff.z = ((colOff.z >= 0.0f) ? 1.0f : -1.0f) * 15.0f; } - this->unk178.dim.pos.x = this->dyna.actor.world.pos.x + (colOff.x * cos) + (colOff.z * sin); - this->unk178.dim.pos.z = this->dyna.actor.world.pos.z + (colOff.x * sin) + (colOff.z * cos); + this->colliderCylinder.dim.pos.x = this->dyna.actor.world.pos.x + (colOff.x * cos) + (colOff.z * sin); + this->colliderCylinder.dim.pos.z = this->dyna.actor.world.pos.z + (colOff.x * sin) + (colOff.z * cos); } #define BGHAKATRAP_SPIKEDWALL_HITEAST (1 << 0) @@ -245,7 +271,7 @@ void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!sIsSpikeWallBurning && (Player_InCsMode(play) == 0)) { + if (!sIsSpikeWallBurning && !Player_InCsMode(play)) { if (Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f) == 0) { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG); } else { @@ -257,8 +283,8 @@ void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) { } } BgHakaTrap_UpdateBodyColliderPos(this, play); - if (this->unk1C4.base.acFlags & AC_HIT) { - this->unk168 = 0x14; + if (this->spikedWallCollider.base.acFlags & AC_HIT) { + this->timer = 20; sIsSpikeWallBurning = true; this->actionFunc = BgHakaTrap_SpikedWall_Burn; } else if (sSpikedWallFlags == (BGHAKATRAP_SPIKEDWALL_HITEAST | BGHAKATRAP_SPIKEDWALL_HITWEST)) { @@ -267,25 +293,24 @@ void BgHakaTrap_SpikedWall_CloseIn(BgHakaTrap* this, PlayState* play) { } } -Vec3f D_8088101C = { 0.0f, 0.0f, 0.0f }; - void BgHakaTrap_SpikedWall_Burn(BgHakaTrap* this, PlayState* play) { - Vec3f sp94; - s32 var_s0; + static Vec3f sEffVelAccel = { 0.0f, 0.0f, 0.0f }; + Vec3f effPos; + s32 i; - if (this->unk168 != 0) { - this->unk168--; + if (this->timer != 0) { + this->timer--; } Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_BURN_OUT - SFX_FLAG); - for (var_s0 = 0; var_s0 < 2; var_s0++) { - sp94.x = (Rand_ZeroOne() * ((this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) ? -30.0f : 30.0f)) + - this->dyna.actor.world.pos.x; - sp94.y = (Rand_ZeroOne() * 10.0f) + this->dyna.actor.world.pos.y + 30.0f; - sp94.z = Rand_CenteredFloat(320.0f) + this->dyna.actor.world.pos.z; - EffectSsDeadDb_Spawn(play, &sp94, &D_8088101C, &D_8088101C, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, + for (i = 0; i < 2; i++) { + effPos.x = (Rand_ZeroOne() * ((this->dyna.actor.params == BG_HAKA_TRAP_SPIKED_WALL_EAST) ? -30.0f : 30.0f)) + + this->dyna.actor.world.pos.x; + effPos.y = (Rand_ZeroOne() * 10.0f) + this->dyna.actor.world.pos.y + 30.0f; + effPos.z = Rand_CenteredFloat(320.0f) + this->dyna.actor.world.pos.z; + EffectSsDeadDb_Spawn(play, &effPos, &sEffVelAccel, &sEffVelAccel, 130, 20, 255, 255, 150, 170, 255, 0, 0, 1, 9, false); } - if (this->unk168 == 0) { + if (this->timer == 0) { sIsSpikeWallBurning = false; Actor_Kill(&this->dyna.actor); } @@ -293,56 +318,56 @@ void BgHakaTrap_SpikedWall_Burn(BgHakaTrap* this, PlayState* play) { void BgHakaTrap_Guillotine_Fall(BgHakaTrap* this, PlayState* play) { s32 isDoneFalling; - s32 unk168; + s32 timer; if (this->isGuillotineFast) { this->dyna.actor.velocity.y *= 3.0f; } else { this->dyna.actor.velocity.y *= 2.0f; } - if (this->unk168 != 0) { - this->unk168 -= 1; + if (this->timer != 0) { + this->timer -= 1; } isDoneFalling = Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 185.0f, this->dyna.actor.velocity.y); - unk168 = this->unk168; - if (((unk168 == 0xA) && !this->isGuillotineFast) || ((unk168 == 0xD) && this->isGuillotineFast)) { + timer = this->timer; + if (((timer == 10) && !this->isGuillotineFast) || ((timer == 13) && this->isGuillotineFast)) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GUILLOTINE_BOUND); } - if (this->unk168 == 0) { + if (this->timer == 0) { this->dyna.actor.velocity.y = 0.0f; if (this->isGuillotineFast) { - this->unk168 = 0xA; + this->timer = 10; } else { - this->unk168 = 0x28; + this->timer = 40; } Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GUILLOTINE_UP); this->actionFunc = BgHakaTrap_Guillotine_Lift; } BgHakaTrap_UpdateBodyColliderPos(this, play); if (!isDoneFalling) { - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk178.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } } void BgHakaTrap_Guillotine_Lift(BgHakaTrap* this, PlayState* play) { - if (this->unk168 != 0) { - this->unk168 -= 1; + if (this->timer != 0) { + this->timer--; } if (this->isGuillotineFast) { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 27.0f); } else { - if (this->unk168 >= 0x15) { + if (this->timer > 20) { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 90.0f, 9.0f); } else { Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 4.5f); } - if (this->unk168 == 0x14) { + if (this->timer == 20) { Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_GUILLOTINE_UP); } } - if (this->unk168 == 0) { - this->unk168 = 0x14; + if (this->timer == 0) { + this->timer = 20; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; this->dyna.actor.velocity.y = 0.1f; this->actionFunc = BgHakaTrap_Guillotine_Fall; @@ -351,34 +376,34 @@ void BgHakaTrap_Guillotine_Lift(BgHakaTrap* this, PlayState* play) { } void BgHakaTrap_SpikedCrusher_Fall(BgHakaTrap* this, PlayState* play) { - Vec3f sp74; + Vec3f pos; f32 yIntersect; f32 floorHeight; - s32 var_s0; + s32 i; s32 bgId; this->dyna.actor.velocity.y *= 1.6f; - if (this->unk168 != 0) { - this->unk168 -= 1; + if (this->timer != 0) { + this->timer--; } // Perform a collision check for the "stone umbrella" block // Because of the shape of the room and the size of the block we only need to check three positions, // the center of the east edge, the centerpoint, and the center of the west edge of the crusher. // // The y coordinate is offset by 25 units, as the crusher is allowed to clip into the floor for visual effect. - sp74.x = this->dyna.actor.world.pos.x + 90.0f; - sp74.y = this->dyna.actor.world.pos.y + 1.0f + 25.0f; - sp74.z = this->dyna.actor.world.pos.z; + pos.x = this->dyna.actor.world.pos.x + 90.0f; + pos.y = this->dyna.actor.world.pos.y + 1.0f + 25.0f; + pos.z = this->dyna.actor.world.pos.z; // actor.floorHeight is storing the minimum y position of the crusher floorHeight = this->dyna.actor.floorHeight; - for (var_s0 = 0; var_s0 < 3; var_s0++) { + for (i = 0; i < 3; i++) { yIntersect = - BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &sp74) - + BgCheck_EntityRaycastDown4(&play->colCtx, &this->dyna.actor.floorPoly, &bgId, &this->dyna.actor, &pos) - 25.0f; if (floorHeight < yIntersect) { floorHeight = yIntersect; } - sp74.x -= 90.0f; + pos.x -= 90.0f; } if (Math_StepToF(&this->dyna.actor.world.pos.y, floorHeight, this->dyna.actor.velocity.y) != 0) { if (this->dyna.actor.velocity.y > 0.01f) { @@ -389,9 +414,9 @@ void BgHakaTrap_SpikedCrusher_Fall(BgHakaTrap* this, PlayState* play) { if (this->dyna.actor.velocity.y >= 0.01f) { Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_CHINETRAP_DOWN - SFX_FLAG); } - if (this->unk168 == 0) { + if (this->timer == 0) { this->dyna.actor.velocity.y = 0.0f; - this->unk168 = 0x1E; + this->timer = 30; this->spikedCrusherStepY = (s16)this->dyna.actor.world.pos.y + 50.0f; this->spikedCrusherStepY = MIN(this->dyna.actor.home.pos.y, this->spikedCrusherStepY); this->actionFunc = BgHakaTrap_SpikedCrusher_Lift; @@ -399,17 +424,17 @@ void BgHakaTrap_SpikedCrusher_Fall(BgHakaTrap* this, PlayState* play) { } void BgHakaTrap_SpikedCrusher_Lift(BgHakaTrap* this, PlayState* play) { - if (this->unk168 != 0) { - this->unk168--; + if (this->timer != 0) { + this->timer--; } - if (this->unk168 >= 0x15) { + if (this->timer > 20) { this->isSpikedCrusherStationary = Math_StepToF(&this->dyna.actor.world.pos.y, this->spikedCrusherStepY, 15.0f); } else { this->isSpikedCrusherStationary = Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 20.0f); } - if (this->unk168 == 0) { - this->unk168 = 0x1E; + if (this->timer == 0) { + this->timer = 30; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; this->dyna.actor.velocity.y = 0.5f; this->actionFunc = BgHakaTrap_SpikedCrusher_Fall; @@ -417,11 +442,11 @@ void BgHakaTrap_SpikedCrusher_Lift(BgHakaTrap* this, PlayState* play) { } void BgHakaTrap_FanBlade_Idle(BgHakaTrap* this, PlayState* play) { - if (this->unk168 != 0) { - this->unk168 -= 1; + if (this->timer != 0) { + this->timer -= 1; } - if (this->unk168 == 0) { - // this->unk168 = 0, which signals the fan to turn on and speed up + if (this->timer == 0) { + // this->timer = 0, which signals the fan to turn on and speed up this->actionFunc = BgHakaTrap_FanBlade_ToggleFanGust; } } @@ -434,28 +459,27 @@ void BgHakaTrap_PushPlayer(BgHakaTrap* this, PlayState* play, s16 angularVelocit if ((fabsf(playerRelOff.x) < 70.0f) && (fabsf(playerRelOff.y) < 100.0f) && (playerRelOff.z < 500.0f) && (GET_PLAYER(play)->currentBoots != 1)) { player->pushedSpeed = - (((500.0f - playerRelOff.z) * 0.06f) + 5.0f) * angularVelocity * (1.0f / 14848.0f) * (2.0f / 3.0f); + (((500.0f - playerRelOff.z) * 0.06f) + 5.0f) * angularVelocity * (1.0f / 0x3A00) * (2.0f / 3.0f); player->pushedYaw = this->dyna.actor.shape.rot.y; } } void BgHakaTrap_FanBlade_ToggleFanGust(BgHakaTrap* this, PlayState* play) { - // this->unk168 stores the current fan behavior. + // this->timer stores the current fan behavior. // if 1, the fan is on and is ramping down to the off state. // if 0, the fan is off and is ramping up to the full on state. // world.rot.z is the current angular velocity of the fan - if (this->unk168 != 0) { + if (this->timer != 0) { // Fan winds down - if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0, (this->dyna.actor.world.rot.z * 0.03f) + 5.0f) != 0) { - this->unk168 = 0x28; + if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0, (this->dyna.actor.world.rot.z * 0.03f) + 5.0f)) { + this->timer = 40; this->actionFunc = BgHakaTrap_FanBlade_Idle; } } else { // Fan speeds up - if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0x3A00, (this->dyna.actor.world.rot.z * 0.03f) + 5.0f) != - 0) { - this->unk168 = 0x64; + if (Math_ScaledStepToS(&this->dyna.actor.world.rot.z, 0x3A00, (this->dyna.actor.world.rot.z * 0.03f) + 5.0f)) { + this->timer = 100; this->actionFunc = BgHakaTrap_FanBlade_FullGust; } } @@ -467,12 +491,12 @@ void BgHakaTrap_FanBlade_ToggleFanGust(BgHakaTrap* this, PlayState* play) { } void BgHakaTrap_FanBlade_FullGust(BgHakaTrap* this, PlayState* play) { - if (this->unk168 != 0) { - this->unk168--; + if (this->timer != 0) { + this->timer--; } Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_WIND_TRAP - SFX_FLAG); - if (this->unk168 == 0) { - this->unk168 = 1; // setting this signals the fan to turn off and slow down + if (this->timer == 0) { + this->timer = 1; // setting this signals the fan to turn off and slow down this->actionFunc = BgHakaTrap_FanBlade_ToggleFanGust; } // world.rot.z is the current angular velocity of the fan @@ -487,15 +511,15 @@ void BgHakaTrap_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); if ((thisx->params != BG_HAKA_TRAP_FAN_BLADE) && (thisx->params != BG_HAKA_TRAP_SPIKED_CRUSHER)) { - this->unk178.dim.pos.y = this->dyna.actor.world.pos.y; + this->colliderCylinder.dim.pos.y = this->dyna.actor.world.pos.y; if ((thisx->params == BG_HAKA_TRAP_GUILLOTINE) || (thisx->params == BG_HAKA_TRAP_GUILLOTINE_FAST)) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk178.base); - CollisionCheck_SetOC(play, &play->colChkCtx, &this->unk178.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder.base); + CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder.base); } else { if (this->actionFunc == BgHakaTrap_SpikedWall_CloseIn) { - CollisionCheck_SetAC(play, &play->colChkCtx, &this->unk1C4.base); + CollisionCheck_SetAC(play, &play->colChkCtx, &this->spikedWallCollider.base); } - CollisionCheck_SetAT(play, &play->colChkCtx, &this->unk178.base); + CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderCylinder.base); } } } @@ -506,23 +530,23 @@ void BgHakaTrap_SpikedWall_UpdateCollider(BgHakaTrap* this) { Matrix_MultVec3f(&sSpikedWallTrisElementsInit[0].dim.vtx[0], &vtx[0]); Matrix_MultVec3f(&sSpikedWallTrisElementsInit[0].dim.vtx[1], &vtx[1]); Matrix_MultVec3f(&sSpikedWallTrisElementsInit[0].dim.vtx[2], &vtx[2]); - Collider_SetTrisVertices(&this->unk1C4, 0, &vtx[0], &vtx[1], &vtx[2]); + Collider_SetTrisVertices(&this->spikedWallCollider, 0, &vtx[0], &vtx[1], &vtx[2]); Matrix_MultVec3f(&sSpikedWallTrisElementsInit[1].dim.vtx[2], &vtx[1]); - Collider_SetTrisVertices(&this->unk1C4, 1, &vtx[0], &vtx[2], &vtx[1]); + Collider_SetTrisVertices(&this->spikedWallCollider, 1, &vtx[0], &vtx[2], &vtx[1]); } Gfx* D_80881028[5] = { gShadowTempleGuillotineDL, gShadowTempleSpikedCrusherDL, gShadowTempleSpikedWallEastDL, gShadowTempleSpikedWallWestDL, gShadowTempleFanBladeDL, }; -static Color_RGBA8 sFogBlack = { 0, 0, 0, 0 }; void BgHakaTrap_Draw(Actor* thisx, PlayState* play) { + static Color_RGBA8 sFogBlack = { 0, 0, 0, 0 }; BgHakaTrap* this = (BgHakaTrap*)thisx; STACK_PAD(s32); if (this->actionFunc == BgHakaTrap_SpikedWall_Burn) { - func_80026230(play, &sFogBlack, this->unk168 + 0x14, 40); + func_80026230(play, &sFogBlack, this->timer + 20, 40); } Gfx_DrawDListOpa(play, D_80881028[this->dyna.actor.params]); if (this->actionFunc == BgHakaTrap_SpikedWall_CloseIn) { 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 ee212c5a7a8..a690c9f8041 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 @@ -20,7 +20,7 @@ typedef void (*BgHakaTrapActionFunc)(struct BgHakaTrap*, struct PlayState*); typedef struct BgHakaTrap { /* 0x000 */ DynaPolyActor dyna; /* 0x164 */ BgHakaTrapActionFunc actionFunc; - /* 0x168 */ u8 unk168; + /* 0x168 */ u8 timer; /* 0x169 */ s8 isSpikedCrusherStationary; /* 0x016A */ union { s16 isGuillotineFast; // 0 slow, 1 fast @@ -28,9 +28,9 @@ typedef struct BgHakaTrap { // lifted to its maximum height }; /* 0x16C */ Vec3f chainLiftSfxPos; - /* 0x178 */ ColliderCylinder unk178; - /* 0x1C4 */ ColliderTris unk1C4; - /* 0x1E4 */ ColliderTrisElement unk1E4[2]; + /* 0x178 */ ColliderCylinder colliderCylinder; + /* 0x1C4 */ ColliderTris spikedWallCollider; + /* 0x1E4 */ ColliderTrisElement spikedWallColliderElements[2]; } BgHakaTrap; // size = 0x29C #endif From b259996e81327cee348c1a538eb1e6d7d4f6de5b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 11 Oct 2026 16:33:29 +0200 Subject: [PATCH 142/150] EnDns review --- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 200 ++++++++++++---------- src/overlays/actors/ovl_En_Dns/z_en_dns.h | 27 +-- 2 files changed, 123 insertions(+), 104 deletions(-) diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 2b4830b3b0b..450290461c0 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -17,6 +17,7 @@ #include "player.h" #include "save.h" #include "stack_pad.h" +#include "translation.h" #include "assets/objects/object_shopnuts/object_shopnuts.h" @@ -44,7 +45,7 @@ void EnDns_PayForDekuStickUpgrade(EnDns* this); void EnDns_PayForDekuNutUpgrade(EnDns* this); void EnDns_SetupIdle(EnDns*, PlayState*); void EnDns_Idle(EnDns*, PlayState*); -void func_809EFC9C(EnDns*, PlayState*); +void EnDns_Talking(EnDns*, PlayState*); void EnDns_SetupSale(EnDns*, PlayState*); void EnDns_Sale(EnDns*, PlayState*); void EnDns_SetupBurrow(EnDns*, PlayState*); @@ -63,6 +64,7 @@ ActorProfile En_Dns_Profile = { /**/ EnDns_Update, /**/ EnDns_Draw, }; + static ColliderCylinderInitType1 sCylinderInit = { { COL_MATERIAL_NONE, @@ -81,6 +83,7 @@ static ColliderCylinderInitType1 sCylinderInit = { }, { 18, 32, 0, { 0, 0, 0 } }, }; + static u16 sStartingTextIds[] = { 0x10A0, // DNS_TYPE_DEKU_NUTS_5 0x10A1, // DNS_TYPE_DEKU_STICKS_1 @@ -94,21 +97,23 @@ static u16 sStartingTextIds[] = { 0x10DC, // DNS_TYPE_DEKU_STICK_UPGRADE 0x10DD, // DNS_TYPE_DEKU_NUT_UPGRADE }; + #if DEBUG_FEATURES static char* sItemDebugTxt[] = { - "デクの実売り ", // DNS_TYPE_DEKU_NUTS_5 - "デクの棒売り ", // DNS_TYPE_DEKU_STICKS_1 - "ハートの欠片売り ", // DNS_TYPE_HEART_PIECE - "デクの種売り ", // DNS_TYPE_DEKU_SEEDS_30 - "デクの盾売り ", // DNS_TYPE_DEKU_SHIELD - "バクダン売り ", // DNS_TYPE_BOMBS_5 - "矢売り ", // DNS_TYPE_ARROWS_30 - "赤のくすり売り ", // DNS_TYPE_RED_POTION - "緑のくすり売り ", // DNS_TYPE_GREEN_POTION - "デクの棒持てる数を増やす", // DNS_TYPE_DEKU_STICK_UPGRADE - "デクの実持てる数を増やす", // DNS_TYPE_DEKU_NUT_UPGRADE + T("デクの実売り ", "Deku Nut Vendor "), // DNS_TYPE_DEKU_NUTS_5 + T("デクの棒売り ", "Deku selling sticks "), // DNS_TYPE_DEKU_STICKS_1 + T("ハートの欠片売り ", "Heart Piece Seller "), // DNS_TYPE_HEART_PIECE + T("デクの種売り ", "Deku Seed Seller "), // DNS_TYPE_DEKU_SEEDS_30 + T("デクの盾売り ", "Deku Shield Salesman "), // DNS_TYPE_DEKU_SHIELD + T("バクダン売り ", "Bomb Seller "), // DNS_TYPE_BOMBS_5 + T("矢売り ", "Arrow seller "), // DNS_TYPE_ARROWS_30 + T("赤のくすり売り ", "The Red Medicine Seller "), // DNS_TYPE_RED_POTION + T("緑のくすり売り ", "The Green Medicine Seller"), // DNS_TYPE_GREEN_POTION + T("デクの棒持てる数を増やす", "Increase the number of Deku Sticks you can carry."), // DNS_TYPE_DEKU_STICK_UPGRADE + T("デクの実持てる数を増やす", "Increase the number of Deku Nuts you can carry."), // DNS_TYPE_DEKU_NUT_UPGRADE }; #endif + static EnDnsPurchaseInfo sItemDekuNuts = { 20, 5, GI_DEKU_NUTS_5_2, EnDns_CanBuyDekuNuts, EnDns_PayForDekuNuts, }; @@ -142,6 +147,7 @@ static EnDnsPurchaseInfo sItemDekuStickUpgrade = { static EnDnsPurchaseInfo sItemDekuNutUpgrade = { 40, 1, GI_DEKU_NUT_UPGRADE_30, EnDns_CanBuyPrice, EnDns_PayForDekuNutUpgrade, }; + static EnDnsPurchaseInfo* sEnDnsPurchaseInfos[] = { &sItemDekuNuts, // DNS_TYPE_DEKU_NUTS_5 &sItemDekuSticks, // DNS_TYPE_DEKU_STICKS_1 @@ -155,6 +161,7 @@ static EnDnsPurchaseInfo* sEnDnsPurchaseInfos[] = { &sItemDekuStickUpgrade, // DNS_TYPE_DEKU_STICK_UPGRADE &sItemDekuNutUpgrade, // DNS_TYPE_DEKU_NUT_UPGRADE }; + static InitChainEntry sInitChain[3] = { ICHAIN_S8(naviEnemyId, NAVI_ENEMY_BUSINESS_SCRUB, ICHAIN_CONTINUE), ICHAIN_U8(attentionRangeType, ATTENTION_RANGE_2, ICHAIN_CONTINUE), @@ -171,31 +178,34 @@ void EnDns_Init(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; if (DNS_GET_TYPE(&this->actor) < 0) { - PRINTF(VT_FGCOL(RED) "引数エラー(売りナッツ)[ arg_data = %d ]" VT_RST "\n", this->actor.params); + PRINTF(VT_FGCOL(RED) T("引数エラー(売りナッツ)[ arg_data = %d ]", + "Argument error (Selling nuts) [ arg_data = %d ]") VT_RST "\n", + this->actor.params); Actor_Kill(&this->actor); return; } - if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == 5)) { + if ((DNS_GET_TYPE(&this->actor) == DNS_TYPE_ARROWS_30) && (LINK_AGE_IN_YEARS == YEARS_CHILD)) { this->actor.params = DNS_TYPE_DEKU_SEEDS_30; } - PRINTF(VT_FGCOL(GREEN) "◆◆◆ 売りナッツ『%s』 ◆◆◆" VT_RST "\n", sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); + PRINTF(VT_FGCOL(GREEN) T("◆◆◆ 売りナッツ『%s』 ◆◆◆", "◆◆◆ Nuts for sale 『%s』 ◆◆◆") VT_RST "\n", + sItemDebugTxt[DNS_GET_TYPE(&this->actor)]); Actor_ProcessInitChain(&this->actor, sInitChain); - SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, this->unk190, - this->unk1FC, 0x12); + SkelAnime_InitFlex(play, &this->skelAnime, &gBusinessScrubSkel, &gBusinessScrubNervousTransitionAnim, + this->jointTable, this->morphTable, BUSINESS_SCRUB_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f); this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; Actor_SetScale(&this->actor, 0.01f); - this->actor.colChkInfo.mass = 0xFF; - this->isColliderEnabled = 1; - this->unk2BC = 1; - this->unk2BD = 0; + this->actor.colChkInfo.mass = MASS_IMMOVABLE; + this->isColliderEnabled = true; + this->runUpdBgCheckInfo = true; + this->spawnHeartsAfterBurrow = false; this->actor.speed = 0.0f; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; - this->unk2C0 = sEnDnsPurchaseInfos[DNS_GET_TYPE(&this->actor)]; - this->unk268 = EnDns_SetupIdle; + this->purchaseInfo = sEnDnsPurchaseInfos[DNS_GET_TYPE(&this->actor)]; + this->actionFunc = EnDns_SetupIdle; } void EnDns_Destroy(Actor* thisx, PlayState* play) { @@ -204,20 +214,20 @@ void EnDns_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } -void EnDns_ChangeAnim(EnDns* this, u8 arg1) { - s16 temp_ft0; +void EnDns_ChangeAnim(EnDns* this, u8 animIndex) { + s16 animLastFrame; - temp_ft0 = Animation_GetLastFrame(sAnimationInfo[arg1].animation); - this->animIndex = arg1; - Animation_Change(&this->skelAnime, sAnimationInfo[arg1].animation, 1.0f, 0.0f, temp_ft0, sAnimationInfo[arg1].mode, - sAnimationInfo[arg1].morphFrames); + animLastFrame = Animation_GetLastFrame(sAnimationInfo[animIndex].animation); + this->animIndex = animIndex; + Animation_Change(&this->skelAnime, sAnimationInfo[animIndex].animation, 1.0f, 0.0f, animLastFrame, + sAnimationInfo[animIndex].mode, sAnimationInfo[animIndex].morphFrames); } u32 EnDns_CanBuyDekuNuts(EnDns* this) { - if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (AMMO(ITEM_DEKU_NUT) >= (s32)CUR_CAPACITY(UPG_DEKU_NUTS))) { + if ((CUR_CAPACITY(UPG_DEKU_NUTS) != 0) && (AMMO(ITEM_DEKU_NUT) >= CUR_CAPACITY(UPG_DEKU_NUTS))) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } @@ -228,10 +238,10 @@ u32 EnDns_CanBuyDekuNuts(EnDns* this) { } u32 EnDns_CanBuyDekuSticks(EnDns* this) { - if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= (s32)CUR_CAPACITY(UPG_DEKU_STICKS))) { + if ((CUR_CAPACITY(UPG_DEKU_STICKS) != 0) && (AMMO(ITEM_DEKU_STICK) >= CUR_CAPACITY(UPG_DEKU_STICKS))) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } @@ -242,7 +252,7 @@ u32 EnDns_CanBuyDekuSticks(EnDns* this) { } u32 EnDns_CanBuyPrice(EnDns* this) { - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } return DNS_CANBUY_RESULT_SUCCESS; @@ -256,7 +266,7 @@ u32 EnDns_CanBuyDekuSeeds(EnDns* this) { if (AMMO(ITEM_SLINGSHOT) >= CUR_CAPACITY(UPG_BULLET_BAG)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } @@ -270,7 +280,7 @@ u32 EnDns_CanBuyDekuShield(EnDns* this) { if (CHECK_OWNED_EQUIP_ALT(EQUIP_TYPE_SHIELD, EQUIP_INV_SHIELD_DEKU)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } return DNS_CANBUY_RESULT_SUCCESS; @@ -284,7 +294,7 @@ u32 EnDns_CanBuyBombs(EnDns* this) { if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } return DNS_CANBUY_RESULT_SUCCESS; @@ -298,7 +308,7 @@ u32 EnDns_CanBuyArrows(EnDns* this) { if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } return DNS_CANBUY_RESULT_SUCCESS; @@ -308,46 +318,46 @@ u32 EnDns_CanBuyBottle(EnDns* this) { if (!Inventory_HasEmptyBottle()) { return DNS_CANBUY_RESULT_CAPACITY_FULL; } - if (gSaveContext.save.info.playerData.rupees < this->unk2C0->price) { + if (gSaveContext.save.info.playerData.rupees < this->purchaseInfo->price) { return DNS_CANBUY_RESULT_NEED_RUPEES; } return DNS_CANBUY_RESULT_SUCCESS; } void EnDns_PayPrice(EnDns* this) { - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_PayForDekuNuts(EnDns* this) { - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_PayForHeartPiece(EnDns* this) { SET_ITEMGETINF(ITEMGETINF_DEKU_HEART_PIECE); - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_PayForBombs(EnDns* this) { - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_PayForArrows(EnDns* this) { - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_PayForDekuStickUpgrade(EnDns* this) { SET_INFTABLE(INFTABLE_HAS_DEKU_STICK_UPGRADE); - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_PayForDekuNutUpgrade(EnDns* this) { SET_INFTABLE(INFTABLE_HAS_DEKU_NUT_UPGRADE); - Rupees_ChangeBy(-this->unk2C0->price); + Rupees_ChangeBy(-this->purchaseInfo->price); } void EnDns_SetupIdle(EnDns* this, PlayState* play) { if (this->skelAnime.curFrame == this->skelAnime.endFrame) { - this->unk268 = EnDns_Idle; + this->actionFunc = EnDns_Idle; EnDns_ChangeAnim(this, DNS_ANIM_IDLE); } } @@ -357,7 +367,7 @@ void EnDns_Idle(EnDns* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; if (Actor_TalkOfferAccepted(&this->actor, play)) { - this->unk268 = func_809EFC9C; + this->actionFunc = EnDns_Talking; } else { if ((this->collider.base.ocFlags1 & OC1_HIT) || (this->actor.isLockedOn != 0)) { this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; @@ -370,33 +380,37 @@ void EnDns_Idle(EnDns* this, PlayState* play) { } } -void func_809EFC9C(EnDns* this, PlayState* play) { +void EnDns_Talking(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: - switch (this->unk2C0->canBuy(this)) { + switch (this->purchaseInfo->canBuy(this)) { case DNS_CANBUY_RESULT_NEED_RUPEES: Message_ContinueTextbox(play, 0x10A5); - this->unk268 = EnDns_SetupNoSaleBurrow; - return; + this->actionFunc = EnDns_SetupNoSaleBurrow; + break; + case DNS_CANBUY_RESULT_CAPACITY_FULL: Message_ContinueTextbox(play, 0x10A6); - this->unk268 = EnDns_SetupNoSaleBurrow; - return; + this->actionFunc = EnDns_SetupNoSaleBurrow; + break; + case DNS_CANBUY_RESULT_CANT_GET_NOW: Message_ContinueTextbox(play, 0x10DE); - this->unk268 = EnDns_SetupNoSaleBurrow; - return; + this->actionFunc = EnDns_SetupNoSaleBurrow; + break; + case DNS_CANBUY_RESULT_SUCCESS_NEW_ITEM: case DNS_CANBUY_RESULT_SUCCESS: Message_ContinueTextbox(play, 0x10A7); - this->unk268 = EnDns_SetupSale; - return; + this->actionFunc = EnDns_SetupSale; + break; } break; + case 1: Message_ContinueTextbox(play, 0x10A4); - this->unk268 = EnDns_SetupNoSaleBurrow; + this->actionFunc = EnDns_SetupNoSaleBurrow; break; } } @@ -416,7 +430,7 @@ void EnDns_OfferSaleItem(EnDns* this, PlayState* play) { Actor_OfferGetItem(&this->actor, play, GI_DEKU_NUT_UPGRADE_40, 130.0f, 100.0f); } } else { - Actor_OfferGetItem(&this->actor, play, this->unk2C0->gid, 130.0f, 100.0f); + Actor_OfferGetItem(&this->actor, play, this->purchaseInfo->getItemId, 130.0f, 100.0f); } } @@ -424,14 +438,14 @@ void EnDns_SetupSale(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); EnDns_OfferSaleItem(this, play); - this->unk268 = EnDns_Sale; + this->actionFunc = EnDns_Sale; } } void EnDns_Sale(EnDns* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { this->actor.parent = NULL; - this->unk268 = EnDns_SetupBurrow; + this->actionFunc = EnDns_SetupBurrow; } else { EnDns_OfferSaleItem(this, play); } @@ -442,29 +456,29 @@ void EnDns_SetupBurrow(EnDns* this, PlayState* play) { if (player->stateFlags1 & PLAYER_STATE1_10) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->unk2C0->payment(this); - this->unk2BD = 1; - this->isColliderEnabled = 0; + this->purchaseInfo->payment(this); + this->spawnHeartsAfterBurrow = true; + this->isColliderEnabled = false; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); - this->unk268 = EnDns_Burrow; + this->actionFunc = EnDns_Burrow; } } else { - this->unk2C0->payment(this); - this->unk2BD = 1; - this->isColliderEnabled = 0; + this->purchaseInfo->payment(this); + this->spawnHeartsAfterBurrow = true; + this->isColliderEnabled = false; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); - this->unk268 = EnDns_Burrow; + this->actionFunc = EnDns_Burrow; } } void EnDns_SetupNoSaleBurrow(EnDns* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { - this->isColliderEnabled = 0; + this->isColliderEnabled = false; this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; EnDns_ChangeAnim(this, DNS_ANIM_BURROW); - this->unk268 = EnDns_Burrow; + this->actionFunc = EnDns_Burrow; } } @@ -473,33 +487,33 @@ void EnDns_Burrow(EnDns* this, PlayState* play) { if (this->skelAnime.curFrame == f) { Actor_PlaySfx(&this->actor, NA_SE_EN_AKINDONUTS_HIDE); - this->unk268 = EnDns_PostBurrow; - this->unk2BC = 0; - this->unk2C4 = this->actor.world.pos.y; + this->actionFunc = EnDns_PostBurrow; + this->runUpdBgCheckInfo = false; + this->floorY = this->actor.world.pos.y; } } void EnDns_PostBurrow(EnDns* this, PlayState* play) { f32 depthInGround; - Vec3f sp38; - s32 var_s0; + Vec3f pos; + s32 i; - depthInGround = this->unk2C4 - this->actor.world.pos.y; - if ((this->unk2B8 % 4) == 0) { - sp38.x = this->actor.world.pos.x; - sp38.y = this->unk2C4; - sp38.z = this->actor.world.pos.z; - func_80028990(play, 20.0f, &sp38); + depthInGround = this->floorY - this->actor.world.pos.y; + if ((this->timer % 4) == 0) { + pos.x = this->actor.world.pos.x; + pos.y = this->floorY; + pos.z = this->actor.world.pos.z; + func_80028990(play, 20.0f, &pos); } this->actor.shape.rot.y += 0x2000; if (depthInGround > 400.0f) { - if (this->unk2BD != 0) { - sp38.x = this->actor.world.pos.x; - sp38.y = this->unk2C4; - sp38.z = this->actor.world.pos.z; - for (var_s0 = 0; var_s0 < 3; var_s0++) { - Item_DropCollectible(play, &sp38, ITEM00_RECOVERY_HEART); + if (this->spawnHeartsAfterBurrow) { + pos.x = this->actor.world.pos.x; + pos.y = this->floorY; + pos.z = this->actor.world.pos.z; + for (i = 0; i < 3; i++) { + Item_DropCollectible(play, &pos, ITEM00_RECOVERY_HEART); } } Actor_Kill(&this->actor); @@ -510,17 +524,17 @@ void EnDns_Update(Actor* thisx, PlayState* play) { EnDns* this = (EnDns*)thisx; STACK_PAD(s32); - this->unk2B8++; + this->timer++; this->actor.textId = sStartingTextIds[DNS_GET_TYPE(&this->actor)]; Actor_SetFocus(&this->actor, 60.0f); Actor_SetScale(&this->actor, 0.01f); SkelAnime_Update(&this->skelAnime); Actor_MoveXZGravity(&this->actor); - this->unk268(this, play); - if (this->unk2BC != 0) { + this->actionFunc(this, play); + if (this->runUpdBgCheckInfo) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 20.0f, UPDBGCHECKINFO_FLAG_2); } - if (this->isColliderEnabled != 0) { + if (this->isColliderEnabled) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } 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 091037ab625..8e180bc3582 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.h +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.h @@ -37,28 +37,33 @@ typedef enum EnDnsAnimation { struct EnDns; +typedef u32 (*EnDnsCanBuyFunc)(struct EnDns*); +typedef void (*EnDnsPaymentFunc)(struct EnDns*); + typedef struct EnDnsPurchaseInfo { /* 0x00 */ s16 price; /* 0x02 */ s16 unk_2; // unused - /* 0x04 */ s32 gid; - /* 0x08 */ u32 (*canBuy)(struct EnDns*); - /* 0x0C */ void (*payment)(struct EnDns*); + /* 0x04 */ s32 getItemId; + /* 0x08 */ EnDnsCanBuyFunc canBuy; + /* 0x0C */ EnDnsPaymentFunc payment; } EnDnsPurchaseInfo; +typedef void (*EnDnsActionFunc)(struct EnDns*, struct PlayState*); + typedef struct EnDns { /* 0x0000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ Vec3s unk190[BUSINESS_SCRUB_LIMB_MAX]; - /* 0x1FC */ Vec3s unk1FC[BUSINESS_SCRUB_LIMB_MAX]; - /* 0x268 */ void (*unk268)(struct EnDns*, struct PlayState*); + /* 0x190 */ Vec3s jointTable[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x1FC */ Vec3s morphTable[BUSINESS_SCRUB_LIMB_MAX]; + /* 0x268 */ EnDnsActionFunc actionFunc; /* 0x26C */ ColliderCylinder collider; - /* 0x2B8 */ s16 unk2B8; + /* 0x2B8 */ s16 timer; /* 0x2BA */ u8 animIndex; /* 0x2BB */ u8 isColliderEnabled; - /* 0x2BC */ u8 unk2BC; - /* 0x2BD */ u8 unk2BD; - /* 0x2C0 */ EnDnsPurchaseInfo* unk2C0; - /* 0x2C4 */ f32 unk2C4; + /* 0x2BC */ u8 runUpdBgCheckInfo; + /* 0x2BD */ u8 spawnHeartsAfterBurrow; + /* 0x2C0 */ EnDnsPurchaseInfo* purchaseInfo; + /* 0x2C4 */ f32 floorY; } EnDns; // size = 0x02C8 #endif From 6c7c30eb6cf1cb092e63207213d2730532f019d0 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 11 Oct 2026 16:48:22 +0200 Subject: [PATCH 143/150] EnGe3 review (part 1) --- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 6 +++--- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index c1abc1d2d00..40e628fdd00 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -66,7 +66,7 @@ static ColliderCylinderInit sCylinderInit = { { 20, 50, 0, { 0, 0, 0 } }, }; -static void (*sActionFuncs[1])(EnGe3*, PlayState*) = { EnGe3_Idle }; +static EnGe3ActionFunc sActionFuncs[1] = { EnGe3_Idle }; static AnimationHeader* sAnims[1] = { &gGerudoRedStandAnim }; static u8 sAnimModes[1] = { ANIMMODE_LOOP }; @@ -237,7 +237,7 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p case 0xB: case 0x10: *dList = NULL; - return 0; + return false; case 6: rot->x += this->headRot.y; @@ -272,7 +272,7 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p #endif break; } - return 0; + return false; } void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index d46017ac190..ab70b91879e 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -19,7 +19,6 @@ typedef struct EnGe3 { /* 0x300 */ Vec3s headRot; /* 0x306 */ Vec3s torsoRot; /* 0x30C */ u16 stateFlags; - /* 0x30E */ char pad_30E[2]; /* 0x310 */ EnGe3ActionFunc actionFunc; } EnGe3; // size = 0x314 From 785e2859fb48bdba2595dd8749ba9a651e966b6b Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Sun, 11 Oct 2026 16:51:12 +0200 Subject: [PATCH 144/150] EnJj review --- src/overlays/actors/ovl_En_Jj/z_en_jj.c | 12 ++++++------ src/overlays/actors/ovl_En_Jj/z_en_jj.h | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) 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 dad288feef4..eec4c087ae1 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -93,8 +93,8 @@ static void* sEyeTextures[] = { gObjectJjEyeClosedTex, }; -void EnJj_SetupAction(EnJj* this, void (*arg1)(EnJj*, PlayState*)) { - this->actionFunc = arg1; +void EnJj_SetupAction(EnJj* this, EnJjActionFunc actionFunc) { + this->actionFunc = actionFunc; } void EnJj_Init(Actor* thisx, PlayState* play) { @@ -129,7 +129,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit); this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE; - return; + break; case EN_JJ_TYPE_HEAD_COL: DynaPolyActor_Init(&this->dyna, 0); @@ -139,7 +139,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { this->dyna.actor.update = EnJj_DoNothing; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); - return; + break; case EN_JJ_TYPE_1: DynaPolyActor_Init(&this->dyna, 0); @@ -148,7 +148,7 @@ void EnJj_Init(Actor* thisx, PlayState* play) { this->dyna.actor.update = EnJj_DoNothing; this->dyna.actor.draw = NULL; Actor_SetScale(&this->dyna.actor, 0.087f); - return; + break; } } @@ -307,7 +307,7 @@ void EnJj_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx, "../z_en_jj.c", 879); Gfx_SetupDL_37Opa(play->state.gfxCtx); - Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * 0.076624215f) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(0.0f, (cosf(this->skelAnime.curFrame * (M_PI / 41)) * 10.0f) - 10.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(10.0f, 10.0f, 10.0f, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); SkelAnime_DrawFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, 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 6af4ad4bcc6..e5a2720e702 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.h +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.h @@ -32,7 +32,6 @@ typedef struct EnJj { /* 0x30F */ u8 eyeTimer; /* 0x310 */ u8 eyeExtraBlinkAmount; /* 0x311 */ u8 nextEyeExtraBlinkAmount; - /* 0x312 */ char pad_312[2]; } EnJj; // size = 0x314 #endif From 81f2ff0a45ab745ff6cc8e3af2354486a9a35025 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Oct 2026 09:17:29 +0200 Subject: [PATCH 145/150] tools/spec review --- tools/mkdmadata.c | 2 +- tools/mkldscript.c | 6 +++--- tools/mkspecrules.c | 12 ++++++------ tools/spec.c | 31 +++++++++++++++++++------------ tools/spec.h | 12 ++++++------ tools/util.c | 4 ++-- tools/util.h | 4 ++-- 7 files changed, 39 insertions(+), 32 deletions(-) diff --git a/tools/mkdmadata.c b/tools/mkdmadata.c index 1001f570433..ab27d7ad9aa 100644 --- a/tools/mkdmadata.c +++ b/tools/mkdmadata.c @@ -9,7 +9,7 @@ #include "spec.h" #include "util.h" -struct Segment* g_segments; +Segment* g_segments; int g_segmentsCount; static void write_dmadata_table(FILE *fout) diff --git a/tools/mkldscript.c b/tools/mkldscript.c index 2fb65a07a47..654965ac16f 100644 --- a/tools/mkldscript.c +++ b/tools/mkldscript.c @@ -9,10 +9,10 @@ #include "spec.h" #include "util.h" -struct Segment *g_segments; +Segment *g_segments; int g_segmentsCount; -static void write_includes(const struct Segment *seg, FILE *fout, const char *segments_dir, const char *section) +static void write_includes(const Segment *seg, FILE *fout, const char *segments_dir, const char *section) { // Note sections contain a suffix wildcard as compilers other than IDO such as GCC may emit sections titled // e.g. .rodata.cstN, .rodata.strN.M, .text.FUNCNAME depending on their settings. @@ -94,7 +94,7 @@ static void write_ld_script(FILE *fout, uint32_t entrypoint_addr, const char *ma uint32_t last_romalign = 0; for (i = 0; i < g_segmentsCount; i++) { - const struct Segment *seg = &g_segments[i]; + const Segment *seg = &g_segments[i]; fprintf(fout, " /* %s */\n\n", seg->name); diff --git a/tools/mkspecrules.c b/tools/mkspecrules.c index 7452175d373..b05f3d8cf5f 100644 --- a/tools/mkspecrules.c +++ b/tools/mkspecrules.c @@ -6,10 +6,10 @@ #include "spec.h" #include "util.h" -struct Segment* g_segments; +Segment* g_segments; int g_segmentsCount; -static void write_progbits_section(FILE *fout, struct Segment *seg, const char *section_name, bool with_padding) +static void write_progbits_section(FILE *fout, Segment *seg, const char *section_name, bool with_padding) { fprintf(fout, " .%s :\n {\n", section_name); @@ -22,7 +22,7 @@ static void write_progbits_section(FILE *fout, struct Segment *seg, const char * fprintf(fout, " }\n"); } -static void write_noload_section(FILE *fout, struct Segment *seg, const char *section_name) +static void write_noload_section(FILE *fout, Segment *seg, const char *section_name) { fprintf(fout, " .%s (NOLOAD) :\n {\n", section_name); @@ -39,7 +39,7 @@ static void write_noload_section(FILE *fout, struct Segment *seg, const char *se * however in the iQue version we have bss files that are created partway through linking that need * special handling in the linker script. */ -static void write_linker_script(FILE *fout, struct Segment *seg) +static void write_linker_script(FILE *fout, Segment *seg) { fprintf(fout, "OUTPUT_ARCH (mips)\n" @@ -67,7 +67,7 @@ static void write_linker_script(FILE *fout, struct Segment *seg) static void write_overlay_rules(FILE *fout, const char *ovls_dir) { for (int i = 0; i < g_segmentsCount; i++) { - struct Segment *seg = &g_segments[i]; + Segment *seg = &g_segments[i]; /* Write rule for partial linkage of this segment */ fprintf(fout, "%s/%s.plf:", ovls_dir, seg->name); @@ -159,7 +159,7 @@ int main(int argc, char **argv) } for (int i = 0; i < g_segmentsCount; i++) { - struct Segment *seg = &g_segments[i]; + Segment *seg = &g_segments[i]; // Form the full path for this segment's linker script strcpy(ld_outpath + seg_dir_len, seg->name); diff --git a/tools/spec.c b/tools/spec.c index 11450e500e7..88da86ae5c7 100644 --- a/tools/spec.c +++ b/tools/spec.c @@ -11,9 +11,9 @@ #define ARRAY_COUNT(arr) (sizeof(arr) / sizeof(arr[0])) -static struct Segment *add_segment(struct Segment **segments, int *segments_count) +static Segment *add_segment(Segment **segments, int *segments_count) { - struct Segment *seg; + Segment *seg; (*segments_count)++; *segments = realloc(*segments, *segments_count * sizeof(**segments)); @@ -146,12 +146,25 @@ static const char *const stmtNames[] = [STMT_pad_text] = "pad_text", }; -void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count) +static unsigned int parse_statement_name(const char *stmtName, int lineNum) +{ + unsigned int stmt; + for (stmt = 0; stmt < ARRAY_COUNT(stmtNames); stmt++) + { + if (strcmp(stmtName, stmtNames[stmt]) == 0) + { + return stmt; + } + } + util_fatal_error("line %i: unknown statement '%s'", lineNum, stmtName); +} + +void parse_rom_spec(char *spec, Segment **segments, int *segment_count) { int lineNum = 1; char *line = spec; - struct Segment *currSeg = NULL; + Segment *currSeg = NULL; // iterate over lines while (line[0] != 0) @@ -167,13 +180,7 @@ void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count) if (line[0] != 0 && stmtName[0] != 0) { char *args = token_split(stmtName); - unsigned int stmt; - - for (stmt = 0; stmt < ARRAY_COUNT(stmtNames); stmt++) - if (strcmp(stmtName, stmtNames[stmt]) == 0) - goto got_stmt; - util_fatal_error("line %i: unknown statement '%s'", lineNum, stmtName); - got_stmt: + unsigned int stmt = parse_statement_name(stmtName, lineNum); if (currSeg != NULL) { @@ -291,7 +298,7 @@ void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count) } } -void free_rom_spec(struct Segment *segments, int segment_count) +void free_rom_spec(Segment *segments, int segment_count) { int i; diff --git a/tools/spec.h b/tools/spec.h index 15cab8ede34..d2b6323eff1 100644 --- a/tools/spec.h +++ b/tools/spec.h @@ -1,5 +1,5 @@ -#ifndef _SPEC_H_ -#define _SPEC_H_ +#ifndef SPEC_H +#define SPEC_H #include #include @@ -39,7 +39,7 @@ struct Include int linkerPadding; }; -struct Segment +typedef struct Segment { uint32_t fields; char *name; @@ -55,10 +55,10 @@ struct Segment struct Include *includes; int includesCount; bool compress; -}; +} Segment; -void parse_rom_spec(char *spec, struct Segment **segments, int *segment_count); +void parse_rom_spec(char *spec, Segment **segments, int *segment_count); -void free_rom_spec(struct Segment *segments, int segment_count); +void free_rom_spec(Segment *segments, int segment_count); #endif diff --git a/tools/util.c b/tools/util.c index 421215fceae..5886a201db9 100644 --- a/tools/util.c +++ b/tools/util.c @@ -12,13 +12,13 @@ void util_fatal_error(const char *msgfmt, ...) { va_list args; - fputs("error: ", stderr); + fputs("\x1b[31m" "error: ", stderr); va_start(args, msgfmt); vfprintf(stderr, msgfmt, args); va_end(args); - fputc('\n', stderr); + fputs("\x1b[m" "\n", stderr); exit(1); } diff --git a/tools/util.h b/tools/util.h index e8749d9a4e0..82c7508a7d9 100644 --- a/tools/util.h +++ b/tools/util.h @@ -1,5 +1,5 @@ -#ifndef _UTIL_H_ -#define _UTIL_H_ +#ifndef UTIL_H +#define UTIL_H #include #include From d99f934d8bf3ff5ca185b6e6793a5fc88415a8b9 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Oct 2026 11:51:15 +0200 Subject: [PATCH 146/150] finish object_geldb docs --- assets/xml/objects/object_geldb.xml | 160 +++++++++--------- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 18 +- src/overlays/actors/ovl_En_Ge3/z_en_ge3.h | 6 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 33 ++-- 4 files changed, 110 insertions(+), 107 deletions(-) diff --git a/assets/xml/objects/object_geldb.xml b/assets/xml/objects/object_geldb.xml index 4b91b3d8730..124eddcdd59 100644 --- a/assets/xml/objects/object_geldb.xml +++ b/assets/xml/objects/object_geldb.xml @@ -1,7 +1,7 @@ - + @@ -21,126 +21,126 @@ - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 40e628fdd00..718d281e7bf 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -233,13 +233,13 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p EnGe3* this = (EnGe3*)thisx; switch (limbIndex) { - case 5: - case 0xB: - case 0x10: + case GERUDO_RED_LIMB_VEIL: + case GERUDO_RED_LIMB_RIGHT_SWORD: + case GERUDO_RED_LIMB_LEFT_SWORD: *dList = NULL; return false; - case 6: + case GERUDO_RED_LIMB_HEAD: rot->x += this->headRot.y; #if OOT_VERSION >= PAL_1_1 FALLTHROUGH; @@ -248,16 +248,16 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p // depending on what was drawn earlier in the frame. OPEN_DISPS(play->state.gfxCtx, "../z_en_ge3.c", 547); switch (limbIndex) { - case 3: + case GERUDO_RED_LIMB_HEAD_ROOT: break; - case 6: + case GERUDO_RED_LIMB_HEAD: gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 80, 60, 10, 255); break; - case 11: - case 16: + case GERUDO_RED_LIMB_RIGHT_SWORD: + case GERUDO_RED_LIMB_LEFT_SWORD: gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 170, 230, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0x00, 0x00, 255, 255, 255, 255); @@ -279,7 +279,7 @@ void EnGe3_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, EnGe3* this = (EnGe3*)thisx; Vec3f focusOffset = { 600.0f, 700.0f, 0.0f }; - if (limbIndex == 6) { + if (limbIndex == GERUDO_RED_LIMB_HEAD) { Matrix_MultVec3f(&focusOffset, &this->actor.focus.pos); } } diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h index ab70b91879e..d8f11836d3a 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_geldb/object_geldb.h" + struct EnGe3; typedef void (*EnGe3ActionFunc)(struct EnGe3*, struct PlayState*); @@ -12,8 +14,8 @@ typedef struct EnGe3 { /* 0x000 */ Actor actor; /* 0x14C */ ColliderCylinder collider; /* 0x198 */ SkelAnime skelAnime; - /* 0x1DC */ Vec3s jointTable[24]; - /* 0x26C */ Vec3s morphTable[24]; + /* 0x1DC */ Vec3s jointTable[GERUDO_RED_LIMB_MAX]; + /* 0x26C */ Vec3s morphTable[GERUDO_RED_LIMB_MAX]; /* 0x2FC */ s16 eyeTexIndex; /* 0x2FE */ s16 eyeTimer; /* 0x300 */ Vec3s headRot; 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 72d4cd397dc..ccf61c7c139 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -1459,14 +1459,14 @@ s32 EnGeldB_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* EnGeldB* this = (EnGeldB*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_geldB.c", 2507); - if (limbIndex == 3) { + if (limbIndex == GERUDO_RED_LIMB_HEAD_ROOT) { rot->z += this->headRot.x; rot->x += this->headRot.y; rot->y += this->headRot.z; - } else if (limbIndex == 6) { + } else if (limbIndex == GERUDO_RED_LIMB_HEAD) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 80, 60, 10, 255); - } else if ((limbIndex == 11) || (limbIndex == 16)) { + } else if ((limbIndex == GERUDO_RED_LIMB_RIGHT_SWORD) || (limbIndex == GERUDO_RED_LIMB_LEFT_SWORD)) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 140, 170, 230, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); @@ -1492,7 +1492,7 @@ void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro EnGeldB* this = (EnGeldB*)thisx; s32 bodyPart = -1; - if (limbIndex == 11) { + if (limbIndex == GERUDO_RED_LIMB_RIGHT_SWORD) { Matrix_MultVec3f(&swordQuadOffset1, &this->swordCollider.dim.quad[1]); Matrix_MultVec3f(&swordQuadOffset0, &this->swordCollider.dim.quad[0]); Matrix_MultVec3f(&swordQuadOffset3, &this->swordCollider.dim.quad[3]); @@ -1510,40 +1510,41 @@ void EnGeldB_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* ro EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &swordTip, &swordHilt); } } else { - Actor_SetFeetPos(&this->actor, limbIndex, 19, &footOffset, 22, &footOffset); + Actor_SetFeetPos(&this->actor, limbIndex, GERUDO_RED_LIMB_LEFT_FOOT, &footOffset, GERUDO_RED_LIMB_RIGHT_FOOT, + &footOffset); } - if (limbIndex == 19) { + if (limbIndex == GERUDO_RED_LIMB_LEFT_FOOT) { Matrix_MultVec3f(&footOffset, &this->rightFootPos); - } else if (limbIndex == 22) { + } else if (limbIndex == GERUDO_RED_LIMB_RIGHT_FOOT) { Matrix_MultVec3f(&footOffset, &this->leftFootPos); } if (this->iceTimer != 0) { switch (limbIndex) { - case 3: + case GERUDO_RED_LIMB_HEAD_ROOT: bodyPart = 0; break; - case 16: + case GERUDO_RED_LIMB_LEFT_SWORD: bodyPart = 1; break; - case 11: + case GERUDO_RED_LIMB_RIGHT_SWORD: bodyPart = 2; break; - case 12: + case GERUDO_RED_LIMB_LEFT_ARM: bodyPart = 3; break; - case 7: + case GERUDO_RED_LIMB_RIGHT_ARM: bodyPart = 4; break; - case 2: + case GERUDO_RED_LIMB_TORSO: bodyPart = 5; break; - case 23: + case GERUDO_RED_LIMB_PELVIS: bodyPart = 6; break; - case 19: + case GERUDO_RED_LIMB_LEFT_FOOT: bodyPart = 7; break; - case 22: + case GERUDO_RED_LIMB_RIGHT_FOOT: bodyPart = 8; break; default: From e6466f8bfbfeedb826d1465b7896c19cc5a7c353 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Oct 2026 12:43:39 +0200 Subject: [PATCH 147/150] EnMd review --- src/overlays/actors/ovl_En_Md/z_en_md.c | 292 +++++++++++------------- src/overlays/actors/ovl_En_Md/z_en_md.h | 14 +- 2 files changed, 145 insertions(+), 161 deletions(-) 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 31ffa4e48d1..4a91c40bca5 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -33,9 +33,6 @@ void EnMd_BlockPath(EnMd* this, PlayState* play); void EnMd_ListenToOcarina(EnMd* this, PlayState* play); void EnMd_Walk(EnMd* this, PlayState* play); -extern AnimationHeader D_60002C8; -extern SkeletonHeader D_6007FB8; - ActorProfile En_Md_Profile = { /**/ ACTOR_EN_MD, /**/ ACTORCAT_NPC, @@ -67,6 +64,7 @@ static ColliderCylinderInit sCylinderInit = { }, { 36, 46, 0, { 0, 0, 0 } }, }; + static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; typedef enum EnMdAnimSequence { @@ -117,22 +115,14 @@ static AnimationInfo sAnimationInfo[] = { { &gMidoAnnoyedToHaltAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { &gMidoIdleToAnnoyedAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, }; -Vec3f D_80AAC498 = { 400.0f, 0.0f, 0.0f }; -void* D_80AAC4A4[3] = { - gMidoEyeOpenTex, - gMidoEyeHalfTex, - gMidoEyeClosedTex, -}; void EnMd_ReverseAnimation(EnMd* this) { - f32 temp_fv0; - f32 temp_fv1; - - temp_fv0 = this->skelAnime.startFrame; - temp_fv1 = this->skelAnime.endFrame; - this->skelAnime.startFrame = temp_fv1; - this->skelAnime.curFrame = temp_fv1; - this->skelAnime.endFrame = temp_fv0; + f32 startFrame = this->skelAnime.startFrame; + f32 endFrame = this->skelAnime.endFrame; + + this->skelAnime.startFrame = endFrame; + this->skelAnime.curFrame = endFrame; + this->skelAnime.endFrame = startFrame; this->skelAnime.playSpeed = -1.0f; } @@ -143,7 +133,7 @@ void EnMd_UpdateAnimSequence_IdleToHalt(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); this->animSequenceEntry++; } @@ -158,7 +148,7 @@ void EnMd_UpdateAnimSequence_HaltToCurious(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_CURIOUS); this->animSequenceEntry++; } @@ -174,7 +164,7 @@ void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_TO_WALK); this->animSequenceEntry++; } else { @@ -182,7 +172,7 @@ void EnMd_UpdateAnimSequence_WalkAway(EnMd* this) { } FALLTHROUGH; case 2: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_WALK); this->animSequenceEntry++; } @@ -197,7 +187,7 @@ void EnMd_UpdateAnimSequence_TwitchIdle_Unused(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } @@ -213,7 +203,7 @@ void EnMd_UpdateAnimSequence_HaltToIdle(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } @@ -228,7 +218,7 @@ void EnMd_UpdateAnimSequence_SurpriseToAnnoyed(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } @@ -244,7 +234,7 @@ void EnMd_UpdateAnimSequence_SurpriseToIdle(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } @@ -259,7 +249,7 @@ void EnMd_UpdateAnimSequence_CuriousToAnnoyed(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } @@ -274,7 +264,7 @@ void EnMd_UpdateAnimSequence_AnnoyedToHalt(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_HALT); this->animSequenceEntry++; } @@ -289,7 +279,7 @@ void EnMd_UpdateAnimSequence_IdleToAnnoyed(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_ANNOYED); this->animSequenceEntry++; } @@ -305,7 +295,7 @@ void EnMd_UpdateAnimSequence_StopWalking(EnMd* this) { this->animSequenceEntry++; FALLTHROUGH; case 1: - if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame) != 0) { + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE); this->animSequenceEntry++; } @@ -351,11 +341,9 @@ void EnMd_UpdateAnimSequence(EnMd* this) { case ENMD_ANIM_SEQ_IDLE_TO_ANNOYED: EnMd_UpdateAnimSequence_IdleToAnnoyed(this); break; - case 11: + case ENMD_ANIM_SEQ_STOP_WALKING: EnMd_UpdateAnimSequence_StopWalking(this); break; - default: - break; } } @@ -412,9 +400,8 @@ void EnMd_UpdateAnimSequence_WithTalking(EnMd* this) { s16 EnMd_TrackMessageState(Actor* thisx, PlayState* play) { EnMd* this = (EnMd*)thisx; - s16 messageState; + s16 messageState = Message_GetState(&play->msgCtx); - messageState = Message_GetState(&play->msgCtx); if (((this->messageState == TEXT_STATE_AWAITING_NEXT) || (this->messageState == TEXT_STATE_EVENT) || (this->messageState == TEXT_STATE_CLOSING) || (this->messageState == TEXT_STATE_DONE_HAS_NEXT)) && (this->messageState != messageState)) { @@ -424,10 +411,9 @@ s16 EnMd_TrackMessageState(Actor* thisx, PlayState* play) { return messageState; } -u16 func_80AAACF8(PlayState* play, EnMd* this) { - u16 textId; +u16 EnMd_GetTextIdKokiriForest(PlayState* play, EnMd* this) { + u16 textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_MIDO); - textId = MaskReaction_GetTextId(play, MASK_REACTION_SET_MIDO); if (textId != 0) { return textId; } @@ -449,7 +435,7 @@ u16 func_80AAACF8(PlayState* play, EnMd* this) { return 0x102F; } -u16 func_80AAADE0(PlayState* play, EnMd* this) { +u16 EnMd_GetTextIdMidosHouse(PlayState* play, EnMd* this) { this->messageEntry = 0; this->messageState = TEXT_STATE_NONE; if (GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)) { @@ -458,7 +444,7 @@ u16 func_80AAADE0(PlayState* play, EnMd* this) { return 0x1046; } -u16 func_80AAAE14(PlayState* play, EnMd* this) { +u16 EnMd_GetTextIdLostWoods(PlayState* play, EnMd* this) { this->messageEntry = 0; this->messageState = TEXT_STATE_NONE; if (GET_EVENTCHKINF(EVENTCHKINF_48)) { @@ -476,16 +462,16 @@ u16 func_80AAAE14(PlayState* play, EnMd* this) { } } -u16 func_80AAAE94(PlayState* play, Actor* thisx) { +u16 EnMd_GetTextId(PlayState* play, Actor* thisx) { EnMd* this = (EnMd*)thisx; switch (play->sceneId) { case SCENE_KOKIRI_FOREST: - return func_80AAACF8(play, this); + return EnMd_GetTextIdKokiriForest(play, this); case SCENE_MIDOS_HOUSE: - return func_80AAADE0(play, this); + return EnMd_GetTextIdMidosHouse(play, this); case SCENE_LOST_WOODS: - return func_80AAAE14(play, this); + return EnMd_GetTextIdLostWoods(play, this); default: return 0; } @@ -533,43 +519,42 @@ s16 EnMd_UpdateTalkState(PlayState* play, Actor* thisx) { return NPC_TALK_STATE_TALKING; } -s32 func_80AAB03C(EnMd* this, PlayState* play) { +s32 EnMd_CheckCanSpawn(EnMd* this, PlayState* play) { if ((play->sceneId == SCENE_KOKIRI_FOREST) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && !GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)) { - return 1; + return true; } else if ((play->sceneId == SCENE_MIDOS_HOUSE) && - ((gSaveContext.save.info.eventChkInf[1] & 0x1000) || (gSaveContext.save.info.eventChkInf[4] & 1)) && + (GET_EVENTCHKINF(EVENTCHKINF_1C) || GET_EVENTCHKINF(EVENTCHKINF_OBTAINED_ZELDAS_LETTER)) && !LINK_IS_ADULT) { - return 1; + return true; } else if (play->sceneId == SCENE_LOST_WOODS) { - return 1; + return true; } else { - return 0; + return false; } } -void func_80AAB0E0(EnMd* arg0) { - if (DECR(arg0->unk20C) == 0) { - arg0->unk20E += 1; - if (arg0->unk20E >= 3) { - arg0->unk20C = Rand_S16Offset(0x1E, 0x1E); - arg0->unk20E = 0; +void EnMd_UpdateEyes(EnMd* this) { + if (DECR(this->eyeTimer) == 0) { + this->eyeTexIndex++; + if (this->eyeTexIndex >= 3) { + this->eyeTimer = Rand_S16Offset(30, 30); + this->eyeTexIndex = 0; } } } void EnMd_UpdateTalking(EnMd* this, PlayState* play) { - Player* temp_a2; - s16 temp_v1; - s16 temp_ft1; + Player* player = GET_PLAYER(play); + s16 absRelYawTowardsPlayer; + s16 relYawTowardsPlayer; s16 canUpdateTalking; s16 trackingMode; - temp_a2 = GET_PLAYER(play); if (this->actor.xzDistToPlayer < 170.0f) { - temp_ft1 = (f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y; - temp_v1 = ABS(temp_ft1); - if (temp_v1 <= Npc_GetTrackingPresetMaxPlayerYaw(2)) { + relYawTowardsPlayer = (f32)this->actor.yawTowardsPlayer - (f32)this->actor.shape.rot.y; + absRelYawTowardsPlayer = ABS(relYawTowardsPlayer); + if (absRelYawTowardsPlayer <= Npc_GetTrackingPresetMaxPlayerYaw(2)) { trackingMode = NPC_TRACKING_HEAD_AND_TORSO; canUpdateTalking = true; } else { @@ -583,11 +568,11 @@ void EnMd_UpdateTalking(EnMd* this, PlayState* play) { if (this->interactInfo.talkState != NPC_TALK_STATE_IDLE) { trackingMode = NPC_TRACKING_FULL_BODY; } - if (this->unk190 == EnMd_Walk) { + if (this->actionFunc == EnMd_Walk) { trackingMode = NPC_TRACKING_NONE; canUpdateTalking = false; } - if (this->unk190 == EnMd_Watch) { + if (this->actionFunc == EnMd_Watch) { trackingMode = NPC_TRACKING_FULL_BODY; canUpdateTalking = true; } @@ -596,7 +581,7 @@ void EnMd_UpdateTalking(EnMd* this, PlayState* play) { this->interactInfo.yOffset = 40.0f; trackingMode = NPC_TRACKING_HEAD_AND_TORSO; } else { - this->interactInfo.trackPos = temp_a2->actor.world.pos; + this->interactInfo.trackPos = player->actor.world.pos; if (gSaveContext.save.linkAge > 0) { this->interactInfo.yOffset = 0.0f; } else { @@ -604,56 +589,54 @@ void EnMd_UpdateTalking(EnMd* this, PlayState* play) { } } Npc_TrackPoint(&this->actor, &this->interactInfo, 2, trackingMode); - if ((this->unk190 != EnMd_ListenToOcarina) && canUpdateTalking) { + if ((this->actionFunc != EnMd_ListenToOcarina) && canUpdateTalking) { Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->collider.dim.radius + 30.0f, - func_80AAAE94, EnMd_UpdateTalkState); + EnMd_GetTextId, EnMd_UpdateTalkState); } } -s32 func_80AAB370(EnMd* this, PlayState* play) { - Path* temp_a0; +s32 EnMd_UpdateRotFollowPath(EnMd* this, PlayState* play) { + Path* path; STACK_PAD(s32); - f32 temp_fa0; - f32 temp_fa1; - Vec3s* temp_v0; - s32 temp_a2; + f32 dx; + f32 dz; + Vec3s* pointPos; + s32 pathIndexNoShift = ENMD_GET_PATH_INDEX_NOSHIFT(this); - temp_a2 = ENMD_GET_PATH_INDEX_NOSHIFT(this); - if (temp_a2 == (ENMD_PATH_NONE << 8)) { + if (pathIndexNoShift == (ENMD_PATH_NONE << 8)) { return 0; } - temp_a0 = &play->pathList[temp_a2 >> 8]; - temp_v0 = SEGMENTED_TO_VIRTUAL(temp_a0->points); - temp_v0 += this->unk212; - temp_fa0 = (f32)temp_v0->x - this->actor.world.pos.x; - temp_fa1 = (f32)temp_v0->z - this->actor.world.pos.z; - Math_SmoothStepToS(&this->actor.world.rot.y, (Math_FAtan2F(temp_fa0, temp_fa1) * 10430.378f), 4, 0xFA0, 1); - if (((temp_fa0 * temp_fa0) + (temp_fa1 * temp_fa1)) < 100.0f) { - this->unk212++; - if (this->unk212 >= temp_a0->count) { - this->unk212 = 0; + path = &play->pathList[pathIndexNoShift >> 8]; + pointPos = SEGMENTED_TO_VIRTUAL(path->points); + pointPos += this->waypoint; + dx = (f32)pointPos->x - this->actor.world.pos.x; + dz = (f32)pointPos->z - this->actor.world.pos.z; + Math_SmoothStepToS(&this->actor.world.rot.y, RAD_TO_BINANG(Math_FAtan2F(dx, dz)), 4, 0xFA0, 1); + if ((SQ(dx) + SQ(dz)) < 100.0f) { + this->waypoint++; + if (this->waypoint >= path->count) { + this->waypoint = 0; } - return 1; + return true; } - return 0; + return false; } -s32 func_80AAB4DC(EnMd* this, PlayState* play) { - Path* temp_a1; - s32 temp_v1; - Vec3s* temp_a3; +s32 EnMd_SetPosToPathEnd(EnMd* this, PlayState* play) { + Path* path; + s32 pathIndexNoShift = ENMD_GET_PATH_INDEX_NOSHIFT(this); + Vec3s* pointPos; - temp_v1 = ENMD_GET_PATH_INDEX_NOSHIFT(this); - if (temp_v1 == (ENMD_PATH_NONE << 8)) { - return 0; + if (pathIndexNoShift == (ENMD_PATH_NONE << 8)) { + return false; } - temp_a1 = &play->pathList[temp_v1 >> 8]; - temp_a3 = SEGMENTED_TO_VIRTUAL(temp_a1->points); - temp_a3 += temp_a1->count - 1; - this->actor.world.pos.x = temp_a3->x; - this->actor.world.pos.y = temp_a3->y; - this->actor.world.pos.z = temp_a3->z; - return 1; + path = &play->pathList[pathIndexNoShift >> 8]; + pointPos = SEGMENTED_TO_VIRTUAL(path->points); + pointPos += path->count - 1; + this->actor.world.pos.x = pointPos->x; + this->actor.world.pos.y = pointPos->y; + this->actor.world.pos.z = pointPos->z; + return true; } void EnMd_UpdateAlphaByDistance(EnMd* this, PlayState* play) { @@ -666,11 +649,11 @@ void EnMd_UpdateAlphaByDistance(EnMd* this, PlayState* play) { } else { radius = 400.0f; } - this->unk210 = Actor_UpdateAlphaByDistance(&this->actor, play, this->unk210, radius); - this->actor.shape.shadowAlpha = (u8)this->unk210; + this->alpha = Actor_UpdateAlphaByDistance(&this->actor, play, this->alpha, radius); + this->actor.shape.shadowAlpha = (u8)this->alpha; } else { - this->unk210 = 255; - this->actor.shape.shadowAlpha = (u8)this->unk210; + this->alpha = 255; + this->actor.shape.shadowAlpha = (u8)this->alpha; } } @@ -679,18 +662,18 @@ void EnMd_Init(Actor* thisx, PlayState* play) { STACK_PAD(s32); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->unk258, this->unk2BE, MIDO_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gMidoSkel, NULL, this->jointTable, this->morphTable, MIDO_LIMB_MAX); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - if (func_80AAB03C(this, play) == 0) { + if (!EnMd_CheckCanSpawn(this, play)) { Actor_Kill(&this->actor); return; } Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENMD_ANIM_INDEX_IDLE_DEFAULT); Actor_SetScale(&this->actor, 0.01f); this->actor.attentionRangeType = ATTENTION_RANGE_6; - this->unk210 = 255; + this->alpha = 255; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_ELF, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI); if (((play->sceneId == SCENE_KOKIRI_FOREST) && !GET_EVENTCHKINF(EVENTCHKINF_04)) || @@ -698,12 +681,12 @@ void EnMd_Init(Actor* thisx, PlayState* play) { CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) || ((play->sceneId == SCENE_LOST_WOODS) && !GET_EVENTCHKINF(EVENTCHKINF_0A))) { this->actor.home.pos = this->actor.world.pos; - this->unk190 = EnMd_BlockPath; + this->actionFunc = EnMd_BlockPath; } else { if (play->sceneId != SCENE_MIDOS_HOUSE) { - func_80AAB4DC(this, play); + EnMd_SetPosToPathEnd(this, play); } - this->unk190 = EnMd_Idle; + this->actionFunc = EnMd_Idle; } } @@ -731,24 +714,22 @@ void EnMd_Watch(EnMd* this, PlayState* play) { } void EnMd_BlockPath(EnMd* this, PlayState* play) { - Player* sp2C; - f32 temp_fv1; - Player* sp24; - s16 temp_v0_3; + Player* player = GET_PLAYER(play); + f32 playSpeed; + Player* player2 = GET_PLAYER(play); + s16 yawTowardsPlayerFromHome; STACK_PAD(s32); - sp2C = GET_PLAYER(play); - sp24 = GET_PLAYER(play); EnMd_UpdateAnimSequence_WithTalking(this); if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer; - temp_v0_3 = Math_Vec3f_Yaw(&this->actor.home.pos, &sp24->actor.world.pos); + yawTowardsPlayerFromHome = Math_Vec3f_Yaw(&this->actor.home.pos, &player2->actor.world.pos); this->actor.world.pos.x = this->actor.home.pos.x; - this->actor.world.pos.x += 60.0f * Math_SinS(temp_v0_3); + this->actor.world.pos.x += 60.0f * Math_SinS(yawTowardsPlayerFromHome); this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.z += 60.0f * Math_CosS(temp_v0_3); - temp_fv1 = fabsf((f32)this->actor.yawTowardsPlayer - (f32)temp_v0_3) * 0.001f * 3.0f; - this->skelAnime.playSpeed = CLAMP(temp_fv1, 1.0f, 3.0f); + this->actor.world.pos.z += 60.0f * Math_CosS(yawTowardsPlayerFromHome); + playSpeed = fabsf((f32)this->actor.yawTowardsPlayer - (f32)yawTowardsPlayerFromHome) * 0.001f * 3.0f; + this->skelAnime.playSpeed = CLAMP(playSpeed, 1.0f, 3.0f); } if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && @@ -763,49 +744,48 @@ void EnMd_BlockPath(EnMd* this, PlayState* play) { } EnMd_SetAnimSequence(this, ENMD_ANIM_SEQ_WALK_AWAY); EnMd_UpdateAnimSequence(this); - this->unk212 = 1; + this->waypoint = 1; this->interactInfo.talkState = NPC_TALK_STATE_IDLE; - this->unk190 = EnMd_Walk; + this->actionFunc = EnMd_Walk; this->actor.speed = 1.5f; } else { if (this->skelAnime.animation == &gMidoIdleAnim) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); } if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneId == SCENE_LOST_WOODS)) { - if (sp2C->stateFlags2 & PLAYER_STATE2_24) { - sp2C->stateFlags2 |= PLAYER_STATE2_25; - sp2C->unk_6A8 = &this->actor; + if (player->stateFlags2 & PLAYER_STATE2_24) { + player->stateFlags2 |= PLAYER_STATE2_25; + player->unk_6A8 = &this->actor; Message_StartOcarina(play, OCARINA_ACTION_CHECK_SARIA); - this->unk190 = EnMd_ListenToOcarina; - } else if (this->actor.xzDistToPlayer < (30.0f + (f32)this->collider.dim.radius)) { - sp2C->stateFlags2 |= PLAYER_STATE2_23; + this->actionFunc = EnMd_ListenToOcarina; + } else if (this->actor.xzDistToPlayer < (30.0f + this->collider.dim.radius)) { + player->stateFlags2 |= PLAYER_STATE2_23; } } } } void EnMd_ListenToOcarina(EnMd* this, PlayState* play) { - Player* temp_v0; + Player* player = GET_PLAYER(play); - temp_v0 = GET_PLAYER(play); if (play->msgCtx.ocarinaMode >= OCARINA_MODE_04) { - this->unk190 = EnMd_BlockPath; + this->actionFunc = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_03) { SFX_PLAY_CENTERED(NA_SE_SY_CORRECT_CHIME); this->actor.textId = 0x1067; Actor_OfferTalk(&this->actor, play, (f32)this->collider.dim.radius + 30.0f); - this->unk190 = EnMd_BlockPath; + this->actionFunc = EnMd_BlockPath; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { - temp_v0->stateFlags2 |= PLAYER_STATE2_23; + player->stateFlags2 |= PLAYER_STATE2_23; } } void EnMd_Walk(EnMd* this, PlayState* play) { Actor_UpdateFidgetTables(play, this->fidgetTableY, this->fidgetTableZ, MIDO_LIMB_MAX); EnMd_UpdateAnimSequence(this); - if ((func_80AAB370(this, play) == 0) || (this->unk212 != 0)) { + if (!EnMd_UpdateRotFollowPath(this, play) || (this->waypoint != 0)) { this->actor.shape.rot = this->actor.world.rot; } else if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !GET_EVENTCHKINF(EVENTCHKINF_1C) && (play->sceneId == SCENE_KOKIRI_FOREST)) { @@ -817,7 +797,7 @@ void EnMd_Walk(EnMd* this, PlayState* play) { this->skelAnime.playSpeed = 0.0f; this->actor.speed = 0.0f; this->actor.home.pos = this->actor.world.pos; - this->unk190 = EnMd_Watch; + this->actionFunc = EnMd_Watch; } } @@ -828,24 +808,24 @@ void EnMd_Update(Actor* thisx, PlayState* play) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - func_80AAB0E0(this); + EnMd_UpdateEyes(this); EnMd_UpdateAlphaByDistance(this, play); Actor_MoveXZGravity(&this->actor); EnMd_UpdateTalking(this, play); Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2); - this->unk190(this, play); + this->actionFunc(this, play); } -s32 func_80AABEF0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { +s32 EnMd_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; Vec3s limbRot; if (limbIndex == MIDO_LIMB_HEAD) { - Matrix_Translate(1200.0f, 0.0f, 0.0f, 1U); + Matrix_Translate(1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); limbRot = this->interactInfo.headRot; Matrix_RotateX(BINANG_TO_RAD_ALT(limbRot.y), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(limbRot.x), MTXMODE_APPLY); - Matrix_Translate(-1200.0f, 0.0f, 0.0f, 1U); + Matrix_Translate(-1200.0f, 0.0f, 0.0f, MTXMODE_APPLY); } if (limbIndex == MIDO_LIMB_TORSO) { limbRot = this->interactInfo.torsoRot; @@ -854,32 +834,36 @@ s32 func_80AABEF0(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s } if ((limbIndex == MIDO_LIMB_TORSO) || (limbIndex == MIDO_LIMB_LEFT_UPPER_ARM) || (limbIndex == MIDO_LIMB_RIGHT_UPPER_ARM)) { - rot->y += (Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE); - rot->z += (Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE); + rot->y += Math_SinS(this->fidgetTableY[limbIndex]) * FIDGET_AMPLITUDE; + rot->z += Math_CosS(this->fidgetTableZ[limbIndex]) * FIDGET_AMPLITUDE; } return 0; } -void func_80AAC104(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { +void EnMd_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { EnMd* this = (EnMd*)thisx; - Vec3f sp18; + Vec3f focusPosOffset = { 400.0f, 0.0f, 0.0f }; - sp18 = D_80AAC498; if (limbIndex == MIDO_LIMB_HEAD) { - Matrix_MultVec3f(&sp18, &this->actor.focus.pos); + Matrix_MultVec3f(&focusPosOffset, &this->actor.focus.pos); } } void EnMd_Draw(Actor* thisx, PlayState* play) { + static void* sEyeTextures[3] = { + gMidoEyeOpenTex, + gMidoEyeHalfTex, + gMidoEyeClosedTex, + }; EnMd* this = (EnMd*)thisx; OPEN_DISPS(play->state.gfxCtx, "../z_en_md.c", 1280); - if (this->unk210 == 255) { - gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80AAC4A4[this->unk20E])); - func_80034BA0(play, &this->skelAnime, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); - } else if (this->unk210 != 0) { - gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_80AAC4A4[this->unk20E])); - func_80034CC4(play, &this->skelAnime, func_80AABEF0, func_80AAC104, &this->actor, this->unk210); + if (this->alpha == 255) { + gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); + func_80034BA0(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); + } else if (this->alpha != 0) { + gSPSegment(POLY_XLU_DISP++, 8, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->eyeTexIndex])); + func_80034CC4(play, &this->skelAnime, EnMd_OverrideLimbDraw, EnMd_PostLimbDraw, &this->actor, this->alpha); } CLOSE_DISPS(play->state.gfxCtx, "../z_en_md.c", 1317); } 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 b90217a469f..1ef07fb572f 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.h +++ b/src/overlays/actors/ovl_En_Md/z_en_md.h @@ -17,21 +17,21 @@ typedef void (*EnMdActionFunc)(struct EnMd*, struct PlayState*); typedef struct EnMd { /* 0x000 */ Actor actor; /* 0x14C */ SkelAnime skelAnime; - /* 0x190 */ EnMdActionFunc unk190; + /* 0x190 */ EnMdActionFunc actionFunc; /* 0x194 */ ColliderCylinder collider; /* 0x1E0 */ NpcInteractInfo interactInfo; /* 0x208 */ u8 messageEntry; // tracks message state changes, like with `BOX_BREAK` or `TEXTID` /* 0x209 */ u8 messageState; // last known result of `Message_GetState` /* 0x20A */ u8 animSequenceEntry; // each one changes animation info and waits /* 0x20B */ u8 animSequence; - /* 0x20C */ s16 unk20C; - /* 0x20E */ s16 unk20E; - /* 0x210 */ s16 unk210; - /* 0x212 */ s16 unk212; + /* 0x20C */ s16 eyeTimer; + /* 0x20E */ s16 eyeTexIndex; + /* 0x210 */ s16 alpha; + /* 0x212 */ s16 waypoint; /* 0x214 */ s16 fidgetTableY[MIDO_LIMB_MAX]; /* 0x236 */ s16 fidgetTableZ[MIDO_LIMB_MAX]; - /* 0x258 */ Vec3s unk258[MIDO_LIMB_MAX]; - /* 0x2BE */ Vec3s unk2BE[MIDO_LIMB_MAX]; + /* 0x258 */ Vec3s jointTable[MIDO_LIMB_MAX]; + /* 0x2BE */ Vec3s morphTable[MIDO_LIMB_MAX]; } EnMd; // size = 0x0324 #endif From 025833bba8aae2a576ced1376bdaa9851cb6e5e9 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Oct 2026 13:40:17 +0200 Subject: [PATCH 148/150] EnKusa review --- src/overlays/actors/ovl_En_Kusa/z_en_kusa.c | 215 ++++++++++---------- src/overlays/actors/ovl_En_Kusa/z_en_kusa.h | 3 +- 2 files changed, 114 insertions(+), 104 deletions(-) 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 cee774dd837..3eba9a07330 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -13,6 +13,7 @@ #include "effect.h" #include "play_state.h" #include "stack_pad.h" +#include "translation.h" #include "assets/objects/gameplay_keep/cuttable_shrub.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" @@ -28,8 +29,8 @@ void EnKusa_SetupWaitForObject(EnKusa* this); void EnKusa_WaitForObject(EnKusa* this, PlayState* play); void EnKusa_SetupMain(EnKusa* this); void EnKusa_Main(EnKusa* this, PlayState* play); -void func_80A9BA98(EnKusa* this); -void func_80A9BAD8(EnKusa* this, PlayState* play); +void EnKusa_SetupCarried(EnKusa* this); +void EnKusa_Carried(EnKusa* this, PlayState* play); void EnKusa_SetupFall(EnKusa* this); void EnKusa_Fall(EnKusa* this, PlayState* play); void EnKusa_SetupCut(EnKusa* this); @@ -39,7 +40,7 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this); void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play); void EnKusa_SetupRegrow(EnKusa* this); void EnKusa_Regrow(EnKusa* this, PlayState* play); -void func_80A9C164(Actor* thisx, PlayState* play); +void EnKusa_Draw(Actor* thisx, PlayState* play); static s16 rotSpeedXtarget = 0; static s16 rotSpeedX = 0; @@ -56,11 +57,13 @@ ActorProfile En_Kusa_Profile = { /**/ EnKusa_Update, /**/ NULL, }; -static s16 D_80A9C200[4] = { + +static s16 sRequiredObjectIds[] = { OBJECT_GAMEPLAY_FIELD_KEEP, OBJECT_KUSA, OBJECT_KUSA, }; + static ColliderCylinderInit sCylinderInit = { { COL_MATERIAL_NONE, @@ -80,68 +83,73 @@ static ColliderCylinderInit sCylinderInit = { }, { 12, 44, 0, { 0, 0, 0 } }, }; + static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 30, MASS_IMMOVABLE }; + static Vec3f sUnitDirections[4] = { { 0.0f, 0.7071f, 0.7071f }, { 0.7071f, 0.7071f, 0.0f }, { 0.0f, 0.7071f, -0.7071f }, { -0.7071f, 0.7071f, 0.0f }, }; + static s16 sFragmentScales[8] = { - 0x6C, 0x66, 0x60, 0x54, 0x42, 0x37, 0x2A, 0x26, + 108, 102, 96, 84, 66, 55, 42, 38, }; -static InitChainEntry sInitChain[6] = { + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 400, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(gravity, -3200, ICHAIN_CONTINUE), ICHAIN_F32_DIV1000(minVelocityY, -17000, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDistance, 1200, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeScale, 100, ICHAIN_CONTINUE), ICHAIN_F32(cullingVolumeDownward, 120, ICHAIN_STOP), }; -static Gfx* D_80A9C294[3] = { + +static Gfx* sDLists[3] = { gFieldBushDL, object_kusa_DL_000140, object_kusa_DL_000140, }; -void func_80A9AFA0(EnKusa* this, EnKusaActionFunc actionFunc) { - this->unk19C = 0; +void EnKusa_SetupAction(EnKusa* this, EnKusaActionFunc actionFunc) { + this->timer = 0; this->actionFunc = actionFunc; } -s32 func_80A9AFAC(EnKusa* this, PlayState* play, f32 arg2) { +s32 EnKusa_SnapToGround(EnKusa* this, PlayState* play, f32 offsetY) { STACK_PAD(s32); - CollisionPoly* sp38; - Vec3f sp2C; - UNK_TYPE sp28; - f32 temp_fv0; - - sp2C.x = this->actor.world.pos.x; - sp2C.y = this->actor.world.pos.y + 30.0f; - sp2C.z = this->actor.world.pos.z; - temp_fv0 = BgCheck_EntityRaycastDown4(&play->colCtx, &sp38, &sp28, &this->actor, &sp2C); - if (temp_fv0 > BGCHECK_Y_MIN) { - this->actor.world.pos.y = temp_fv0 + arg2; + CollisionPoly* groundPoly; + Vec3f pos; + s32 bgId; + f32 groundY; + + pos.x = this->actor.world.pos.x; + pos.y = this->actor.world.pos.y + 30.0f; + pos.z = this->actor.world.pos.z; + groundY = BgCheck_EntityRaycastDown4(&play->colCtx, &groundPoly, &bgId, &this->actor, &pos); + if (groundY > BGCHECK_Y_MIN) { + this->actor.world.pos.y = groundY + offsetY; Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - return 1; + return true; } else { PRINTF_COLOR_WARNING(); - PRINTF("地面に付着失敗(%s %d)\n", "../z_en_kusa.c", 323); + PRINTF(T("地面に付着失敗(%s %d)\n", "Failed to attach to ground (%s %d)\n"), "../z_en_kusa.c", 323); PRINTF_RST(); - return 0; + return false; } } -void func_80A9B07C(EnKusa* this, PlayState* play) { - s16 var_v0; +void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { + s16 dropTable; STACK_PAD(s32); switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: - var_v0 = PARAMS_GET_U(this->actor.params, 8, 4); - if (var_v0 >= 0xD) { - var_v0 = 0; + dropTable = PARAMS_GET_U(this->actor.params, 8, 4); + if (dropTable >= COLLECTIBLE_DROP_TABLE_13) { + dropTable = COLLECTIBLE_DROP_TABLE_0; } Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, - COLLECTIBLE_DROP_RANDOM_PARAMS(var_v0, false)); + COLLECTIBLE_DROP_RANDOM_PARAMS(dropTable, false)); break; case ENKUSA_TYPE_1: if (Rand_ZeroOne() < 0.5f) { @@ -160,11 +168,11 @@ void EnKusa_UpdateVelY(EnKusa* this) { } } -void EnKusa_RandScaleVecToZero(Vec3f* arg0, f32 scale) { +void EnKusa_RandScaleVecToZero(Vec3f* vec, f32 scale) { scale += ((Rand_ZeroOne() * 0.2f) - 0.1f) * scale; - arg0->x -= arg0->x * scale; - arg0->y -= arg0->y * scale; - arg0->z -= arg0->z * scale; + vec->x -= vec->x * scale; + vec->y -= vec->y * scale; + vec->z -= vec->z * scale; } void EnKusa_SetScaleSmall(EnKusa* this) { @@ -173,51 +181,51 @@ void EnKusa_SetScaleSmall(EnKusa* this) { this->actor.scale.z = 0.120000005f; } -void func_80A9B21C(EnKusa* this, PlayState* play) { - Vec3f spC4; - Vec3f spB8; +void EnKusa_SpawnFragmentsEffects(EnKusa* this, PlayState* play) { + Vec3f effVel; + Vec3f effPos; Vec3f* dir; - s32 new_var; + s32 scaleIndex; s32 i; STACK_PAD(s32); for (i = 0; i < ARRAY_COUNT(sUnitDirections); i++) { dir = &sUnitDirections[i]; - spB8.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 20.0f); - spB8.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 20.0f) + 10.0f; - spB8.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 20.0f); - spC4.x = (Rand_ZeroOne() - 0.5f) * 8.0f; - spC4.y = Rand_ZeroOne() * 10.0f; - spC4.z = (Rand_ZeroOne() - 0.5f) * 8.0f; - new_var = (s32)(Rand_ZeroOne() * 111.1f) & 7; - EffectSsKakera_Spawn(play, &spB8, &spC4, &spB8, -100, 0x40, 0x28, 3, 0, sFragmentScales[new_var], 0, 0, 80, -1, - 1, gCuttableShrubStalkDL); - - spB8.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f); - spB8.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 40.0f) + 10.0f; - spB8.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 40.0f); - spC4.x = (Rand_ZeroOne() - 0.5f) * 6.0f; - spC4.y = Rand_ZeroOne() * 10.0f; - spC4.z = (Rand_ZeroOne() - 0.5f) * 6.0f; - new_var = (s32)(Rand_ZeroOne() * 111.1f) % 7; - EffectSsKakera_Spawn(play, &spB8, &spC4, &spB8, -100, 0x40, 0x28, 3, 0, sFragmentScales[new_var], 0, 0, 80, -1, - 1, gCuttableShrubTipDL); + effPos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 20.0f); + effPos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 20.0f) + 10.0f; + effPos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 20.0f); + effVel.x = (Rand_ZeroOne() - 0.5f) * 8.0f; + effVel.y = Rand_ZeroOne() * 10.0f; + effVel.z = (Rand_ZeroOne() - 0.5f) * 8.0f; + scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) & 7; + EffectSsKakera_Spawn(play, &effPos, &effVel, &effPos, -100, 0x40, 0x28, 3, 0, sFragmentScales[scaleIndex], 0, 0, + 80, -1, 1, gCuttableShrubStalkDL); + + effPos.x = this->actor.world.pos.x + (dir->x * this->actor.scale.x * 40.0f); + effPos.y = this->actor.world.pos.y + (dir->y * this->actor.scale.y * 40.0f) + 10.0f; + effPos.z = this->actor.world.pos.z + (dir->z * this->actor.scale.z * 40.0f); + effVel.x = (Rand_ZeroOne() - 0.5f) * 6.0f; + effVel.y = Rand_ZeroOne() * 10.0f; + effVel.z = (Rand_ZeroOne() - 0.5f) * 6.0f; + scaleIndex = (s32)(Rand_ZeroOne() * 111.1f) % 7; + EffectSsKakera_Spawn(play, &effPos, &effVel, &effPos, -100, 0x40, 0x28, 3, 0, sFragmentScales[scaleIndex], 0, 0, + 80, -1, 1, gCuttableShrubTipDL); } } -void func_80A9B574(EnKusa* this, PlayState* play) { - s32 var_s0; +void EnKusa_SpawnBugs(EnKusa* this, PlayState* play) { + s32 i; - for (var_s0 = 0; var_s0 < 3; var_s0++) { + for (i = 0; i < 3; i++) { if (Actor_Spawn(&play->actorCtx, play, ACTOR_EN_INSECT, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, (s16)(s32)(Rand_ZeroOne() * 65535.0f), 0, + this->actor.world.pos.z, 0, TRUNCF_BINANG(Rand_ZeroOne() * 0xFFFF), 0, INSECT_TYPE_SPAWNED) == NULL) { break; } } } -void func_80A9B630(Actor* thisx, PlayState* play) { +void EnKusa_InitCollider(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; Collider_InitCylinder(play, &this->collider); @@ -232,18 +240,20 @@ void EnKusa_Init(Actor* thisx, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { this->actor.cullingVolumeDistance += 1000.0f; } - func_80A9B630(&this->actor, play); + EnKusa_InitCollider(&this->actor, play); CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); if (this->actor.shape.rot.y == 0) { this->actor.shape.rot.y = this->actor.home.rot.y = this->actor.world.rot.y = (s16)(s32)Rand_ZeroFloat(65536.0f); } - if (func_80A9AFAC(this, play, 0.0f) == 0) { + if (!EnKusa_SnapToGround(this, play, 0.0f)) { Actor_Kill(&this->actor); return; } - this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, D_80A9C200[PARAMS_GET_U(this->actor.params, 0, 2)]); + this->requiredObjectSlot = + Object_GetSlot(&play->objectCtx, sRequiredObjectIds[PARAMS_GET_U(this->actor.params, 0, 2)]); if (this->requiredObjectSlot < 0) { - PRINTF("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_en_kusa.c", 0x231); + PRINTF(T("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", "Error : Bank danger! (arg_data 0x%04x)(%s %d)\n"), + this->actor.params, "../z_en_kusa.c", 561); Actor_Kill(&this->actor); return; } @@ -258,7 +268,7 @@ void EnKusa_Destroy(Actor* thisx, PlayState* play2) { } void EnKusa_SetupWaitForObject(EnKusa* this) { - func_80A9AFA0(this, EnKusa_WaitForObject); + EnKusa_SetupAction(this, EnKusa_WaitForObject); } void EnKusa_WaitForObject(EnKusa* this, PlayState* play) { @@ -268,14 +278,14 @@ void EnKusa_WaitForObject(EnKusa* this, PlayState* play) { } else { EnKusa_SetupMain(this); } - this->actor.draw = func_80A9C164; + this->actor.draw = EnKusa_Draw; this->actor.objectSlot = this->requiredObjectSlot; this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; } } void EnKusa_SetupMain(EnKusa* this) { - func_80A9AFA0(this, EnKusa_Main); + EnKusa_SetupAction(this, EnKusa_Main); this->actor.flags &= ~ACTOR_FLAG_UPDATE_CULLING_DISABLED; } @@ -283,15 +293,15 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { STACK_PAD(s32); if (Actor_HasParent(&this->actor, play)) { - func_80A9BA98(this); + EnKusa_SetupCarried(this); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_PL_PULL_UP_PLANT); } else if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; - func_80A9B21C(this, play); - func_80A9B07C(this, play); + EnKusa_SpawnFragmentsEffects(this, play); + EnKusa_DropCollectible(this, play); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); if (PARAMS_GET_U(this->actor.params, 4, 1)) { - func_80A9B574(this, play); + EnKusa_SpawnBugs(this, play); } if (PARAMS_GET_U(this->actor.params, 0, 2) == ENKUSA_TYPE_0) { Actor_Kill(&this->actor); @@ -316,13 +326,13 @@ void EnKusa_Main(EnKusa* this, PlayState* play) { } } -void func_80A9BA98(EnKusa* this) { - func_80A9AFA0(this, func_80A9BAD8); +void EnKusa_SetupCarried(EnKusa* this) { + EnKusa_SetupAction(this, EnKusa_Carried); this->actor.room = -1; this->actor.flags |= ACTOR_FLAG_UPDATE_CULLING_DISABLED; } -void func_80A9BAD8(EnKusa* this, PlayState* play) { +void EnKusa_Carried(EnKusa* this, PlayState* play) { if (Actor_HasNoParent(&this->actor, play)) { this->actor.room = play->roomCtx.curRoom.num; EnKusa_SetupFall(this); @@ -341,23 +351,23 @@ void func_80A9BAD8(EnKusa* this, PlayState* play) { } void EnKusa_SetupFall(EnKusa* this) { - func_80A9AFA0(this, EnKusa_Fall); + EnKusa_SetupAction(this, EnKusa_Fall); rotSpeedXtarget = -0xBB8; - rotSpeedYtarget = (s16)(s32)((Rand_ZeroOne() - 0.5f) * 1600.0f); + rotSpeedYtarget = (Rand_ZeroOne() - 0.5f) * 1600.0f; rotSpeedX = 0; rotSpeedY = 0; } void EnKusa_Fall(EnKusa* this, PlayState* play) { STACK_PAD(s32); - Vec3f sp30; + Vec3f waterSurfacePos; if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH | BGCHECKFLAG_WALL)) { if (!(this->actor.bgCheckFlags & BGCHECKFLAG_WATER)) { SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 20, NA_SE_EV_PLANT_BROKEN); } - func_80A9B21C(this, play); - func_80A9B07C(this, play); + EnKusa_SpawnFragmentsEffects(this, play); + EnKusa_DropCollectible(this, play); switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_0: case ENKUSA_TYPE_2: @@ -370,18 +380,18 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { return; } if (this->actor.bgCheckFlags & BGCHECKFLAG_WATER_TOUCH) { - sp30.x = this->actor.world.pos.x; - sp30.y = this->actor.world.pos.y + this->actor.depthInWater; - sp30.z = this->actor.world.pos.z; - EffectSsGSplash_Spawn(play, &sp30, NULL, NULL, 0, 400); - EffectSsGRipple_Spawn(play, &sp30, 150, 650, 0); - EffectSsGRipple_Spawn(play, &sp30, 400, 800, 4); - EffectSsGRipple_Spawn(play, &sp30, 500, 1100, 8); + waterSurfacePos.x = this->actor.world.pos.x; + waterSurfacePos.y = this->actor.world.pos.y + this->actor.depthInWater; + waterSurfacePos.z = this->actor.world.pos.z; + EffectSsGSplash_Spawn(play, &waterSurfacePos, NULL, NULL, 0, 400); + EffectSsGRipple_Spawn(play, &waterSurfacePos, 150, 650, 0); + EffectSsGRipple_Spawn(play, &waterSurfacePos, 400, 800, 4); + EffectSsGRipple_Spawn(play, &waterSurfacePos, 500, 1100, 8); this->actor.minVelocityY = -3.0f; - rotSpeedX = (s16)((s16)rotSpeedX >> 1); - rotSpeedXtarget = (s16)((s16)rotSpeedXtarget >> 1); - rotSpeedY = (s16)((s16)rotSpeedY >> 1); - rotSpeedYtarget = (s16)((s16)rotSpeedYtarget >> 1); + rotSpeedX = rotSpeedX >> 1; + rotSpeedXtarget = rotSpeedXtarget >> 1; + rotSpeedY = rotSpeedY >> 1; + rotSpeedYtarget = rotSpeedYtarget >> 1; this->actor.bgCheckFlags &= ~BGCHECKFLAG_WATER_TOUCH; SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); } @@ -402,16 +412,16 @@ void EnKusa_Fall(EnKusa* this, PlayState* play) { void EnKusa_SetupCut(EnKusa* this) { switch (PARAMS_GET_U(this->actor.params, 0, 2)) { case ENKUSA_TYPE_2: - func_80A9AFA0(this, EnKusa_DoNothing); + EnKusa_SetupAction(this, EnKusa_DoNothing); break; case ENKUSA_TYPE_1: - func_80A9AFA0(this, EnKusa_CutWaitRegrow); + EnKusa_SetupAction(this, EnKusa_CutWaitRegrow); break; } } void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play) { - if (this->unk19C >= 0x78) { + if (this->timer >= 120) { EnKusa_SetupRegrow(this); } } @@ -425,18 +435,18 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this) { this->actor.world.pos.z = this->actor.home.pos.z; EnKusa_SetScaleSmall(this); this->actor.shape.rot = this->actor.home.rot; - func_80A9AFA0(this, EnKusa_UprootedWaitRegrow); + EnKusa_SetupAction(this, EnKusa_UprootedWaitRegrow); } void EnKusa_UprootedWaitRegrow(EnKusa* this, PlayState* play) { - if ((this->unk19C >= 0x79) && Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f) && - (this->unk19C >= 0xAA)) { + if ((this->timer > 120) && Math_StepToF(&this->actor.world.pos.y, this->actor.home.pos.y, 0.6f) && + (this->timer >= 170)) { EnKusa_SetupRegrow(this); } } void EnKusa_SetupRegrow(EnKusa* this) { - func_80A9AFA0(this, EnKusa_Regrow); + EnKusa_SetupAction(this, EnKusa_Regrow); EnKusa_SetScaleSmall(this); this->actor.shape.rot = this->actor.home.rot; this->actor.flags &= ~ACTOR_FLAG_GRASS_DESTROYED; @@ -457,7 +467,8 @@ void EnKusa_Regrow(EnKusa* this, PlayState* play) { void EnKusa_Update(Actor* thisx, PlayState* play) { EnKusa* this = (EnKusa*)thisx; - this->unk19C += 1; + + this->timer++; this->actionFunc(this, play); if (this->actor.flags & ACTOR_FLAG_GRASS_DESTROYED) { this->actor.shape.yOffset = -6.25f; @@ -466,10 +477,10 @@ void EnKusa_Update(Actor* thisx, PlayState* play) { } } -void func_80A9C164(Actor* thisx, PlayState* play) { +void EnKusa_Draw(Actor* thisx, PlayState* play) { if (thisx->flags & ACTOR_FLAG_GRASS_DESTROYED) { Gfx_DrawDListOpa(play, object_kusa_DL_0002E0); } else { - Gfx_DrawDListOpa(play, D_80A9C294[PARAMS_GET_U(thisx->params, 0, 2)]); + Gfx_DrawDListOpa(play, sDLists[PARAMS_GET_U(thisx->params, 0, 2)]); } } 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 a65e1257158..c3e4057a613 100644 --- a/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h +++ b/src/overlays/actors/ovl_En_Kusa/z_en_kusa.h @@ -18,9 +18,8 @@ typedef struct EnKusa { /* 0x000 */ Actor actor; /* 0x14C */ EnKusaActionFunc actionFunc; /* 0x150 */ ColliderCylinder collider; - /* 0x19C */ s16 unk19C; + /* 0x19C */ s16 timer; /* 0x19E */ s8 requiredObjectSlot; - /* 0x19F */ char pad19F[1]; } EnKusa; // size = 0x1A0 #endif From 616f413cf54377937bd0aa3fedbf1e03de57f6f0 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Oct 2026 20:12:13 +0200 Subject: [PATCH 149/150] ge3/geldb review --- src/overlays/actors/ovl_En_Ge3/z_en_ge3.c | 3 ++- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 2 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.h | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 718d281e7bf..d4fe6c2a72c 100644 --- a/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -82,7 +82,8 @@ void EnGe3_Init(Actor* thisx, PlayState* play) { STACK_PAD(s32); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f); - SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, 24); + SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, NULL, this->jointTable, this->morphTable, + GERUDO_RED_LIMB_MAX); Animation_PlayLoop(&this->skelAnime, &gGerudoRedStandAnim); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); 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 ccf61c7c139..5f7bdebe953 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -248,7 +248,7 @@ void EnGeldB_Init(Actor* thisx, PlayState* play) { this->blinkState = 0; this->unkFloat = 10.0f; SkelAnime_InitFlex(play, &this->skelAnime, &gGerudoRedSkel, &gGerudoRedNeutralAnim, this->jointTable, - this->morphTable, 24); + this->morphTable, GERUDO_RED_LIMB_MAX); Collider_InitCylinder(play, &this->bodyCollider); Collider_SetCylinder(play, &this->bodyCollider, thisx, &sBodyCylinderInit); Collider_InitTris(play, &this->blockCollider); 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 29322370ebb..82a077b4587 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.h @@ -4,6 +4,8 @@ #include "ultra64.h" #include "actor.h" +#include "assets/objects/object_geldb/object_geldb.h" + struct EnGeldB; typedef void (*EnGeldBActionFunc)(struct EnGeldB*, struct PlayState*); @@ -12,8 +14,8 @@ typedef struct EnGeldB { /* 0x0000 */ Actor actor; /* 0x014C */ Vec3s bodyPartsPos[10]; /* 0x0188 */ SkelAnime skelAnime; - /* 0x01CC */ Vec3s jointTable[24]; - /* 0x025C */ Vec3s morphTable[24]; + /* 0x01CC */ Vec3s jointTable[GERUDO_RED_LIMB_MAX]; + /* 0x025C */ Vec3s morphTable[GERUDO_RED_LIMB_MAX]; /* 0x02EC */ s32 action; /* 0x02F0 */ char unk_2F0[4]; /* 0x02F4 */ EnGeldBActionFunc actionFunc; From d1ecc4d22be3deba0a5007bbd2f79dbeb89678c2 Mon Sep 17 00:00:00 2001 From: Dragorn421 Date: Mon, 12 Oct 2026 20:17:24 +0200 Subject: [PATCH 150/150] EnMd review --- src/overlays/actors/ovl_En_Md/z_en_md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 4a91c40bca5..d0500a58def 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -650,10 +650,10 @@ void EnMd_UpdateAlphaByDistance(EnMd* this, PlayState* play) { radius = 400.0f; } this->alpha = Actor_UpdateAlphaByDistance(&this->actor, play, this->alpha, radius); - this->actor.shape.shadowAlpha = (u8)this->alpha; + this->actor.shape.shadowAlpha = this->alpha; } else { this->alpha = 255; - this->actor.shape.shadowAlpha = (u8)this->alpha; + this->actor.shape.shadowAlpha = this->alpha; } }